
    LC                     L   S 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SUS jrS rSVS jrS rSWS jrSWS jrS rSVS jrS rS rSVS jrSXS jrS rS rS rSVS jrS r S r!S r"S r#S  r$S! r%S" r&S# r'S$ r(S% r)S& r*S' r+S( r,S) r-S* r.S+ r/S, r0S- r1S. r2S/ r3S0 r4SYS1 jr5S2 r6S3 r7S4 r8S5 r9S6 r:S7 r;SXS8 jr<S9 r=S: r>S; r?S< r@S= rASYS> jrBS? rCSYS@ jrDSA rESB rFSC rGSD rHSE rISYSF jrJSG rKSH rLSI rMSJ rNSK rOSL rPSM rQSN rRSO rSSP rTSQ rUSR rVSS rWgT)ZzEHelpers for flags in commands working with Anthos Multi-Cloud on AWS.    )absolute_import)division)unicode_literals)util)arg_parsers)	arg_utilsc                 &    U R                  SSSS9  g )Nz--aws-regionTz!AWS region to deploy the cluster.requiredhelpadd_argumentparsers    5lib/googlecloudsdk/command_lib/container/aws/flags.pyAddAwsRegionr      s    t*M      c                     [        U SS 5      $ )N
aws_regiongetattrargss    r   GetAwsRegionr       s    	|T	**r   c                 &    U R                  SSSS9  g )Nz--vpc-idTz VPC associated with the cluster.r
   r   r   s    r   AddVpcIdr   $   s    4&H  r   c                     [        U SS 5      $ )Nvpc_idr   r   s    r   GetVpcIdr   *   s    	x	&&r   c                 D    U R                  SUSR                  U5      S9  g)z%Adds the --iam-instance-profile flag.z--iam-instance-profilez?Name or ARN of the IAM instance profile associated with the {}.r
   Nr   format)r   kindr   s      r   AddIamInstanceProfiler$   .   s'    
K6$<  r   c                     [        U SS 5      $ )Niam_instance_profiler   r   s    r   GetIamInstanceProfiler'   :   s    	-t	44r   c                 B    U R                  SSR                  U5      S9  g)zAdds the --instance-type flag.z--instance-typez)AWS EC2 instance type for the {}'s nodes.r   Nr!   r   r#   s     r   AddInstanceTyper+   >   s&    6==dC  r   c                     [        U SS 5      $ )Ninstance_typer   r   s    r   GetInstanceTyper.   F   s    		--r   c                 l    U R                  S[        R                  " 5       SSR                  U5      S9  g)z$Adds the --spot-instance-types flag.z--spot-instance-typesINSTANCE_TYPEaR  List of AWS EC2 instance types for creating a spot {}'s nodes. The specified instance types must have the same CPU architecture, the same number of CPUs and memory. You can use the Amazon EC2 Instance Selector tool (https://github.com/aws/amazon-ec2-instance-selector) to choose instance types with matching CPU and memory configurations.typemetavarr   Nr   r   ArgListr"   r*   s     r   AddSpotInstanceTypesr6   J   s7     
 $VD\  r   c                 P    U R                  SSS9n[        X!5        [        X!5        g)z2Adds instance configurtion for creating node pool.z Node pool instance configurationTmutexN)	add_groupr+   r6   r   r#   groups      r   AddOnDemandOrSpotInstanceTyper=   [   s(    


=T

J%%u#r   c                     [        U SS 5      $ )Nspot_instance_typesr   r   s    r   GetSpotInstanceTypesr@   b       	,d	33r   c                 B    U R                  SSR                  U5      S9  g)z!Adds the --ssh-ec2-key-pair flag.z--ssh-ec2-key-pairz?Name of the EC2 key pair authorized to login to the {}'s nodes.r)   Nr!   r*   s     r   AddSshEC2KeyPairrC   f   s$    
K6$<	  r   c                     [        U SS 5      $ )Nssh_ec2_key_pairr   r   s    r   GetSshEC2KeyPairrF   q       	)4	00r   c                 F    U R                  SSSSR                  U5      S9  g)z'Adds the --clear-ssh-ec2-key-pair flag.z--clear-ssh-ec2-key-pair
store_trueNz=Clear the EC2 key pair authorized to login to the {}'s nodes.actiondefaultr   r!   r*   s     r   AddClearSshEc2KeyPairrM   u   s*     
I6$<  r   c                 P    U R                  SSS9n[        X!5        [        X!5        g)z6Adds SSH config EC2 key pair related flags for update.z
SSH configTr8   N)r:   rC   rM   r;   s      r   AddSshEC2KeyPairForUpdaterO      s'    


