CloudWanderer Reference¶
Main cloudwanderer module.
-
class
cloudwanderer.cloud_wanderer.
CloudWanderer
(storage_connector)¶ CloudWanderer.
- Parameters
storage_connector – A CloudWanderer storage connector object.
-
property
account_id
¶ Return the AWS Account ID our boto3 client is authenticated against.
-
property
client_region
¶ Return the region our boto3 client is authenticated against.
-
read_all_resources_in_account
(account_id)¶ Return all resources in the provided AWS Account from storage.
-
read_resource
(urn)¶ Return a specific resource by its urn from storage.
-
read_resource_of_type
(service, resource_type)¶ Return all resources of type.
- Parameters
service (str) – Service name (e.g. ec2)
resource_type (str) – Resource Type (e.g. instance)
-
read_resource_of_type_in_account
(service, resource_type, account_id)¶ Return all resources of this type in the provided AWS Account from storage.
-
write_all_resources
(exclude_resources=None)¶ Write all AWS resources in this account from all services to storage.
-
write_resource_attributes
(service_name)¶ Write all AWS resource attributes in this account in this service to storage.
These custom resource attribute definitions allow us to fetch resource attributes that are not returned by the resource’s default describe calls.
- Parameters
service_name (str) – The name of the service to write the attributes of (e.g.
ec2
)
-
write_resources
(service_name, exclude_resources=None)¶ Write all AWS resources in this account in this service to storage.
- Parameters
service_name (str) – The name of the service to write resources for (e.g.
'ec2'
)exclude_resources (list) – A list of resources to exclude (e.g. [‘instances’])
-
class
cloudwanderer.cloud_wanderer.
CloudWandererBoto3Interface
¶ Class of methods which expect boto3 resources and services rather than resource names and service names.
-
get_all_resource_services
()¶ Return all the boto3 service Resource objects that are available, both built-in and custom.
-
get_boto3_resource_service
(service_name)¶ Return the boto3 service Resource object matching this service_name.
-
get_custom_resource_service
(service_name)¶ Get the custom resource definition matching this service name.
-
get_resource_attribute_from_collection
(boto3_resource_attribute_service, boto3_resource_attribute_collection)¶ Return a boto3.resource pertaining to a resource attribute defined by CloudWanderer.
These custom resource attribute definitions allow us to fetch resource attributes that are not returned by the resource’s default describe calls.
- Parameters
boto3_resource_attribute_service – The boto3.resource service from self.get_resource_attributes_service_by_name
boto3_resource_attribute_collection – The boto3 collection of attributes we want to retrieve.
-
get_resource_attributes_service_by_name
(service_name)¶ Return the boto3.resource service containing a collection of resource attributes provided by CloudWanderer.
These custom resource attribute definitions allow us to fetch resource attributes that are not returned by the resource’s default describe calls.
- Parameters
service_name (str) – The name of the service (e.g.``ec2``) to get.
-
get_resource_collections
(boto3_service)¶ Return all resource types in this service.
-
get_resource_from_collection
(boto3_service, boto3_resource_collection)¶ Return all resources of this resource type (collection) from this service.
-
get_resource_service_by_name
(service_name)¶ Return all services matching name, boto3 or custom.
-
-
class
cloudwanderer.cloud_wanderer.
ResourceDict
(urn, resource)¶ A dictionary representation of a resource that prevents any storage metadata polluting the resource dictionary.
Use
dict(my_resource_dict)
to convert this object into a dictionary that contains only the resource’s metadata.-
urn
¶ The AWS URN of the resource.
- Type
cloudwanderer.AwsUrn
-
metadata
¶ The original storage representation of the resource as it was passed in.
- Type
dict
-