
                         ^   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  \R                   " \R"                  R$                  \R"                  R&                  \R"                  R(                  5      \R*                   " S S\R,                  5      5       5       rg)z&gcloud dns record-sets create command.    )absolute_import)division)unicode_literalsN)resource_record_sets)util)apis)base)flagsc                       \ rS rSrSr\R                  " S5      \R                  " S5      S.r\S 5       r	\S 5       r
S rS	rg
)Create   z'Creates a record-set in a managed-zone.zm          This command creates a record-set contained within the specified
          managed-zone.
          a            To create a record-set with dnsName foo.bar.com., record type A,
          rrdata [1.2.3.4, 9.8.7.6] and ttl 60 in my_zone run this:

          $ {command} foo.bar.com. --rrdatas=1.2.3.4,9.8.7.6 --type=A --ttl=60
            --zone=my_zone

          To create a geo routed record-set with dnsName foo.bar.com., record
          type A, routing_policy_data "us-centra1=1.2.3.4,2.3.4.5;us-west1=3.4.5.6,9.8.7.6"
          and ttl 60 in my_zone.

          $ {command} foo.bar.com. --routing_policy_data="us-centra1=1.2.3.4,2.3.4.5;us-west1=3.4.5.6,9.8.7.6"
           --routing_policy_type=GEO --type=A --ttl=60 --zone=my_zone --location=us-east1-a

          To create a record-set with dnsName foo.bar.com., record type A,
          rrdata [1.2.3.4, 9.8.7.6] and ttl 60 in my_zone in us-east1-a run this:

          $ {command} us-east1-a.bar.com. --rrdatas=1.2.3.4,9.8.7.6 --type=A --ttl=60
            --zone=my_zone --location=us-east1-a

          To create a failover type health checked routed record-set with dnsName
          foo.bar.com., record type A, primary routing data "config1", backup
          routing data "us-centra1=1.2.3.4,2.3.4.5;us-west1=3.4.5.6,9.8.7.6", with a
          trickle traffic ratio of 10% to the backup data,
          and ttl 60 in my_zone.

          $ {command} foo.bar.com.  --type=A --ttl=60             --zone=routing-policy-test --routing_policy_type=FAILOVER             --routing-policy-primary-data='config1'             --routing-policy-backup-data-type=GEO             --routing-policy-backup-data='us-centra1=1.2.3.4,2.3.4.5;us-west1=3.4.5.6,9.8.7.6'             --backup-data-trickle-ratio=0.1 --enable-health-checking --zone=my_zone

          To create a geo fenced health checked routed record-set with dnsName
          foo.bar.com., record type A, routing-policy-data
          "us-centra1=config1,config2;us-west1=3.4.5.6,9.8.7.6",
          and ttl 60 in my_zone.

          $ {command} foo.bar.com.  --type=A --ttl=60             --zone=routing-policy-test --routing_policy_type=GEO             --routing_policy_data='us-centra1=config1,config2;us-west1=3.4.5.6,9.8.7.6'             --enable-health-checking --enable-geo-fencing --zone=my_zone
          )DESCRIPTIONEXAMPLESc                     U R                  5       [        R                   R                  [        R                   R                  4;   $ )N)ReleaseTrackr	   BETAALPHA)clss    %lib/surface/dns/record_sets/create.py_BetaOrAlphaCreate._BetaOrAlphaY   s:    $"3"3"8"8"&"3"3"9"9"; ; ;    c                    [         R                  " 5       R                  U5        [         R                  " 5       R                  U5        [         R                  " S5      R                  U5        [         R
                  " S5      R                  U5        [         R                  " U R                  5       S9R                  U5        [         R                  " 5       R                  U5        UR                  R                  S 5        UR                  R                  [         R                  5        UR                  R                  [         R                  5        g )NTF)use_deprecated_names)r
   
GetZoneArgAddToParserGetResourceRecordSetsNameArgGetResourceRecordSetsTypeArgGetResourceRecordSetsTtlArg$GetResourceRecordSetsRrdatasArgGroupr   GetLocationArgdisplay_infoAddCacheUpdaterAddTransformsRESOURCERECORDSETS_TRANSFORMS	AddFormatRESOURCERECORDSETS_FORMAT)r   parsers     r   ArgsCreate.Args^   s    	""6*	&&(44V<	&&t,88@	%%e,88@	.. --/k&	&&v.
''-
%%e&I&IJ
!!%"A"ABr   c           	         [         R                  " U R                  5       U5      n[        R                  " SU5      n[         R
                  " U5      n[         R                  " U5      R                  UR                  [         R                  " X!5      SS9nUR                  UR                  UR                  [        R                  " UUR                  U5      S9nUS:X  a  UR                  Ul        UR                   R#                  U5      nU$ )Ndnszdns.managedZones)params
collection)projectmanagedZoneresourceRecordSetv2)r   GetApiFromTrackAndArgsr   r   GetMessagesModuleGetApiClientGetRegistryParsezoneGetParamsForRegistry"DnsResourceRecordSetsCreateRequestr/   r0   rrsets_utilCreateRecordSetFromArgslocationresourceRecordSetsr   )selfargsapi_versionmessages
dns_clientzone_refrequestresults           r   Run
Create.Runm   s    --d.?.?.A4HK%%e[9H"";/J,22		((;% 3 H
 99  ((%==
 : G dg**11':FMr    N)__name__
__module____qualname____firstlineno____doc__textwrapdedentdetailed_helpclassmethodr   r)   rG   __static_attributes__rI   r   r   r   r      sd    
 0 //  
 // * *2-h ; ; C Cr   r   )rN   
__future__r   r   r   rO   googlecloudsdk.api_lib.dnsr   r;   r   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper	   googlecloudsdk.command_lib.dnsr
   ReleaseTracksr   r   r   GAUniverseCompatibleCreateCommandr   rI   r   r   <module>r]      s    - &  '  J + , ( 0 T..33T5F5F5I5I fT f fr   