<t

4%5$r   c                 &    U R                  SUSS9  g )Nz
--role-arnzQAmazon Resource Name (ARN) of the IAM role to assume when managing AWS resources.r
   r   r   r   s     r   
AddRoleArnrR      s     $	  r   c                     [        U SS 5      $ )Nrole_arnr   r   s    r   
GetRoleArnrU      s    	z4	((r   c                 $    U R                  SSS9  g )Nz--role-session-namez(Identifier for the assumed role session.r)   r   r   s    r   AddRoleSessionNamerW      s    "L  r   c                     [        U SS 5      $ )Nrole_session_namer   r   s    r   GetRoleSessionNamerZ      s    	*D	11r   c                 l    U R                  S[        R                  " 5       SSR                  U5      S9  g)z#Adds the --security-group-ids flag.z--security-group-idsSECURITY_GROUP_IDz;IDs of additional security groups to add to the {}'s nodes.r1   Nr4   r*   s     r   AddSecurityGroupIdsr]      s8     !
G
N
N  	r   c                 .    [        U SS 5      =(       d    / $ )Nsecurity_group_idsr   r   s    r   GetSecurityGroupIdsr`      s    	+T	2	8b8r   c                 F    U R                  SSSSR                  U5      S9  g)zAdds flag for clearing the security groups.

Args:
  parser: The argparse.parser to add the arguments to.
  noun: The resource type to which the flag is applicable.
z--clear-security-group-idsrI   NzvClear any additional security groups associated with the {}'s nodes. This does not remove the default security groups.rJ   r!   r   nouns     r   AddClearSecurityGroupIdsrd      s/     	"J6$<  	r   c                 P    U R                  SSS9n[        X!5        [        X!5        g)zAdds security group related flags for update.

Args:
  parser: The argparse.parser to add the arguments to.
  noun: The resource type to which the flags are applicable.
zSecurity groupsTr8   N)r:   r]   rd   )r   rc   r<   s      r   AddSecurityGroupFlagsForUpdaterf      s*     

,D

9%e"5'r   c                 *    U R                  SSSSSS9  g)z5Adds --disable-per-node-pool-sg-rules flag to parser.z --disable-per-node-pool-sg-rulesrI   Nper_node_pool_sg_rules_disabledzDisable the default per node pool subnet security group rules on the control plane security group. When disabled, at least one security group that allows node pools to send traffic to the control plane on ports TCP/443 and TCP/8132 must be provided.rK   rL   destr   r   r   s    r   AddPerNodePoolSGRulesrk      s)     	(,N  r   c                     [        U SS 5      $ )Nrh   r   r   s    r   GetPerNodePoolSGRulesDisabledrm      s    	:D	AAr   c                 `    U R                  SSS9n[        U5        UR                  SSSSSS	9  g)
zZAdds --disable-per-node-pool-sg-rules and --enable-per-node-pool-sg-rules flags to parser.z*Default per node pool security group rulesTr8   z--enable-per-node-pool-sg-rulesstore_falseNrh   zaEnable the default per node pool subnet security group rules on the control plane security group.ri   )r:   rk   r   r   r<   s     r   AddPerNodePoolSGRulesForUpdaterq      sL     

