Cloudwanderer Boto3 Interface¶
Code which abstracts away the majority of boto3 interrogation.
Provides simpler methods for CloudWanderer
to call.
-
class
CloudWandererBoto3Interface
(boto3_session=None)¶ Simplifies lookup of boto3 services and resources.
-
get_all_resource_services
(client_args=None)¶ Return all boto3 service Resource objects.
- Parameters
client_args (dict) – Arguments to pass into the boto3 client. See:
boto3.session.Session.client()
- Return type
Iterator[boto3.resources.base.ServiceResource]
-
get_child_resource_definitions
(service_name, boto3_resource_model, resource_type)¶ Return all secondary attributes models for this resource.
Subresources and collections on custom service resources may be secondary attribute definitions if specified in metadata.
- Parameters
service_name (str) – The name of the service this model resides in (e.g.
'ec2'
)boto3_resource_model (boto3.resources.model.ResourceModel) – The
boto3.resources.model.ResourceModel
to get secondary attributes models fromresource_type (str) – The resource types to return (either ‘secondaryAttribute’ or ‘resource’)
- Return type
-
get_child_resources
(boto3_resource, resource_type)¶ Return all child resources of resource_type for this resource.
- Parameters
boto3_resource (boto3.resources.base.ServiceResource) – The
boto3.resources.base.ServiceResource
to get secondary attributes fromresource_type (str) – The resource types to return (either ‘secondaryAttribute’ or ‘resource’)
- Return type
-
get_resource_collection_by_resource_type
(boto3_service, resource_type)¶ Return the resource collection that matches the resource_type (e.g. instance).
This is as opposed to the collection name (e.g. instances)
- Parameters
boto3_service (boto3.resources.base.ServiceResource) –
resource_type (str) –
- Return type
Iterator[boto3.resources.model.Collection]
-
get_resource_collections
(boto3_service)¶ Return all resource types in this service.
- Parameters
boto3_service (boto3.resources.base.ServiceResource) –
- Return type
-
get_resource_from_collection
(boto3_service, boto3_resource_collection)¶ Return all resources of this resource type (collection) from this service.
- Parameters
boto3_service (boto3.resources.base.ServiceResource) –
boto3_resource_collection (boto3.resources.model.Collection) –
- Return type
Iterator[boto3.resources.model.ResourceModel]
-
get_resource_service_by_name
(service_name, client_args=None)¶ Get the resource definition matching this service name.
- Parameters
service_name (str) – The name of the service (e.g.
'ec2'
) to get.client_args (dict) – Arguments to pass into the boto3 client. See:
boto3.session.Session.client()
- Return type
-
get_resources_of_type
(service_name, resource_type, client_args)¶ Return all resources of resource_type from all definition sources.
- Parameters
service_name (str) – The name of the service to get resource for (e.g.
'ec2'
)resource_type (str) – The type of resource to get resources of (e.g.
'instance'
client_args (dict) – Arguments to pass into the boto3 client. See:
boto3.session.Session.client()
- Return type
Iterator[boto3.resources.model.ResourceModel]
-
get_secondary_attributes
(boto3_resource)¶ Return all secondary attributes resources for this resource.
Subresources and collections on custom service resources may be secondary attribute definitions if specified in metadata.
- Parameters
boto3_resource (boto3.resources.base.ServiceResource) – The
boto3.resources.base.ServiceResource
to get secondary attributes from- Return type
-
get_service_resource_collections
(service_name)¶ Return all the resource collections for a given service_name.
This is crucial to return collections for both native boto3 resources and custom cloudwanderer resources.
- Parameters
service_name (str) – The name of the service to get resource types for (e.g.
'ec2'
)- Return type
Iterator[boto3.resources.model.Collection]
-
get_service_resource_types
(service_name)¶ Return all possible resource names for a given service.
Returns resources for both native boto3 resources and custom cloudwanderer resources.
- Parameters
service_name (str) – The name of the service to get resource types for (e.g.
'ec2'
)- Return type
Iterator[str]
-
get_service_resource_types_from_collections
(collections)¶ Return all possible resource names for a given service.
Returns resources for both native boto3 resources and custom cloudwanderer resources.
- Parameters
collections (List[Collection]) – The list of collections from which to get resource names.
- Return type
Iterator[str]
-
get_subresources
(boto3_resource)¶ Return all subresources for this resource.
Subresources and collections on custom service resources may be subresources we want to collect if they are specified in our custom resource definitions.
- Parameters
boto3_resource (boto3.resources.base.ServiceResource) – The
boto3.resources.base.ServiceResource
to get secondary attributes from- Return type
-