
                             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
l	mZ ddlmZ ej                    G d dej"                               Zy)z:`gcloud domains registrations configure contacts` command.    )absolute_import)division)unicode_literals)registrations)base)contacts_util)flags)resource_args)util)logc                   ,    e Zd ZdZed        Zd Zd Zy)ConfigureContactsa  Configure contact settings of a Cloud Domains registration.

  Configure registration's contact settings: email, phone number, postal
  address and also contact privacy.

  In some cases such changes have to be confirmed through an email sent to
  the registrant before they take effect. In order to resend the email, execute
  this command again.

  NOTE: Please consider carefully any changes to contact privacy settings when
  changing from "redacted-contact-data" to "public-contact-data."
  There may be a delay in reflecting updates you make to registrant
  contact information such that any changes you make to contact privacy
  (including from "redacted-contact-data" to "public-contact-data")
  will be applied without delay but changes to registrant contact
  information may take a limited time to be publicized. This means that
  changes to contact privacy from "redacted-contact-data" to
  "public-contact-data" may make the previous registrant contact
  data public until the modified registrant contact details are published.

  ## EXAMPLES

  To start an interactive flow to configure contact settings for
  ``example.com'', run:

    $ {command} example.com

  To enable contact privacy for ``example.com'', run:

    $ {command} example.com --contact-privacy=private-contact-data

  To change contact data for ``example.com'' according to information from a
  YAML file ``contacts.yaml'', run:

    $ {command} example.com --contact-data-from-file=contacts.yaml
  c                     t        j                  | d       t        j                  |        t        j                  | d       t        j
                  |        y )Nz!to configure contact settings forz!configure contact settings of the)r
   AddRegistrationResourceArgr	   )AddConfigureContactsSettingsFlagsToParserAddValidateOnlyFlagToParserAddAsyncFlagToParser)parsers    7lib/surface/domains/registrations/configure/contacts.pyArgszConfigureContacts.ArgsE   sF    ,,35	33F;	%%f&IK	v&    c                 N    |j                  |      }t        |j                        S )N)GetboolpendingContactSettings)selfclientregistration_refregistrations       r   CheckPendingContactsz&ConfigureContacts.CheckPendingContactsN   s"    ::./L3344r   c                 P   t        j                  |      }t        j                  |      }t        j                  |j
                        |_        |j                  j
                  j                         }|j                  |      }t        j                  ||       t        j                  ||j                        }t        j                  ||j                        }t        j                  ||j                         }| t        j"                  ||j$                        }|qt'        t)        t+        j,                  |j.                        j0                  |j2                              }	t        j4                  ||	|j$                  j6                        }||y |xs |j$                  j6                  }
|j.                  j8                  j:                  }|s|
|j<                  k(  rt        j>                  ||j$                  |      }|j$                  j6                  |j<                  k7  r!t        j@                  |jB                  |      }n t        jD                  |jB                  |      }|jG                  |||||jH                        }|jH                  r!tJ        jL                  jO                  d       |S t        jP                  |||jR                        }d }|jR                  s| jU                  ||      rd}tK        jV                  |jY                         d|jR                  |       |S )N)prev_contactsnew_contacts)validate_onlyzKThe command will not have any effect because validate-only flag is present.zNote:
The contact settings are currently pending.
In order to finalize the update you need to confirm the change.
An email with instructions has been sent to the registrant.r   )details)-r   GetApiVersionFromArgsRegistrationsClientr   NormalizeResourceNamer   CONCEPTSParser   AssertRegistrationOperationalr   ParseContactDatacontact_data_from_fileParseContactPrivacycontact_privacyParsePublicContactsAcknoticesPromptForContactscontactSettingslistmapr	   ContactPrivacyEnumMappermessagesGetChoiceForEnumsupportedPrivacyPromptForContactPrivacyprivacyContactSettingsPrivacyValueValuesEnumPUBLIC_CONTACT_DATAMergeContacts PromptForPublicContactsUpdateAck
domainNamePromptForPublicContactsAckr   r$   r   statusPrintWaitForOperationasync_r    UpdatedResourceName)r   argsapi_versionr   r   r   contactsr/   public_contacts_ackchoicesnew_privacyr;   merged_contactsresponsenotes                  r   RunzConfigureContacts.RunR   s   55d;K..{;F2243D3DED}}11779::./L&&{LA--k.2.I.IKH#778<8L8LNO'>>T\\# 001=1M1MOh 
,,V__=NN++-.g &==
w < < D DFo O3!I\%A%A%I%IKoo--DDG;'2M2M#M%33
$44!o 
	%	%	-	-1L1L	L+LL##_6 ,FF##_6 ''(( ( *H 	jj 8 9 O &&{HdkkJhd[[T66v7GIK 




!>4;;N Or   N)__name__
__module____qualname____doc__staticmethodr   r    rR    r   r   r   r      s'    #J ' '5Cr   r   N)rV   
__future__r   r   r   googlecloudsdk.api_lib.domainsr   googlecloudsdk.callioper   "googlecloudsdk.command_lib.domainsr   r	   r
   r   googlecloudsdk.corer   DefaultUniverseOnlyUpdateCommandr   rX   r   r   <module>r`      sS    A &  ' 8 ( < 4 < 3 # v** v vr   