2$  % ',.  	r   c                     [         R                  " SR                  U 5      [        R                  " 5       R
                  R                  S SR                  U 5      S9$ )Nz--{}-volume-typec                     SU ;  $ NUNSPECIFIED )volume_types    r   <lambda>'_VolumeTypeEnumMapper.<locals>.<lambda>  s	    k)Ir   zType of the {} volume.include_filterhelp_str)r   ChoiceEnumMapperr"   api_utilGetMessagesModule+GoogleCloudGkemulticloudV1AwsVolumeTemplateVolumeTypeValueValuesEnum)prefixs    r   _VolumeTypeEnumMapperr      sL    		#	#'  "NNhhI'..v6	
 r   c                 L    [        S5      R                  R                  U 5        g Nrootr   
choice_argAddToParserr   s    r   AddRootVolumeTyper         **66v>r   c                 L    [        S5      R                  R                  U 5        g Nmainr   r   s    r   AddMainVolumeTyper   
  r   r   c                 p    [        U SS 5      (       a$  [        S5      R                  U R                  5      $ g )Nroot_volume_typer   )r   r   GetEnumForChoicer   r   s    r   GetRootVolumeTyper     3    T%t,, (99$:O:OPP -r   c                 p    [        U SS 5      (       a$  [        S5      R                  U R                  5      $ g )Nmain_volume_typer   )r   r   r   r   r   s    r   GetMainVolumeTyper     r   r   c                 j    U R                  SR                  U5      [        SR                  U5      S9  g )Nz--{}-volume-iopszJNumber of I/O operations per second (IOPS) to provision for the {} volume.r2   r   r   r"   intr   r   s     r   _AddVolumeIopsr     s4    '%vf~  r   c                     [        U S5        g r   r   r   s    r   AddRootVolumeIopsr   #       r   c                     [        U SS 5      $ )Nroot_volume_iopsr   r   s    r   GetRootVolumeIopsr   '  rG   r   c                     [        U S5        g r   r   r   s    r   AddMainVolumeIopsr   +  r   r   c                     [        U SS 5      $ )Nmain_volume_iopsr   r   s    r   GetMainVolumeIopsr   /  rG   r   c                 j    U R                  SR                  U5      [        SR                  U5      S9  g )Nz--{}-volume-throughputzThroughput to provision for the {} volume, in MiB/s. Only valid if the volume type is GP3. If volume type is GP3 and throughput is not provided, it defaults to 125.r   r   r   s     r   _AddVolumeThroughputr   3  s4    %%f-117  r   c                     [        U S5        g r   r   r   s    r   AddRootVolumeThroughputr   ?      vv&r   c                     [        U SS 5      $ )Nroot_volume_throughputr   r   s    r   GetRootVolumeThroughputr   C      	/	66r   c                     [        U S5        g r   r   r   s    r   AddMainVolumeThroughputr   G  r   r   c                     [        U SS 5      $ )Nmain_volume_throughputr   r   s    r   GetMainVolumeThroughputr   K  r   r   c                 b    U R                  SR                  U5      USR                  U5      S9  g )Nz--{}-kms-key-arnz@Amazon Resource Name (ARN) of the AWS KMS key to encrypt the {}.r
   r!   )r   r   targetr   s       r   _AddKmsKeyArnr   O  s2    '
L6&>  r   c                     [        U SS5        g )Nzroot-volumezroot volumer   r   s    r   AddRootVolumeKmsKeyArnr   Z      }5r   c                     [        U SS 5      $ )Nroot_volume_kms_key_arnr   r   s    r   GetRootVolumeKmsKeyArnr   ^      	0$	77r   c                     [        U SS5        g )Nzmain-volumezmain volumer   r   s    r   AddMainVolumeKmsKeyArnr   b  r   r   c                     [        U SS 5      $ )Nmain_volume_kms_key_arnr   r   s    r   GetMainVolumeKmsKeyArnr   f  r   r   c                     [        U SSSS9  g )Nzdatabase-encryptionzcluster secretsTr   r   r   s    r   AddDatabaseEncryptionKmsKeyArnr   j  s    -/@4Pr   c                     [        U SS 5      $ )Ndatabase_encryption_kms_key_arnr   r   s    r   GetDatabaseEncryptionKmsKeyArnr   n      	8$	??r   c                     [        U SSUS9  g )Nzconfig-encryptionz	user datar   r   rQ   s     r   AddConfigEncryptionKmsKeyArnr   r  s    +[8Lr   c                     [        U SS 5      $ )Nconfig_encryption_kms_key_arnr   r   s    r   GetConfigEncryptionKmsKeyArnr   v      	6	==r   c                      [         R                  " S[        R                  " 5       R                  R
                  S SS9$ )Nz--instance-placementc                     SU ;  $ rt   rv   )tenancys    r   rx   $_TenancyEnumMapper.<locals>.<lambda>~  s	    ]'%Ar   zType of the tenancy.rz   )r   r}   r~   r   .GoogleCloudGkemulticloudV1AwsInstancePlacementTenancyValueValuesEnumrv   r   r   _TenancyEnumMapperr   z  s6    		#	#  "QQhhA%	
 r   c                 H    [        5       R                  R                  U 5      $ )N)r   r   r   r   s    r   AddInstancePlacementr     s    			(	(	4	4V	<<r   c                 `    [        U SS 5      nU(       a  [        5       R                  U5      $ S $ )Ninstance_placement)r   r   r   )r   r   s     r   GetInstancePlacementr     s:    t%94@ 
 ++,>? r   c                 F    U R                  SSSSR                  U5      S9  g)zAdds flag for clearing the proxy configuration.

Args:
  parser: The argparse.parser to add the arguments to.
  noun: The resource type to which the flag is applicable.
z--clear-proxy-configrI   Nz5Clear the proxy configuration associated with the {}.rJ   r!   rb   s     r   AddClearProxyConfigr     s.     	BII$O	  r   c                 &    U R                  SUSS9  g )Nz--proxy-secret-arnzJARN of the AWS Secrets Manager secret that contains a proxy configuration.r
   r   rQ   s     r   AddProxySecretArnr     s     	  r   c                     [        U SS 5      $ )Nproxy_secret_arnr   r   s    r   GetProxySecretArnr     rG   r   c                 &    U R                  SUSS9  g )Nz--proxy-secret-version-idzXVersion ID string of the AWS Secrets Manager secret that contains a proxy configuration.r
   r   rQ   s     r   AddProxySecretVersionIdr     s     !#	  r   c                     [        U SS 5      $ )Nproxy_secret_version_idr   r   s    r   GetProxySecretVersionIdr     r   r   c                 N    U R                  S5      n[        USS9  [        USS9  g)z^Adds proxy configuration flags.

Args:
  parser: The argparse.parser to add the arguments to.
Proxy configTr   N)add_argument_groupr   r   rp   s     r   AddProxyConfigr     s(     
#
#N
3%ED)%$/r   c                     U R                  SSS9nUR                  S5      n[        U5        [        U5        [        X!5        g)zAdds proxy configuration flags for update.

Args:
  parser: The argparse.parser to add the arguments to.
  noun: The resource type to which the flags are applicable.
r   Tr8   z'Update existing proxy config parametersN)r:   r   r   r   )r   rc   r<   update_proxy_groups       r   AddProxyConfigForUpdater     sG     

>

6%/ &',-e"r   c                 .    [        U SS 5      =(       d    / $ )N
subnet_idsr   r   s    r   GetSubnetIdsr     s    	|T	*	0b0r   c                 P    U R                  S5      n[        USS9  [        U5        g)ziAdds autoscaling metrics collection flags.

Args:
  parser: The argparse.parser to add the arguments to.
(Node pool autoscaling metrics collectionTr   N)r    AddAutoscalingMetricsGranularityAddAutoscalingMetricsrp   s     r   AddAutoScalingMetricsCollectionr     s'     
#
#$N
O%"548r   c                 &    U R                  SUSS9  g )Nz!--autoscaling-metrics-granularityzoFrequency at which EC2 Auto Scaling sends aggregated data to AWS CloudWatch. The only valid value is "1Minute".r
   r   rQ   s     r   r   r     s     )?	  r   c                     [        U SS 5      $ )Nautoscaling_metrics_granularityr   r   s    r    GetAutoscalingMetricsGranularityr     r   r   c                 P    U R                  S[        R                  " 5       SSSS9  g )Nz--autoscaling-metricsAUTOSCALING_METRICFzAutoscaling metrics to enable. For a list of valid metrics, refer to https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_EnableMetricsCollection.html. If granularity is specified but not any metrics, all metrics are enabled.)r2   r3   r   r   )r   r   r5   r   s    r   r   r     s/     ":  r   c                     [        U SS 5      $ )Nautoscaling_metricsr   r   s    r   GetAutoscalingMetricsr  	  rA   r   c                     U R                  SSS9nUR                  S5      n[        U5        [        U5        [        U5        g)ztAdds autoscaling metrics collection flags for update.

Args:
  parser: The argparse.parser to add the arguments to.
r   Tr8   zDUpdate existing cloudwatch autoscaling metrics collection parametersN)r:   r   r   AddClearAutoscalingMetrics)r   r<   update_metrics_groups      r   (AddAutoScalingMetricsCollectionForUpdater	    sN     

0  % L ##78,-U#r   c                 (    U R                  SSSSS9  g)zAdds flag for clearing the cloudwatch autoscaling metrics collection.

Args:
  parser: The argparse.parser to add the arguments to.
z--clear-autoscaling-metricsrI   NzQClear the cloudwatch autoscaling metrics collection associated with the nodepool.rJ   r   r   s    r   r  r    s%     	#*  r   c                 ,    U R                  SSSSS/S9  g)zmSets kubelet configuration CPU manager policy.

Args:
  parser: The argparse.parser to add the arguments to.
z#--kubelet-config-cpu-manager-policyFzKubelet CPU manager policy.nonestatic)r   r   choicesNr   r   s    r    AddKubeletConfigCpuManagerPolicyr  1  s(     	+
'x   r   c                     [        U SS 5      $ )N!kubelet_config_cpu_manager_policyr   r   s    r    GetKubeletConfigCpuManagerPolicyr  A  s    	:D	AAr   c                 0    U R                  S[        SSS9  g)zhSets kubelet configuration CPU CFS quota.

Args:
  parser: The argparse.parser to add the arguments to.
z--kubelet-config-cpu-cfs-quotaFz Enforce a Kubelet CPU CFS quota.r2   r   r   N)r   boolr   s    r   AddKubeletConfigCpuCfsQuotar  E  s#     	&
,  r   c                     [        U SS 5      $ )Nkubelet_config_cpu_cfs_quotar   r   s    r   GetKubeletConfigCpuCfsQuotar  U  s    	5t	<<r   c                 &    U R                  SSSS9  g)zoSets kubelet configuration CPU CFS quota period.

Args:
  parser: The argparse.parser to add the arguments to.
z%--kubelet-config-cpu-cfs-quota-periodFz=Kubelet CPU CFS quota period, within the range "1ms" to "1s".r
   Nr   r   s    r   !AddKubeletConfigCpuCfsQuotaPeriodr  Y  s      	-
I	  r   c                     [        U SS 5      $ )N#kubelet_config_cpu_cfs_quota_periodr   r   s    r   !GetKubeletConfigCpuCfsQuotaPeriodr  h  s    	<d	CCr   c                 0    U R                  S[        SSS9  g)ziSets kubelet configuration pod PIDS limit.

Args:
  parser: The argparse.parser to add the arguments to.
z--kubelet-config-pod-pids-limitFzLKubelet maximum number of PIDS in any pod, within the range 1024 to 4194304.r  N)r   r   r   s    r   AddKubeletConfigPodPidsLimitr   l  s%     	'#  r   c                     [        U SS 5      $ )Nkubelet_config_pod_pids_limitr   r   s    r   GetKubeletConfigPodPidsLimitr#  }  r   r   N)clusterT)zcontrol plane)z	node pool)T)F)X__doc__
__future__r   r   r   .googlecloudsdk.api_lib.container.gkemulticloudr   r~   googlecloudsdk.callioper   $googlecloudsdk.command_lib.util.apisr   r   r   r   r   r$   r'   r+   r.   r6   r=   r@   rC   rF   rM   rO   rR   rU   rW   rZ   r]   r`   rd   rf   rk   rm   rq   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	  r  r  r  r  r  r  r  r   r#  rv   r   r   <module>r*     s   L &  ' K / :+'	5."$41
%)29(
("B&??Q
Q
!1!1	'7'76868Q@M>= 18	0#"1	@4$$$ B =D">r   