
                            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dlmZ ddiZ ej,                  ej.                  j0                        ej2                   G d dej4                                      Z ej,                  ej.                  j8                  ej.                  j:                         G d de             Zy)z:AI Platform index endpoints mutate-deployed-index command.    )absolute_import)division)unicode_literals)encoding)
operations)client)base)	constants)endpoint_util)flags)index_endpoints_util)operations_util)logEXAMPLESa          To mutated a deployed index ``deployed-index-123'' from an index
        endpoint ``456'' with 2 min replica count and 10 max replica count under
        project ``example'' in region ``us-central1'', within
        ``vertex-ai-ip-ranges-1'' and ``vertex-ai-ip-ranges-2'', within
        deployment group ``test'', enabling access logging, with JWT audiences
        ``aud1'' and ``aud2'', JWT issuers ``issuer1'' and ``issuer2'' run:

          $ {command} 456 --project=example --region=us-central1 --deployed-index-id=deployed-index-123 --min-replica-count=2 --max-replica-count=10 --reserved-ip-ranges=vertex-ai-ip-ranges-1,vertex-ai-ip-ranges-2 --enable-access-logging --audiences=aud1,aud2 --allowed-issuers=issuer1,issuer2 --deployment-group=test
        c                   0    e Zd ZdZeZed        Zd Zd Z	y)MutateDeployedIndexV1BMutate an existing deployed index from a Vertex AI index endpoint.c                 j   t        j                  | d       t        j                         j                  |        t        j                  | d       t        j
                  | d       t        j                  |        t        j                  | d       t        j                         j                  |        y )NzID of the index endpoint.zdeployed index)	r   AddIndexEndpointResourceArgGetDeployedIndexIdAddToParserAddDeploymentResourcesArgsAddReservedIpRangesArgsAddDeploymentGroupArgAddAuthConfigArgsGetEnableAccessLoggingArg)parsers    7lib/surface/ai/index_endpoints/mutate_deployed_index.pyArgszMutateDeployedIndexV1.Args6   s    	%%f.IJ	**62	$$V-=>	!!&*:;	'	F$45	##%11&9    c                    |j                   j                  j                         }|j                         d   }t	        j
                  ||      5  t        j                  |      }|t        j                  k(  r|j                  ||      }n|j                  ||      }t        j                  t        j                  |      |t!        j"                  |j$                              }d d d        Tt'        j(                  |      }d|v r;d|d   v r4t*        j,                  j/                  dj1                  |d   d                |S # 1 sw Y   axY w)NlocationsId)region)version)operations_clientopop_refdeployedIndexidz%Id of the deployed index updated: {}.)CONCEPTSindex_endpointParseAsDictr   AiplatformEndpointOverridesr   IndexEndpointsClientr
   
GA_VERSIONMutateDeployedIndexMutateDeployedIndexBetar   WaitForOpMayber   OperationsClientr   ParseIndexEndpointOperationnamer   MessageToPyValuer   statusPrintformat)	selfargsr$   index_endpoint_refr#   index_endpoint_client	operationresponse_msgresponses	            r   _RunzMutateDeployedIndexV1._Run@   s0   55;;=&&(7F		2	276	J$99'J	I((	()==&	 *AA&	 %33&77H%AAnnl 
K **<8h	H	$/1J)J

AII_%d+- 	.' 
K	Js   BEEc                 B    | j                  |t        j                        S N)rB   r
   r0   r;   r<   s     r   RunzMutateDeployedIndexV1.RunX   s    99T9//00r    N)
__name__
__module____qualname____doc__DETAILED_HELPdetailed_helpstaticmethodr   rB   rF    r    r   r   r   /   s)     K-: :01r    r   c                       e Zd ZdZeZd Zy)MutateDeployedIndexV1Beta1r   c                 B    | j                  |t        j                        S rD   )rB   r
   BETA_VERSIONrE   s     r   rF   zMutateDeployedIndexV1Beta1.Runb   s    99T91122r    N)rG   rH   rI   rJ   rK   rL   rF   rN   r    r   rP   rP   \   s    J-3r    rP   N)rJ   
__future__r   r   r   apitools.base.pyr   googlecloudsdk.api_lib.air   )googlecloudsdk.api_lib.ai.index_endpointsr   googlecloudsdk.callioper	   googlecloudsdk.command_lib.air
   r   r   r   r   googlecloudsdk.corer   rK   ReleaseTracksReleaseTrackGADefaultUniverseOnlyCommandr   ALPHABETArP   rN   r    r   <module>ra      s    A &  ' % 0 < ( 3 7 / > 9 # 		 D%%(()(1DLL (1  *(1V D%%++T->->-C-CD3!6 3 E3r    