
    D
                        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j0                   G d dej2                                      Zy)z.Exports a Cloud Deploy deploy policy resource.    N)deploy_policy)
exceptions)base)export_util)manifest_util)resource_args)utilz{description}z
      To return the .yaml definition of the deploy policy `test-policy`, in region `us-central1`, run:

        $ {command} test-policy --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 deploy policy.

  The exported yaml definition can be applied by `deploy apply` command.
  c                 \    t        j                  | d       t        j                  |        y )NT)
positional)r   AddDeployPolicyResourceArgcore_export_utilAddExportFlags)parsers    ,lib/surface/deploy/deploy_policies/export.pyArgszExport.Args5   s     ,,VE##F+    c                 8   |j                   j                  j                         }t        j                         j	                  |j                               }t        j                  ||t        j                  j                        }t        j                  ||       y)zEntry point of the export command.

    Args:
      args: argparser.Namespace, an object that contains the values for the
        arguments specified in the .Args() method.
    N)CONCEPTSr   ParseDeployPoliciesClientGetRelativeNamer   ProtoToManifestResourceKindDEPLOY_POLICYr   r   )selfargsdeploy_policy_type_refresourcemanifests        r   Runz
Export.Run:   s{     "]]88>>@11377++-H ,,""00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.clouddeployr   googlecloudsdk.api_lib.utilr   r-   googlecloudsdk.callioper   !googlecloudsdk.command_lib.deployr/   r   r   r   !googlecloudsdk.command_lib.exportr	   r   dedentr*   ReleaseTracksReleaseTrackALPHABETAGADefaultUniverseOnlyExportCommandr   r1   r   r   <module>r@      s    5  < F ( M 9 ; ; F # !
 	 T..33T5F5F5I5I "'T "' "'r   