
    ;                     R   S r SSKJr  SSKJr  SSKJr  SSKrSSKJr  SSK	J
r
  SSKJr  SS	KJr  SS
KJr  SSKJr  \
R&                  " \
R(                  R*                  \
R(                  R,                  \
R(                  R.                  5       " S S\
R0                  5      5       rS rg)zExport cluster command.    )absolute_import)division)unicode_literalsN)dataproc)base)clusters)flags)util)filesc                   F    \ rS rSrSrSS0r\S 5       r\S 5       rS r	Sr
g	)
Export   zExport a cluster.

Exports an existing cluster's configuration to a file.
This configuration can then be used to create new clusters using the import
command.
EXAMPLESz
To export a cluster to a YAML file, run:

  $ {command} my-cluster --region=us-central1 --destination=cluster.yaml

To export a cluster to standard output, run:

  $ {command} my-cluster --region=us-central1
c                     g)z3Returns the API version based on the release track.v1 )clss    'lib/surface/dataproc/clusters/export.pyGetApiVersionExport.GetApiVersion4   s         c                     [         R                  " U R                  5       5      n[        R                  " USUR
                  5        [        R                  " U5        g )Nexport)dpDataprocReleaseTrackr	   AddClusterResourceArgapi_versionexport_utilAddExportFlags)r   parserr   s      r   ArgsExport.Args9   s?    {{3++-.H	(2F2FGv&r   c                    [         R                  " U R                  5       5      nUR                  R                  R                  5       nUR                  R                  UR                  UR                  UR                  S9nUR                  R                  R                  U5      n[        R                  " XR5        [        R                   " XR5        [#        U5        UR$                  (       a>  [&        R(                  " UR$                  5       n[*        R,                  " XVS9  S S S 5        g [*        R,                  " U[.        R0                  S9  g ! , (       d  f       g = f)N)	projectIdregionclusterName)messagestream)r   r   r   CONCEPTSclusterParsemessages)DataprocProjectsRegionsClustersGetRequestr%   r&   r'   clientprojects_regions_clustersGetr   DeleteGeneratedLabelsDeleteGeneratedPropertiesRemoveNonImportableFieldsdestinationr   
FileWriterr   r   sysstdout)selfargsr   cluster_refrequestr+   r)   s          r   Run
Export.Run?   s    {{4,,./H--''--/KII''!!++ J -G
 oo77;;GDG ""75&&w9g&D,,-7: .- < .-s   E
Er   N)__name__
__module____qualname____firstlineno____doc__detailed_helpclassmethodr   r"   r=   __static_attributes__r   r   r   r   r      sE      
-   ' '
=r   r   c                    SU l         SU l        SU l        / U l        SU l        SU l        U R                  b  U R                  nUR                  b"  SUR                  l        SUR                  l	        UR                  UR                  UR                  /nUR                   H(  nUR                  UR                  R                   5        M*     U H  nUc  M  / Ul        SUl        SUl        M     gg)zHModifies cluster to exclude OUTPUT_ONLY and resource-identifying fields.N)r%   r'   statusstatusHistoryclusterUuidmetricsconfiglifecycleConfigidleStartTimeautoDeleteTimemasterConfigworkerConfigsecondaryWorkerConfigauxiliaryNodeGroupsappend	nodeGroupnodeGroupConfiginstanceNamesisPreemptiblemanagedGroupConfig)r+   rL   instance_group_configs
aux_configgroups        r   r4   r4   X   s     '''.'''/^^^^F)-1f* /3f+ 	V00&2N2N 00
##J$8$8$H$HI 1 (		 "#' 	 ('  r   )rC   
__future__r   r   r   r7   googlecloudsdk.api_lib.dataprocr   r   googlecloudsdk.callioper   #googlecloudsdk.command_lib.dataprocr   r	   !googlecloudsdk.command_lib.exportr
   r   googlecloudsdk.core.utilr   ReleaseTracksr   ALPHABETAGADescribeCommandr   r4   r   r   r   <module>rh      s     &  ' 
 : ( 8 5 A * D%%++T->->-C-C%%((*4=T!! 4=*4=p!(r   