Global Service Mappings

Provides a way to map resources back to the regions they reside in.

In some cases we need to perform additional API calls to discover the region in which a resource resides. The most well-known example of this is s3 buckets which require an additional API call to get their region. When a resource is passed in that doesn’t have a Global Service Mapping, the Session’s region is used.

class GlobalServiceMapping(service_name, service_mapping, boto3_session=None)

Understand the location of global services and their resources.

Parameters
  • service_name (str) – The name of the service mapping to instantiate.

  • service_mapping (dict) – The service mapping to instantiate.

  • boto3_session (boto3.session.Session) – The Session to use to query for resource region information.

get_resource_region(resource, default_region)

Get the region of a boto3.resources.base.ServiceResource object.

Parameters
Return type

str

has_global_resources_in_region(region)

Return True if service has only global resources and their primary endpoint is this region.

Parameters

region (str) –

Return type

bool

property has_regional_resources

Returns True if this global service has resources in regions other than the primary service region.

Also returns True if there is no service_mapping (i.e. this is not a known global service).

class GlobalServiceMappingCollection(boto3_session=None)

Load and retrieve global service mappings.

Parameters

boto3_session (boto3.session.Session) – The boto3.session.Session object to use for any queries.

get_global_service_map(service_name)

Returns the mapping for service_name.

Parameters

service_name (str) –

Return type

List[cloudwanderer.global_service_mappings.GlobalServiceMapping]

get_global_service_maps()

Return our custom resource definitions.

Return type

List[cloudwanderer.global_service_mappings.GlobalServiceMapping]

exception GlobalServiceResourceMappingNotFound

Global Service Resource Mapping not Found.