
                            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 rS r\R,                  " \R.                  R0                  5      \R2                   " S S\R4                  5      5       5       r\R,                  " \R.                  R8                  \R.                  R:                  5      \R2                   " S S\5      5       5       rg)z#Vertex AI endpoints update command.    )absolute_import)division)unicode_literals)client)base)	constants)endpoint_util)errors)flags)region_util)
validation)labels_util)logc                 b   [         R                  " U S[        R                  S9  [         R                  " SSS9R                  U 5        [         R                  " S5      R                  U 5        [         R                  " U 5        [         R                  " U 5        [        R                  " U 5        g )Nz	to update)prompt_funcendpointF)required)r   AddEndpointResourceArgr   PromptForOpRegionGetDisplayNameArgAddToParserGetDescriptionArgAddTrafficSplitGroupArgs.AddRequestResponseLoggingConfigUpdateGroupArgsr   AddUpdateLabelsFlagsparsers    "lib/surface/ai/endpoints/update.py_AddArgsr   !   s|    k{'D'DF*u5AA&I*%11&9  (66v>""6*    c                   ^ ^^ [         R                  " T R                  5        T R                  R                  R                  5       mTR                  5       S   T l        [        R                  " UT R                  S9   [        R                  " US9mUU4S jn U[        R                  :X  a  TR                  T[        R                   " T TR"                  R$                  R&                  U5      T R                  T R(                  T R*                  T R,                  T R.                  T R0                  T R2                  S9	nOTR5                  T[        R                   " T TR"                  R6                  R&                  U5      T R                  T R(                  T R*                  T R,                  T R.                  T R0                  T R2                  S9	n[8        R:                  " UR<                  SS9  UsSSS5        $ ! [>        R@                   aI    / S	Qn[C        U 4S
 jU 5       5      (       d  e [8        RD                  RG                  S5         SSS5        gf = f! , (       d  f       g= f)z&Update an existing Vertex AI endpoint.locationsId)region)versionc                  :   > TR                  T 5      R                  $ N)Getlabels)endpoint_refendpoints_clients   r   	GetLabels_Run.<locals>.GetLabels4   s    !!,/666r    )display_namedescriptiontraffic_splitclear_traffic_splitrequest_response_logging_tablerequest_response_logging_rate disable_request_response_loggingzVertex AI endpoint)kindN)
r-   r/   r0   update_labelsclear_labelsremove_labelsr.   r1   r2   r3   c              3   F   >#    U  H  nTR                  U5      v   M     g 7fr&   )IsSpecified).0argargss     r   	<genexpr>_Run.<locals>.<genexpr>[   s!     H2G3!!#&&2Gs   !zNo update to perform.)$r   ValidateDisplayNamer-   CONCEPTSr   ParseAsDictr#   r	   AiplatformEndpointOverridesr   EndpointsClientr   
GA_VERSIONPatchr   ProcessUpdateArgsLazymessagesGoogleCloudAiplatformV1EndpointLabelsValuer.   r/   r0   r1   r2   r3   	PatchBeta$GoogleCloudAiplatformV1beta1Endpointr   UpdatedResourcenamer
   NoFieldsSpecifiedErroranystatusPrint)r<   r$   r+   opavailable_update_argsr)   r*   s   `    @@r   _RunrU   +   s
     !2!23''--/,##%m4$+00M--g>7*	I((	(##--&//OOi) **((,, $ 8 8+/+N+N*.*L*L-1-- $ / ''--&//55kk9N **((,, $ 8 8+/+N+N*.*L*L-1-- ( /2 
"''(<=a NMF (( 
 H2GHHH	jj./[ NMF
G NMs2   ?ID7G= I=AIIII
I+c                   .    \ rS rSrSr\S 5       rS rSrg)UpdateGad   Update an existing Vertex AI endpoint.

## EXAMPLES

To update an endpoint ``123'' under project ``example'' in region
``us-central1'', run:

  $ {command} 123 --project=example --region=us-central1
  --display-name=new_name
c                     [        U 5        g r&   )r   r   s    r   ArgsUpdateGa.Argsr   s
    Vr    c                 6    [        U[        R                  5      $ r&   )rU   r   rE   selfr<   s     r   RunUpdateGa.Runv   s    i**++r     N)	__name__
__module____qualname____firstlineno____doc__staticmethodr[   r`   __static_attributes__rb   r    r   rW   rW   d   s     	  ,r    rW   c                       \ rS rSrSrS rSrg)
UpdateBetaz   rY   c                 6    [        U[        R                  5      $ r&   )rU   r   BETA_VERSIONr^   s     r   r`   UpdateBeta.Run   s    i,,--r    rb   N)rc   rd   re   rf   rg   r`   ri   rb   r    r   rk   rk   z   s    	.r    rk   N)rg   
__future__r   r   r   #googlecloudsdk.api_lib.ai.endpointsr   googlecloudsdk.callioper   googlecloudsdk.command_lib.air   r	   r
   r   r   r   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer   r   rU   ReleaseTracksReleaseTrackGAUniverseCompatibleUpdateCommandrW   BETAALPHArk   rb   r    r   <module>r}      s    * &  ' 6 ( 3 7 0 / 5 4 < #+6r D%%((),t!! ,  *,( D%%**D,=,=,C,CD. .  E.r    