
                             d Z ddlmZ ddlmZ ddlmZ ddl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  G d dej"                        Zy)z3gcloud dns record-sets transaction execute command.    )absolute_import)division)unicode_literalsN)import_util)transaction_util)util)base)flags)log)
propertiesc                   &    e Zd ZdZed        Zd Zy)Executea  Execute the transaction on Cloud DNS.

  This command executes the transaction on Cloud DNS. This will result in
  record-sets being changed as specified in the transaction.

  ## EXAMPLES

  To execute the transaction, run:

    $ {command} --zone=MANAGED_ZONE
  c                     t        j                         j                  |        | j                  j	                  t         j
                         | j                  j                  d        y )N)r
   
GetZoneArgAddToParserdisplay_info	AddFormatCHANGES_FORMATAddCacheUpdater)parsers    2lib/surface/dns/record_sets/transaction/execute.pyArgszExecute.Args-   sG    	""6*
!!%"6"67
''-    c                 J   d}| j                         t        j                   j                  k(  rd}n-| j                         t        j                   j                  k(  rd}t	        j
                  |j                        5 }t	        j                  ||      }d d d        t        j                  |      rXt        j                  j                  dj                  |j                               t        j                  |j                         y t!        j"                  |      }t!        j$                  |      j'                  |j(                  dt*        j,                  j.                  j0                  j2                  id      }|j4                  j7                  |j8                  j;                  ||j=                         |j0                  	            }t!        j$                  |      j7                  d
|j0                  |j=                         |j>                        }dj                  |j                  |j=                               }	t        j                  j                  |	       t        j@                  |       t        j                  |j                         |S # 1 sw Y   xY w)Nv1v1beta2v1alpha2)api_versionz&Nothing to do, empty transaction [{0}]projectzdns.managedZones)params
collection)changemanagedZoner   zdns.changes)r!   r   r#   changeIdz2Executed transaction [{0}] for managed-zone [{1}].)!ReleaseTrackr	   BETAALPHAr   TransactionFiletransaction_fileChangeFromYamlFiler   IsOnlySOAIncrementr   statusPrintformatosremover   GetApiClientGetRegistryParsezoner   VALUEScorer   	GetOrFailchangesCreateMESSAGES_MODULEDnsChangesCreateRequestNameidCreatedResource)
selfargsr   
trans_filer"   dnszone_refresult
change_refmsgs
             r   RunzExecute.Run3   s   K d//444k				 1 1 7 7	7k		)	)$*?*?	@J22
+/f 
A %%f+F	jj
2
9
9##%& 	ii%%&


K
(C,22		z((--55??
 & 3 'H [[ 3 3 K K8==?H<L<L !L !N OF!!+.55 (*:*:MMOfii 6 9J ?
E
Ex}}0CJJS
#IId##$M= 
A	@s   =JJ"N)__name__
__module____qualname____doc__staticmethodr   rG    r   r   r   r       s     
 . .
'r   r   )rK   
__future__r   r   r   r/   googlecloudsdk.api_lib.dnsr   r   r   googlecloudsdk.callioper	   googlecloudsdk.command_lib.dnsr
   googlecloudsdk.corer   r   ListCommandr   rM   r   r   <module>rT      s=     : &  ' 	 2 7 + ( 0 # *:d :r   