
                         6   S r SSKJr  SSKJr  SSKJr  SSKrSSKJr  SSKJr  SSK	J
r
  SS	KJr  SSKrS
rSrSrSrSr\R&                  R(                  4S jr\R&                  R(                  4S jr\R&                  R(                  4S jr  SS jrS rS rg)z'Utilities for calling the Composer API.    )absolute_import)division)unicode_literalsN)encoding)
list_pager)apis)basecomposerv1v1beta1v1alpha2   c                     U [         R                  R                  :X  a  [        $ U [         R                  R                  :X  a  [
        $ [        $ N)r	   ReleaseTrackBETACOMPOSER_BETA_API_VERSIONALPHACOMPOSER_ALPHA_API_VERSIONCOMPOSER_GA_API_VERSIONrelease_tracks    +lib/googlecloudsdk/api_lib/composer/util.pyGetApiVersionr   %   s<    d'',,,$$))///%%	      c                 F    [         R                  " [        [        U S95      $ Nr   )r   GetClientInstanceCOMPOSER_API_NAMEr   r   s    r   r   r   -   !    			]C
E Er   c                 F    [         R                  " [        [        U S95      $ r   )r   GetMessagesModuler   r   r   s    r   r"   r"   2   r    r   c                     / nU H`  nU " 5       n	[        XUR                  5       5        [        R                  " U[        R
                  " UU	UUc  SOUUc  [        OUSS95      nMb     [        R                  " Xu5      $ )aF  Collects the results of a List API call across a list of locations.

Args:
  request_cls: class, the apitools.base.protorpclite.messages.Message class
      corresponding to the API request message used to list resources in a
      location.
  service: apitools.base.py.BaseApiService, a service whose list
      method to call with an instance of `request_cls`
  location_refs: [core.resources.Resource], a list of resource references to
      locations in which to list resources.
  field: str, the name of the field within the list method's response from
      which to extract a list of resources
  page_size: int, the maximum number of resources to retrieve in each API
      call
  limit: int, the maximum number of results to return. None if all available
      results should be returned.
  location_attribute: str, the name of the attribute in `request_cls` that
      should be populated with the name of the location

Returns:
  A generator over up to `limit` resources if `limit` is not None. If `limit`
  is None, the generator will yield all resources in all requested locations.
NpageSize)requestfieldlimit
batch_sizebatch_size_attribute)setattrRelativeName	itertoolschainr   YieldFromListDEFAULT_PAGE_SIZEislice)
request_clsservicelocation_refsr&   	page_sizer'   location_attributeresultslocation_refr%   s
             r   AggregateListResultsr8   7   s    < '#lmGG)B)B)DEoo  -$U,5,=(9!+	-.G $ 
		'	))r   c                 t    U (       d  U" 5       $ [         R                  " U[         R                  " U 5      5      $ r   )r   JsonToMessageMessageToJson)metadata_valuemetadata_types     r   ParseOperationJsonMetadatar>   e   s2    	?			 ( 6 6~ F
H Hr   c                     U" [         R                  " U 5       VVs/ s H  u  p#UR                  X#S9PM     snnS9$ s  snnf )N)keyvalue)additionalProperties)six	iteritemsAdditionalProperty)
dictionarymsg_typer@   rA   s       r   DictToMessagerH   l   sH    	j1(1*# !!c!71( 
  (s   =
)Nparent)__doc__
__future__r   r   r   r,   apitools.base.pyr   r   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper	   rC   r   r   r   r   r/   r   GAr   r   r"   r8   r>   rH    r   r   <module>rQ      s    . &  '  % ' , ( 
  % '   !% 1 1 4 4 ! %)$5$5$8$8 E
 %)$5$5$8$8 E  $,4+*\Hr   