
                         l   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Z e
j,                  e
j.                  j0                  e
j.                  j2                  e
j.                  j4                         G d de
j6                               Zy)z8Command to create an Anthos on bare metal admin cluster.    )absolute_import)division)unicode_literals)bare_metal_admin_clusters)
operations)base)parser_arguments)admin_cluster_flags)	constants)flags)logz}
To create a cluster named ``my-cluster'' managed in location ``us-west1'', run:

$ {command} my-cluster --location=us-west1
c                   H    e Zd ZdZdeiZedej                  fd       Z	d Z
y)Createz-Create an Anthos on bare metal admin cluster.EXAMPLESparserc                 8   | j                   j                  t        j                         t	        j
                  | dd       t        j                  j                  |        t	        j                  |        t	        j                  |        t	        j                  |        t	        j                  |        t	        j                  |        t	        j                  |        t	        j                  |        t	        j                   |        t	        j"                  |        t	        j$                  |        t	        j&                  |        t	        j(                  |        t	        j*                  |        t	        j,                  |        t/        j0                  |        y)z|Gathers command line arguments for the create command.

    Args:
      parser: The argparse parser to add the flag to.
    z	to createTN)display_info	AddFormatbare_metal_constants BARE_METAL_ADMIN_CLUSTERS_FORMATbare_metal_flagsAddAdminClusterResourceArgr   
ASYNC_FLAGAddToParserAddValidationOnlyAddDescriptionAddAnnotations
AddVersionAddNetworkConfigAddAdminLoadBalancerConfigAddStorageConfigAddControlPlaneConfigAddProxyConfigAddClusterOperationsConfigAddMaintenanceConfigAddAdminWorkloadNodeConfigAddNodeAccessConfigAddSecurityConfigr   AddBinauthzEvaluationMode)r   s    9lib/surface/container/bare_metal/admin_clusters/create.pyArgszCreate.Args.   s    !!== //TJOO'&&v.##F+##F+'%%f-//7%%f-**62##F+//7))&1//7((0&&v.	##F+    c                    |j                   j                  j                         }t        j                         }|j                  |      }|j                  r&|j                  d      st        j                  |_
        |j                  r#t        j                  |d|j                         |S t        j                         }|j                  |      }|j                   s!t        j                  |d|j                         |S )aa  Runs the create command.

    Args:
      args: The arguments received from command line.

    Returns:
      The return value depends on the command arguments. If `--async` is
      specified, it returns an operation; otherwise, it returns the created
      resource. If `--validate-only` is specified, it returns None or any
      possible error.
    formatz"Anthos on bare metal Admin Cluster)CONCEPTSadmin_clusterParseapisAdminClustersClientr   async_IsSpecifiedr   OPERATIONS_FORMATr.   r   CreatedResourcer   OperationsClientWaitvalidate_only)selfargscluster_refcluster_client	operationoperation_clientoperation_responses          r*   Runz
Create.RunJ   s     ----335K--/N%%d+I{{4++H5//dk{{	
;T[[ !224)..y9	
;T[[ r,   N)__name__
__module____qualname____doc__	_EXAMPLESdetailed_helpstaticmethodr	   ArgumentInterceptorr+   rB    r,   r*   r   r   &   s6     6y)-,#77 , ,6 r,   r   N)rF   
__future__r   r   r   *googlecloudsdk.api_lib.container.gkeonpremr   r2   r   googlecloudsdk.callioper   r	   /googlecloudsdk.command_lib.container.bare_metalr
   r   r   r   .googlecloudsdk.command_lib.container.gkeonpremr   googlecloudsdk.corer   rG   ReleaseTracksReleaseTrackALPHABETAGACreateCommandr   rK   r,   r*   <module>rX      s    ? &  ' X A ( 4 c ] D @ #	 T..33T5F5F5I5IAT AAr,   