Models

AWS Interface specific model classes.

class AWSResourceTypeFilter(service, resource_type, botocore_filters=None, jmespath_filters=None)

AWS Specific resource type filter.

Allows specification of either botocore filters or jmespath filters.

Parameters
  • service (str) –

  • resource_type (str) –

  • botocore_filters (Dict[str, Any]) –

  • jmespath_filters (List[str]) –

Return type

None

class IdPartSpecification(path, regex_pattern)

Specification for getting the ID parts of a resource’s relationship with another resource.

Parameters
  • path (str) –

  • regex_pattern (str) –

get_urn_parts(data)

Return id parts from a given data dict.

Parameters

data (Dict[str, Any]) – The data dictionary to get URN parts from.

Return type

Optional[Dict[str, Any]]

property path

The path to the ID Part

property regex_pattern

The regex pattern to apply to the ID part to extract the URN

property specified_urn_parts: Dict[str, List[str]]

Return a dictionary specifying the URN components which were specified in this id part specification.

class RelationshipSpecification(base_path, id_parts, cloud_name, service, resource_type, region_source, account_id_source, direction)

Specification for a relationship between two resources.

Parameters
property account_id_source

The source for determining the account id of the partner resource

property base_path

The base path to the id parts

property cloud_name

The name of the Cloud (defaults to aws)

property direction

The direction of the relationship. Whether the resource HAS the partner resource (outbound) or the partner resource HAS the resource (inbound)

property id_parts

The specifications for the parts of relationship partner resource’s URN

property region_source

The source for determining the region of the partner resource

property resource_type

The resource type of the partner resource

property service

The service name of the partner resource

class ResourceMap(name, type, id_uniqueness_scope, region_request, default_aws_resource_type_filter, service_map, relationships, secondary_attribute_maps, urn_overrides, regional_resource=True, requires_load=False)

Specification for additional CloudWanderer specific metadata about a Boto3 resource type.

Parameters
property default_aws_resource_type_filter

The default AWSResourceTypeFilter for this resource.

property id_uniqueness_scope

The scope in which this resource’s ID is unique.

property name

The PascalCase name of the resource (e.g. Instance)

property region_request

An optional definition for how to perform a secondary query to discover the region in which this resource exists

property regional_resource

Whether or not this resource exists in every region.

property relationships

The specifications for the relationships this resource can have.

property requires_load

If the resource requires .load() calling on it before it has a complete set of metadata. Used by IAM PolicyVersion because as a dependent resource it needs to be listed with ListPolicyVersions, then subsequently got with GetPolicyVersion.

property secondary_attribute_maps

The specifications for the secondary attributes for this resource.

property service_map

A link back to the parent ServiceMap object.

should_query_resources_in_region(region)

Return whether this resource should be queried from this region.

Parameters

region (str) – The region in which to query the resource.

Return type

bool

property type

The ResourceIndependenceType of the resource (baseResource, secondaryAttribute, dependentResource)

property urn_overrides

Optional specifications for overriding URN parts based on resource metadata.

class ResourceRegionRequest(operation, params, path_to_region, default_value)

Specification for a request to get a resource’s region.

Parameters
build_params(resource)

Return the params required to query the resource’s region from the Boto3 resource’s attributes.

Parameters

resource (boto3.resources.base.ServiceResource) – The Boto3 Resource to build params for.

Return type

dict

property default_value

The value to use if no region is found

property operation

The (snake_case) name of the botocore client operation to call

property params

The parameters to the request

property path_to_region

The path of to the region value in the request response

class ResourceRegionRequestParam(target, source, name)

Specification for a request param data model.

Parameters
  • target (str) –

  • source (str) –

  • name (str) –

property name

The name of the attribute to pull the value from

property source

The source for the value of the argument (e.g. resourceAttribute)

property target

The name of the argument to supply

class SecondaryAttributeMap(source_path, destination_name)

Specification for mapping attributes contained in a secondary attribute to its parent’s resource.

Parameters
  • source_path (str) –

  • destination_name (str) –

property destination_name

The key to place this secondary attribute under in the parent resource.

property source_path

The path to get the URN from in the Secondary Attribute resource metadata itself.

class ServiceMap(name, resource_definition, global_service, global_service_region, service_definition)

Specification for additional CloudWanderer specific metadata about a Boto3 service.

Parameters
  • name (str) –

  • resource_definition (dict) –

  • global_service (bool) –

  • global_service_region (str) –

  • service_definition (dict) –

get_resource_map(resource_type)

Return the resource map given a snake_case resource name.

Parameters

resource_type (str) – The snake_case name of the resource map to get.

Return type

cloudwanderer.aws_interface.models.ResourceMap

property global_service

Whether or not it is a global service

property global_service_region

If it is a global service, what region is its primary region

property is_default_service: bool

Return True if this service has no definition and should return default values.

property is_global_service: bool

Return whether this service is a global service.

property name

The name of the service

property resource_definition

The raw definition of the resources in this service

property service_definition

The raw service definition