
                            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S r\R0                  " \R2                  R4                  5      \R6                   " S S\R8                  5      5       5       r\R0                  " \R2                  R<                  \R2                  R>                  5      \R6                   " S S\R8                  5      5       5       r g)z#Vertex AI endpoints create command.    )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&   .   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,   r-   r.   	gdce_zonegdc_zoner/   r0   NnamezCreated Vertex AI endpoint: {}.)*r   ValidateDisplayNamedisplay_nameCONCEPTSr)   ParseAsDictr   AiplatformEndpointOverridesr   EndpointsClientr   OperationsClientr   
GA_VERSIONCreater   ParseCreateArgsmessagesGoogleCloudAiplatformV1EndpointLabelsValuer+   r,   r-   r.   r/   r0   
CreateBeta$GoogleCloudAiplatformV1beta1Endpointr1   r2   r   WaitForOpMayber	   ParseOperationr3   r   MessageToPyValuer   statusPrintformat)argsr*   
region_refendpoints_clientoperation_clientopresponse_msgresponses           r!   _RunrQ   <   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)CreateGal   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.Argsz   s
    vr#   c                 6    [        U[        R                  5      $ rW   )rQ   r   r<   selfrJ   s     r!   RunCreateGa.Run~   s    i**++r#    N	__name__
__module____qualname____firstlineno____doc__staticmethodrX   r]   __static_attributes__r_   r#   r!   rS   rS   l   s     	  ,r#   rS   c                   .    \ rS rSrSr\S 5       rS rSrg)rB      rU   c                     [        U 5        g rW   )r&   r   s    r!   rX   CreateBeta.Args   s
    Vr#   c                 6    [        U[        R                  5      $ rW   )rQ   r   BETA_VERSIONr[   s     r!   r]   CreateBeta.Run   s    i,,--r#   r_   Nr`   r_   r#   r!   rB   rB      s     	  .r#   rB   N)!re   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&   rQ   ReleaseTracksReleaseTrackGAUniverseCompatibleCreateCommandrS   BETAALPHArB   r_   r#   r!   <module>r}      s    * & 0 6 ( 3 7 8 / 9 5 4 < #
99-` D%%((),t!! ,  *,( D%%**D,=,=,C,CD.## .  E.r#   