Boto3 Loaders

Boto3 Loaders.

Loaders and data classes to load custom CloudWanderer Boto3 service definitions and merge them with the boto3 provided ones. This allows cloudwanderer to extend Boto3 to support AWS resources that it does not support natively. We can do this quite easily because CloudWanderer only needs a fraction of the functionality that native Boto3 resources provide (i.e. the description of the resources).

class CustomServiceLoader(definition_path='resource_definitions')

A class to load custom services.

Parameters

definition_path (str) –

Return type

None

property available_services: List[str]

Return a list of available snake_case service names.

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) –

property path

Alias for field number 0

property regex_pattern

Alias for field number 1

class MergedServiceLoader

A class to merge the services from a custom service loader with those of Boto3.

Return type

None

property boto3_available_services: List[str]

Return a list of services defined by Boto3.

property cloudwanderer_available_services: List[str]

Return a list of services defined by CloudWanderer.

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

Specification for a relationship between two resources.

Parameters
property account_id_source

Alias for field number 5

property base_path

Alias for field number 0

property direction

Alias for field number 6

property id_parts

Alias for field number 1

property region_source

Alias for field number 4

property resource_type

Alias for field number 3

property service

Alias for field number 2

class ResourceRegionRequest(operation, params, path_to_region, default_value)

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

Parameters
  • operation (str) –

  • params (list) –

  • path_to_region (str) –

  • default_value (str) –

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

Alias for field number 3

property operation

Alias for field number 0

property params

Alias for field number 1

property path_to_region

Alias for field number 2

class ResourceRegionRequestParam(target, source, name)

Specification for a request param data model.

Parameters
  • target (str) –

  • source (str) –

  • name (str) –

property name

Alias for field number 2

property source

Alias for field number 1

property target

Alias for field number 0

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

Alias for field number 1

property source_path

Alias for field number 0

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.boto3_loaders.ResourceMap

property global_service

Alias for field number 2

property global_service_region

Alias for field number 3

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

Alias for field number 0

property resource_definition

Alias for field number 1

property service_definition

Alias for field number 4

class ResourceMap(type, region_request, ignored_subresources, default_filters, service_map, relationships, secondary_attribute_maps, requires_load_for_full_metadata=False, regional_resource=True)

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

Parameters
region_request

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

Type

Optional[cloudwanderer.aws_interface.boto3_loaders.ResourceRegionRequest]

parent_resource_type

The snake_case resource type of the parent (if this is a subresource).

ignored_subresources

A list of snake case subresources which exist in the Boto3 definition but should be ignored.

Type

list

default_filters

A dict of arguments to supply to the API Method used when enumerating this resource type. This can be overridden by the user with the filters argument.

Type

Dict[str, Any]

service_map

A link back to the parent ServiceMap object.

Type

cloudwanderer.aws_interface.boto3_loaders.ServiceMap

requires_load_for_full_metadata

If set resource.load() is called when fetching a list of these resources. Resources in a big increase in the number of API calls as one must be made for each resource.

Type

bool

regional_resource

Whether or not this resource exists in every region.

Type

bool