
    U                     :   S r SSKJr  SSKJr  SSKJr  SSK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  \R                   r " S S\R$                  5      rS rS rS rS rS rS rS rS"S jrS rS rS rS rS r S r!S r"S r#S r$S r%S  r&S! r'g)#z(Shared flags for Cloud Domains commands.    )absolute_import)division)unicode_literalsN)registrations)apis)actions)arg_parsers)base)	arg_utilsc                   (    \ rS rSrSrSrSrSrSrSr	g)	
MutationOp#   z'Different types of mutation operations.             N)
__name__
__module____qualname____firstlineno____doc__REGISTERUPDATETRANSFERRENEWAL__static_attributes__r       /lib/googlecloudsdk/command_lib/domains/flags.pyr   r   #   s    /(&('r   r   c                     [        U [        R                  S9  [        R                  " SSS[
        R                  " SSSSS9S9R                  U 5        g	)
zcGet flags for changing DNS settings.

Args:
  parser: argparse parser to which to add these flags.
mutation_opz--unsafe-dns-updateFzJUse this flag to allow DNS changes that may make your domain stop serving.zThe {flag_name} option is deprecated. To complete an unsafe DNS operation first disable DNSSEC, then change name servers, then (optionally) enable DNSSEC.
store_truewarnremovedaction)defaulthelpr'   N)_AddDNSSettingsFlagsToParserr   r   r
   Argumentr   DeprecationActionAddToParserparsers    r   $AddConfigureDNSSettingsFlagsToParserr0   +   sU     v:3D3DE--"&&
