
                            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  e
j"                  e
j$                  j&                         G d de
j(                               Z e
j"                  e
j$                  j,                  e
j$                  j.                         G d de             Zy)z1Vertex AI index endpoints undeploy-index command.    )absolute_import)division)unicode_literals)
operations)client)base)	constants)endpoint_util)flags)index_endpoints_util)operations_utilc                   ,    e Zd ZdZed        Zd Zd Zy)UndeployIndexV1?  Undeploy an index from a Vertex AI index endpoint.

  ## EXAMPLES

  To undeploy the deployed-index ``deployed-index-345'' from an index endpoint
  ``456'' under project ``example'' in region ``us-central1'', run:

    $ {command} 456 --project=example --region=us-central1
    --deployed-index-id=deployed-index-345
  c                 v    t        j                  | d       t        j                         j                  |        y )Nzto undeploy an index)r   AddIndexEndpointResourceArgGetDeployedIndexIdAddToParser)parsers    0lib/surface/ai/index_endpoints/undeploy_index.pyArgszUndeployIndexV1.Args,   s*    	%%f.DE	**62    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$                              cd d d        S # 1 sw Y   y xY w)NlocationsId)region)version)operations_clientopop_ref)CONCEPTSindex_endpointParseAsDictr
   AiplatformEndpointOverridesr   IndexEndpointsClientr	   
GA_VERSIONUndeployIndexUndeployIndexBetar   WaitForOpMayber   OperationsClientr   ParseIndexEndpointOperationname)selfargsr   index_endpoint_refr   index_endpoint_client	operations          r   _RunzUndeployIndexV1._Run1   s    55;;=&&(7F		2	276	J$99'J	I((	()778J8<>	 *;;&	++&77H%AAnn 
K	J	Js   BC00C9c                 B    | j                  |t        j                        S N)r2   r	   r&   r-   r.   s     r   RunzUndeployIndexV1.RunB   s    99T9//00r   N)__name__
__module____qualname____doc__staticmethodr   r2   r6    r   r   r   r      s%    	 3 3"1r   r   c                       e Zd ZdZd Zy)UndeployIndexV1Beta1r   c                 B    | j                  |t        j                        S r4   )r2   r	   BETA_VERSIONr5   s     r   r6   zUndeployIndexV1Beta1.RunS   s    99T91122r   N)r7   r8   r9   r:   r6   r<   r   r   r>   r>   F   s    	3r   r>   N)r:   
__future__r   r   r   googlecloudsdk.api_lib.air   )googlecloudsdk.api_lib.ai.index_endpointsr   googlecloudsdk.callioper   googlecloudsdk.command_lib.air	   r
   r   r   r   ReleaseTracksReleaseTrackGACommandr   ALPHABETAr>   r<   r   r   <module>rL      s    8 &  ' 0 < ( 3 7 / > 9 D%%(()#1dll #1 *#1L D%%++T->->-C-CD3? 3 E3r   