CloudWanderer Resource

Standardised dataclasses for returning resources from storage.

class CloudWandererResource(urn, resource_data, secondary_attributes=None, loader=None)

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

urn

The URN of the resource.

Type

URN

cloudwanderer_metadata

The metadata of this resource (including attributes).

Type

ResourceMetadata

__init__(urn, resource_data, secondary_attributes=None, loader=None)

Initialise the resource.

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

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

  • secondary_attributes (List[dict]) – A list of secondary attribute raw dictionaries.

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

Return type

None

get_secondary_attribute(name=None, jmes_path=None)

Get an attribute not returned in the resource’s standard describe method.

Parameters
  • name (str) – The name of the secondary attribute (e.g. 'enable_dns_support)

  • jmes_path (str) – A JMES path to the secondary attribute. e.g. [].EnableDnsSupport.Value

Return type

None

property is_inflated

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, secondary_attributes)

Metadata for a CloudWandererResource.

Contains the original dictionaries of the resource and its attributes.

resource_data

The raw dictionary representation of the Resource.

Type

dict

secondary_attributes

The list of the resource’s SecondaryAttribute objects.

Type

list

__init__(resource_data, secondary_attributes)

Initialise the data class.

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

  • secondary_attributes (list) – The list of the resource’s SecondaryAttribute objects.

Return type

None

class SecondaryAttribute(name, **kwargs)

Partially formalised SecondaryAttribute for resources.

Allows us to store unstructured data in a dict-like object while maintaining the attribute_name attribute.

attribute_name

The name of the attribute.

Type

str

__init__(name, **kwargs)

Initialise the Secondary Attribute.

Parameters
  • name (str) – The name of the attribute

  • **kwargs – The attributes keys and values

Return type

None