3  	Fr   c                 
   [        U [        R                  S9  [        R                  " S[
        5      n[        R                  " SSS[        R                  " [        [        U5      R                  S9S9R                  U 5        g)	zgGet flags for changing contact settings.

Args:
  parser: argparse parser to which to add these flags.
r!   domains	--notices-Notices about special properties of contacts.NOTICEelement_typechoicesr)   metavartypeN) _AddContactSettingsFlagsToParserr   r   r   GetMessagesModuleAPI_VERSION_FOR_FLAGSr
   r+   r	   ArgListstrContactNoticeEnumMapperr8   r-   r/   messagess     r   )AddConfigureContactsSettingsFlagsToParserrD   B   si     #6z7H7HI##I/DE(--:$;%!	" #.+f"5r   c           
         [        U [        R                  S9  [        U [        R                  S9  [	        U [        R                  5        Sn[
        R                  " SUS[
        R                  S9R                  U 5        [        R                  " S[        5      n[        U5      R                  R                  5       n[
        R                  " SSS	[        R                   " ["        US
9S9R                  U 5        g)zcGet flags for transferring a domain.

Args:
  parser: argparse parser to which to add these flags.
r!   z    A file containing the authorizaton code. In most cases, you must provide an
    authorization code from the domain's current registrar to transfer the
    domain.

    Examples of file contents:

    ```
    5YcCd!X&W@q0Xozj
    ```
    z--authorization-code-from-fileAUTHORIZATION_CODE_FILE_NAMEr)   r:   categoryr2   r3   @Notices about special properties of certain domains or contacts.r5   r6   r9   N)r*   r   r   r<   AddPriceFlagsToParserr
   r+   COMMONLY_USED_FLAGSr-   r   r=   r>   rA   r8   copyr	   r?   r@   )r/   	help_textrC   notice_choicess       r   AddTransferFlagsToParserrO   T   s     v:3F3FG"6z7J7JK
 3 34
) --&,''	) *5V)<##I/DE(*84<<AAC.--MC'57	8
 9DF8Kr   c           
         [        U [        R                  S9  [        U [        R                  S9  [	        U [        R                  5        [
        R                  " S[        5      n[        U5      R                  R                  5       nUR                  SS05        [        R                  " SSS[        R                  " [         US9S	9R#                  U 5        g
)zbGet flags for registering a domain.

Args:
  parser: argparse parser to which to add these flags.
r!   r2   zhsts-preloadeda   By sending this notice you acknowledge that the domain is preloaded on the HTTP Strict Transport Security list in browsers. Serving a website on such domain will require an SSL certificate. See https://support.google.com/domains/answer/7638036 for details.r3   rI   r5   r6   r9   N)r*   r   r   r<   rJ   r   r=   r>   rA   r8   rL   updater
   r+   r	   r?   r@   r-   )r/   rC   rN   s      r   AddRegisterFlagsToParserrR   {   s     v:3F3FG"6z7J7JK
 3 34##I/DE(*84<<AAC.P  --MC'57	8
 9DF8Kr   c                    SnSnU[         R                  :X  a  SnU[         R                  :X  a  US-   nU[         R                  :X  a  SnUS-   n[        R
                  " SU[        R                  S9nU[         R                  :w  a=  UR                  [        R                  " S	S
S[        R                  " [        SS9S95        SnU[         R                  :X  a  SnSR                  XR5      nSnU[         R                  :X  a  SnSR                  Xr5      nUR                  [        R                  " SUS95        UR                  [        R                  " SUS[        R                  " SSU[         R                  :H  SS9S95        U[         R                  :X  a&  UR                  [        R                  " SSSSS95        U[         R                  :X  a'  Sn	UR                  [        R                  " SU	SS 95        UR                  U 5        U[         R                  :w  a'  [        R                  " S!S"SSS9R                  U 5        g#g#)$zGet flags for providing DNS settings.

Args:
  parser: argparse parser to which to add these flags.
  mutation_op: operation for which we're adding flags.
 zE      Set the authoritative name servers for the given domain.
      zZIf the zone is signed, DNSSEC will be enabled by default unless you pass --disable-dnssec.a  

    Warning: Do not change name servers if ds_records is non-empty.
    Clear ds_records first by calling this command with the
    --disable-dnssec flag, and wait 24 hours before changing
    name servers. Otherwise your domain may stop serving.

        z]DNSSEC will be disabled and will need to be enabled after the transfer completes, if desired.a  

    Warning: If your DNS is hosted by your old registrar, we do not
    recommend keeping your current DNS settings, as these services
    often terminate when you transfer out. Instead, you should
    switch to another DNS provider such as Cloud DNS. To avoid
    downtime during the transfer, copy your DNS records to your new
    DNS provider before initiating transfer.

    Warning: If you are changing your DNS settings and your domain
    currently has DS records, make sure to remove the DS records at
    your old registrar and wait a day before initiating transfer.
    If you are keeping your current DNS settings, then no changes
    to DS records are necessary.

        T)mutexr)   rH   z--name-serversz(List of DNS name servers for the domain.NAME_SERVERr   )
min_lengthr9   zd To avoid downtime following transfer, make sure the zone is configured correctly before proceeding.zThe name of the Cloud DNS managed-zone to set as the name server for the domain.
If it's in the same project, you can use short name. If not, use the full resource name, e.g.: --cloud-dns-zone=projects/example-project/managedZones/example-zone.{}
{}z> This blank-slate option cannot be configured before transfer.z6Use free name servers provided by Google Domains.{}
{}z--cloud-dns-zoner)   z--use-google-domains-dnsFrThe {flag_name} option is deprecated; See https://cloud.google.com/domains/docs/deprecations/feature-deprecations.r#   r$   )r)   r(   r'   z--keep-dns-settingszKeep the domain's current DNS configuration from its current registrar. Use this option only if you are sure that the domain's current DNS service will not cease upon transfer, as is often the case for DNS services provided for free by the registrar.a      A YAML file containing the required DNS settings.
    If specified, its content will replace the values currently used in the
    registration resource. If the file is missing some of the dns_settings
    fields, those fields will be cleared.

    Examples of file contents:

    ```
    googleDomainsDns:
      dsState: DS_RECORDS_PUBLISHED
    glueRecords:
    - hostName: ns1.example.com
      ipv4Addresses:
      - 8.8.8.8
    - hostName: ns2.example.com
      ipv4Addresses:
      - 8.8.8.8
    ```

    ```
    customDns:
      nameServers:
      - new.ns1.com
      - new.ns2.com
      dsRecords:
      - keyTag: 24
        algorithm: RSASHA1
        digestType: SHA256
        digest: 2e1cfa82b035c26cbbbdae632cea070514eb8b773f616aaeaf668e2f0be8f10d
      - keyTag: 42
        algorithm: RSASHA1
        digestType: SHA256
        digest: 2e1cfa82bf35c26cbbbdae632cea070514eb8b773f616aaeaf668e2f0be8f10d
    ```
        z--dns-settings-from-fileDNS_SETTINGS_FILE_NAME)r)   r:   z--disable-dnssecz        Use this flag to disable DNSSEC, or to skip enabling it when switching
        to a Cloud DNS Zone or Google Domains nameservers.
        N)r   r   r   r   r
   ArgumentGrouprK   AddArgumentr+   r	   r?   r@   formatr   r,   r-   )
r/   r"   dnssec_help_textgroup_help_text	dns_groupcloud_dns_transfer_help_textcloud_dns_help_textgoogle_dns_transfer_help_textgoogle_dns_help_textrM   s
             r   r*   r*      sn    
/ J'''D J%%%% ) O J'''D% ) O"   1I1IK) J''';!$$SQ7		9: "$J'''	2 !

 F/B  #%J'''H "F0C  
mm&-@AC
mm
$#**(^ #j&9&99!		" J'''!
 		!
" J%%%#IH &,	./
 J'''MM  )[0 (r   c                    SnU[         R                  :X  a  UR                  SS5      nOUR                  SS5      n[        R                  " SUS[        R
                  S9R                  U 5        S n[        R                  " S	[        5      n[        R                  " S
[        U5      R                  USS[        R
                  [        R                  " SS SSSS9S9R                  U 5        g)zGet flags for providing Contact settings.

Args:
  parser: argparse parser to which to add these flags.
  mutation_op: operation for which we're adding flags.
a      A YAML file containing the contact data for the domain's three contacts:
    registrant, admin, and technical.

    The file can either specify a single set of contact data with label
    'allContacts', or three separate sets of contact data with labels
    'adminContact' and 'technicalContact'.
    {}
    Each contact data must contain values for all required fields: email,
    phoneNumber and postalAddress in google.type.PostalAddress format.

    For more guidance on how to specify postalAddress, please see:
    https://support.google.com/business/answer/6397478

    Examples of file contents:

    ```
    allContacts:
      email: 'example@example.com'
      phoneNumber: '+1.8005550123'
      postalAddress:
        regionCode: 'US'
        postalCode: '94043'
        administrativeArea: 'CA'
        locality: 'Mountain View'
        addressLines: ['1600 Amphitheatre Pkwy']
        recipients: ['Jane Doe']
    ```
    {}
    ```
    registrantContact:
      email: 'registrant@example.com'
      phoneNumber: '+1.8005550123'
      postalAddress:
        regionCode: 'US'
        postalCode: '94043'
        administrativeArea: 'CA'
        locality: 'Mountain View'
        addressLines: ['1600 Amphitheatre Pkwy']
        recipients: ['Registrant Jane Doe']
    adminContact:
      email: 'admin@example.com'
      phoneNumber: '+1.8005550123'
      postalAddress:
        regionCode: 'US'
        postalCode: '94043'
        administrativeArea: 'CA'
        locality: 'Mountain View'
        addressLines: ['1600 Amphitheatre Pkwy']
        recipients: ['Admin Jane Doe']
    technicalContact:
      email: 'technical@example.com'
      phoneNumber: '+1.8005550123'
      postalAddress:
        regionCode: 'US'
        postalCode: '94043'
        administrativeArea: 'CA'
        locality: 'Mountain View'
        addressLines: ['1600 Amphitheatre Pkwy']
        recipients: ['Technic Jane Doe']
    ```
    z
    If 'registrantContact', 'adminContact' or 'technicalContact' labels are used
    then only the specified contacts are updated.
    aT  
    ```
    adminContact:
      email: 'admin@example.com'
      phoneNumber: '+1.8005550123'
      postalAddress:
        regionCode: 'US'
        postalCode: '94043'
        administrativeArea: 'CA'
        locality: 'Mountain View'
        addressLines: ['1600 Amphitheatre Pkwy']
        recipients: ['Admin Jane Doe']
    ```
        rT   z--contact-data-from-fileCONTACT_DATA_FILE_NAMErG   c                 B    U R                  SS5      R                  5       $ )zCopy of base._ChoiceValueType._-)replacelower)values    r   _ChoiceValueType:_AddContactSettingsFlagsToParser.<locals>._ChoiceValueType  s    ==c"((**r   r2   --contact-privacyNThe contact privacy mode to use. Supported privacy modes depend on the domain.Fz&--contact-privacy=private-contact-datac                     U S:H  $ )Nprivate-contact-datar   )choices    r   <lambda>2_AddContactSettingsFlagsToParser.<locals>.<lambda>  s
    f0F&Fr   rY   )show_messageshow_add_helpr%   r&   )r8   r;   r)   requiredrH   r'   N)r   r   r]   r
   r+   rK   r-   r   r=   r>   ContactPrivacyEnumMapperr8   r   r,   )r/   r"   rM   rm   rC   s        r   r<   r<   >  s    =)| J%%%  	
	I&   R(I-- &''	) *5V)<+ ##I/DE(--&x088 ''&&
2FZ 	( Kr   c                     SnU[         R                  :X  a  SnO-U[         R                  :X  a  SnOU[         R                  :X  a  Sn[        R
                  " SSR                  U5      S9R                  U 5        g )NrT   z)using the get-register-parameters commandz)using the get-transfer-parameters commandzCby calling the renew-domain command without the --yearly-price flagz--yearly-pricezAccept the domain's yearly price in the interactive flow or by using this flag. Use a number followed by a currency code, for example, "12.00 USD". Get the price {}.rX   )r   r   r   r   r
   r+   r]   r-   )r/   r"   get_price_methods      r   rJ   rJ     ss    J'''Bj)))Bj(((. --66<f=M6N	
 Kr   c                     [         R                  " SSR                  X5      SS[         R                  S9R	                  U 5        g)z?Adds validate_only flag as go/gcloud-style#commonly-used-flags.z--validate-onlyz.Don't actually {} {}. Only validate arguments.Fr#   )r)   r(   r'   rH   N)r
   r+   r]   rK   r-   )r/   verbnouns      r   AddValidateOnlyFlagToParserr     s:    --<CCDO'')
 *5V)<r   c                 B    [         R                  R                  U 5        g)zHAdds async flag. It's not marked as go/gcloud-style#commonly-used-flags.N)r
   
ASYNC_FLAGr-   r.   s    r   AddAsyncFlagToParserr     s    //f%r   c                 L    [         R                  " SSS9R                  U 5        g )Nz--tagzPThe Tag of the new registrar. Can be found at https://nominet.uk/registrar-list/rX   )r
   r+   r-   r.   s    r   AddTagFlagToParserr     s"    --1 Kr   c                     [         R                  " S[        5      n[        U5      R                  R                  U 5        [        U5      R                  R                  U 5        g)zjGet flags for configure management command.

Args:
  parser: argparse parser to which to add these flags.
r2   N)r   r=   r>   TransferLockEnumMapper
choice_argr-   RenewalMethodEnumMapperrB   s     r   "AddManagementSettingsFlagsToParserr     sI     ##I/DE("--99&A(#..::6Br   c                 .    U R                   R                  $ )z+Get Contact Privacy Enum from api messages.)ContactSettingsPrivacyValueValuesEnumdomains_messagess    r   _GetContactPrivacyEnumr     s    		)	)	@	@@r   c                 L    [         R                  " S[        U 5      SSSS.SSS9$ )	Nro   )rr   a  (DEPRECATED) Your contact info won't be available to the public. To help protect your info and prevent spam, a third party provides alternate (proxy) contact info for your domain in the public directory at no extra cost. They will forward received messages to you. The private-contact-data option is deprecated; See https://cloud.google.com/domains/docs/deprecations/feature-deprecations.)redacted-contact-datazLimited personal information will be available to the public. The actual information redacted depends on the domain. For more information see https://support.google.com/domains/answer/3251242.)public-contact-datazAll the data from contact config is publicly available. To set this value, you must also pass the --notices flag with value public-contact-data-acknowledgement or agree to the notice interactively.)PRIVATE_CONTACT_DATAREDACTED_CONTACT_DATAPUBLIC_CONTACT_DATAFrp   custom_mappingsrx   help_str)r   ChoiceEnumMapperr   r   s    r   ry   ry     sA    		#	#-.#$"-@ "K(
 (r   c                 .    U S:X  a  gU S:X  a  gU S:X  a  gg)zHReturns privacy strength (stronger privacy means higher returned value).r   r   r   r   rr   r   Nr   )privacys    r   PrivacyChoiceStrengthr   !  s+    %%''&& 'r   c                 .    U R                   R                  $ )z(Get ContactNoticeEnum from api messages.)ConfigureContactSettingsRequest&ContactNoticesValueListEntryValuesEnumr   s    r   _GetContactNoticeEnumr   +  s    		9	9	`	``r   c                 H    [         R                  " S[        U 5      SS0SSS9$ )Nr3   #PUBLIC_CONTACT_DATA_ACKNOWLEDGEMENT)z#public-contact-data-acknowledgementzBy sending this notice you acknowledge that using public-contact-data contact privacy makes all the data from contact config publicly available.Fr4   r   )r   r   r   r   s    r   rA   rA   0  s8    		#	#,-
/< ?
B Br   c                 .    U R                   R                  $ )z7Get TransferLockStateValueValuesEnum from api messages.)ManagementSettings TransferLockStateValueValuesEnumr   s    r   _GetTransferLockEnumr   ?  s    		,	,	M	MMr   c                 J    [         R                  " S[        U 5      SSS.SSS9$ )Nz--transfer-lock-state)lockedzThe transfer lock is locked.)unlockedzThe transfer lock is unlocked.)LOCKEDUNLOCKEDFznTransfer Lock of a registration. It needs to be unlocked in order to transfer the domain to another registrar.r   )r   r   r   r   s    r   r   r   D  s9    		#	#+,@F H	
J 	Jr   c                 .    U R                   R                  $ )z<Get PreferredRenewalMethodValueValuesEnum from api messages.)r   %PreferredRenewalMethodValueValuesEnumr   s    r   _GetRenewalMethodEnumr   Q  s     ))OOr   c                 J    [         R                  " S[        U 5      SSS.SSS9$ )Nz--preferred-renewal-method)zautomatic-renewalz.The domain is automatically renewed each year.)zrenewal-disabledzCThe domain won't be renewed and will expire at its expiration time.)AUTOMATIC_RENEWALRENEWAL_DISABLEDFzPreferred Renewal Method of a registration. It defines how the registration should be renewed. The actual Renewal Method can be set to renewal-disabled in case of e.g. problems with the Billing Account or reporeted domain abuse.r   )r   r   r   r   s    r   r   r   X  s;    		#	#",-  N%
 r   )registration)(r   
__future__r   r   r   enumgooglecloudsdk.api_lib.domainsr   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper   r	   r
   $googlecloudsdk.command_lib.util.apisr   GA_API_VERSIONr>   Enumr   r0   rD   rO   rR   r*   r<   rJ   r   r   r   r   r   ry   r   r   rA   r   r   r   r   r   r   r   <module>r      s    / &  '  8 , + / ( : &44  .6$$LNL6e1Pzz$=&
	CA
)Xa
BN

Jr   