
                             d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ d	 Zd
 Zd Zd ZddZdZd Zd Zy)zCommon flags for iam commands.    )absolute_import)division)unicode_literals)arg_parsers)base)cred_config)common_argsc                 P    t        j                  dddj                  |             S )NroleROLE_IDzID of the role to {0}. Curated roles example: roles/viewer. Custom roles example: CustomRole. For custom roles, you must also specify the `--organization` or `--project` flag.metavarhelpr   Argumentformatverbs    +lib/googlecloudsdk/command_lib/iam/flags.pyGetRoleFlagr      s)    	 $VD\
+ +    c                 P    t        j                  dddj                  |             S )Nr   r   z]ID of the custom role to {0}. You must also specify the `--organization` or `--project` flag.r   r   r   s    r   GetCustomRoleFlagr   '   s'    	fTl
 r   c                 N    t        j                  ddj                  |             S )Nz--organizationz)Organization of the role you want to {0}.r   r   r   s    r   
GetOrgFlagr   0   s&    	6==dC
E Er   c                 P    dj                  |       }t        j                  |      S )Nz$Project of the role you want to {0}.)help_text_to_prepend)r   r	   ProjectArgument)r   	help_texts     r   GetProjectFlagr!   6   s#    4;;DA)		$	$)	DDr   c                     | j                  |      }t        |      j                  |       t        |      j                  |       y )N)required)add_mutually_exclusive_groupr   AddToParserr!   )parserr   r#   parent_groups       r   AddParentFlagsr(   ;   s;    44h4G,T|,""<0r   a  The full resource name or URI to {verb}.

See ["Resource Names"](https://cloud.google.com/apis/design/resource_names) for
details. To get a URI from most `list` commands in `gcloud`, pass the `--uri`
flag. For example:

```
$ gcloud compute instances list --project prj --uri \
https://compute.googleapis.com/compute/v1/projects/prj/zones/us-east1-c/instances/i1 \
https://compute.googleapis.com/compute/v1/projects/prj/zones/us-east1-d/instances/i2
```

c                 X    t        j                  dt        j                  |             S )Nresourcer   r   )r   r   _RESOURCE_NAME_HELPr   r   s    r   GetResourceNameFlagr,   Q   s"    	z(;(B(B(B(M	NNr   c           	         | j                  ddd       | j                  ddd       | j                  d	      }|j                  d
dd       |j                  dt        j                  dddd      d       | j                  dt        j                         dd       | j                  dd	       | j                  dd	       | j                  d	      }|j                  dt        j                  dddd      d        |j                  d!d"	       |t
        j                  j                  k(  r,|j                  d#t        j                  dd$d%d      d&       y'y')(z_Adds parser arguments that are common to both workload identity federation and workforce pools.z--output-filez>Location to store the generated credential configuration file.T)r   r#   z--universe-domainzUniverse domain.)r   hiddenz&Service account impersonation options.r   z--service-accountz,Email of the service account to impersonate.z(--service-account-token-lifetime-secondss60043200)default_unitlower_boundupper_boundparsed_unitaH  Lifetime duration of the service account access token in seconds. Defaults to one hour if not specified. If a lifetime greater than one hour is required, the service account must be added as an allowed value in an Organization Policy that enforces the `constraints/iam.allowServiceAccountCredentialLifetimeExtension` constraint.)typer   z--credential-source-headersz	key=valuez7Headers to use when querying the credential-source-url.)r6   r   r   z--credential-source-typez/Format of the credential source (JSON or text).z--credential-source-field-namez;Subject token field name (key) in a JSON credential source.z3Arguments for an executable type credential source.z--executable-timeout-millisms5s120szHTimeout duration, in milliseconds, to wait for the executable to finish.z--executable-output-filez:Absolute path to the file storing the executable response.z'--executable-interactive-timeout-millis30s1800szxTimeout duration, in milliseconds, to wait for the executable to finish when the command is running in interactive mode.N)add_argument	add_groupr   DurationArgDictr   
ConfigTypeWORKFORCE_POOLS)r&   config_type%service_account_impersonation_optionsexecutable_argss       r   AddCommonByoidCreateConfigFlagsrE   U   s   K  
 	 24   +1*:*:3 +; +5''449 5  (550	
 6  	# D	  F
 	 <  > 	&H  J $$@ % B/#	
1  	  G  I K**:::  1!!	
P ! Q ;r   N)T)__doc__
__future__r   r   r   googlecloudsdk.callioper   r   .googlecloudsdk.command_lib.iam.byoid_utilitiesr   $googlecloudsdk.command_lib.util.argsr	   r   r   r   r!   r(   r+   r,   rE    r   r   <module>rL      sO     % &  ' / ( F <+EE
1  OEQr   