Custom Resource Definitions¶
Classes for handling custom boto3 ServiceResource
.
Custom resources use the boto3.resources.base.ServiceResource
model to extend support to
AWS resources that boto3 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
CustomResourceDefinitions
(boto3_session=None, definition_path='resource_definitions')¶ Custom Resource Definitions.
Allows us to specify
ServiceResource
definitions where they are not supplied by boto3.-
property
definitions
¶ Return our custom resource definitions.
-
resource
(service_name, **kwargs)¶ Instantiate and return the boto3 Resource object for our custom resource definition.
- Parameters
service_name (str) – The name of the service (e.g.
'ec2'
)kwargs – Any additional keyword aguments will be passed to the Boto3 client.
- Return type
-
property
services
¶ Return our custom service resources.
-
property
-
class
CustomResourceFactory
(boto3_session)¶ Factory class for generating custom boto3 Resource objects.
-
load
(service_name, resource_definitions=None, service_definition=None)¶ Load the specified resource definition dictionaries into a Resource object.
- Parameters
service_name (str) – The name of the service to load (e.g.
'ec2'
)resource_definitions (dict) – A dict describing the resource definitions. This is the
'resources'
key in eachresource_definition
json.service_definition (dict) – A dict describing the service definition. This is the
'service'
key in eachresource_definition
json.
- Return type
-