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
base_path (str) –
id_parts (List[cloudwanderer.aws_interface.boto3_loaders.IdPartSpecification]) –
service (str) –
resource_type (str) –
region_source (cloudwanderer.models.RelationshipRegionSource) –
account_id_source (cloudwanderer.models.RelationshipAccountIdSource) –
direction (cloudwanderer.models.RelationshipDirection) –
- 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
- 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(name, type, 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
name (str) –
type (Optional[str]) –
region_request (Optional[cloudwanderer.aws_interface.boto3_loaders.ResourceRegionRequest]) –
default_aws_resource_type_filter (cloudwanderer.aws_interface.models.AWSResourceTypeFilter) –
service_map (cloudwanderer.aws_interface.boto3_loaders.ServiceMap) –
relationships (List[cloudwanderer.aws_interface.boto3_loaders.RelationshipSpecification]) –
secondary_attribute_maps (List[cloudwanderer.aws_interface.boto3_loaders.SecondaryAttributeMap]) –
urn_overrides (List[cloudwanderer.aws_interface.boto3_loaders.IdPartSpecification]) –
regional_resource (bool) –
requires_load (bool) –
- name
The PascalCase name of the resource (e.g.
Instance
)- Type
str
- type
The snake_case type of the resource (e.g.
instance
)- Type
Optional[str]
- region_request
An optional definition for how to perform a secondary query to discover the region in which this resource exists.
- default_aws_resource_type_filter
The default
AWSResourceTypeFilter
for this resource.
- service_map
A link back to the parent
ServiceMap
object.
- relationships
The specifications for the relationships this resource can have.
- secondary_attribute_maps
The specifications for the secondary attributes for this resource.
- urn_overrides
Optional specifications for overriding URN parts based on resource metadata.
- regional_resource
Whether or not this resource exists in every region.
- Type
bool
- 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.
- Type
bool