GCP Resource.

For now, this only represents Organization resources. In the future, we may need to separate the classes depending on implementation.

class LifecycleState[source]

Bases: object

Resource lifecycle state.

class Resource(resource_id, resource_type, name=None, display_name=None, parent=None, locations=None, lifecycle_state='LIFECYCLE_STATE_UNSPECIFIED')[source]

Bases: object

Represents a GCP resource.


Test equality of Resource.

Parameters:other (object) – The other object.
Returns:Whether the objects are equal.
Return type:bool

Create a hash on the resource type and id.

Returns:The hash of the object.
Return type:hash

Test inequality of Resource.

Parameters:other (object) – The other object.
Returns:Whether the objects are equal.
Return type:bool

String representation of the Resource.

Returns:The representation.
Return type:str
_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 182
_abc_registry = <_weakrefset.WeakSet object>

Display name.

Returns:The display name.
Return type:str

Resource id.

Returns:The id.
Return type:str

Lifecycle state.

Returns:The LifecycleState.
Return type:LifecycleState

Locations the resource resides in.

Returns:Locations the resource resides in.
Return type:List[str]

GCP name.

Returns:The name.
Return type:str

Resource parent.

Returns:The parent.
Return type:Resource

Resource type.

Returns:The type.
Return type:str
class ResourceType[source]

Bases: object

Resource types.

APPENGINE_APP = 'appengine_app'
APPENGINE_INSTANCE = 'appengine_instance'
APPENGINE_VERSION = 'appengine_version'
BACKEND_SERVICE = 'backendservice'
BILLING_ACCOUNT = 'billing_account'
BUCKET = 'bucket'
CLOUD_SQL_INSTANCE = 'cloudsqlinstance'
DATASET = 'dataset'
FIREWALL_RULE = 'firewall'
FOLDER = 'folder'
FORWARDING_RULE = 'forwardingrule'
GROUP = 'gsuite_group'
INSTANCE = 'instance'
INSTANCE_GROUP = 'instancegroup'
INSTANCE_GROUP_MANAGER = 'instancegroupmanager'
INSTANCE_TEMPLATE = 'instancetemplate'
KE_CLUSTER = 'kubernetes_cluster'
LIEN = 'lien'
LOG_SINK = 'sink'
ORGANIZATION = 'organization'
PROJECT = 'project'
SERVICE_ACCOUNT = 'serviceaccount'
SERVICE_ACCOUNT_KEY = 'serviceaccount_key'
resource_types = frozenset(['forwardingrule', 'lien', 'bucket', 'project', 'sink', 'billing_account', 'organization', 'folder', 'gsuite_group'])
classmethod verify(resource_type)[source]

Verify if the resource type is recognized.

Parameters:resource_type (str) – The resource type.
Returns:The resource type if it is recognized in the resource_types.
Return type:str
Raises:InvalidResourceTypeError – If resource type is not recognized.