
    	                        d 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 dd	lmZ d
 ej                   d      dZ ej$                  ej&                  j(                  ej&                  j*                  ej&                  j,                        ej.                   G d dej0                                      Zy)z(Exports a Gcloud Deploy target resource.    N)
exceptions)base)export_util)manifest_util)resource_args)target_util)utilz{description}z
      To return the .yaml definition of the target 'test-target' in region 'us-central1', run:

        $ {command} test-target --region=us-central1

      )DESCRIPTIONEXAMPLESc                   h    e Zd ZdZeZed        Z ej                  e
j                        d        Zy)ExportzReturns the .yaml definition of the specified target.

  The exported YAML definition can be applied by 'deploy apply' command.
  c                 \    t        j                  | d       t        j                  |        y )NT)
positional)r   AddTargetResourceArgcore_export_utilAddExportFlags)parsers    $lib/surface/deploy/targets/export.pyArgszExport.Args5   s     &&v$?##F+    c                     |j                   j                  j                         }t        j                  |      }t        j                  ||t
        j                  j                        }t        j                  ||       y)zEntry point of the export command.

    Args:
      args: argparse.Namespace, An object that contains the values for the
        arguments specified in the .Args() method.
    N)CONCEPTStargetParser   	GetTargetr   ProtoToManifestResourceKindTARGETr   r   )selfargs
target_ref
target_objmanifests        r   Runz
Export.Run:   sb     %%++-J&&z2J,,Z-:-G-G-N-NPH x&r   N)__name__
__module____qualname____doc___DETAILED_HELPdetailed_helpstaticmethodr   gcloud_exception CatchHTTPErrorRaiseHTTPExceptiondeploy_exceptionsHTTP_ERROR_FORMATr$    r   r   r   r   +   sK     !-, , 544))''r   r   )r(   textwrapgooglecloudsdk.api_lib.utilr   r,   googlecloudsdk.callioper   !googlecloudsdk.command_lib.deployr.   r   r   r   r   !googlecloudsdk.command_lib.exportr	   r   dedentr)   ReleaseTracksReleaseTrackALPHABETAGADefaultUniverseOnlyExportCommandr   r0   r   r   <module>r>      s    /  F ( M 9 ; ; 9 F 	 
 		 D%%++T->->-C-C%%((*'T ' *'r   