
    	                        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 ddlmZ dZ e
j(                  e
j*                  j,                        e
j.                   G d de
j0                                      Zy)z7Command to export an Anthos clusters on bare metal API.    )absolute_import)division)unicode_literalsN)bare_metal_clusters)base)parser_arguments)cluster_flags)util)filesz
A cluster can be exported to a file by running:

  $ {command} NAME --destination=<path-to-file>

A cluster can also be exported to stdout by running:

  $ {command} NAME
c                   Z    e Zd ZdZdeiZedd       Zedej                  fd       Z
d Zy)	Exportz,Export an Anthos on bare metal user cluster.EXAMPLESc                 4    t        j                  ddd|       S )N	gkeonpremv1BareMetalClusterfor_help)export_utilGetSchemaPathr   s    3lib/surface/container/bare_metal/clusters/export.pyr   zExport.GetSchemaPath0   s    $$T-     parserc                     t        j                  | d       t        j                  | t        j                  d             y )Nz	to export)verbTr   )schema_path)r	   AddClusterResourceArgr   AddExportFlagsr   r   )r   s    r   ArgszExport.Args6   s3    ''[AF00$0?r   c                    |j                   j                  j                         }t        j                         }|j                  |      }|j                  rOt        j                  |j                        5 }t        j                  ||| j                                d d d        y t        j                  |t        j                  | j                                y # 1 sw Y   y xY w)N)messagestreamr   )CONCEPTSclusterParseapisClustersClientDescribedestinationr   
FileWriterr   r   r   sysstdout)selfargscluster_refclientuser_clusterr"   s         r   Runz
Export.Run=   s    --''--/K  "F??;/LD,,- **,	
 .- ((* .-s   5'CC#N)F)__name__
__module____qualname____doc__	_EXAMPLESdetailed_helpstaticmethodr   r   ArgumentInterceptorr   r2    r   r   r   r   )   sJ     5y)- 
 #77  r   r   )r6   
__future__r   r   r   r+   *googlecloudsdk.api_lib.container.gkeonpremr   r&   googlecloudsdk.callioper   r   /googlecloudsdk.command_lib.container.bare_metalr	   !googlecloudsdk.command_lib.exportr
   r   googlecloudsdk.core.utilr   r7   ReleaseTracksReleaseTrackALPHAHiddenCommandr   r;   r   r   <module>rG      ss    > &  ' 
 R ( 4 I A *	 D%%++,#T\\ #  -#r   