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 = 199
_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'
CRYPTO_KEY = 'kms_cryptokey'
DATASET = 'dataset'
FIREWALL_RULE = 'firewall'
FOLDER = 'folder'
FORWARDING_RULE = 'forwardingrule'
GROUP = 'gsuite_group'
GROUPS_SETTINGS = 'gsuite_groups_settings'
INSTANCE = 'instance'
INSTANCE_GROUP = 'instancegroup'
INSTANCE_GROUP_MANAGER = 'instancegroupmanager'
INSTANCE_TEMPLATE = 'instancetemplate'
KEY_RING = 'kms_keyring'
KE_CLUSTER = 'kubernetes_cluster'
LIEN = 'lien'
LOG_SINK = 'sink'
ORGANIZATION = 'organization'
PROJECT = 'project'
SERVICE_ACCOUNT = 'serviceaccount'
SERVICE_ACCOUNT_KEY = 'serviceaccount_key'
TABLE = 'bigquery_table'
resource_types = frozenset(['forwardingrule', 'kms_keyring', 'lien', 'bucket', 'project', 'sink', 'billing_account', 'organization', 'folder', 'kms_cryptokey', '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.