
    k
                         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  G d de
j$                        Zy)z"Export autoscaling policy command.    )absolute_import)division)unicode_literalsN)dataproc)base)flags)util)filesc                   &    e Zd ZdZed        Zd Zy)Exporta  Export an autoscaling policy.

  Exporting an autoscaling policy is similar to describing one, except that
  export omits output only fields, such as the policy id and resource name. This
  is to allow piping the output of export directly into import, which requires
  that output only fields are omitted.

  ## EXAMPLES

  The following command saves the contents of autoscaling policy
  `example-autoscaling-policy` to a file so that it can be imported later:

    $ {command} example-autoscaling-policy --destination=saved-policy.yaml
  c                     t        j                  | j                               }t        j                  |d|j
                         t        j                  |       y )Nexport)dpDataprocReleaseTrackr   AddAutoscalingPolicyResourceArgapi_versionexport_utilAddExportFlags)clsparserr   s      3lib/surface/dataproc/autoscaling_policies/export.pyArgszExport.Args.   sC    {{3++-.H	))&(*2*>*>@v&    c                 J   t        j                  | j                               }|j                  }|j                  j
                  j                         }|j                  |j                               }|j                  j                  j                  |      }d |_        d |_        |j                  r@t        j                   |j                        5 }t#        j$                  ||       d d d        y t#        j$                  |t&        j(                         y # 1 sw Y   y xY w)N)name)messagestream)r   r   r   messagesCONCEPTSautoscaling_policyParse4DataprocProjectsRegionsAutoscalingPoliciesGetRequestRelativeNameclient$projects_regions_autoscalingPoliciesGetidr   destinationr
   
FileWriterr   r   sysstdout)selfargsr   r   
policy_refrequestpolicyr   s           r   Runz
Export.Run5   s    {{4,,./H  H11779JKK$$& L (G__AAEEgNF FIFKD,,-6&9 .- 

;	 .-s   DD"N)__name__
__module____qualname____doc__classmethodr   r2    r   r   r   r      s      ' '<r   r   )r6   
__future__r   r   r   r+   googlecloudsdk.api_lib.dataprocr   r   googlecloudsdk.callioper   #googlecloudsdk.command_lib.dataprocr   !googlecloudsdk.command_lib.exportr	   r   googlecloudsdk.core.utilr
   Commandr   r8   r   r   <module>r@      s5    ) &  ' 
 : ( 5 A *+<T\\ +<r   