
                         n    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
\5      rg))Base class for gkemulticloud API clients.    )absolute_import)division)unicode_literalsN)
list_pager)util)flagsc                   x    \ rS rSrSrSS jrS rS rS rS r	S	 r
S
 rS rS rSS jrS r   SS jrS rSrg)
ClientBase   r   Nc                     [         R                  " 5       U l        [         R                  " 5       U l        Xl        X l        g )N)r   GetClientInstance_clientGetMessagesModule	_messages_service_list_result_field)selfservicelist_result_fields      <lib/googlecloudsdk/api_lib/container/gkemulticloud/client.py__init__ClientBase.__init__   s-    ))+DL++-DNM/    c                     S[         R                  " U5      0n[        UR                  5       5      (       a  U R                  R
                  " S0 UD6$ S $ )Nproject )r	   GetFleetProjectanyvaluesr   GoogleCloudGkemulticloudV1Fleetr   argskwargss      r   _FleetClientBase._Fleet%   sR    5((.F
 v}} 	66@@ r   c                     S[         R                  " U5      0n[        UR                  5       5      (       a  U R                  R
                  " S0 UD6$ S $ )NmaxPodsPerNoder   )r	   GetMaxPodsPerNoder   r    r   +GoogleCloudGkemulticloudV1MaxPodsConstraintr"   s      r   _MaxPodsConstraintClientBase._MaxPodsConstraint/   sP     7 7 =>F v}} 	BBLVL r   c                     [         R                  " U5      nU(       d  g UR                  R                  nUR                  UR	                  5        VVs/ s H  u  pVU" XVS9PM     snnS9$ s  snnf NkeyvalueadditionalProperties)r	   GetNodeLabelsLabelsValueAdditionalPropertyitems)r   r#   parent_typelabels
label_typekvs          r   _LabelsClientBase._Labels7   sj      &F((;;J""39<<>
3A41J1&>
 #  
   A+
c                     [         R                  " U5      nU(       d  g UR                  R                  nUR                  UR	                  5        VVs/ s H  u  pVU" XVS9PM     snnS9$ s  snnf r.   )r	   GetTags	TagsValuer6   r7   )r   r#   r8   tagstag_typer;   r<   s          r   _TagsClientBase._TagsB   sa    ==D$$77H  CG::<P<41h16<P !  Pr?   c                     [         R                  " U5      nU(       d  gUR                  R                  nUR                  UR	                  5        VVs/ s H  u  pVU" XVS9PM     snnS9$ s  snnf )zParses the annotations from the args.

Args:
  args: Arguments to be parsed.
  parent_type: Type of the parent object.

Returns:
  Returns the parsed annotations.
Nr/   r2   )r	   GetAnnotationsAnnotationsValuer6   r7   )r   r#   r8   annotationsannotation_typer;   r<   s          r   _AnnotationsClientBase._AnnotationsK   sp     &&t,K!22EEO''8C8I8I8K
8KO+8K
 (  
r?   c                     [         R                  " U5      nU(       d  gUR                  R                  nUR                  UR	                  5        VVs/ s H  u  pVU" XVS9PM     snnS9$ s  snnf )zParses the tag bindings from the args.

Args:
  args: Arguments to be parsed.
  parent_type: Type of the parent object.

Returns:
  Returns the parsed tag bindings.
Nr/   r2   )r	   GetResourceManagerTagsrB   r6   r7   )r   r#   r8   tag_bindingstag_binding_typer;   r<   s          r   _TagBindingsClientBase._TagBindings_   sr     //5L",,??  9E9K9K9M
9M,9M
 !  
r?   c                 p    [         R                  " U5      nU(       d  g U R                  R                  US9$ )N)evaluationMode)r	   GetBinauthzEvaluationModer   -GoogleCloudGkemulticloudV1BinaryAuthorization)r   r#   evaluation_modes      r   _BinaryAuthorizationClientBase._BinaryAuthorizations   s8    55d;O>>GG& H  r   c                 p    [         R                  " U5      nU(       d  g U R                  R                  US9$ )N)vulnerabilityMode)r	    GetWorkloadVulnerabilityScanningr   /GoogleCloudGkemulticloudV1SecurityPostureConfig)r   r#   vulnerability_modes      r   _SecurityPostureClientBase._SecurityPosture{   s9    ??E>>II, J  r   c                 l   XAR                  5       0nU R                  R                  S5      " S0 UD6nU R                  SS.nU(       a  X5S'   U(       a  X%S'   [        R
                  " U R                  U40 UD6n [        U5      n[        R                  " U/U5      nUS4$ ! [         a    US4s $ f = f)	aR  Lists gkemulticloud API resources.

Args:
  parent_ref: Reference to the parent field to list resources.
  page_size: Page size for listing resources.
  limit: Limit for listing resources.
  parent_field: Name of the parent field.

Returns:
  iterator: List of resources returned from the server.
  bool: True if empty. False, otherwise.
ListpageSize)fieldbatch_size_attributelimit
batch_sizeFTr   )
RelativeNamer   GetRequestTyper   r   YieldFromListnext	itertoolschainStopIteration)	r   
parent_ref	page_sizerg   parent_fieldr$   reqr7   
first_items	            r   rc   ClientBase.List   s     3356F
--
&
&v
.
8
8C(( *F Wo&\$$T]]CB6BE;joozlE2eE\ D[s   ;&B" "B32B3c                     U R                   R                  S5      " UR                  5       S9nU R                   R                  U5      $ )z"Gets a gkemulticloud API resource.Getname)r   rj   ri   rw   )r   resource_refrs   s      r   rw   ClientBase.Get   s9    
--
&
&u
-<3L3L3N
OC==S!!r   c                     U R                   R                  S5      " UR                  5       S9nU(       a  SUl        U(       a  SUl        U(       a  SUl        U R                   R                  U5      $ )z%Deletes a gkemulticloud API resource.Deleterx   T)r   rj   ri   validateOnlyallowMissingignoreErrorsr}   )r   rz   validate_onlyallow_missingignore_errorsrs   s         r   r}   ClientBase.Delete   sa     --
&
&x
0&&(C ccc==$$r   c                     U R                   R                  S5      " UR                  5       SS9nU R                   R                  U5      n[	        X0R
                  S5      nU(       a  S$ S$ )z&Checks if the cluster has a node pool.rc      )parentrd   NTF)r   rj   ri   rc   getattrr   )r   cluster_refrs   res
node_poolss        r   HasNodePoolsClientBase.HasNodePools   s^    
--
&
&v
.'')AC --

S
!C55t<J4(5(r   )r   r   r   r   )NN)NNr   )NNN)__name__
__module____qualname____firstlineno____doc__r   r%   r+   r=   rE   rL   rR   rY   r`   rc   rw   r}   r   __static_attributes__r   r   r   r   r      sQ    10	((>" %&)r   r   )r   
__future__r   r   r   rm   apitools.base.pyr   .googlecloudsdk.api_lib.container.gkemulticloudr   2googlecloudsdk.command_lib.container.gkemulticloudr	   objectr   r   r   r   <module>r      s-    0 &  '  ' ? De) e)r   