
                            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S.r\R                   \R"                  " \R$                  R&                  5       " S S\R(                  5      5       5       rg)z8'vmware private-clouds identity-sources create' command.    )absolute_import)division)unicode_literals)IdentitySourcesClient)base)flags)log)fileszO
        Create a new identity source resource in a given private cloud.
      a  
        To create an identity source called `my-is` in a private cloud `my-pc` located in project `my-project` and zone `us-west1-a`:

          $ {command} my-is --private-cloud my-pc --project my-project --location us-west1-a --domain example.com
            --base-users-dn dc=example,dc=com --base-groups-dn dc=example,dc=com --domain-user user@example.com
            --domain-password secretPassword123 --protocol LDAP --primary-server ldap://example.com

          Or:

          $ {command} my-is --private-cloud my-pc --domain example.com --base-users-dn dc=example,dc=com
            --base-groups-dn dc=example,dc=com --domain-user user@example.com --domain-password secretPassword123
            --protocol LDAP --primary-server ldap://example.com

          In the second example, the project and location are taken from gcloud properties `core/project` and `compute/zone` respectively.
  )DESCRIPTIONEXAMPLESc                   2    \ rS rSrSr\r\S 5       rS r	Sr
g)Create1   z4Create a Google Cloud VMware Engine identity source.c                 >   [         R                  " U 5        [        R                  R	                  U 5        [        R                  R                  U S5        U R                  R                  S5        U R                  SSSS9  U R                  SSSS9  U R                  S	SS
S9  U R                  SSSS9  U R                  SSSS9  U R                  SSSS9  U R                  SSSS/SS9  U R                  SSSS9  U R                  SSS9  U R                  SS/ SS9  g) z Register flags for this command.Tyamlz--domainz'The domain name of the identity source.)requiredhelpz--domain-aliasFz(The domain alias of the identity source.z--base-users-dnz&The base distinguished name for users.z--base-groups-dnz'The base distinguished name for groups.z--domain-userzuID of a user in the domain who has a minimum of read-only access to the base distinguished names of users and groups.z--domain-passwordz}Password of the user in the domain who has a minimum of read-only access to the base distinguished names of users and groups.z
--protocolLDAPLDAPSz$The LDAP server connection protocol.)r   choicesr   z--primary-serverz
        Primary domain controller LDAP server for the domain.
        Format `ldap://hostname:port` or `ldaps://hostname:port`
        z--secondary-serverz
        Secondary domain controller LDAP server for the domain.
        Format `ldap://hostname:port` or `ldaps://hostname:port`
        )r   z--ssl-certificate-from-fileappendzgPath to the root CA certificate files in CER format for the LDAPS server. Can be passed multiple times.)actiondefaultr   N)	r   AddIdentitySourceArgToParserr   
ASYNC_FLAGAddToParser
SetDefaultdisplay_info	AddFormatadd_argument)parsers    <lib/surface/vmware/private_clouds/identity_sources/create.pyArgsCreate.Args8   s    
&&v.OO'OOvt,
!!&)
6  
 7  
 5  
 6  
 D	   K	   !3	         %5      c                    UR                   R                  R                  5       n[        5       nUR                  nUR
                   Vs/ s H  n[        R                  " U5      PM     nnUR                  UUR                  UR                  UR                  UR                  UR                  UR                  UR                  UR                   UR"                  US9nU(       a!  [$        R&                  " UR(                  SSS9  g UR+                  UR-                  U5      SR/                  UR1                  5       5      S9n[$        R&                  " UR1                  5       SS9  U$ s  snf )N)
domaindomain_aliasbase_users_dnbase_groups_dndomain_userdomain_passwordprotocolprimary_serversecondary_serverssl_certificateszidentity sourceT)kindis_asyncz.waiting for identity source [{}] to be created)operation_refmessage)r1   )CONCEPTSidentity_sourceParser   async_ssl_certificate_from_filer
   ReadFileContentsr   r'   r(   r)   r*   r+   r,   r-   r.   r/   r	   CreatedResourcenameWaitForOperationGetOperationRefformatRelativeName)	selfargssourceclientr2   pathcertificates	operationresources	            r"   Run
Create.Run   sE   ]]**002F"$F{{H 261O1O1Ot$1O   {{&&((**$$,,**..%  I 	)../@4P&&,,Y7@GG!
 ' H ++-4EFO9s   	 E' N)__name__
__module____qualname____firstlineno____doc___DETAILED_HELPdetailed_helpstaticmethodr#   rI   __static_attributes__rK   r%   r"   r   r   1   s&     = -G GR!r%   r   N)rP   
__future__r   r   r   -googlecloudsdk.api_lib.vmware.identitysourcesr   googlecloudsdk.callioper   !googlecloudsdk.command_lib.vmwarer   googlecloudsdk.corer	   googlecloudsdk.core.utilr
   rQ   HiddenReleaseTracksReleaseTrackGACreateCommandr   rK   r%   r"   <module>r`      sz    ? &  ' O ( 3 # *
	, D%%(()pT p * pr%   