google.cloud.forseti.services.inventory.base.resources module

Crawler implementation for gcp resources.

class AppEngineApp(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for AppEngineApp

key()[source]

Get key of this resource

Returns:key of this resource
Return type:str
static type()[source]

Get type of this resource

Returns:‘appengine_app’
Return type:str
class AppEngineAppIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for AppEngineApp

iter()[source]

Yields: Resource: AppEngineApp created

class AppEngineInstance(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for AppEngineInstance

key()[source]

Get key of this resource

Returns:key of this resource
Return type:str
static type()[source]

Get type of this resource

Returns:‘appengine_instance’
Return type:str
class AppEngineInstanceIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for AppEngineInstance

iter()[source]

Yields: Resource: AppEngineInstance created

class AppEngineService(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for AppEngineService

key()[source]

Get key of this resource

Returns:key of this resource
Return type:str
static type()[source]

Get type of this resource

Returns:‘appengine_service’
Return type:str
class AppEngineServiceIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for AppEngineService

iter()[source]

Yields: Resource: AppEngineService created

class AppEngineVersion(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for AppEngineVersion

key()[source]

Get key of this resource

Returns:key of this resource
Return type:str
static type()[source]

Get type of this resource

Returns:‘appengine_version’
Return type:str
class AppEngineVersionIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for AppEngineVersion

iter()[source]

Yields: Resource: AppEngineVersion created

class BackendService(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for BackendService

key()[source]

Get key of this resource

Returns:key of this resource
Return type:str
static type()[source]

Get type of this resource

Returns:‘backendservice’
Return type:str
class BackendServiceIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for BackendService

iter()[source]

Yields: Resource: BackendService created

class BillingAccount(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for BillingAccount

get_iam_policy(**kwargs)[source]

Function wrapper to perform caching

Parameters:
  • args – args to be passed to the function
  • kwargs – kwargs to be passed to the function
Returns:

Results of executing f

Return type:

object

key()[source]

Get key of this resource

Returns:key of this resource
Return type:str
static type()[source]

Get type of this resource

Returns:‘billing_account’
Return type:str
class BillingAccountIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for BillingAccount

iter()[source]

Yields: Resource: BillingAccount created

class BillingAccountSinkIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for Billing Account Sink

iter()[source]

Yields: Resource: Sink created

class BucketIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for GcsBucket

iter()[source]

Yields: Resource: GcsBucket created

class CloudSqlInstance(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for cloudsqlinstance

key()[source]

Get key of this resource

Returns:id key of this resource
Return type:str
static type()[source]

Get type of this resource

Returns:‘cloudsqlinstance’
Return type:str
class CloudSqlIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for CloudSqlInstance

iter()[source]

Yields: Resource: CloudSqlInstance created

class ComputeIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for ComputeProject

iter()[source]

Yields: Resource: ComputeProject created

class ComputeProject(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for ComputeProject

key()[source]

Get key of this resource

Returns:key of this resource
Return type:str
static type()[source]

Get type of this resource

Returns:‘compute_project’
Return type:str
class CuratedRole(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for CuratedRole

key()[source]

Get key of this resource

Returns:key of this resource
Return type:str
parent()[source]

Get parent of this resource

curated role doesn’t have parent

static type()[source]

Get type of this resource

Returns:‘role’
Return type:str
class DataSet(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for DataSet

get_dataset_policy(**kwargs)[source]

Function wrapper to perform caching

Parameters:
  • args – args to be passed to the function
  • kwargs – kwargs to be passed to the function
Returns:

Results of executing f

Return type:

object

key()[source]

Get key of this resource

Returns:key of this resource
Return type:str
static type()[source]

Get type of this resource

Returns:‘dataset’
Return type:str
class DataSetIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for Dataset

iter()[source]

Yields: Resource: Dataset created

class Disk(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for Disk

key()[source]

Get key of this resource

Returns:key of this resource
Return type:str
static type()[source]

Get type of this resource

Returns:‘disk’
Return type:str
class DiskIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for Disk

iter()[source]

Yields: Resource: Disk created

class Firewall(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for Firewall

key()[source]

Get key of this resource

Returns:key of this resource
Return type:str
static type()[source]

Get type of this resource

Returns:‘firewall’
Return type:str
class FirewallIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for Firewall

iter()[source]

Yields: Resource: Firewall created

class Folder(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for Folder

classmethod fetch(client, resource_key)[source]

Get Folder

Parameters:
  • client (object) – GCP API client
  • resource_key (str) – resource key to fetch
Returns:

created Folder

Return type:

Folder

get_iam_policy(**kwargs)[source]

Function wrapper to perform caching

Parameters:
  • args – args to be passed to the function
  • kwargs – kwargs to be passed to the function
Returns:

Results of executing f

Return type:

object

key()[source]

Get key of this resource

Returns:key of this resource
Return type:str
static type()[source]

Get type of this resource

Returns:‘folder’
Return type:str
class FolderFolderIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for Folder

iter()[source]

Yields: Resource: Folder created

class FolderIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for Folder

iter()[source]

Yields: Resource: Folder created

class FolderProjectIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for Project

iter()[source]

Yields: Resource: Project created

class FolderSinkIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for Folder Sink

iter()[source]

Yields: Resource: Sink created

class ForwardingRule(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for ForwardingRule

key()[source]

Get key of this resource

Returns:key of this resource
Return type:str
static type()[source]

Get type of this resource

Returns:‘forwardingrule’
Return type:str
class ForwardingRuleIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for ForwardingRule

iter()[source]

Yields: Resource: ForwardingRule created

class GcsBucket(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for GcsBucket

get_gcs_policy(client=None)[source]

Full projection returns GCS policy with the resource.

Parameters:client (object) – GCP API client
Returns:bucket acl
Return type:dict
get_iam_policy(**kwargs)[source]

Function wrapper to perform caching

Parameters:
  • args – args to be passed to the function
  • kwargs – kwargs to be passed to the function
Returns:

Results of executing f

Return type:

object

key()[source]

Get key of this resource

Returns:key of this resource
Return type:str
static type()[source]

Get type of this resource

Returns:‘bucket’
Return type:str
class GcsObject(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for GcsObject

get_gcs_policy(client=None)[source]

Full projection returns GCS policy with the resource.

Parameters:client (object) – GCP API client
Returns:Object acl
Return type:dict
get_iam_policy(**kwargs)[source]

Function wrapper to perform caching

Parameters:
  • args – args to be passed to the function
  • kwargs – kwargs to be passed to the function
Returns:

Results of executing f

Return type:

object

key()[source]

Get key of this resource

Returns:key of this resource
Return type:str
static type()[source]

Get type of this resource

Returns:‘storage_object’
Return type:str
class GsuiteGroup(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for gsuite_group

key()[source]

Get key of this resource

Returns:id key of this resource
Return type:str
static type()[source]

Get type of this resource

Returns:‘gsuite_group’
Return type:str
class GsuiteGroupIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for GsuiteGroup

iter()[source]

Yields: Resource: GsuiteGroup created

class GsuiteGroupMember(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for gsuite_group_member

key()[source]

Get key of this resource

Returns:id key of this resource
Return type:str
static type()[source]

Get type of this resource

Returns:‘gsuite_group_member’
Return type:str
class GsuiteMemberIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for GsuiteMember

iter()[source]

Yields: Resource: GsuiteUserMember or GsuiteGroupMember created

class GsuiteUser(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for gsuite_user

key()[source]

Get key of this resource

Returns:id key of this resource
Return type:str
static type()[source]

Get type of this resource

Returns:‘gsuite_user’
Return type:str
class GsuiteUserIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for GsuiteUser

iter()[source]

Yields: Resource: GsuiteUser created

class GsuiteUserMember(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for gsuite_user_member

key()[source]

Get key of this resource

Returns:id key of this resource
Return type:str
static type()[source]

Get type of this resource

Returns:‘gsuite_user_member’
Return type:str
class Image(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for Image

key()[source]

Get key of this resource

Returns:key of this resource
Return type:str
static type()[source]

Get type of this resource

Returns:‘image’
Return type:str
class ImageIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for Image

iter()[source]

Yields: Resource: Image created

class Instance(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for Instance

key()[source]

Get key of this resource

Returns:key of this resource
Return type:str
static type()[source]

Get type of this resource

Returns:‘instance’
Return type:str
class InstanceGroup(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for InstanceGroup

key()[source]

Get key of this resource

Returns:key of this resource
Return type:str
static type()[source]

Get type of this resource

Returns:‘instancegroup’
Return type:str
class InstanceGroupIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for InstanceGroup

iter()[source]

Yields: Resource: InstanceGroup created

class InstanceGroupManager(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for InstanceGroupManager

key()[source]

Get key of this resource

Returns:key of this resource
Return type:str
static type()[source]

Get type of this resource

Returns:‘instancegroupmanager’
Return type:str
class InstanceGroupManagerIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for InstanceGroupManager

iter()[source]

Yields: Resource: InstanceGroupManager created

class InstanceIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for Instance

iter()[source]

Yields: Resource: Instance created

class InstanceTemplate(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for InstanceTemplate

key()[source]

Get key of this resource

Returns:key of this resource
Return type:str
static type()[source]

Get type of this resource

Returns:‘instancetemplate’
Return type:str
class InstanceTemplateIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for InstanceTemplate

iter()[source]

Yields: Resource: InstanceTemplate created

class KubernetesCluster(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for KubernetesCluster

get_kubernetes_service_config(**kwargs)[source]

Function wrapper to perform caching

Parameters:
  • args – args to be passed to the function
  • kwargs – kwargs to be passed to the function
Returns:

Results of executing f

Return type:

object

key()[source]

Get key of this resource

Returns:key of this resource
Return type:str
location()[source]

Get KubernetesCluster location

Returns:KubernetesCluster location
Return type:str
static type()[source]

Get type of this resource

Returns:‘kubernetes_cluster’
Return type:str
zone()[source]

Get KubernetesCluster zone

Returns:KubernetesCluster zone
Return type:str
class KubernetesClusterIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for KubernetesCluster

iter()[source]

Yields: Resource: KubernetesCluster created

class Lien(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for Lien

key()[source]

Get key of this resource

Returns:key of this resource
Return type:str
static type()[source]

Get type of this resource

Returns:‘lien’
Return type:str
class Network(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for Network

key()[source]

Get key of this resource

Returns:key of this resource
Return type:str
static type()[source]

Get type of this resource

Returns:‘network’
Return type:str
class NetworkIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for Network

iter()[source]

Yields: Resource: Network created

class ObjectIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for GcsObject

iter()[source]

Yields: Resource: GcsObject created

class Organization(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for Organization

classmethod fetch(client, resource_key)[source]

Get Organization

Saves ApiExecutionErrors as warnings.

Parameters:
  • client (object) – GCP API client
  • resource_key (str) – resource key to fetch
Returns:

created Organization

Return type:

Organization

get_iam_policy(**kwargs)[source]

Function wrapper to perform caching

Parameters:
  • args – args to be passed to the function
  • kwargs – kwargs to be passed to the function
Returns:

Results of executing f

Return type:

object

key()[source]

Get key of this resource

Returns:key of this resource
Return type:str
static type()[source]

Get type of this resource

Returns:‘organization’
Return type:str
class OrganizationCuratedRoleIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for OrganizationCuratedRole

iter()[source]

Yields: Resource: CuratedRole created

class OrganizationRoleIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for Organization Role

iter()[source]

Yields: Resource: Role created

class OrganizationSinkIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for Organization Sink

iter()[source]

Yields: Resource: Sink created

class Project(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for Project

bigquery_api_enabled()[source]

whether bigquery api is enabled

Returns:if this API service is enabled on the project.
Return type:bool
billing_enabled()[source]

whether billing is enabled

Returns:if billing is enabled on the project.
Return type:bool
cloudsql_api_enabled()[source]

whether cloudsql api is enabled

Returns:if this API service is enabled on the project.
Return type:bool
compute_api_enabled()[source]

whether compute api is enabled

Returns:if this API service is enabled on the project.
Return type:bool
container_api_enabled()[source]

whether container api is enabled

Returns:if this API service is enabled on the project.
Return type:bool
enumerable()[source]

whether this project is enumerable

Returns:if this project is enumerable
Return type:bool
classmethod fetch(client, resource_key)[source]

Get Project

Parameters:
  • client (object) – GCP API client
  • resource_key (str) – resource key to fetch
Returns:

created project

Return type:

Project

get_billing_info(**kwargs)[source]

Function wrapper to perform caching

Parameters:
  • args – args to be passed to the function
  • kwargs – kwargs to be passed to the function
Returns:

Results of executing f

Return type:

object

get_enabled_apis(**kwargs)[source]

Function wrapper to perform caching

Parameters:
  • args – args to be passed to the function
  • kwargs – kwargs to be passed to the function
Returns:

Results of executing f

Return type:

object

get_iam_policy(**kwargs)[source]

Function wrapper to perform caching

Parameters:
  • args – args to be passed to the function
  • kwargs – kwargs to be passed to the function
Returns:

Results of executing f

Return type:

object

is_api_enabled(service_name)[source]

Returns True if the API service is enabled on the project.

Parameters:service_name (str) – The API service name to check.
Returns:whether a service api is enabled
Return type:bool
key()[source]

Get key of this resource

Returns:key of this resource
Return type:str
should_dispatch()[source]

Project resources should run in parallel threads.

Returns:whether project resources should run in parallel threads.
Return type:bool
storage_api_enabled()[source]

whether storage api is enabled

Returns:if this API service is enabled on the project.
Return type:bool
static type()[source]

Get type of this resource

Returns:‘project’
Return type:str
class ProjectIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for Project

iter()[source]

Yields: Resource: Project created

class ProjectLienIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for Project Liens.

iter()[source]

Yields: Resource: Lien created

class ProjectRoleIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for Project Role

iter()[source]

Yields: Resource: Role created

class ProjectSinkIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for Project Sink

iter()[source]

Yields: Resource: Sink created

class Resource(data, root=False, contains=None, **kwargs)[source]

Bases: object

The Resource template

__getitem__(key)[source]

Get Item

Parameters:key (str) – key of this resource
Returns:data of this resource
Return type:str
Raises:KeyError – ‘key: {}, data: {}’
__repr__()[source]

String Representation

Returns:Resource representation
Return type:str
__setitem__(key, value)[source]

set the value of an item

Parameters:
  • key (str) – key of this resource
  • value (str) – value to set on this resource
static _utcnow()[source]

Wrapper for datetime.datetime.now() injection.

Returns:the datetime
Return type:datatime
accept(visitor, stack=None)[source]

Accept of resource in visitor pattern

Parameters:
  • visitor (Crawler) – visitor instance
  • stack (list) – resource hierarchy stack
add_warning(warning)[source]

Add warning on this resource

Parameters:warning (str) – warning to be added
data()[source]

Get data on this resource

Returns:raw data
Return type:str
get_billing_info(**kwargs)[source]

Function wrapper to perform caching

Parameters:
  • args – args to be passed to the function
  • kwargs – kwargs to be passed to the function
Returns:

Results of executing f

Return type:

object

get_cloudsql_policy(**kwargs)[source]

Function wrapper to perform caching

Parameters:
  • args – args to be passed to the function
  • kwargs – kwargs to be passed to the function
Returns:

Results of executing f

Return type:

object

get_dataset_policy(**kwargs)[source]

Function wrapper to perform caching

Parameters:
  • args – args to be passed to the function
  • kwargs – kwargs to be passed to the function
Returns:

Results of executing f

Return type:

object

get_enabled_apis(**kwargs)[source]

Function wrapper to perform caching

Parameters:
  • args – args to be passed to the function
  • kwargs – kwargs to be passed to the function
Returns:

Results of executing f

Return type:

object

get_gcs_policy(**kwargs)[source]

Function wrapper to perform caching

Parameters:
  • args – args to be passed to the function
  • kwargs – kwargs to be passed to the function
Returns:

Results of executing f

Return type:

object

get_group_members(**kwargs)[source]

Function wrapper to perform caching

Parameters:
  • args – args to be passed to the function
  • kwargs – kwargs to be passed to the function
Returns:

Results of executing f

Return type:

object

get_iam_policy(**kwargs)[source]

Function wrapper to perform caching

Parameters:
  • args – args to be passed to the function
  • kwargs – kwargs to be passed to the function
Returns:

Results of executing f

Return type:

object

get_kubernetes_service_config(**kwargs)[source]

Function wrapper to perform caching

Parameters:
  • args – args to be passed to the function
  • kwargs – kwargs to be passed to the function
Returns:

Results of executing f

Return type:

object

get_timestamp()[source]

template for timestamp when the resource object

Returns:a string timestamp when the resource object was created.
Return type:str
get_warning()[source]

Get warning on this resource

Returns:warning message
Return type:str
inventory_key()[source]

Gets the inventory key for this resource, if set.

Returns:The unique id for the resource in storage.
Return type:int
key()[source]

get key of this resource

Raises:NotImplementedError – key method not implemented
parent()[source]

Get parent of this resource

Returns:parent of this resource
Return type:Resource
set_inventory_key(key)[source]

Set the inventory unique id for the resource.

Parameters:key (int) – The unique id for the resource from the storage.
should_dispatch()[source]

whether resources should run in parallel threads.

Returns:whether this resource should run in parallel threads.
Return type:bool
stack()[source]

Get resource hierarchy stack of this resource

Returns:resource hierarchy stack of this resource
Return type:list
Raises:Exception – ‘Stack not initialized yet’
try_accept(visitor, stack=None)[source]

Handle exceptions on the call the accept.

Parameters:
  • visitor (object) – The class implementing the visitor pattern.
  • stack (list) – The resource stack from the root to immediate parent of this resource.
static type()[source]

Get type of this resource

Raises:NotImplementedError – method not implemented
visitor()[source]

Get visitor on this resource

Returns:visitor on this resource
Return type:Crawler
Raises:Exception – ‘Visitor not initialized yet’
class ResourceFactory(attributes)[source]

Bases: object

ResourceFactory for visitor pattern

create_new(data, root=False)[source]

Create a new instance of a Resouce type

Parameters:
  • data (str) – raw data
  • root (Resource) – root of this resource
Returns:

Resource instance

Return type:

Resource

class ResourceIterator(resource, client)[source]

Bases: object

The Resource iterator template

iter()[source]

Raises: NotImplementedError: Abstract class method not implemented

class ResourceKey(res_type, res_id)[source]

Bases: object

ResourceKey class

class Role(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for role

key()[source]

Get key of this resource

Returns:key of this resource
Return type:str
static type()[source]

Get type of this resource

Returns:‘role’
Return type:str
class ServiceAccount(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for serviceaccount

get_iam_policy(**kwargs)[source]

Function wrapper to perform caching

Parameters:
  • args – args to be passed to the function
  • kwargs – kwargs to be passed to the function
Returns:

Results of executing f

Return type:

object

key()[source]

Get key of this resource

Returns:id key of this resource
Return type:str
static type()[source]

Get type of this resource

Returns:‘serviceaccount’
Return type:str
class ServiceAccountIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for ServiceAccount

iter()[source]

Yields: Resource: ServiceAccount created

class ServiceAccountKey(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for serviceaccount_key

key()[source]

Get key of this resource

Key name is in the format:
projects/{project_id}/serviceAccounts/{service_account}/keys/{key_id}
Returns:id key of this resource
Return type:str
static type()[source]

Get type of this resource

Returns:‘serviceaccount_key’
Return type:str
class ServiceAccountKeyIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for ServiceAccountKey

iter()[source]

Yields: Resource: ServiceAccountKey created

class Sink(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for Stackdriver Logging sink

key()[source]

Get key of this resource

Returns:key of this resource
Return type:str
static type()[source]

Get type of this resource

Returns:‘sink’
Return type:str
class Snapshot(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for Snapshot

key()[source]

Get key of this resource

Returns:key of this resource
Return type:str
static type()[source]

Get type of this resource

Returns:‘snapshot’
Return type:str
class SnapshotIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for Snapshot

iter()[source]

Yields: Resource: Snapshot created

class Subnetwork(data, root=False, contains=None, **kwargs)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.Resource

The Resource implementation for Subnetwork

key()[source]

Get key of this resource

Returns:key of this resource
Return type:str
static type()[source]

Get type of this resource

Returns:‘subnetwork’
Return type:str
class SubnetworkIterator(resource, client)[source]

Bases: google.cloud.forseti.services.inventory.base.resources.ResourceIterator

The Resource iterator implementation for Subnetwork

iter()[source]

Yields: Resource: Subnetwork created

cached(field_name)[source]

Decorator to perform caching

Parameters:field_name (str) – The name of the attribute to cache
Returns:Function wrapper to perform caching
Return type:wrapper
from_root_id(client, root_id)[source]

Start the crawling from root if the root type is supported

Parameters:
  • client (object) – GCP API client
  • root_id (str) – id of the root
Returns:

the root resource instance

Return type:

Resource

Raises:

Exception – Unsupported root id