CloudWanderer¶
Main cloudwanderer module.
-
class
CloudWanderer
(storage_connectors, cloud_interface=None)¶ CloudWanderer.
-
__init__
(storage_connectors, cloud_interface=None)¶ Initialise CloudWanderer.
- Parameters
storage_connectors (List[BaseStorageConnector]) – CloudWanderer storage connector objects.
cloud_interface (CloudWandererAWSInterface) – The cloud interface to get resources from. Defaults to
CloudWandererAWSInterface
.
- Return type
None
-
write_resource
(urn, **kwargs)¶ Fetch data for and persist to storage a single resource and its subresources.
If the resource does not exist it will be deleted from the storage connectors.
- Parameters
urn (URN) – The URN of the resource to write
**kwargs – All additional keyword arguments will be passed down to the cloud interface client calls.
- Return type
None
-
write_resources
(regions=None, service_names=None, resource_types=None, exclude_resources=None, **kwargs)¶ Write all AWS resources in this account from all regions and all services to storage.
All arguments are optional.
- Parameters
regions (list) – The name of the region to get resources from (defaults to session default if not specified)
service_names (str) – The names of the services to write resources for (e.g.
['ec2']
)resource_types (list) – A list of resource types to include (e.g.
['instance']
)exclude_resources (list) – A list of service:resources to exclude (e.g.
['ec2:instance']
)kwargs – All additional keyword arguments will be passed down to the cloud interface client calls.
- Return type
None
-
write_resources_concurrently
(cloud_interface_generator, storage_connector_generator, exclude_resources=None, concurrency=10, **kwargs)¶ Write all AWS resources in this account from all regions and all services to storage.
Any additional args will be passed into the cloud interface’s
get_
methods. WARNING: Experimental.- Parameters
exclude_resources (list) – exclude_resources (list): A list of service:resources to exclude (e.g.
['ec2:instance']
)concurrency (int) – Number of query threads to invoke concurrently.
cloud_interface_generator (Callable) – A method which returns a new cloud interface session when called. This helps prevent non-threadsafe cloud interfaces from interfering with each others.
storage_connector_generator (Callable) – A method which returns a list of storage connectors when called. The returned connectors should be instances of the same connectors each time the method is called. These connectors do not need to be thread safe and will be returned at the end of execution.
**kwargs – Additional keyword arguments will be passed down to the cloud interface methods.
- Return type
List[cloudwanderer.cloud_wanderer.CloudWandererConcurrentWriteThreadResult]
-