
                         8   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SKJr  SSKJr  SSKJr  S rS rS r\R8                  " \R:                  R<                  5      \R>                   " S S\R@                  5      5       5       r!\R8                  " \R:                  RD                  \R:                  RF                  5      \R>                   " S S\R@                  5      5       5       r$g)z#Vertex AI endpoints create command.    )absolute_import)division)unicode_literals)encoding)
operations)client)base)	constants)endpoint_util)endpoints_util)flags)operations_util)region_util)
validation)labels_util)logc                 Z   [         R                  " S5      R                  U 5        [         R                  " U S[        R
                  S9  [         R                  " S5      R                  U 5        [         R                  " S5      R                  U 5        [        R                  " U 5        [         R                  " 5       R                  U 5        [         R                  " 5       R                  U 5        [         R                  " 5       R                  U 5        [         R                  " U 5        g Nendpointzto create endpoint)prompt_func)r   GetDisplayNameArgAddToParserAddRegionResourceArgr   PromptForOpRegionGetDescriptionArgGetUserSpecifiedIdArgr   AddCreateLabelsFlagsGetEndpointNetworkArgGetEncryptionKmsKeyNameArgGetHiddenGdceZoneArg(AddRequestResponseLoggingConfigGroupArgsparsers    "lib/surface/ai/endpoints/create.py
_AddArgsGar%   $   s    *%11&9"0M0MO*%11&9j)55f=""6*++F3""$008**62008    c                    [         R                  " S5      R                  U 5        [         R                  " U S[        R
                  S9  [         R                  " S5      R                  U 5        [         R                  " S5      R                  U 5        [        R                  " U 5        [         R                  " 5       R                  U 5        [         R                  " 5       R                  U 5        [         R                  " 5       R                  U 5        [         R                  " 5       R                  U 5        [         R                  " U 5        g r   )r   r   r   r   r   r   r   r   r   r   r   r   r    GetGdcZoneArgr!   r"   s    r$   _AddArgsr)   1   s    *%11&9"0M0MO*%11&9j)55f=""6*++F3""$008**62##F+008r&   c                    [         R                  " U R                  5        U R                  R                  R                  5       nUR                  5       S   U l        [        R                  " XR                  S9   [        R                  " US9n[        R                  " 5       nU[        R                  :X  a  UR                  X R                  [         R"                  " XR$                  R&                  R(                  5      U R*                  U R,                  U R.                  U R0                  U R2                  U R4                  S9	nOUR7                  UU R                  [         R"                  " U UR$                  R8                  R(                  5      U R*                  U R,                  U R.                  U R0                  U R:                  U R<                  U R2                  U R4                  S9n[>        R@                  " XE[B        RD                  " URF                  5      5      nUbM  [H        RJ                  " U5      nSU;   a1  [L        RN                  RQ                  SRS                  US   5      5        UsSSS5        $ ! , (       d  f       g= f)	z Create a new Vertex AI endpoint.locationsId)region)version)descriptionnetworkendpoint_idencryption_kms_key_namerequest_response_logging_tablerequest_response_logging_rate)r.   r/   r0   r1   	gdce_zonegdc_zoner2   r3   NnamezCreated Vertex AI endpoint: {}.)*r   ValidateDisplayNamedisplay_nameCONCEPTSr,   ParseAsDictr   AiplatformEndpointOverridesr   EndpointsClientr   OperationsClientr
   
GA_VERSIONCreater   ParseCreateArgsmessagesGoogleCloudAiplatformV1EndpointLabelsValuer.   r/   r0   r1   r2   r3   
CreateBeta$GoogleCloudAiplatformV1beta1Endpointr4   r5   r   WaitForOpMayber   ParseOperationr6   r   MessageToPyValuer   statusPrintformat)argsr-   
region_refendpoints_clientoperation_clientopresponse_msgresponses           r$   _RunrT   ?   s     !2!23}}##))+*!!#M2$+00M--g>!224)&&&""
''

%
%--MM{ &&,,&&"&">">)-)L)L(,(J(J # 
Lb &&





%
%''LLXX &&,,&&"&">">NN==)-)L)L(,(J(J ' b  #11n;;BGGDFL**<8h	8	

.66x7GH	JO NMMs   ;G9I>>
Jc                   .    \ rS rSrSr\S 5       rS rSrg)CreateGao   Create a new Vertex AI endpoint.

## EXAMPLES

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

  $ {command} --project=example --region=us-central1
  --display-name=my_endpoint
c                     [        U 5        g N)r%   r"   s    r$   ArgsCreateGa.Args}   s
    vr&   c                 6    [        U[        R                  5      $ rZ   )rT   r
   r?   selfrM   s     r$   RunCreateGa.Run   s    i**++r&    N	__name__
__module____qualname____firstlineno____doc__staticmethodr[   r`   __static_attributes__rb   r&   r$   rV   rV   o   s     	  ,r&   rV   c                   .    \ rS rSrSr\S 5       rS rSrg)rE      rX   c                     [        U 5        g rZ   )r)   r"   s    r$   r[   CreateBeta.Args   s
    Vr&   c                 6    [        U[        R                  5      $ rZ   )rT   r
   BETA_VERSIONr^   s     r$   r`   CreateBeta.Run   s    i,,--r&   rb   Nrc   rb   r&   r$   rE   rE      s     	  .r&   rE   N)%rh   
__future__r   r   r   apitools.base.pyr   googlecloudsdk.api_lib.air   #googlecloudsdk.api_lib.ai.endpointsr   googlecloudsdk.callioper	   googlecloudsdk.command_lib.air
   r   r   r   r   r   r   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer   r%   r)   rT   ReleaseTracksReleaseTrackGAUniverseCompatibleCreateCommandrV   BETAALPHArE   rb   r&   r$   <module>r      s    * &  ' % 0 6 ( 3 7 8 / 9 5 4 < #
99-` D%%((),t!! ,  *,( D%%**D,=,=,C,CD.## .  E.r&   