
                            S 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
  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  SSKJr  SSKJr  SSKJr  S rS r\R2                  \R4                  " \R6                  R8                  \R6                  R:                  5      \R<                   " S S\R>                  5      5       5       5       r g)z3Vertex AI deployment resource pools create command.    )absolute_import)division)unicode_literals)encoding)
operations)client)base)	constants)deployment_resource_pools_util)endpoint_util)flags)operations_util)region_util)
validation)logc                     [         R                  nU R                  SSS9  [        R                  " XSS9  [        R
                  " 5       R                  U 5        [        R                  " U S[        R                  S9  g)	zAdding deployment resource pool arguments from CLI.

Args:
  parser: argparse.ArgumentParser, cli argument parser

Returns:
  None
deployment_resource_pool_idzThe ID to use for the DeploymentResourcePool, which will become the final component of the DeploymentResourcePool's resource name. The maximum length is 63 characters, and valid characters are /^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$/.)helpT)drpz"to create deployment resource pool)prompt_funcN)
r
   BETA_VERSIONadd_argumentr   AddPredictionResourcesArgsGetAutoscalingMetricSpecsArgAddToParserAddRegionResourceArgr   .PromptForDeploymentResourcePoolSupportedRegion)parserversions     2lib/surface/ai/deployment_resource_pools/create.py_AddArgsBetar!   #   sq     ""'#-  . ""6=$$&226:*LLN    c                    [         R                  " U R                  U R                  5        [        R
                  nU R                  R                  R                  5       nUR                  5       S   U l        [        R                  " XR                  S9   [        R                  " US9nUR                  UU R                  U R                   U R"                  U R                  U R$                  U R&                  U R(                  U R*                  U R,                  U R.                  U R                  S9n[0        R2                  " [4        R6                  " 5       U[8        R:                  " UR<                  5      5      nUbM  [>        R@                  " U5      nSU;   a1  [B        RD                  RG                  SRI                  US   5      5        SSS5        U$ ! , (       d  f       W$ = f)z0Create a new Vertex AI deployment resource pool.locationsId)region)r   )
autoscaling_metric_specsaccelerator_dictmin_replica_countmax_replica_countmachine_typetpu_topologymultihost_gpu_node_countreservation_affinityspotrequired_replica_countNnamez/Created Vertex AI deployment resource pool: {}.)%r   ValidateRequiredReplicaCountr/   r(   r
   r   CONCEPTSr%   ParseAsDictr   AiplatformEndpointOverridesr   DeploymentResourcePoolsClient
CreateBetar   r&   acceleratorr)   r*   r+   r,   r-   r.   r   WaitForOpMayber   OperationsClientr   ParseOperationr0   r   MessageToPyValuer   statusPrintformat)argsr   
region_ref deployment_resource_pools_clientopresponse_msgresponses          r    _RunBetarF   ;   s   ))$*E*E*.*@*@B""'}}##))+*!!#M2$+00M'-'K'K($	)	4	4((!%!>!>))0000&&&&!%!>!>!66YY#:: 
5 
B #11##%r&55bgg>@L **<8h	8	

>VHV$%	'/ N4 
5 NM4 
s   D6G
G%c                   .    \ rS rSrSr\S 5       rS rSrg)CreateV1Beta1_   a  Create a new Vertex AI deployment resource pool.

This command creates a new deployment resource pool with a provided deployment
resource pool id (name) in a provided region (assuming that region provides
support for this api). You can choose to simply provide the resource pool
name and create an instance with default arguments, or you can pass in your
own preferences, such as the accelerator and machine specs. Please note this
functionality is not yet available in the GA track and is currently only
part of the v1beta1 API version.

## EXAMPLES

To create a deployment resource pool with name ``example'' in region
``us-central1'', run:

  $ {command} example --region=us-central1
c                     [        U 5      $ N)r!   )r   s    r    ArgsCreateV1Beta1.Argsu   s    r"   c                     [        U5      $ rK   )rF   )selfr@   s     r    RunCreateV1Beta1.Runy   s    D>r"    N)	__name__
__module____qualname____firstlineno____doc__staticmethodrL   rP   __static_attributes__rR   r"   r    rH   rH   _   s     $    r"   rH   N)!rW   
__future__r   r   r   apitools.base.pyr   googlecloudsdk.api_lib.air   3googlecloudsdk.api_lib.ai.deployment_resource_poolsr   googlecloudsdk.callioper	   googlecloudsdk.command_lib.air
   r   r   r   r   r   r   googlecloudsdk.corer   r!   rF   HiddenReleaseTracksReleaseTrackALPHABETAUniverseCompatibleCreateCommandrH   rR   r"   r    <module>rh      s    : &  ' % 0 F ( 3 H 7 / 9 5 4 #N0!H D%%++T->->-C-CDD&&   E r"   