boto3.resources.action

Module Contents

logger
class ServiceAction(action_model, factory=None, service_context=None)

Bases:object

A class representing a callable action on a resource, for example sqs.get_queue_by_name(...) or s3.Bucket('foo').delete(). The action may construct parameters from existing resource identifiers and may return either a raw response or a new resource instance.

Parameters:
  • action_model (:py:class`~boto3.resources.model.Action`) – The action model.
  • factory (ResourceFactory) – The factory that created the resource class to which this action is attached.
  • service_context (ServiceContext) – Context about the AWS service
__call__(self, parent, *args, **kwargs)

Perform the action’s request operation after building operation parameters and build any defined resources from the response.

Parameters:parent (ServiceResource) – The resource instance to which this action is attached.
Return type:dict or ServiceResource or list(ServiceResource)
Returns:The response, either as a raw dict or resource instance(s).
class BatchAction

Bases:boto3.resources.action.ServiceAction

An action which operates on a batch of items in a collection, typically a single page of results from the collection’s underlying service operation call. For example, this allows you to delete up to 999 S3 objects in a single operation rather than calling .delete() on each one individually.

Parameters:
  • action_model (:py:class`~boto3.resources.model.Action`) – The action model.
  • factory (ResourceFactory) – The factory that created the resource class to which this action is attached.
  • service_context (ServiceContext) – Context about the AWS service
__call__(self, parent, *args, **kwargs)

Perform the batch action’s operation on every page of results from the collection.

Parameters:parent (ResourceCollection) – The collection iterator to which this action is attached.
Return type:list(dict)
Returns:A list of low-level response dicts from each call.
class WaiterAction(waiter_model, waiter_resource_name)

Bases:object

A class representing a callable waiter action on a resource, for example s3.Bucket('foo').wait_until_bucket_exists(). The waiter action may construct parameters from existing resource identifiers.

Parameters:
  • waiter_model (:py:class`~boto3.resources.model.Waiter`) – The action waiter.
  • waiter_resource_name (string) – The name of the waiter action for the resource. It usually begins with a wait_until_
__call__(self, parent, *args, **kwargs)

Perform the wait operation after building operation parameters.

Parameters:parent (ServiceResource) – The resource instance to which this action is attached.
class CustomModeledAction(action_name, action_model, function, event_emitter)

Bases:object

A custom, modeled action to inject into a resource.

inject(self, class_attributes, service_context, event_name, **kwargs)