
                            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0r\R$                  " \R&                  R(                  5      \R*                   " S S\R,                  5      5       5       r\R$                  " \R&                  R0                  \R&                  R2                  5       " S S\5      5       rg)z/Vertex AI index endpoints deploy-index command.    )absolute_import)division)unicode_literals)client)base)	constants)endpoint_util)flags)index_endpoints_util)
validation)logEXAMPLESa          To deploy index ``345'' to an index endpoint ``456'' with 2 min replica count and 10 max replica count under project ``example'' in region ``us-central1'', within reserved ip ranges
        ``vertex-ai-ip-range-1'' and ``vertex-ai-ip-range-2'' run:

          $ {command} 456 --project=example --region=us-central1 --index=345 --deployed-index-id=deployed-index-345 --display-name=deployed-index-345 --min-replica-count=2 --max-replica-count=10 --reserved-ip-ranges=vertex-ai-ip-range-1,vertex-ai-ip-range-2
        c                   8    \ rS rSrSr\r\S 5       rS r	S r
Srg)DeployIndexV1)   .Deploy an index to a Vertex AI index endpoint.c                 6   [         R                  " U S5        [         R                  " 5       R                  U 5        [         R                  " 5       R                  U 5        [         R
                  " S5      R                  U 5        [         R                  " U S5        [         R                  " U S5        [         R                  " U 5        [         R                  " U S5        [         R                  " 5       R                  U 5        [         R                  " U 5        g )Nzto deploy an indexzdeployed index)r
   AddIndexEndpointResourceArgGetDeployedIndexIdAddToParserGetIndexIdArgGetDisplayNameArgAddDeploymentResourcesArgsAddReservedIpRangesArgsAddDeploymentGroupArgAddAuthConfigArgsGetEnableAccessLoggingArgAddPscAutomationConfigsArgs)parsers    .lib/surface/ai/index_endpoints/deploy_index.pyArgsDeployIndexV1.Args0   s    	%%f.BC	**62	%%f-	,-99&A	$$V-=>	!!&*:;	'	F$45	##%11&9	%%f-    c                    [         R                  " UR                  5        UR                  R                  R                  5       nUR                  5       S   nUR                  5       S   n[        R                  " X%S9   [        R                  " US9nU[        R                  :X  a  UR                  X15      nOUR                  X15      n[        R                   " UR"                  5      nUR                  5       S   n	[$        R&                  R)                  [        R*                  R-                  UR"                  SUR/                  5       SR-                  XU5      S95        UsS S S 5        $ ! , (       d  f       g = f)	N
projectsIdlocationsId)region)versionindexEndpointsIdzdeploy indexz.--index-endpoint={} --region={} [--project={}])nameverbidsub_commands)r   ValidateDisplayNamedisplay_nameCONCEPTSindex_endpointParseAsDictr	   AiplatformEndpointOverridesr   IndexEndpointsClientr   
GA_VERSIONDeployIndexDeployIndexBetar   ParseIndexEndpointOperationr*   r   statusPrint"OPERATION_CREATION_DISPLAY_MESSAGEformatName)
selfargsr(   index_endpoint_ref
project_idr'   index_endpoint_client	operationop_refindex_endpoint_ids
             r    _RunDeployIndexV1._Run=   s.   ""4#4#4555;;=#**,\:J&&(7F		2	27	J$99'J	I((	()556HO	)99&	 $??	Of --/*<=	jj

6
6
=
=>>!Kv'< > >? % 
K	J	Js   ?C%E..
E<c                 B    U R                  U[        R                  5      $ N)rG   r   r6   r?   r@   s     r    RunDeployIndexV1.RunV   s    99T9//00r#    N)__name__
__module____qualname____firstlineno____doc__DETAILED_HELPdetailed_helpstaticmethodr!   rG   rL   __static_attributes__rN   r#   r    r   r   )   s(     7-
. 
.21r#   r   c                   "    \ rS rSrSr\rS rSrg)DeployIndexV1Beta1Z   r   c                 B    U R                  U[        R                  5      $ rJ   )rG   r   BETA_VERSIONrK   s     r    rL   DeployIndexV1Beta1.Run`   s    99T91122r#   rN   N)	rO   rP   rQ   rR   rS   rT   rU   rL   rW   rN   r#   r    rY   rY   Z   s    6-3r#   rY   N)rS   
__future__r   r   r   )googlecloudsdk.api_lib.ai.index_endpointsr   googlecloudsdk.callioper   googlecloudsdk.command_lib.air   r	   r
   r   r   googlecloudsdk.corer   rT   ReleaseTracksReleaseTrackGADefaultUniverseOnlyCommandr   ALPHABETArY   rN   r#   r    <module>rj      s    6 &  ' < ( 3 7 / > 4 # 	 D%%((),1DLL ,1  *,1^ D%%++T->->-C-CD3 3 E3r#   