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
urn (cloudwanderer.urn.URN) –
resource_data (dict) –
relationships (List[cloudwanderer.models.Relationship]) –
loader (Optional[Callable]) –
dependent_resource_urns (List[cloudwanderer.urn.URN]) –
parent_urn (cloudwanderer.urn.URN) –
discovery_time (datetime.datetime) –
- Return type
- 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
- __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
- 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
- class ResourceMetadata(resource_data)
Metadata for a
CloudWandererResource
.Contains the original dictionaries of the resource and its attributes.