
    H              
          S 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Jr  SSKJr  S rS	 rS
 rS r\R&                  " S\R(                  " 5       R*                  R,                  S S9rSrSR3                  SR5                  \R6                   V s/ s H  n \" U 5      PM     sn 5      5      rSr\R<                  \R>                  /r \RB                  \R<                  \R>                  /r"\R&                  " S\R(                  " 5       RF                  RH                  S S9r%S r&S r'S r(S r)SS jr*S r+S r,S r-S r.SS jr/S r0SS  jr1S! r2SS" jr3S# r4S$ r5S% r6SS& jr7S' r8S( r9S) r:SS* jr;S+ r<SS, jr=S- r>S. r?S/ r@S0 rAS1 rBS2 rCS3 rDS4 rES5 rFSS6 jrGS7 rHS8 rIS9 rJS: rKS; rLS< rMS= rNS> rOS? rPS@ rQSA rRSB rSSC rTSD rUSE rVSF rWSG rXSH rYSI rZSJ r[SK r\SL r]SM r^SN r_SO r`SP raSQ rbSR rcSS rdST reSU rfSV rgSW rhSSX jriSY rjSZ rkS[ rlS\ rmS] rnSS^ jroSS_ jrpS` rqSa rrSb rsSc rtSd ruSe rvSf rwSg rxSh rySi rzSj r{Sk r|SSl jr}Sm r~Sn rSo r SSp jrSq rSr rSs rSt rSu rSv rSw rSx rSy rSz rS{ rSS| jrS} rS~ rS rS rS rgs  sn f )z;Helpers for flags in commands working with GKE Multi-cloud.    N)util)arg_parsers)	constants)	arg_utils)
propertiesc                 T    U R                  S5      nSR                  S U 5       5      $ )z'Converts hyphen-case name to CamelCase.- c              3   @   #    U  H  oR                  5       v   M     g 7f)N)title).0xs     ?lib/googlecloudsdk/command_lib/container/gkemulticloud/flags.py	<genexpr>_ToCamelCase.<locals>.<genexpr>   s     *EqEs   )splitjoinnamepartss     r   _ToCamelCaser      s$    
**S/%	*E*	**    c                 b    U R                  S5      nSR                  U5      R                  5       $ )z(Converts hyphen-case name to SNAKE_CASE.r	   _)r   r   upperr   s     r   _ToSnakeCaseUpperr   "   &    
**S/%	%			  r   c                 b    U R                  S5      nSR                  U5      R                  5       $ )z#Converts SNAKE_CASE to hyphen-case.r   r	   )r   r   lowerr   s     r   _ToHyphenCaser    (   r   r   c                 N    [         R                  " SR                  XU5      5      $ )Nz&Invalid value [{}] for argument {}. {})r   ArgumentTypeErrorformat)valueflagdetails      r   _InvalidValueErrorr'   .   s%    		&	&.55e6J
 r   --node-taintsc                     SU ;  $ NUNSPECIFIED )effects    r   <lambda>r.   7   s	    -v"=r   )include_filterz)Node taint is of format key=value:effect.zEffect must be one of: {}.z, zIReplica placement is of format subnetid:zone, for example subnetid12345:1--binauthz-evaluation-modec                     SU ;  $ r*   r,   )modes    r   r.   r.   O   s	    T 9r   c                 &    U R                  SSSS9  g)z(Adds the --pod-address-cidr-blocks flag.z--pod-address-cidr-blocksTzQIP address range for the pods in this cluster in CIDR notation (e.g. 10.0.0.0/8).requiredhelpNadd_argumentparsers    r   AddPodAddressCidrBlocksr;   S   s     !(	  r   c                 4    [        U SS5      nU(       a  U/$ / $ )z1Gets the value of --pod-address-cidr-blocks flag.pod_address_cidr_blocksNgetattrargscidr_blockss     r   GetPodAddressCidrBlocksrC   _   s     7>+%+-2-r   c                 &    U R                  SSSS9  g)z+Add the --service-address-cidr-blocks flag.z--service-address-cidr-blocksTzIIP address range for the services IPs in CIDR notation (e.g. 10.0.0.0/8).r4   Nr7   r9   s    r   AddServiceAddressCidrBlocksrE   e   s     %	  r   c                 4    [        U SS5      nU(       a  U/$ / $ )z5Gets the value of --service-address-cidr-blocks flag.service_address_cidr_blocksNr>   r@   s     r   GetServiceAddressCidrBlocksrH   q   s     ;TB+%+-2-r   c                 D    U R                  SUSR                  U5      S9  g)zAdd the --subnet-id flag.z--subnet-idz,Subnet ID of an existing VNET to use for {}.r4   Nr8   r#   )r:   	help_textr5   s      r   AddSubnetIDrL   w   s)    9@@K  r   c                     [        U SS 5      $ )N	subnet_idr>   rA   s    r   GetSubnetIDrP          	{D	))r   c                 B    U R                  SSR                  U5      S9  g)zAdd an output file argument.

Args:
  parser: The argparse.parser to add the output file argument to.
  help_action: str, describes the action of what will be stored.
