ó T!¶\c@sÝddlZddlmZddlmZddlmZmZddlm Z ddl m Z ddl m Z ejeƒZd efd „ƒYZd efd „ƒYZd efd„ƒYZdefd„ƒYZdS(iÿÿÿÿN(t xform_namei(tcreate_request_parameters(t RawHandlertResourceHandler(tAction(tActionDocstring(tinject_attributet ServiceActioncBs&eZdZddd„Zd„ZRS(s¥ 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. :type action_model: :py:class`~boto3.resources.model.Action` :param action_model: The action model. :type factory: ResourceFactory :param factory: The factory that created the resource class to which this action is attached. :type service_context: :py:class:`~boto3.utils.ServiceContext` :param service_context: Context about the AWS service c Csd||_|j}|rNtd|jd|d|d|d|jjƒ|_nt|jƒ|_dS(Nt search_pathtfactorytresource_modeltservice_contexttoperation_name(t _action_modeltresourceRtpathtrequestt operationt_response_handlerR(tselft action_modelR R tresource_response_model((s7/tmp/pip-install-usGedi/boto3/boto3/resources/action.pyt__init__.s    cOs‘t|jjjƒ}t||jjƒ}|j|ƒtjd|jj ||ƒt |jj |ƒ|}tjd|ƒ|j |||ƒS(s½ Perform the action's request operation after building operation parameters and build any defined resources from the response. :type parent: :py:class:`~boto3.resources.base.ServiceResource` :param parent: The resource instance to which this action is attached. :rtype: dict or ServiceResource or list(ServiceResource) :return: The response, either as a raw dict or resource instance(s). sCalling %s:%s with %rs Response: %r( RR RRRtupdatetloggertdebugtmetat service_nametgetattrtclientR(RtparenttargstkwargsR tparamstresponse((s7/tmp/pip-install-usGedi/boto3/boto3/resources/action.pyt__call__>s   N(t__name__t __module__t__doc__tNoneRR#(((s7/tmp/pip-install-usGedi/boto3/boto3/resources/action.pyRst BatchActioncBseZdZd„ZRS(sÆ 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. :type action_model: :py:class`~boto3.resources.model.Action` :param action_model: The action model. :type factory: ResourceFactory :param factory: The factory that created the resource class to which this action is attached. :type service_context: :py:class:`~boto3.utils.ServiceContext` :param service_context: Context about the AWS service c Os(d}d}g}t|jjjƒ}xú|jƒD]ì}i} xot|ƒD]a\} } |dkrt| jj}n|dkr| jj }nt | |jjd| d| ƒqMW| s¼Pn| j |ƒt j d||| ƒt||ƒ| } t j d| ƒ|j|j|| | ƒƒq4W|S(s‘ Perform the batch action's operation on every page of results from the collection. :type parent: :py:class:`~boto3.resources.collection.ResourceCollection` :param parent: The collection iterator to which this action is attached. :rtype: list(dict) :return: A list of low-level response dicts from each call. R!tindexsCalling %s:%s with %rs Response: %rN(R'RR RRtpagest enumerateRRRRRRRRtappendR( RRRR RRt responsesR tpageR!R)RR"((s7/tmp/pip-install-usGedi/boto3/boto3/resources/action.pyR#ls0      (R$R%R&R#(((s7/tmp/pip-install-usGedi/boto3/boto3/resources/action.pyR(Zst WaiterActioncBs eZdZd„Zd„ZRS(s/ 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. :type waiter_model: :py:class`~boto3.resources.model.Waiter` :param waiter_model: The action waiter. :type waiter_resource_name: string :param waiter_resource_name: The name of the waiter action for the resource. It usually begins with a ``wait_until_`` cCs||_||_dS(N(t _waiter_modelt_waiter_resource_name(Rt waiter_modeltwaiter_resource_name((s7/tmp/pip-install-usGedi/boto3/boto3/resources/action.pyR°s c OsŽt|jjƒ}t||jƒ}|j|ƒtjd|jj|j |ƒ|jj }|j |ƒ}|j |}tjd|ƒdS(sñ Perform the wait operation after building operation parameters. :type parent: :py:class:`~boto3.resources.base.ServiceResource` :param parent: The resource instance to which this action is attached. sCalling %s:%s with %rs Response: %rN( RR0t waiter_nameRRRRRRR1Rt get_waitertwait( RRRR tclient_waiter_nameR!RtwaiterR"((s7/tmp/pip-install-usGedi/boto3/boto3/resources/action.pyR#´s     (R$R%R&RR#(((s7/tmp/pip-install-usGedi/boto3/boto3/resources/action.pyR/¢s  tCustomModeledActioncBs eZdZd„Zd„ZRS(s3A custom, modeled action to inject into a resource.cCs(||_||_||_||_dS(sƒ :type action_name: str :param action_name: The name of the action to inject, e.g. 'delete_tags' :type action_model: dict :param action_model: A JSON definition of the action, as if it were part of the resource model. :type function: function :param function: The function to perform when the action is called. The first argument should be 'self', which will be the resource the function is to be called on. :type event_emitter: :py:class:`botocore.hooks.BaseEventHooks` :param event_emitter: The session event emitter. N(tnametmodeltfunctiontemitter(Rt action_nameRR<t event_emitter((s7/tmp/pip-install-usGedi/boto3/boto3/resources/action.pyRÑs   c Ks‡|jdƒd}t|j|jiƒ}|j|j_td|d|jd|d|jdt ƒ|j_ t ||j|jƒdS(Nt.iÿÿÿÿt resource_nameR?Rt service_modeltinclude_signature( trsplitRR:R;R<R$RR=RBtFalseR&R(Rtclass_attributesR t event_nameR RAtaction((s7/tmp/pip-install-usGedi/boto3/boto3/resources/action.pytinjectés  (R$R%R&RRI(((s7/tmp/pip-install-usGedi/boto3/boto3/resources/action.pyR9Ïs (tloggingtbotocoreRR!RR"RRR;Rtboto3.docs.docstringRt boto3.utilsRt getLoggerR$RtobjectRR(R/R9(((s7/tmp/pip-install-usGedi/boto3/boto3/resources/action.pyts =H-