CloudWanderer Resource

Standardised dataclasses for returning resources from storage.

class CloudWandererResource(urn, resource_data, relationships=None, loader=None, dependent_resource_urns=None, parent_urn=None, discovery_time=None)

A simple representation of a resource that prevents any storage metadata polluting the resource dictionary.

This can be a resource, or a dependent resource. A dependent resource in CloudWanderer is a resource which does not have a unique identifier of its own and depends upon its parent for its identity.

Parameters
Return type

None

urn

The URN of the resource.

dependent_resource_urns

The URNs of this resource’s dependent resources (e.g. role_policies for a role).

relationships

The PartialURNs of resources that are related to this one.

parent_urn

The URN of this resource’s parent (only exists if this is a dependent resource).

cloudwanderer_metadata

The metadata of this resource (including attributes).

Type

ResourceMetadata

__init__(urn, resource_data, relationships=None, loader=None, dependent_resource_urns=None, parent_urn=None, discovery_time=None)

Initialise the resource.

Parameters
  • urn (cloudwanderer.urn.URN) – The URN of the resource.

  • resource_data (dict) – The dictionary containing the raw data about this resource.

  • relationships (Optional[List[cloudwanderer.models.Relationship]]) – The relationships this resource has with other resources.

  • loader (Optional[Callable]) – The method which can be used to fulfil the CloudWandererResource.load().

  • dependent_resource_urns (Optional[List[cloudwanderer.urn.URN]]) – The URNs of the dependent resources of this resource.

  • parent_urn (Optional[cloudwanderer.urn.URN]) – The URN of the resource’s parent resource.

  • discovery_time (Optional[datetime.datetime]) – The time the resource was discovered.

Return type

None

property is_inflated: bool

Return whether this resource has all the attributes from storage.

load()

Inflate this resource with all data from the original storage connector it was spawned from.

Raises

ValueError – Occurs if the storage connector loader isn’t populated or the resource no longer exists in the StorageConnector’s storage.

Return type

None

class ResourceMetadata(resource_data)

Metadata for a CloudWandererResource.

Contains the original dictionaries of the resource and its attributes.

Parameters

resource_data (dict) –

Return type

None

resource_data

The raw dictionary representation of the Resource.

Type

dict

__init__(resource_data)

Initialise the data class.

Parameters

resource_data (dict) – The raw dictionary representation of the Resource.

Return type

None