
                         F   S 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                  R$                  5       " S	 S
\R&                  5      5       5       rg)z%Command for bigtable clusters create.    N)clusters)util)base)	arguments)	arg_utils)logc                   \    \ rS rSrSrS\R                  " S5      0r\S 5       r	S r
S rSrg	)
CreateCluster   zCreate a bigtable cluster.EXAMPLESa[            To add a cluster in zone `us-east1-c` to the instance with id
          `my-instance-id`, run:

            $ {command} my-cluster-id --instance=my-instance-id --zone=us-east1-c

          To add a cluster with `10` nodes, run:

            $ {command} my-cluster-id --instance=my-instance-id --zone=us-east1-c --num-nodes=10

          c                     [         R                  " U S5        [         R                  " U 5      R                  5       R	                  5       R                  5       R                  5         [         R                  " U S5        g)z Register flags for this command.zto describeclusterN)r   AddClusterResourceArgArgAdderAddClusterZoneAddAsyncAddScalingArgsForClusterCreateAddClusterNodeScalingFactorAddKmsKeyResourceArg)parsers    'lib/surface/bigtable/clusters/create.pyArgsCreateCluster.Args2   sU     ##FM:nxxz"@"@"BC^C^C`""695    c                    U R                  U5      nUR                  R                  R                  5       n[        R
                  " X25      n[        R                  " U5      nUR                  (       aB  [        R                  " UR                  5       SR                  UR                  5       5      SS9  g[        R                  " USR                  UR                  5       5      5      $ )zThis is what gets called when the user runs this command.

Args:
  args: an argparse namespace. All the arguments that were provided to this
    command invocation.

Returns:
  Some value that we want to have printed later.
zbigtable cluster {0}T)kindis_asyncNzCreating bigtable cluster {0})_ClusterCONCEPTSr   Parser   Creater   GetOperationRefasync_r   CreatedResourceRelativeNameformatNameAwaitCluster)selfargsr   cluster_ref	operationoperation_refs         r   RunCreateCluster.Run;   s     mmD!G--''--/K5I((3M{{	

$
$
&%,,[-=-=-?@ '..{/?/?/ABD Dr   c                    [         R                  " 5       nUR                  R                  R                  n[
        R                  " UR                  UR                  R                  5      nUR                  UR                  U[         R                  " UR                  5      US9n[        R                  " U5      nU(       a  UR                  US9Ul        UR                   c'  UR"                  c  UR$                  c  UR&                  bK  [(        R*                  " UR                   UR"                  UR$                  UR&                  S9Ul        S Ul        U$ )N)
serveNodesnodeScalingFactorlocationdefaultStorageType)
kmsKeyName)autoscaling_minautoscaling_maxautoscaling_cpu_targetautoscaling_storage_target)r   GetAdminMessagesCluster!DefaultStorageTypeValueValuesEnumSTORAGE_TYPE_UNSPECIFIEDr   ChoiceToEnumnode_scaling_factor NodeScalingFactorValueValuesEnum	num_nodesLocationUrlzoner   GetAndValidateKmsKeyNameEncryptionConfigencryptionConfigautoscaling_min_nodesautoscaling_max_nodesr8   r9   r   BuildClusterConfigclusterConfigr1   )r)   r*   msgsstorage_typer?   r   kms_keys          r   r   CreateCluster._ClusterT   s'     "D66OO  $00  55 ll>>-!!$)),'	  )G 006G!%!6!6'!6!Jg""."".##/''3&994444!%!<!<%)%D%D	Fg  gNr    N)__name__
__module____qualname____firstlineno____doc__textwrapdedentdetailed_helpstaticmethodr   r.   r   __static_attributes__rO   r   r   r
   r
      sC    
 # 
// 
 
- 6 6D2 r   r
   )rT   rU   googlecloudsdk.api_lib.bigtabler   r   googlecloudsdk.callioper   #googlecloudsdk.command_lib.bigtabler   $googlecloudsdk.command_lib.util.apisr   googlecloudsdk.corer   UniverseCompatibleReleaseTracksReleaseTrackGABETAALPHACreateCommandr
   rO   r   r   <module>rf      s    ,  4 0 ( 9 : # $++00$2C2C2I2ITD&& T Tr   