
    g                        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d	lmZ d
ddZej                    ej"                  ej$                  j&                         G d dej(                                      Zy)z9'vmware  private-clouds identity-sources update' command.    )absolute_import)division)unicode_literals)IdentitySourcesClient)base)flags)log)filesz
        Update an identity source. Only base-users-dn, base-groups-dn, domain-user, domain-password and ssl-certificates can be updated.
      aH  
        To update an identity source called `my-identity-source` in private cloud `my-private-cloud` and zone `us-west2-a`
        by changing base-users-dn to `dc=example,dc=com`, domain-user to `user@example.com`, and domain-password to `secretPassword123` run:

          $ {command} my-identity-source --project=my-project --location=us-west2-a --private-cloud=my-private-cloud
            --base-users-dn dc=example,dc=com --domain-user user@example.com --domain-password secretPassword123

          Or:

          $ {command} my-identity-source --private-cloud=my-private-cloud --base-users-dn dc=example,dc=com
            --domain-user user@example.com --domain-password secretPassword123

         In the second example, the project and location are taken from gcloud properties `core/project` and `compute/zone` respectively.
  )DESCRIPTIONEXAMPLESc                   *    e Zd ZdZeZed        Zd Zy)Updatez4Update a Google Cloud VMware Engine identity source.c                    t        j                  |        t        j                  j	                  |        t        j                  j                  | d       | j                  j                  d       | j                  dd       | j                  dd       | j                  dd	       | j                  d
d       | j                  ddg d       y)z Register flags for this command.Tyamlz--base-users-dnz&The base distinguished name for users.)helpz--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--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/update.pyArgszUpdate.Args7   s     
&&v.OO'OOvt,
!!&)
5   6   D   K   %5      c                 l   |j                   j                  j                         }t               }|j                  D cg c]  }t        j                  |       }}|j                  ||j                  |j                  |j                  |j                  |      }|j                  }|r#t        j                  |j                  dd       y |j!                  |j#                  |      dj%                  |j'                                     }t        j                  |j'                         d       |S c c}w )N)base_users_dnbase_groups_dndomain_userdomain_passwordssl_certificateszidentity sourceT)kindis_asyncz.waiting for identity source [{}] to be updated)operation_refmessage)r&   )CONCEPTSidentity_sourceParser   ssl_certificate_from_filer
   ReadFileContentsr   r!   r"   r#   r$   async_r	   UpdatedResourcenameWaitForOperationGetOperationRefformatRelativeName)	selfargssourceclientpathcertificates	operationr'   resources	            r   Runz
Update.Run^   s   ]]**002F"$F 261O1O1Ot$1O   ((**$$,,%  I {{H	)../@4P&&,,Y7@GG!
 ' H ++-4EFO3s   D1N)	__name__
__module____qualname____doc___DETAILED_HELPdetailed_helpstaticmethodr   r>    r   r   r   r   0   s$     = -$ $Lr   r   N)rB   
__future__r   r   r   -googlecloudsdk.api_lib.vmware.identitysourcesr   googlecloudsdk.callioper   !googlecloudsdk.command_lib.vmwarer   googlecloudsdk.corer	   googlecloudsdk.core.utilr
   rC   HiddenReleaseTracksReleaseTrackGAUpdateCommandr   rF   r   r   <module>rR      s}    @ &  ' O ( 3 # *
	* D%%(()IT I * Ir   