z--output-filezPath to the output file {}.r6   NrJ   r:   help_actions     r   AddOutputFilerV      s(     	9@@M  r   c                 D    U R                  SSSR                  U5      S9  g)zAdd the --validate-only argument.

Args:
  parser: The argparse.parser to add the argument to.
  help_action: str, describes the action that will be validated.
z--validate-only
store_truez/Validate the {}, but don't actually perform it.actionr6   NrJ   rT   s     r   AddValidateOnlyr[      s.     	<CC
  r   c                     [        U SS 5      $ )Nvalidate_onlyr>   rO   s    r   GetValidateOnlyr^          		--r   c                 D    SnU(       a  US-  nU R                  SSS US9  g )NzzEnable node autorepair feature for a node pool. Use --no-enable-autorepair to disable.

  $ {command} --enable-autorepair
z)
Node autorepair is disabled by default.
z--enable-autorepairrX   rZ   defaultr6   r7   r:   
for_createrK   s      r   AddEnableAutoRepairre      s;    )
   I 	L$Y  r   c                     [        U SS 5      $ )Nenable_autorepairr>   rO   s    r   GetAutoRepairrh          	*D	11r   c                 &    U R                  SUSS9  g )Nz--cluster-versionz*Kubernetes version to use for the cluster.r4   r7   r:   r5   s     r   AddClusterVersionrl      s    7  r   c                     [        U SS 5      $ )Ncluster_versionr>   rO   s    r   GetClusterVersionro          	($	//r   c                 &    U R                  SUSS9  g )Nz--descriptionzDescription for the cluster.r4   r7   rk   s     r   AddDescriptionrr      s    /M  r   c                     [        U SS 5      $ )Ndescriptionr>   rO   s    r   GetDescriptionru          	}d	++r   c                 (    U R                  SSSSS9  g)zaAdds the --clear-description flag.

Args:
  parser: The argparse.parser to add the arguments to.
z--clear-descriptionrX   Nz&Clear the description for the cluster.ra   r7   r9   s    r   AddClearDescriptionrx      s#     	3	  r   c                 P    U R                  SSS9n[        U5        [        U5        g)ziAdds description related flags for update.

Args:
  parser: The argparse.parser to add the arguments to.
DescriptionTmutexN)	add_grouprr   rx   r:   groups     r   AddDescriptionForUpdater      s)     

=

5%er   c                 j    U R                  S[        R                  " SS9SSR                  U5      S9  g )Nz--annotations   
min_length
ANNOTATIONzAnnotations for the {}.typemetavarr6   )r8   r   ArgDictr#   r:   nouns     r   AddAnnotationsr      s7    !,$++D1	  r   c                 F    U R                  SSSSR                  U5      S9  g)zAdds flag for clearing the annotations.

Args:
  parser: The argparse.parser to add the arguments to.
  noun: The resource type to which the flag is applicable.
z--clear-annotationsrX   Nz!Clear the annotations for the {}.ra   rJ   r   s     r   AddClearAnnotationsr      s.     	.55d;	  r   c                 .    [        U SS 5      =(       d    0 $ )Nannotationsr>   rO   s    r   GetAnnotationsr          	}d	+	1r1r   c                 P    U R                  SSS9n[        X!5        [        X!5        g)zAdds annotations related flags for update.

Args:
  parser: The argparse.parser to add the arguments to.
  noun: The resource type to which the flag is applicable.
AnnotationsTr{   N)r}   r   r   r:   r   r   s      r   AddAnnotationsForUpdater     s)     

=

5%e"r   c                 &    U R                  SUSS9  g )Nz--node-versionz,Kubernetes version to use for the node pool.r4   r7   rk   s     r   AddNodeVersionr     s    9  r   c                     [        U SS 5      $ )Nnode_versionr>   rO   s    r   GetNodeVersionr         	~t	,,r   c                 |    U R                  SUS9nUR                  SU[        SS9  UR                  SU[        SS9  g)	zAdds node pool autoscaling flags.

Args:
  parser: The argparse.parser to add the arguments to.
  required: bool, whether autoscaling flags are required.
