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.- Parameters
boto3_session (boto3.session.Session) – The
boto3.session.Session
object to use for any queries.definition_path (str) – The path to the
*.json
files containing the custom resource definitions.
-
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) –
- Return type
-
class
CustomResourceFactory
(boto3_session)¶ Factory class for generating custom boto3 Resource objects.
- Parameters
boto3_session (boto3.session.Session) – The
boto3.session.Session
object to use for any queries.
-
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 (list) – A list of dicts 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