
                            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  e	j"                  e	j$                  j&                        e	j(                   G d
 de	j*                                      Z e	j"                  e	j$                  j.                         G d de             Z e	j"                  e	j$                  j2                         G d de             Zy)z(Updates a Cloud NetApp Active Directory.    )absolute_import)division)unicode_literals)client)base)flags)labels_util)logc                   \    e Zd ZdZej
                  j                  ZdddZe	d        Z
d Zy)Update'Update a Cloud NetApp Active Directory.zT          Updates AD (Active Directory) configs for Cloud NetApp Volumes.
          a$            The following command updates an AD config in the given project and location with specified arguments:

              $ {command} AD_NAME --location=us-central1 --domain=new-domain.com --dns=1.1.1.1 --site=new_site --net-bios-prefix=new_prefix --organizational-unit=ou2 --enable-aes=true --username=user2 --password="secure2" --backup-operators=backup_op1,backup_op2 --security-operators=secure_op1,secure_op2 --administrators=admin_op1,admin_op2 --enable-ldap-signing=true --encrypt-dc-connections=yes --kdc-hostname=kdc-host1
          )DESCRIPTIONEXAMPLESc                 .    t        j                  |        y )N)activedirectories_flagsAddActiveDirectoryUpdateArgs)parsers    /lib/surface/netapp/active_directories/update.pyArgszUpdate.Args/   s    88@    c                 r	   |j                   j                  j                         }t        j                  | j
                        }|j                  |      }t        j                  j                  |      }|j                         rI|j                  |j                  j                  j                  |j                        j!                         }nd}|j#                  ||j$                  |j&                  |j(                  |j*                  |j,                  |j.                  |j0                  |j2                  |j4                  |j6                  |j8                  |j:                  |j<                  |j>                  |j@                  |jB                  |jD                  |      }g }|jG                  d      r|jI                  d       |jG                  d      r|jI                  d       |jG                  d      r|jI                  d       |jG                  d      r|jI                  d       |jG                  d      r|jI                  d	       |jG                  d
      r|jI                  d       |jG                  d      r|jI                  d       |jG                  d      r|jI                  d       |jG                  d      r|jI                  d       |jG                  d      r|jI                  d       |jG                  d      r|jI                  d       |jG                  d      r|jI                  d       |jG                  d      r|jI                  d       |jG                  d      r|jI                  d       |jG                  d      r|jI                  d       |jG                  d      r|jI                  d       |jG                  d      r|jI                  d       |jG                  d      s"|jG                  d      s|jG                  d       r|jI                  d!       d"jK                  |      }	|jM                  |||	|jN                        }
|jN                  rWd#jQ                  | jS                         jT                        }tV        jX                  j[                  d$jQ                  |             |
S )%z:Update a Cloud NetApp Storage Pool in the current project.N)domainsitednsnet_bios_prefixorganizational_unitaes_encryptionusernamepasswordbackup_operatorssecurity_operatorsadministratorskdc_hostnamekdc_ipnfs_users_with_ldapldap_signingencrypt_dc_connectionsdescriptionlabelsr   r   r   r   netBiosPrefixr   organizationalUnit
enable_aesaesEncryptionr   r   r    backupOperatorsr!   securityOperatorsr"   r#   kdcHostnamer$   kdcIpr%   nfsUsersWithLdapenable_ldap_signingldapSigningr'   encryptDcConnectionsr(   update_labelsremove_labelsclear_labelsr)   ,z(gcloud {} netapp active-directories listz[Check the status of the updated active directory by listing all active directories:
  $ {} ).CONCEPTSactive_directoryParse	ad_clientActiveDirectoriesClient_RELEASE_TRACKGetActiveDirectoryr	   DiffFromUpdateArgsMayHaveUpdatesApplymessagesActiveDirectoryLabelsValuer)   	GetOrNone!ParseUpdatedActiveDirectoryConfigr   r   r   r   r   r,   r   r   r    r!   r"   r#   r$   r%   r3   r'   r(   IsSpecifiedappendjoinUpdateActiveDirectoryasync_formatReleaseTrackprefixr
   statusPrint)selfargsactivedirectory_refr   orig_activedirectorylabels_diffr)   r;   updated_fieldsupdate_maskresultcommands               r   Runz
Update.Run3   s   --88>>@..t/B/BCF!445HI""11$7K!!#  !@!@!L!L!5!<!<>>Gik  f??{{YYHH,, 44..22**&&{{ 44--#::$$' @ * N!H%F#E")*O,-.01%O,
#J'
#J'*+-.,-/0(),-'M*!G$-../-.M*0123&M*))T-=-=n-MH%((>*K))*=?O*5t{{DF{{:AA




$
$&g	jj**0&/ Mr   N)__name__
__module____qualname____doc__r   rP   GAr?   detailed_helpstaticmethodr   r]    r   r   r   r      sE     0$$''.		- A ATr   r   c                   <    e Zd ZdZej
                  j                  Zy)
UpdateBetar   N)r^   r_   r`   ra   r   rP   BETAr?   re   r   r   rg   rg      s    /$$)).r   rg   c                   <    e Zd ZdZej
                  j                  Zy)UpdateAlphar   N)r^   r_   r`   ra   r   rP   ALPHAr?   re   r   r   rj   rj      s    /$$**.r   rj   N)ra   
__future__r   r   r   0googlecloudsdk.api_lib.netapp.active_directoriesr   r=   googlecloudsdk.callioper   4googlecloudsdk.command_lib.netapp.active_directoriesr   r   $googlecloudsdk.command_lib.util.argsr	   googlecloudsdk.corer
   ReleaseTracksrP   rb   DefaultUniverseOnlyUpdateCommandr   rh   rg   rk   rj   re   r   r   <module>ru      s    / &  ' P ( a < # D%%(()hT h  *hV D%%**+* * ,* D%%++,+* + -+r   