
    
                     
   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 e
j$                   e
j&                  e
j(                  j*                         G d de
j,                                      Zy)z Export session template 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 a session template.

  Exporting a session template is similar to describing one, except that export
  omits output only fields, such as the template 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 session template
  `example-session-template` to a file so that it can be imported later:

    $ {command} example-session-template --destination=saved-template.yaml
  c                     t        j                         }t        j                  |d|j                         t        j                  |       y )Nexport)dpDataprocr   AddSessionTemplateResourceArgapi_versionexport_utilAddExportFlags)clsparserr   s      0lib/surface/dataproc/session_templates/export.pyArgszExport.Args0   s3    {{}H	''(:N:NOv&    c                 V   t        j                         }|j                  }|j                  j                  j                         }|j                  |j                               }|j                  j                  j                  |      }d |_        d |_        d |_        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   messagesCONCEPTSsession_templateParse3DataprocProjectsLocationsSessionTemplatesGetRequestRelativeNameclient#projects_locations_sessionTemplatesGetr   
createTimecreator
updateTimeuuiddestinationr
   
FileWriterr   r   sysstdout)selfargsr   r   template_refrequesttemplater   s           r   Runz
Export.Run6   s    {{}H  H==11779LJJ&&( K *GBBFFwOH HMHHHHMD,,-8F; .- #**=	 .-s   DD(N)__name__
__module____qualname____doc__classmethodr   r4    r   r   r   r      s      ' '
>r   r   )r8   
__future__r   r   r   r-   googlecloudsdk.api_lib.dataprocr   r   googlecloudsdk.callioper   #googlecloudsdk.command_lib.dataprocr   !googlecloudsdk.command_lib.exportr	   r   googlecloudsdk.core.utilr
   DefaultUniverseOnlyReleaseTracksReleaseTrackBETACommandr   r:   r   r   <module>rF      sk    ' &  ' 
 : ( 5 A * D%%**+->T\\ -> , ->r   