google.cloud.forseti.common.gcp_type.resource module

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.

ACTIVE = 'ACTIVE'
DELETED = 'DELETED'
UNSPECIFIED = 'LIFECYCLE_STATE_UNSPECIFIED'
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.

__eq__(other)[source]

Test equality of Resource.

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

Create a hash on the resource type and id.

Returns:The hash of the object.
Return type:hash
__ne__(other)[source]

Test inequality of Resource.

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

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 = 208
_abc_registry = <_weakrefset.WeakSet object>
display_name

Display name.

Returns:The display name.
Return type:str
id

Resource id.

Returns:The id.
Return type:str
lifecycle_state

Lifecycle state.

Returns:The LifecycleState.
Return type:LifecycleState
locations

Locations the resource resides in.

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

GCP name.

Returns:The name.
Return type:str
parent

Resource parent.

Returns:The parent.
Return type:Resource
type

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'
ROLE = 'role'
SERVICE_ACCOUNT = 'serviceaccount'
SERVICE_ACCOUNT_KEY = 'serviceaccount_key'
TABLE = 'bigquery_table'
resource_types = frozenset({'kms_cryptokey', 'lien', 'organization', 'bucket', 'folder', 'billing_account', 'kms_keyring', 'dataset', 'gsuite_group', 'forwardingrule', 'sink', 'project'})
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.