
    j                         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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SKJr   " S S\R0                  5      rg)zCCommand to create a new workforce pool under a parent organization.    )util)waiter)arg_parsers)base)
exceptions)concepts)iam_util)identity_pool_waiter)flags)	yaml_data)concept_parsers)log)	resourcesc                   4    \ rS rSrSr\S 5       rS rS rSr	g)Create!   a  Create a new workforce pool under an organization.

Creates a workforce pool under an organization given a valid organization ID.

## EXAMPLES

The following command creates a workforce pool with ID `my-workforce-pool`
in the organization ``12345'':

  $ {command} my-workforce-pool --organization=12345

The following command creates a workforce pool with ID `my-workforce-pool`
with explicit values for all required and optional parameters:

  $ {command} my-workforce-pool --organization=12345 --location=global
  --display-name="My Workforce Pool" --description="My workforce pool
  description." --session-duration="7200s" --disabled
c           	      \   [         R                  R                  S5      n[        R                  R                  S[        R                  R                  UR                  5       SS9SSS9R                  U 5        [        R                  " U S5        U R                  SS	S
9  U R                  SSS
9  U R                  SSSS9  U R                  SSS
9  U R                  SS[        R                  " S[         0S/S9SS9  U R                  SSSS9  ["        R$                  R                  U 5        g )Nziam.workforce_poolworkforce_poolT)is_positionalzThe workforce pool to create.)requiredcreatez--display-namezMA display name for the workforce pool. Cannot exceed 32 characters in length.)helpz--descriptionzMA description for the workforce pool. Cannot exceed 256 characters in length.z
--disabled
store_truez.Whether or not the workforce pool is disabled.)actionr   z--session-durationa"  How long the Google Cloud access tokens, console sign-in sessions, and gcloud sign-in sessions from this workforce pool are valid. Must be greater than 15 minutes (900s) and less than 12 hours (43200s). If not configured, minted credentials will have a default duration of one hour (3600s).z--allowed-servicesappenddomain)specrequired_keyszServices allowed for web sign-in with the workforce pool. The flag accepts multiple values with the key as `domain` and value as the domain of the service allowed for web sign-in. If not set, by default all the services are allowed.)r   typer   z--disable-programmatic-signinz6Disable programmatic sign-in for workforce pool users.)r   ResourceYAMLDataFromPathr   ConceptParserForResourcer   ResourceSpecFromYamlGetDataAddToParserr   AddParentFlagsadd_argumentr   ArgDictstrr   
ASYNC_FLAG)parserworkforce_pool_datas     )lib/surface/iam/workforce_pools/create.pyArgsCreate.Args5   sd   #44== !!--&&'') 	' 	
 	( .  k&	*
&   &   =  
 N  	   C

5   'E  
 	OO'    c                    [         R                  " 5       u  p#UR                  (       d  [        R                  " SS5      e[
        R                  " UR                  S S5      nUR                  R                  R                  5       nUR                  UUR                  UR                  UR                  UR                  U R                  X5      S9nUR                   R#                  UR%                  [&        R(                  " U5      UR*                  US95      n[,        R.                  R1                  SR3                  UR*                  5      5        UR4                  (       a:  [,        R.                  R1                  SR3                  UR6                  5      5        U$ [8        R:                  R=                  UR6                  SS	9n[>        R@                  " UR                   URB                  5      n	[D        RF                  " U	US
R3                  UR6                  5      SS9n
[,        R.                  R1                  SR3                  UR*                  5      5        U
$ )Nz--organizationz4Should specify the organization for workforce pools.zworkforce pool)parentdisplayNamedescriptiondisabledsessionDurationaccessRestrictions)locationworkforcePoolIdworkforcePoolzCreate request issued for: [{}]z Check operation [{}] for status.z'iam.locations.workforcePools.operations)
collectionz'Waiting for operations [{}] to completei )max_wait_mszCreated workforce pool [{}].)$r   GetClientAndMessagesorganizationgcloud_exceptionsRequiredArgumentExceptionr	   GetParentNameCONCEPTSr   ParseWorkforcePooldisplay_namer6   r7   session_durationCreateAccessRestrictionslocations_workforcePoolsr   'IamLocationsWorkforcePoolsCreateRequestr   ParseLocationworkforcePoolsIdr   statusPrintformatasync_namer   REGISTRYParseRelativeNamer
   IdentityPoolOperationPoller#locations_workforcePools_operationsr   WaitFor)selfargsclientmessagesparent_nameworkforce_pool_refnew_workforce_poollro_reflro_resourcepollerresults              r/   Run
Create.Runt   s   002F77

@  ((4!1K 55;;=!//%%$$--88H 0  --4488((..??, 	9 	
G JJ)00//	
 {{	jj9@@NOn%%77!J 8 L "==''22F ^^188F	F JJ&--//	
 Mr2   c                    UR                  S5      (       d  UR                  S5      (       a`  UR                  5       nUR                  S5      (       a  UR                  Ul        UR                  S5      (       a  UR                  Ul        U$ g )Nallowed_servicesdisable_programmatic_signin)IsSpecifiedAccessRestrictionsrf   allowedServicesrg   disableProgrammaticSignin)rX   rY   r[   access_restrictionss       r/   rI   Create.CreateAccessRestrictions   s    *++t/?/?%0 0 %779			,	-	-.2.C.C+			7	8	8,, 	5 ! r2    N)
__name__
__module____qualname____firstlineno____doc__staticmethodr0   rc   rI   __static_attributes__rn   r2   r/   r   r   !   s'    & <( <(|=~r2   r   N)rs   googlecloudsdk.api_lib.iamr   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper   r   r   rA    googlecloudsdk.calliope.conceptsr   googlecloudsdk.command_lib.iamr	   r
   .googlecloudsdk.command_lib.iam.workforce_poolsr   $googlecloudsdk.command_lib.util.apisr   (googlecloudsdk.command_lib.util.conceptsr   googlecloudsdk.corer   r   CreateCommandr   rn   r2   r/   <module>r      sH    J , . / ( C 5 3 ? @ : D # )^T ^r2   