
                             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dZ e	j"                  e	j$                  j&                         G d de	j(                               Zy)z!'vmware clusters create' command.    )absolute_import)division)unicode_literals)ClustersClient)arg_parsers)base)flags)util)logz
          Create a cluster in a VMware Engine private cloud. Successful creation of a cluster results in a cluster in READY state. Check the progress of a cluster using `{parent_command} list`.
        a5  
          To create a cluster called `my-cluster` in private cloud `my-private-cloud`, with 3 initial `standard-72` nodes in zone `us-west2-a`, run:

            $ {command} my-cluster --location=us-west2-a --project=my-project --private-cloud=my-private-cloud --node-type-config=type=standard-72,count=3

            Or:

            $ {command} my-cluster --private-cloud=my-private-cloud --node-type-config=type=standard-72,count=3

            In the second example, the project and location are taken from gcloud properties core/project and compute/zone.
    )DESCRIPTIONEXAMPLESc                   *    e Zd ZdZeZed        Zd Zy)Createz,Create a Google Cloud VMware Engine cluster.c           
         t        j                  | d       t        j                  j	                  |        t        j                  j                  | d       | j                  j                  d       | j                  ddt        j                  t        t        t        dd      dd	
       t        j                  |        y)z Register flags for this command.T)
positionalyamlz--node-type-config)typecountzcustom-core-count)r   r   )specrequired_keysappenda          Information about the type and number of nodes associated with the cluster.

        type (required): canonical identifier of the node type.

        count (required): number of nodes of this type in the cluster.

        custom-core-count (optional): customized number of cores available to each node of the type.
        To get a list of valid values for your node type,
        run the gcloud vmware node-types describe command and reference the
        availableCustomCoreCounts field in the output.
        )requiredr   actionhelpN)r	   AddClusterArgToParserr   
ASYNC_FLAGAddToParser
SetDefaultdisplay_info	AddFormatadd_argumentr   ArgDictstrint#AddAutoscalingSettingsFlagsToParser)parsers    4lib/surface/vmware/private_clouds/clusters/create.pyArgszCreate.Args6   s     
48OO'OOvt,
!!&)
  %(
 ,-   . 
--f5    c                 *   |j                   j                  j                         }t               }|j                  }t        j                  |j                        }d }|j                  rt        j                  |j                        }|j                  s$|j                  s|j                  s|j                  r@t        j                  |j                  |j                  |j                  |j                        }|j                  |||      }|r#t!        j"                  |j$                  dd       y |j'                  |j)                  |      dj+                  |j-                                     }t!        j"                  |j-                         d       |S )NclusterT)kindis_asyncz&waiting for cluster [{}] to be created)operation_refmessage)r,   )CONCEPTSr+   Parser   async_r
   ParseNodesConfigsParametersnode_type_configautoscaling_settings_from_file&ParseAutoscalingSettingsFromFileFormat"autoscaling_min_cluster_node_count"autoscaling_max_cluster_node_countautoscaling_cool_down_periodautoscaling_policy)ParseAutoscalingSettingsFromInlinedFormatr   r   CreatedResourcenameWaitForOperationGetOperationRefformatRelativeName)	selfargsr+   clientr-   nodes_configsautoscaling_settings	operationresources	            r'   Runz
Create.RunV   sS   mm##))+GF{{H44T5J5JKM**!HH

-
- 	//22,,""!KK

1
1

1
1

+
+

!
!	 g}6JKI	)..y4H&&,,Y78??  "$ ' %H ,,.Y?Or)   N)	__name__
__module____qualname____doc__DETAILED_HELPdetailed_helpstaticmethodr(   rI    r)   r'   r   r   0   s!    4-6 6>"r)   r   N)rM   
__future__r   r   r   &googlecloudsdk.api_lib.vmware.clustersr   googlecloudsdk.callioper   r   !googlecloudsdk.command_lib.vmwarer	   *googlecloudsdk.command_lib.vmware.clustersr
   googlecloudsdk.corer   rN   ReleaseTracksReleaseTrackGACreateCommandr   rQ   r)   r'   <module>r\      ss    ( &  ' A / ( 3 ; #	
	( D%%(()GT G *Gr)   