
    K                     B   d 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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
j6                  e
j8                  j:                        e
j<                   G d de
j>                                      Z y)z>Command to import and update an Anthos clusters on VMware API.    )absolute_import)division)unicode_literals)
operations)vmware_clusters)base)parser_arguments)	constants)flags)util)log)
console_io)gkeonprem_v1_messageszS
A cluster can be imported by running:

  $ {command} NAME --source=<path-to-file>
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)	UpdateFromFilezCUpdate an Anthos on VMware user cluster using a configuration file.EXAMPLESc                 4    t        j                  ddd|       S )N	gkeonpremv1VmwareClusterfor_help)export_utilGetSchemaPathr   s    9lib/surface/container/vmware/clusters/update_from_file.pyr   zUpdateFromFile.GetSchemaPath.   s    $$T?X     parserc                     t        j                  | d       t        j                  | t        j                  d             t        j                  j                  |        t        j                  |        y )Nzto import and updateTr   )
r   AddClusterResourceArgr   AddImportFlagsr   r   r   
ASYNC_FLAGAddToParserAddValidationOnly)r   s    r   ArgszUpdateFromFile.Args4   sV    	(>?,,d,; 	OO'	F#r   c                    |j                   j                  j                         }t        j                         }t        j                  |j                  xs dd      }t        j                  t        j                  |t        j                               }|j                  ||      }|j                  r&|j                  d      st         j"                  |_        |j&                  ry |j                  r#t)        j*                  |d|j                         |S t-        j.                         }|j1                  |      }t)        j*                  |d|j                         |S )N-F)binary)message_typestreamschema_pathformatzAnthos Cluster on VMware)CONCEPTSclusterParseapisClustersClientr   ReadFromFileOrStdinsourcer   Importmessagesr   r   r   async_IsSpecifiedr
   OPERATIONS_FORMATr+   validate_onlyr   UpdatedResourcer   OperationsClientWait)	selfargscluster_refcluster_clientdatavmware_cluster	operationoperation_clientoperation_responses	            r   RunzUpdateFromFile.Run=   s   --''--/K((*N))$++*<UKD ''++"002N --dNCI{{4++H5//dk{{	+'A4;;O#446+00;	+'A4;;Or   N)F)__name__
__module____qualname____doc__	_EXAMPLESdetailed_helpstaticmethodr   r	   ArgumentInterceptorr$   rE    r   r   r   r   '   sK     Ly)- 
 $#77 $ $ r   r   N)!rI   
__future__r   r   r   *googlecloudsdk.api_lib.container.gkeonpremr   r   r/   googlecloudsdk.callioper   r	   .googlecloudsdk.command_lib.container.gkeonpremr
   +googlecloudsdk.command_lib.container.vmwarer   !googlecloudsdk.command_lib.exportr   r   googlecloudsdk.corer   googlecloudsdk.core.consoler   2googlecloudsdk.generated_clients.apis.gkeonprem.v1r   r4   rJ   ReleaseTracksReleaseTrackALPHAHiddenCommandr   rN   r   r   <module>r]      s}    E &  ' A N ( 4 D = A # 2 `	 D%%++,/ T\\ /   -/ r   