zNode pool autoscaling)r5   z--min-nodesz)Minimum number of nodes in the node pool.)r5   r   r6   z--max-nodesz)Maximum number of nodes in the node pool.N)add_argument_groupr8   int)r:   r5   r   s      r   AddAutoscalingr     sZ     
#
#$;h
#
O%6	   6	  r   c                 @    SnSnU R                   nU R                  nX4$ )Nr   )	min_nodes	max_nodes)rA   r   r   s      r   GetAutoscalingParamsr   1  s'    ))nn)nn)
	r   c                     [        U SS 5      $ )Nr   r>   rO   s    r   GetMinNodesr   :  rQ   r   c                     [        U SS 5      $ )Nr   r>   rO   s    r   GetMaxNodesr   >  rQ   r   c                 0    U R                  S[        SSS9  g )Nz--max-pods-per-nodez Maximum number of pods per node.T)r   r6   r5   r8   r   r9   s    r   AddMaxPodsPerNoder   B  s!    -	  r   c                     [        U SS 5      $ )Nmax_pods_per_noder>   rO   s    r   GetMaxPodsPerNoder   K  ri   r   c                 $    U R                  SSS9  g )Nz--azure-availability-zonez<Azure availability zone where the node pool will be created.rS   r7   r9   s    r   AddAzureAvailabilityZoner   O  s    !I  r   c                     [        U SS 5      $ )Nazure_availability_zoner>   rO   s    r   GetAzureAvailabilityZoner   V      	0$	77r   c                 $    U R                  SSS9  g )Nz	--vm-sizez1Azure Virtual Machine Size (e.g. Standard_DS1_v).rS   r7   r9   s    r   	AddVMSizer   Z  s    K  r   c                     [        U SS 5      $ )Nvm_sizer>   rO   s    r   	GetVMSizer   `      	y$	''r   c                 &    U R                  SUSS9  g )Nz--ssh-public-keyz)SSH public key to use for authentication.r4   r7   rk   s     r   AddSSHPublicKeyr   d  s    6  r   c                     [        U SS 5      $ )Nssh_public_keyr>   rO   s    r   GetSSHPublicKeyr   l  s    	'	..r   c                 P    U R                  S[        R                  " / SQSS9SS9  g )Nz--root-volume-sizeGBGiBTBTiBGisuggested_binary_size_scalesdefault_unitzSize of the root volume. The value must be a whole number followed by a size unit of `GB` for gigabyte, or `TB` for terabyte. If no size unit is specified, GB is assumed.r   r6   r8   r   
BinarySizer9   s    r   AddRootVolumeSizer   p  1    !!'A
4  r   c                 H    [        U SS 5      nU(       d  g [        U5      S-	  $ )Nroot_volume_size   r?   r   rA   sizes     r   GetRootVolumeSizer     '    	)4	0$	 
Tbr   c                 P    U R                  S[        R                  " / SQSS9SS9  g )Nz--main-volume-sizer   r   r   zSize of the main volume. The value must be a whole number followed by a size unit of `GB` for gigabyte, or `TB` for terabyte. If no size unit is specified, GB is assumed.r   r   r9   s    r   AddMainVolumeSizer     r   r   c                 H    [        U SS 5      nU(       d  g [        U5      S-	  $ )Nmain_volume_sizer   r   r   s     r   GetMainVolumeSizer     r   r   c                     SR                  XR                  SS5      R                  5       5      nU R                  S[        R
                  " SS9SUS9  g )	Nzz  Applies the given tags (comma separated) on the {0}. Example:

    $ {{command}} EXAMPLE_{1} --tags=tag1=one,tag2=two
   r   --tagsr   r   TAGr   )r#   replacer   r8   r   r   )r:   r   rK   s      r   AddTagsr     sX     fT<<S)//12	  	!,	  r   c                 F    U R                  SSSSR                  U5      S9  g)zAdds flag for clearing the tags.

Args:
  parser: The argparse.parser to add the arguments to.
  noun: The resource type to which the flag is applicable.
z--clear-tagsrX   Nz/Clear any tags associated with the {}'s nodes. ra   rJ   r   s     r   AddClearTagsr     s.     	<CCDI	  r   c                 P    U R                  SSS9n[        X!5        [        X!5        g)zAdds tags related flags for update.

Args:
  parser: The argparse.parser to add the arguments to.
  noun: The resource type to which the flags are applicable.
TagsTr{   N)r}   r   r   r   s      r   AddTagsForUpdater     s)     

6

.%	%ur   c                 .    [        U SS 5      =(       d    0 $ )Ntagsr>   rO   s    r   GetTagsr     s    	vt	$	**r   c                 $    U R                  SSS9  g)z^Adds database encryption flags.

Args:
  parser: The argparse.parser to add the arguments to.
z--database-encryption-key-idzbURL the of the Azure Key Vault key (with its version) to use to encrypt / decrypt cluster secrets.rS   Nr7   r9   s    r   AddDatabaseEncryptionr     s     	$9  r   c                     [        U SS 5      $ )Ndatabase_encryption_key_idr>   rO   s    r   GetDatabaseEncryptionKeyIdr     s    	3T	::r   c                 D    U R                  SSS9  U R                  SSS9  g)z\Adds config encryption flags.

Args:
  parser: The argparse.parser to add the arguments to.
z--config-encryption-key-idz^URL the of the Azure Key Vault key (with its version) to use to encrypt / decrypt config data.rS   z--config-encryption-public-keyzLRSA key of the Azure Key Vault public key to use for encrypting config data.Nr7   r9   s    r   AddConfigEncryptionr     s<     	"5   	&  r   c                     [        U SS 5      $ )Nconfig_encryption_key_idr>   rO   s    r   GetConfigEncryptionKeyIdr     s    	14	88r   c                     [        U SS 5      $ )Nconfig_encryption_public_keyr>   rO   s    r   GetConfigEncryptionPublicKeyr     s    	5t	<<r   c                 L    U R                  S[        R                  " SS9SSS9  g)zAdds the --node-labels flag.z--node-labelsr   r   
NODE_LABELz)Labels assigned to the node pool's nodes.r   Nr8   r   r   r9   s    r   AddNodeLabelsr      s,    !,6	  r   c                 .    [        U SS 5      =(       d    0 $ )Nnode_labelsr>   rO   s    r   GetNodeLabelsr   
  r   r   c                 (    U R                  SSSSS9  g)z"Adds the --clear-node-labels flag.z--clear-node-labelsrX   Nz3Clear the labels assigned to the node pool's nodes.ra   r7   r9   s    r   AddClearNodeLabelsr     s!    @	  r   c                 P    U R                  SSS9n[        U5        [        U5        g)z*Adds node labels related flags for update.zNode labelsTr{   N)r}   r   r   r~   s     r   AddNodeLabelsForUpdater    s'    


=

5%Ur   c                 |    U R                  S5      n[        U5      S:w  a  [        U S[        5      eUS   US   p2X#4$ )zValidates the node taint format.

Node taint is of format key=value:effect.

Args:
  taint: Node taint.

Returns:
  The node taint value and effect if the format is valid.

Raises:
  ArgumentError: If the node taint format is invalid.
:   r(   r   r   )r   lenr'   _TAINT_FORMAT_HELP)taintstrsr$   r-   s       r   _ValidateNodeTaintFormatr	    sD     
S	$Y!^
UO5G
HHq'47	r   c                     [        U 5      u  p[        R                   Vs/ s H  n[        U5      PM     nnX$;  a  [	        US[
        5      eU $ s  snf )a  Validates the node taint.

Node taint is of format key=value:effect. Valid values for effect include
NoExecute, NoSchedule, PreferNoSchedule.

Args:
  taint: Node taint.

Returns:
  The node taint if it is valid.

Raises:
  ArgumentError: If the node taint is invalid.
r(   )r	  _TAINT_EFFECT_ENUM_MAPPERchoicesr   r'   _TAINT_EFFECT_HELP)r  unused_valuer-   eeffectss        r   _ValidateNodeTaintr  4  sR     2%8,&?&G&GH&G\!_&G'H
V_6H
II	, Is   Ac           	          U R                  S[        R                  " S[        S9SSR	                  [
        [        5      S9  g )Nr(   r   )r   
value_type
NODE_TAINTz0Taints assigned to nodes of the node pool. {} {}r   )r8   r   r   r  r#   r  r  r9   s    r   AddNodeTaintsr  J  s@    !8JK
<
C
C "4  	r   c                 v   / n[         R                   Vs0 s H  n[        U5      U_M     nn[        U SS5      nU(       as  UR	                  5        H_  u  pV[        U5      u  pxX8   n[         R                  U5      n[        R                  " 5       R                  XWUS9n	UR                  U	5        Ma     U$ s  snf )zGets node taint objects from the arguments.

Args:
  args: Arguments parsed from the command.

Returns:
  The list of node taint objects.

Raises:
  ArgumentError: If the node taint format is invalid.
node_taintsN)keyr$   r-   )r  r  r   r?   itemsr	  GetEnumForChoiceapi_utilGetMessagesModule#GoogleCloudGkemulticloudV1NodeTaintappend)
rA   taintsr  taint_effect_mapr  kvr$   r-   r  s
             r   GetNodeTaintsr#  W  s     &";"C"C"CQl1oq"C   mT2+!!#.q1me'f(99&Af((*NNV O e mmE $ 
-s   B6c                     U R                  S5      n[        U5      S:w  a  [        U S[        5      eUS   US   p2[        R
                  " 5       R                  X2S9$ )aB  Converts a colon-delimited string to a GoogleCloudGkemulticloudV1ReplicaPlacement instance.

Replica placement is of format subnetid:zone.

Args:
  replicaplacement: Replica placement.

Returns:
  A GoogleCloudGkemulticloudV1ReplicaPlacement instance.

Raises:
  ArgumentError: If the Replica placement format is invalid.
r  r  --replica-placementsr   r   )azureAvailabilityZonesubnetId)r   r  r'   _REPLICAPLACEMENT_FORMAT_HELPr  r  *GoogleCloudGkemulticloudV1ReplicaPlacement)replicaplacementr  subnetidzones       r   _ReplicaPlacementStrToObjectr-  t  sk     
			$$Y!^
02O  7DGD  "MM $ N r   c                 z    U R                  S[        R                  " [        S9SSR	                  [
        5      S9  g )Nr%  )element_typeREPLICA_PLACEMENTz1Placement info for the control plane replicas. {}r   )r8   r   ArgListr-  r#   r(  r9   s    r   AddReplicaPlacementsr2    s;    ,HI!
=
D
D+  	r   c                 2    [        U SS 5      nU(       a  U$ / $ )Nreplica_placementsr>   )rA   r4  s     r   GetReplicaPlacementsr5    s     t%94@1	9r9r   c                 &    U R                  SSSS9  g )Nz--auth-provider-cmd-pathTzAPath to the executable for the auth provider field in kubeconfig.)hiddenr6   r7   r9   s    r   AddAuthProviderCmdPathr8    s     N  r   c                 j    U R                  S5      nUR                  SSSS9  UR                  SSSS9  g)	z]Add proxy configuration flags.

Args:
  parser: The argparse.parser to add the arguments to.
zProxy configz--proxy-resource-group-idTz?The ARM ID the of the resource group containing proxy keyvault.r4   z--proxy-secret-idz9The URL the of the proxy setting secret with its version.N)r   r8   r~   s     r   AddProxyConfigr:    sN     
#
#N
3%!L  
 F  r   c                     [        U SS 5      $ )Nproxy_resource_group_idr>   rO   s    r   GetProxyResourceGroupIdr=    r   r   c                     [        U SS 5      $ )Nproxy_secret_idr>   rO   s    r   GetProxySecretIdr@    rp   r   c                 n    U R                  S[        R                  " [        R                  S5      SSS9  g )Nz--fleet-projectz=--fleet-project must be a valid project ID or project number.TzGID or number of the Fleet host project where the cluster is registered.)r   r5   r6   )r8   r   CustomFunctionValidatorproject_utilValidateProjectIdentifierr9   s    r   AddFleetProjectrE    s<    ..

0
0
I   r   c                     [        U SS5      nU(       d  gUR                  5       (       d%  SR                  [        R                  " U5      5      $ SR                  U5      $ )aL  Gets and parses the fleet project argument.

Project ID if specified is converted to project number. The parsed fleet
project has format projects/<project-number>.

Args:
  args: Arguments parsed from the command.

Returns:
  The fleet project in format projects/<project-number>
  or None if the fleet projectnot is not specified.
fleet_projectNzprojects/{})r?   isdigitr#   rC  GetProjectNumber)rA   ps     r   GetFleetProjectrK    sP     dOT*!	
	
 = =a @AA			a	  r   c                 (    U R                  SSSSS9  g )Nz--private-endpointFrX   z+If set, use private VPC for authentication.rb   rZ   r6   r7   r9   s    r   AddPrivateEndpointrN    s!    8	  r   c                 (    U R                  SSSSS9  g )Nz--exec-credentialFrX   zBIf set, format access token as a Kubernetes execCredential object.rM  r7   r9   s    r   AddExecCredentialrP    s!    O	  r   c                 h    SnU(       a  US-  nU R                  S[        R                  " SS9SUS9  g )Nz=Users that can perform operations as a cluster administrator.z> If not specified, the value of property core/account is used.z--admin-usersr   r   USERr   r8   r   r1  )r:   createhelp_txts      r   AddAdminUsersrV    s?    L(PPH!,	  r   c                     [        U S5      (       d  g U R                  (       a  U R                  $ [        R                  R                  R
                  R                  5       /$ )Nadmin_users)hasattrrX  r   VALUEScoreaccount	GetOrFailrO   s    r   GetAdminUsersr^    sK    	}	%	%	



 
 
(
(
2
2
4	55r   c                 P    U R                  SSS9n[        U5        [        U5        g)zoAdds admin group configuration flags for update.

Args:
  parser: The argparse.parser to add the arguments to.
zAdmin groupsTr{   N)r}   AddAdminGroupsAddClearAdminGroupsr~   s     r   AddAdminGroupsForUpdaterb    s)     

>

6%er   c                 T    SnU R                  S[        R                  " 5       SSUS9  g )NzI
Groups of users that can perform operations as a cluster administrator.
z--admin-groupsGROUPF)r   r   r5   r6   rS  )r:   rU  s     r   r`  r`    s6    ( 	   r   c                 (    U R                  SSSSS9  g)z]Adds the --clear-admin-groups.

Args:
  parser: The argparse.parser to add the arguments to.
z--clear-admin-groupsrX   Nz2Clear the admin groups associated with the clusterra   r7   r9   s    r   ra  ra  *  s#     	?	  r   c                 b    [        U S5      (       d  g U R                  (       a  U R                  $ g )Nadmin_groups)rY  rg  rO   s    r   GetAdminGroupsrh  8  s*    	~	&	&		r   c                     Sn/ nU(       a  [         nUS-  nO[        nU R                  S[        R                  " SUS9SUS9  g)	zAdds the --logging flag.z
Set the components that have logging enabled.

Examples:

  $ {command} --logging=SYSTEM
  $ {command} --logging=SYSTEM,WORKLOADz
  $ {command} --logging=NONE
	--loggingr   )r   r  	COMPONENTr   N)_ALLOW_DISABLE_LOGGING_CHOICES_LOGGING_CHOICESr8   r   r1  )r:   allow_disabledrK   logging_choicess       r   
AddLoggingrp  @  sZ    +) /4O  I 'O!_E	  r   c                 ,   [        U SS5      nU(       d  g[        R                  U;   aD  [        R                  U;   d  [        R                  U;   a  [        SR                  U5      SS5      e[        R                  " 5       nUR                  5       nUR                  n[        R                  U;   a2  U(       a  UR                  US9$ [        SR                  U5      SS5      e[        R                  U;  a  [        SR                  U5      SS5      e[        R                  U;   a%  UR                  R                  UR                  5        [        R                  U;   a%  UR                  R                  UR                  5        UR                  US9$ )	aG  Parses and validates the value of the --logging flag.

Args:
  args: Arguments parsed from the command.
  allow_disabled: If disabling logging is allowed for this cluster.

Returns:
  The logging config object as GoogleCloudGkemulticloudV1LoggingConfig.

Raises:
  ArgumentError: If the value of the --logging flag is invalid.
loggingN,rj  zFInvalid logging config. NONE is not supported with SYSTEM or WORKLOAD.)componentConfigz.Invalid logging config. NONE is not supported.z6Must include SYSTEM logging if any logging is enabled.)r?   r   NONESYSTEMWORKLOADr'   r   r  r  0GoogleCloudGkemulticloudV1LoggingComponentConfig(EnableComponentsValueListEntryValuesEnum'GoogleCloudGkemulticloudV1LoggingConfigenableComponentsr  SYSTEM_COMPONENTS	WORKLOADS)rA   rn  rr  messagesconfigenums         r   
GetLoggingr  [  sn    D)T*'	^^w'!Y%7%77%B
	  '')(DDF&		8	8$^^w==  >   
((7


:  W$
@ 
  
""4#9#9:7"
""4>>2		9	9 
: 
 r   c                 (    SnU R                  SUS9  g)zAdds the --image-type flag.z
Set the OS image type to use on node pool instances.

Examples:

  $ {command} --image-type=windows
  $ {command} --image-type=ubuntu
z--image-typerS   Nr7   r:   rK   s     r   AddImageTyper    s    ) 	n95r   c                     [        U SS 5      $ )N
image_typer>   rO   s    r   GetImageTyper    s    	|T	**r   c                 &    U R                  SSSS9  g )Nz--azure-regionTz_Azure location to deploy the cluster. Refer to your Azure subscription for available locations.r4   r7   r9   s    r   AddAzureRegionr    s!    F	  r   c                     [        U SS 5      $ )Nazure_regionr>   rO   s    r   GetAzureRegionr    r   r   c                 &    U R                  SSSS9  g )Nz--resource-group-idTz=ID of the Azure Resource Group to associate the cluster with.r4   r7   r9   s    r   AddResourceGroupIdr    s    J  r   c                     [        U SS 5      $ )Nresource_group_idr>   rO   s    r   GetResourceGroupIdr    ri   r   c                 &    U R                  SSSS9  g )Nz	--vnet-idTz>ID of the Azure Virtual Network to associate with the cluster.r4   r7   r9   s    r   	AddVnetIdr    s    K  r   c                     [        U SS 5      $ )Nvnet_idr>   rO   s    r   	GetVnetIdr    r   r   c                 $    U R                  SSS9  g )Nz!--service-load-balancer-subnet-idzARM ID of the subnet where Kubernetes private service type load balancers are deployed, when the Service lacks a subnet annotation.rS   r7   r9   s    r   AddServiceLoadBalancerSubnetIdr    s    )  r   c                     [        U SS 5      $ )Nservice_load_balancer_subnet_idr>   rO   s    r   GetServiceLoadBalancerSubnetIdr    s    	8$	??r   c                 $    U R                  SSS9  g )Nz--endpoint-subnet-idzARM ID of the subnet where the control plane load balancer is deployed. When unspecified, it defaults to the control plane subnet ID.rS   r7   r9   s    r   AddEndpointSubnetIdr    s      r   c                     [        U SS 5      $ )Nendpoint_subnet_idr>   rO   s    r   GetEndpointSubnetIdr    s    	+T	22r   c                     U R                  S5      nUR                  SUSS9  UR                  SUSS9  U(       d  [        U5        gg)z8Adds --azure-tenant-id and --azure-application-id flags.zAzure services authenticationz--azure-tenant-idz1ID of the Azure Tenant to manage Azure resources.r4   z--azure-application-idz6ID of the Azure Application to manage Azure resources.N)r   r8   AddClearClient)auth_config_grouprT  r   s      r   AddAzureServicesAuthenticationr    s_    

.
./N
O%>  
 C  
 
5 
r   c                 (    U R                  SSSSS9  g)z\Adds the --clear-client flag.

Args:
  parser: The argparse.parser to add the arguments to.
z--clear-clientrX   NzClear the Azure client. This flag is required when updating to use Azure workload identity federation from Azure client to manage  Azure resources.ra   r7   r9   s    r   r  r    s%     	  	r   c                     [        U SS 5      $ )Nazure_tenant_idr>   rO   s    r   GetAzureTenantIDr    rp   r   c                     [        U SS 5      $ )Nazure_application_idr>   rO   s    r   GetAzureApplicationIDr    s    	-t	44r   c                    SnSnSnU(       aO  U R                  SSSUS9  U(       a5  U R                  SS	S
9nUR                  SSSUS9  UR                  SSSUS9  ggU R                  SS	S
9nUR                  SSSSS9  UR                  SSSSS9  U(       a5  U R                  SS	S
9nUR                  SSSSS9  UR                  SSSSS9  gg)z'Adds monitoring config flags to parser.aL  
  Enables managed collection for Managed Service for Prometheus in the cluster.

  See https://cloud.google.com/stackdriver/docs/managed-prometheus/setup-managed#enable-mgdcoll-gke
  for more info.

  Managed Prometheus is enabled by default for cluster versions 1.27 or greater,
  use --no-enable-managed-prometheus to disable.
  z
  Enables managed collection for Cloud Monitoring in the cluster.

  Cloud Monitoring is enabled by default for all clusters. Beginning with
  cluster version 1.31, use --disable-cloud-monitoring to disable.
  z
  Disables managed collection for Cloud Monitoring in the cluster.

  Cloud Monitoring is enabled by default for all clusters. Beginning with
  cluster version 1.31, use --disable-cloud-monitoring to disable.
  z--enable-managed-prometheusrX   Nra   zCloud Monitoring ConfigTr{   z--disable-cloud-monitoringz--enable-cloud-monitoringzMonitoring Configz--disable-managed-prometheusz>Disable managed collection for Managed Service for Prometheus.z=Enable managed collection for Managed Service for Prometheus.z0Disable managed collection for Cloud Monitoring.z/Enable managed collection for Cloud Monitoring.)r8   r}   )r:   rd   cloud_monitoring_optionprometheus_enable_help_text!cloud_monitoring_enable_help_text"cloud_monitoring_disable_help_textr   s          r   AddMonitoringConfigr    sV   !'#($ 
%(	   8Ee
&1	   
%0	    0=E	&M	   
%L	   8Ee
&@   
%@	   r   c                    [        U SS5      n[        U SS5      n[        R                  " 5       nUR                  5       nU(       a  SUl        OU(       a  SUl        OSn[        U SS5      n[        U SS5      n[        R                  " 5       nUR                  5       nU(       a  SUl        OU(       a  SUl        OSnUc  Uc  gUR                  UUS9$ )	a5  Parses and validates the value of the managed prometheus and cloud monitoring config flags.

Args:
  args: Arguments parsed from the command.

Returns:
  The monitoring config object as GoogleCloudGkemulticloudV1MonitoringConfig.
  None if both enable_managed_prometheus and enable_cloud_monitoring are None.
enable_managed_prometheusNdisable_managed_prometheusTFenable_cloud_monitoringdisable_cloud_monitoring)managedPrometheusConfigcloudMonitoringConfig)r?   r  r  1GoogleCloudGkemulticloudV1ManagedPrometheusConfigenabled/GoogleCloudGkemulticloudV1CloudMonitoringConfig*GoogleCloudGkemulticloudV1MonitoringConfig)rA   enabled_prometheusdisabled_prometheusr~  prometheus_configenabled_cloud_monitoringdisabled_cloud_monitoringcloud_monitoring_configs           r   GetMonitoringConfigr  d  s     t%@$G&BDI'')(@@B   $ %$T+DdK%d,FM'')(>>@  &*# &+#"#:#B		<	</3 
= 
 r   c                 D    SnU R                  SSUR                  US9S9  g )NzsAllow idempotent deletion of {resource}.
  The request will still succeed in case the {resource} does not exist.
  z--allow-missingrX   )resourcerY   rJ   )r:   r  rU  s      r   AddAllowMissingr    s2    ( 	??H?-  r   c                     [        U SS 5      $ )Nallow_missingr>   rO   s    r   GetAllowMissingr    r_   r   c           	      D    SnU R                  SSUR                  X!S9S9  g )NzForce delete an {platform} {resource}.
  Deletion of the {platform} {resource} will succeed even if errors occur
  during deleting in-{resource} resources. Using this parameter may
  result in orphaned resources in the {resource}.
  z--ignore-errorsrX   )r  platformrY   rJ   )r:   r  r  rU  s       r   AddIgnoreErrorsr    s2    (
 	??H?@  r   c                     [        U SS 5      $ )Nignore_errorsr>   rO   s    r   GetIgnoreErrorsr    r_   r   c           	          U R                  S[        R                   Vs/ s H  n[        U5      PM     snSSS9  gs  snf )z/Adds --binauthz-evaluation-mode flag to parser.r0   Nz:Set Binary Authorization evaluation mode for this cluster.)r  rb   r6   )r8   _BINAUTHZ_EVAL_MODE_ENUM_MAPPERr  r   )r:   cs     r   AddBinauthzEvaluationModer    sI    "(G(O(O(O1
A
(O G  s   <
c                 `    [        U SS 5      nUc  g [        R                  [        U5      5      $ )Nbinauthz_evaluation_mode)r?   r  r  r    )rA   evaluation_modes     r   GetBinauthzEvaluationModer    s5    D"<dC/	(	9	9O$
 r   c           	      V    U R                  SSS/SS[        R                  " S5      S9  g)z6Adds --workload-vulnerability-scanning flag to parser.z!--workload-vulnerability-scanningdisabled
enterpriseNTaS        Sets the mode of the Kubernetes security posture API's workload vulnerability scanning.
      To enable Advanced vulnerability insights mode explicitly set the flag to --workload-vulnerability-scanning=enterprise.

      To disable in an existing cluster, explicitly set the flag to --workload-vulnerability-scanning=disabled.
      )r  rb   r7  r6   )r8   textwrapdedentr9   s    r    AddWorkloadVulnerabilityScanningr    s7    )<(?? 
   r   c                     [        U SS 5      nUc  g [        R                  " 5       R                  R                  nUR
                  UR                  S.nX1   $ )Nworkload_vulnerability_scanning)r  r  )r?   r  r  /GoogleCloudGkemulticloudV1SecurityPostureConfig VulnerabilityModeValueValuesEnumVULNERABILITY_DISABLEDVULNERABILITY_ENTERPRISE)rA   vulnerability_mode	enum_typemappings       r    GetWorkloadVulnerabilityScanningr    s^    t%FM  "RRss  2266' 
	$$r   c                 4    SnU R                  S[        SUS9  g)z'Adds --max-surge-update flag to parser.aY  Maximum number of extra (surge) nodes to be created beyond the current size of
