
    1-                     f    S SK r S SKJr  SSKJr  S rSS jrS r " S S	\5      r	 " S
 S\5      r
g)    N)
xform_name   )get_data_memberc                      U  H  nUb  M    g   g)z
Return True if all elements of the iterable are not None (or if the
iterable is empty). This is like the built-in ``all``, except checks
against None, so 0 and False are allowable values.
FT )iterableelements     +lib/third_party/boto3/resources/response.pyall_not_noner      s     ?      c                    / nU  H  nUR                   nUR                  nUS:X  a"  [        R                  " UR                  U5      nOUS:X  a"  [        R                  " UR                  U5      nOdUS:X  a   [        U[        UR                  5      5      nO>US:X  a  [        XR                  5      nO"US:X  a  M  [        SR                  U5      5      eUR                  [        U5      U45        M     U$ )a  
Builds a mapping of identifier names to values based on the
identifier source location, type, and target. Identifier
values may be scalars or lists depending on the source type
and location.

:type identifiers: list
:param identifiers: List of :py:class:`~boto3.resources.model.Parameter`
                    definitions
:type parent: ServiceResource
:param parent: The resource instance to which this action is attached.
:type params: dict
:param params: Request parameters sent to the service.
:type raw_response: dict
:param raw_response: Low-level operation response.
:rtype: list
:return: An ordered list of ``(name, value)`` identifier tuples.
responserequestParameter
identifierdatainputzUnsupported source type: {0})sourcetargetjmespathsearchpathgetattrr   namer   NotImplementedErrorformatappend)	identifiersparentparamsraw_responseresultsr   r   r   values	            r
   build_identifiersr#       s    & G!
""""ZOOJOO\BE))OOJOOV<E|#FJz$?@Ev $FOO<Ew%.55f=? ? 	
6*E23+ ". Nr   c                    SnUR                  U5      nUR                  nU (       a  U R                  S5       Hv  nUR                  S5      nUR                  S:X  a  UR
                  U   nM5  UR                  S:X  a  UR                  nMS  [        SR                  UR                  U5      5      e   UR                  S:X  a  0 nU$ UR                  S:X  a  / nU$ UR                  S:X  a  0 nU$ )ai  
Creates an appropriate empty response for the type that is expected,
based on the service model's shape type. For example, a value that
is normally a list would then return an empty list. A structure would
return an empty dict, and a number would return None.

:type search_path: string
:param search_path: JMESPath expression to search in the response
:type operation_name: string
:param operation_name: Name of the underlying service operation.
:type service_model: :ref:`botocore.model.ServiceModel`
:param service_model: The Botocore service model
:rtype: dict, list, or None
:return: An appropriate empty value
N.z[0123456789]$	structurelistz(Search path hits shape type {0} from {1}map)	operation_modeloutput_shapesplitstrip	type_namemembersmemberr   r   )search_pathoperation_nameservice_modelr   r)   shapeitems          r
   build_empty_responser5   O   s      H#33NCO((E
  %%c*D::o.D+-d+F*)>EE/0 0 + +% O 
F	" O 
E	!Or   c                   $    \ rS rSrSrS rS rSrg)
RawHandler   a'  
A raw action response handler. This passed through the response
dictionary, optionally after performing a JMESPath search if one
has been defined for the action.

:type search_path: string
:param search_path: JMESPath expression to search in the response
:rtype: dict
:return: Service response
c                     Xl         g Nr0   )selfr0   s     r
   __init__RawHandler.__init__   s    &r   c                     U R                   (       a1  U R                   S:w  a!  [        R                  " U R                   U5      nU$ )
:type parent: ServiceResource
:param parent: The resource instance to which this action is attached.
:type params: dict
:param params: Request parameters sent to the service.
:type response: dict
:param response: Low-level operation response.
$)r0   r   r   )r<   r   r   r   s       r
   __call__RawHandler.__call__   s5      0 0C 7t'7'7BHr   r;   N)__name__
__module____qualname____firstlineno____doc__r=   rB   __static_attributes__r   r   r
   r7   r7      s    	'r   r7   c                   0    \ rS rSrSr SS jrS rS rSrg)	ResourceHandler   a"  
Creates a new resource or list of new resources from the low-level
response based on the given response resource definition.

:type search_path: string
:param search_path: JMESPath expression to search in the response

:type factory: ResourceFactory
:param factory: The factory that created the resource class to which
                this action is attached.

:type resource_model: :py:class:`~boto3.resources.model.ResponseResource`
:param resource_model: Response resource model.

:type service_context: :py:class:`~boto3.utils.ServiceContext`
:param service_context: Context about the AWS service

:type operation_name: string
:param operation_name: Name of the underlying service operation, if it
                       exists.

:rtype: ServiceResource or list
:return: New resource instance(s).
Nc                 @    Xl         X l        X0l        XPl        X@l        g r:   )r0   factoryresource_modelr1   service_context)r<   r0   rN   rO   rP   r1   s         r
   r=   ResourceHandler.__init__   s    &,,.r   c           	         U R                   R                  nU R                  R                  R	                  U5      nU R
                  R                  UUU R                  S9nUnSnU R                  (       a!  [        R                  " U R                  U5      n[        [        U R                   R                  XU5      5      n	U	R                  5        V
s/ s H  n
[        U
[        5      (       d  M  U
PM     nn
U(       aP  / n[!        [#        US   5      5       H1  nSnU(       a  X   nUR%                  U R'                  XaX5      5        M3     U$ [)        U	R                  5       5      (       a  U R'                  XaX5      nU$ SnU R*                  b5  [-        U R                  U R*                  U R                  R.                  5      nU$ s  sn
f )r@   )resource_namesingle_resource_json_definitionrP   Nr   )rO   typerP   resource_json_definitionsgetrN   load_from_definitionr0   r   r   dictr#   r   values
isinstancer'   rangelenr   handle_response_itemr   r1   r5   r2   )r<   r   r   r   rS   json_definitionresource_clsr    search_responser   vpluraliresponse_items                 r
   rB   ResourceHandler.__call__   s    ++00..HHLL ||88',; 00 9 

   &ood.>.>MO ,++V 
 )//1I1Z45H!1IH 3vay>* !%"$3$6M--l.9JK +8 % +,,.// 00kDH  H"". 0$$d&9&9((668 G Js   G0Gc                     SUR                   R                  0nUR                  5        H/  u  pg[        U[        5      (       a  UR                  S5      nXuU'   M1     U" S0 UD6nUb  XHR                   l        U$ )a'  
Handles the creation of a single response item by setting
parameters and creating the appropriate resource instance.

:type resource_cls: ServiceResource subclass
:param resource_cls: The resource class to instantiate.
:type parent: ServiceResource
:param parent: The resource instance to which this action is attached.
:type identifiers: dict
:param identifiers: Map of identifier names to value or values.
:type resource_data: dict or None
:param resource_data: Data for resource attributes.
:rtype: ServiceResource
:return: New resource instance.
clientr   r   )metarh   itemsr[   r'   popr   )	r<   r`   r   r   resource_datakwargsr   r"   resources	            r
   r^   $ResourceHandler.handle_response_item  sv    $ fkk((
 ',,.KD%&&		! 4L /  )&)$!.MMr   )rN   r1   rO   r0   rP   r:   )	rD   rE   rF   rG   rH   r=   rB   r^   rI   r   r   r
   rK   rK      s    2 26/JX!r   rK   )NN)r   botocorer   r   r   r   r#   r5   objectr7   rK   r   r   r
   <module>rr      s;      #	,^.b <Nf Nr   