
                            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 Zd Z e
j(                  e
j*                  j,                        e
j.                   G d de
j0                                      Z e
j(                  e
j*                  j4                  e
j*                  j6                        e
j.                   G d de                    Zy)z+Vertex AI endpoints undeploy-model command.    )absolute_import)division)unicode_literals)
operations)client)base)	constants)endpoint_util)endpoints_util)flags)operations_util)region_utilc                     t        j                  | dt        j                         t        j                         j                  |        t        j                         j                  |        y )Nzto undeploy a model from)prompt_func)r   AddEndpointResourceArgr   PromptForOpRegionGetDeployedModelIdAddToParserGetTrafficSplitArgparsers    *lib/surface/ai/endpoints/undeploy_model.py_AddArgsr       sO     //1 ((0((0    c                 l   | j                   j                  j                         }|j                         d   | _        t        j                  || j                        5  t        j                  |      }t        j                         }|t        j                  k(  r)|j                  || j                  | j                        }n(|j!                  || j                  | j                        }t#        j$                  ||t'        j(                  |j*                              cddd       S # 1 sw Y   yxY w)z5Undeploy a model fro man existing Vertex AI endpoint.locationsId)region)version)traffic_splitN)CONCEPTSendpointParseAsDictr   r
   AiplatformEndpointOverridesr   EndpointsClientr   OperationsClientr	   
GA_VERSIONUndeployModeldeployed_model_idr   UndeployModelBetar   WaitForOpMayber   ParseOperationname)argsr   endpoint_refendpoints_clientoperation_clientops         r   _Runr3   )   s    ''--/,##%m4$+00M--g>!224)&&&))


 
 ** * ,b
 --


 
 ** . ,b ))"n;;BGGDF NMMs   CD**D3c                   &    e Zd ZdZed        Zd Zy)UndeployModelGa  Undeploy a model from an existing Vertex AI endpoint.

  ## EXAMPLES

  To undeploy a model ``456'' from an endpoint ``123'' under project ``example''
  in region ``us-central1'', run:

    $ {command} 123 --project=example --region=us-central1
    --deployed-model-id=456
  c                     t        |        y N)r   r   s    r   ArgszUndeployModelGa.ArgsL   s
    Vr   c                 8    t        |t        j                         y r8   )r3   r	   r'   selfr.   s     r   RunzUndeployModelGa.RunP   s    y##$r   N)__name__
__module____qualname____doc__staticmethodr9   r=    r   r   r5   r5   >   s     	  %r   r5   c                       e Zd ZdZd Zy)r*   r6   c                 8    t        |t        j                         y r8   )r3   r	   BETA_VERSIONr;   s     r   r=   zUndeployModelBeta.Runb   s    y%%&r   N)r>   r?   r@   rA   r=   rC   r   r   r*   r*   T   s    	'r   r*   N)rA   
__future__r   r   r   googlecloudsdk.api_lib.air   #googlecloudsdk.api_lib.ai.endpointsr   googlecloudsdk.callioper   googlecloudsdk.command_lib.air	   r
   r   r   r   r   r   r3   ReleaseTracksReleaseTrackGAUniverseCompatibleCommandr5   BETAALPHAr*   rC   r   r   <module>rS      s    2 &  ' 0 6 ( 3 7 8 / 9 51F* D%%(()%dll %  *%( D%%**D,=,=,C,CD' '  E'r   