示例#1
0
        def slurp_items(**kwargs):
            item_list = []
            kwargs['user_agent'] = self.user_agent
            service_accounts = list_serviceaccounts(**kwargs)

            for service_account in service_accounts:
                resource_id = gcp_resource_id_builder(
                    kwargs['project'], 'projects.serviceaccounts.get',
                    service_account['name'])
                sa = get_serviceaccount_complete(
                    service_account=service_account['name'], **kwargs)

                key_count = 0
                if 'Keys' in sa:
                    key_count = len(sa['Keys'])

                item_list.append(
                    IAMServiceAccountItem(
                        region='global',
                        # This should only ever be the first item (shouldn't make this a list)
                        account=self.accounts[0],
                        name=sa['Email'],
                        arn=resource_id,
                        config={
                            'policy': sa.get('Policy', None),
                            'email': sa['Email'],
                            'keys': key_count,
                        }))
            return item_list, kwargs.get('exception_map', {})
示例#2
0
        def slurp_items(**kwargs):
            item_list = []
            kwargs['user_agent'] = self.user_agent
            service_accounts = list_serviceaccounts(**kwargs)

            for service_account in service_accounts:
                resource_id = gcp_resource_id_builder(
                    'projects.serviceaccounts.get', service_account['name'])
                sa = get_serviceaccount_complete(
                    service_account=service_account['name'], **kwargs)

                key_count = 0
                if 'Keys' in sa:
                    key_count = len(sa['Keys'])

                item_list.append(
                    IAMServiceAccountItem(
                        region='global',
                        account=sa['ProjectId'],
                        name=sa['DisplayName'],
                        arn=resource_id,
                        config={
                            'policy': sa.get('Policy', None),
                            'email': sa['Email'],
                            'keys': key_count,
                        }))
            return item_list, kwargs.get('exception_map', {})
示例#3
0
        def slurp_items(**kwargs):
            item_list = []
            kwargs['user_agent'] = self.user_agent
            rules = list_firewall_rules(**kwargs)

            for rule in rules:
                resource_id = gcp_resource_id_builder(
                    'compute.firewall.get', rule['name'])
                item_list.append(
                    GCEFirewallRuleItem(
                        region='global',
                        account=kwargs['project'],
                        name=rule['name'],
                        arn=resource_id,
                        config=modify(rule, format='camelized')))
            return item_list, kwargs.get('exception_map', {})
示例#4
0
        def slurp_items(**kwargs):
            item_list = []
            kwargs['user_agent'] = self.user_agent
            rules = list_firewall_rules(**kwargs)

            for rule in rules:
                resource_id = gcp_resource_id_builder('compute.firewall.get',
                                                      rule['name'])
                item_list.append(
                    GCEFirewallRuleItem(region='global',
                                        account=kwargs['project'],
                                        name=rule['name'],
                                        arn=resource_id,
                                        config=modify(rule,
                                                      format='camelized')))
            return item_list, kwargs.get('exception_map', {})
示例#5
0
        def slurp_items(**kwargs):
            item_list = []
            kwargs['user_agent'] = self.user_agent
            networks = list_networks(**kwargs)

            for network in networks:
                resource_id = gcp_resource_id_builder(kwargs['project'],
                                                      'compute.network.get',
                                                      network['name'])
                net_complete = get_network_and_subnetworks(
                    network['name'], **kwargs)
                item_list.append(
                    GCENetworkItem(region='global',
                                   account=kwargs['project'],
                                   name=net_complete['Name'],
                                   arn=resource_id,
                                   config=net_complete))
            return item_list, kwargs.get('exception_map', {})
示例#6
0
        def slurp_items(**kwargs):
            item_list = []
            kwargs['user_agent'] = self.user_agent
            networks = list_networks(**kwargs)

            for network in networks:
                resource_id = gcp_resource_id_builder(
                    'compute.network.get', network['name'])
                net_complete = get_network_and_subnetworks(
                    network['name'], **kwargs)
                item_list.append(
                    GCENetworkItem(
                        region='global',
                        account=kwargs['project'],
                        name=net_complete['Name'],
                        arn=resource_id,
                        config=net_complete))
            return item_list, kwargs.get('exception_map', {})