the node pool during its update process. Use --max-unavailable-update as well,
if needed, to control the overall surge settings.

To create an extra node each time the node pool is rolling updated, run:

  $ {command} --max-surge-update=1 --max-unavailable-update=0
z--max-surge-updateNr   rb   r6   r   r  s     r   AddMaxSurgeUpdater    s'    ) 	d  r   c                     [        U SS 5      $ )Nmax_surge_updater>   rO   s    r   GetMaxSurgeUpdater    s    	)4	00r   c                 H    U(       a  SnOSnU R                  S[        SUS9  g)z-Adds --max-unavailable-update flag to parser.a  Maximum number of nodes that can be simultaneously unavailable during this node
pool's update process. Use --max-surge-update as well, if needed, to control the
overall surge settings.

To update 3 nodes in parallel (1 + 2), but keep at least 4 nodes (6 - 2)
available each time the node pool is rolling updated, run:

  $ {command} --min-nodes=6 --max-surge-update=1 --max-unavailable-update=2
a  Maximum number of nodes that can be simultaneously unavailable during this node
pool's update process. Use --max-surge-update as well, if needed, to control the
overall surge settings.

To modify a node pool with 6 nodes such that, 3 nodes are updated in parallel
(1 + 2), but keep at least 4 nodes (6 - 2) available each time this
node pool is rolling updated, run:

  $ {command} --max-surge-update=1 --max-unavailable-update=2