示例#7
0
        def slurp_items(**kwargs):
            item_list = []
            kwargs['user_agent'] = self.user_agent
            buckets = list_buckets(**kwargs)

            for bucket in buckets:
                resource_id = gcp_resource_id_builder(
                    'storage.bucket.get', bucket['name'])
                b = get_bucket(
                    bucket_name=bucket['name'], **kwargs)
                item_list.append(
                    GCSBucketItem(
                        region=b['Location'],
                        account=kwargs['project'],
                        name=b['Id'],
                        arn=resource_id,
                        config=b))
            return item_list, kwargs.get('exception_map', {})
示例#8
0
        def slurp_items(**kwargs):
            item_list = []
            kwargs['user_agent'] = self.user_agent
            rules = list_firewall_rules(**kwargs)

            for rule in rules:
                resource_id = gcp_resource_id_builder(
                    kwargs['project'], 'compute.firewall.get', rule['name'])
                item_list.append(
                    GCEFirewallRuleItem(
                        region='global',
                        # This should only ever be the first item (shouldn't make this a list)
                        account=self.accounts[0],
                        name=rule['name'],
                        arn=resource_id,
                        config=modify(rule, output='camelized'),
                        source_watcher=self))
            return item_list, kwargs.get('exception_map', {})
        def slurp_items(**kwargs):
            item_list = []
            kwargs['user_agent'] = self.user_agent
            rules = list_firewall_rules(**kwargs)

            for rule in rules:
                resource_id = gcp_resource_id_builder(kwargs['project'],
                                                      'compute.firewall.get',
                                                      rule['name'])
                item_list.append(
                    GCEFirewallRuleItem(
                        region='global',
                        # This should only ever be the first item (shouldn't make this a list)
                        account=self.accounts[0],
                        name=rule['name'],
                        arn=resource_id,
                        config=modify(rule, output='camelized'),
                        source_watcher=self))
            return item_list, kwargs.get('exception_map', {})
        def slurp_items(**kwargs):
            item_list = []
            kwargs['user_agent'] = self.user_agent
            buckets = list_buckets(**kwargs)

            for bucket in buckets:
                resource_id = gcp_resource_id_builder(
                    kwargs['project'], 'storage.bucket.get', bucket['name'])
                b = get_bucket(
                    bucket_name=bucket['name'], **kwargs)
                item_list.append(
                    GCSBucketItem(
                        region=b['Location'],
                        # This should only ever be the first item (shouldn't make this a list)
                        account=self.accounts[0],
                        name=b['Id'],
                        arn=resource_id,
                        config=b,
                        source_watcher=None))
            return item_list, kwargs.get('exception_map', {})
示例#11
0
        def slurp_items(**kwargs):
            item_list = []
            kwargs['user_agent'] = self.user_agent
            networks = list_networks(**kwargs)

            for network in networks:
                resource_id = gcp_resource_id_builder(
                    kwargs['project'], 'compute.network.get', network['name'])
                net_complete = get_network_and_subnetworks(
                    network['name'], **kwargs)
                item_list.append(
                    GCENetworkItem(
                        region='global',
                        # This should only ever be the first item (shouldn't make this a list)
                        account=self.accounts[0],
                        name=net_complete['Name'],
                        arn=resource_id,
                        config=net_complete,
                        source_watcher=self))
            return item_list, kwargs.get('exception_map', {})
示例#12
0
        def slurp_items(**kwargs):
            item_list = []
            kwargs['user_agent'] = self.user_agent
            networks = list_networks(**kwargs)

            for network in networks:
                resource_id = gcp_resource_id_builder(kwargs['project'],
                                                      'compute.network.get',
                                                      network['name'])
                net_complete = get_network_and_subnetworks(
                    network['name'], **kwargs)
                item_list.append(
                    GCENetworkItem(
                        region='global',
                        # This should only ever be the first item (shouldn't make this a list)
                        account=self.accounts[0],
                        name=net_complete['Name'],
                        arn=resource_id,
                        config=net_complete,
                        source_watcher=self))
            return item_list, kwargs.get('exception_map', {})