z--max-unavailable-updateNr  r   rc   s      r   AddMaxUnavailableUpdater    s1    	I
I 	 sDy  r   c                     [        U SS 5      $ )Nmax_unavailable_updater>   rO   s    r   GetMaxUnavailableUpdater    s    	/	66r   c                 ,    SnU R                  SSSUS9  g)z"Adds --respect-pdb flag to parser.zOIndicates whether the node pool rollback should respect pod disruption budget.
z--respect-pdbFrX   rM  Nr7   r  s     r   AddRespectPodDisruptionBudgetr    s*    ) 		  r   c                     [        U SS 5      $ )Nrespect_pdbr>   rO   s    r   GetRespectPodDisruptionBudgetr  +  rv   r   c                 P    SnU R                  S[        R                  " SS9SUS9  g)zZAdds --tags flag to parser.

Args:
  parser: The argparse.parser to add the arguments to.
a$  Tag keys/values directly bound to this resource.

The short name of a tag key or value can have a maximum length of 256
characters. The permitted character set for the short name includes UTF-8
encoded Unicode characters except single quotes, double quotes,
backslashes, and forward slashes.
r   r   r   r   r   Nr   r  s     r   AddResourceManagerTagsr  /  s5    ) 	!,	  r   c                 .    [        U SS5      =(       d    0 $ )zParses and validates the value of the --tags flag.

Args:
  args: Arguments parsed from the command.

Returns:
  The tags object as a dictionary.
r   Nr>   rO   s    r   GetResourceManagerTagsr  E  s     
vt	$	**r   )T)F)cluster)FF)__doc__r  .googlecloudsdk.api_lib.container.gkemulticloudr   r  googlecloudsdk.callioper   2googlecloudsdk.command_lib.container.gkemulticloudr   #googlecloudsdk.command_lib.projectsrC  $googlecloudsdk.command_lib.util.apisr   googlecloudsdk.corer   r   r   r    r'   ChoiceEnumMapperr  r  EffectValueValuesEnumr  r  r#   r   r  r  r(  rv  rw  rm  ru  rl  -GoogleCloudGkemulticloudV1BinaryAuthorizationEvaluationModeValueValuesEnumr  r;   rC   rE   rH   rL   rP   rV   r[   r^   re   rh   rl   ro   rr   ru   rx   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r	  r  r  r#  r-  r2  r5  r8  r:  r=  r@  rE  rK  rN  rP  rV  r^  rb  r`  ra  rh  rp  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  )r  s   0r   <module>r     sS   B  K / H D : *+!! &66 DDZZ=  A 188II(A(I(IJ(I1|A(IJK 
 P  $$i&8&89  NN"  #,"<"<  NNll9# 	.	.*	 .20,2	#-. **28(/ 	+;,9=2*,
:6
:
(80!*	6	67t
6+-2(@3"$05
 7<K\,^.
.	 % 1<7,,	+Q( Ks   J