
    V                        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dZ e	j*                  e	j,                  j.                         G d de	j0                               Z e	j*                  e	j,                  j4                  e	j,                  j6                         G d de             Zy)z"ai-platform models create command.    )absolute_import)division)unicode_literals)models)arg_parsers)base)	constants)endpoint_util)flags)models_util)labels_util)loga  Google Cloud region of the regional endpoint to use for this command.

If you specify this flag, do not specify `--regions`.

If you specify `--region=global`, the model will be deployed to 'us-central1'
by default using the global endpoint. Please use `--regions` only if you want
to change the region where the model will be deployed against the global
endpoint.

If both flags are unspecified and you don't set ``ai_platform/region'', you will
be prompted for region of the regional endpoint.

Learn more about regional endpoints and see a list of available regions:
 https://cloud.google.com/ai-platform/prediction/docs/regional-endpoints
c                    t        j                         j                  |        t        j                  d      j                  |        | j	                         }|j                  dt        j                  t               |j                  ddt        j                  d      d	       | j                  d
dd       |r| j                  ddd       t        j                  |        y)z:Get arguments for the `ai-platform models create` command.modelz--region)choiceshelpz	--regionsREGION   )
min_lengthzThe Google Cloud region where the model will be deployed (currently only a
single region is supported) against the global endpoint.

If you specify this flag, do not specify `--region`.

Defaults to 'us-central1' while using the global endpoint.
)metavartyper   z--enable-logging
store_truezIf set, enables StackDriver Logging for online prediction. These logs are like standard server access logs, containing information such as timestamps and latency for each request.)actionr   z--enable-console-loggingzIf set, enables StackDriver Logging of stderr and stdout streams for online prediction. These logs are more verbose than the standard access logs and can be helpful for debugging.N)r   GetModelNameAddToParserGetDescriptionFlagadd_mutually_exclusive_groupadd_argumentr	   SUPPORTED_REGIONS_WITH_GLOBAL_REGION_FLAG_HELPTEXTr   ArgListr   AddCreateLabelsFlags)parsersupport_console_loggingregion_groups      (lib/surface/ai_platform/models/create.py_AddCreateArgsr'   1   s     ""6*7#//7446,55   " !,	   	>  ? 
"F  G ""6*    c                   .    e Zd ZdZed        ZddZd Zy)CreateCreate a new AI Platform model.c                     t        |        y Nr'   r#   s    r&   ArgszCreate.Args[   s
    6r(   c           
         t        j                  |      \  }}t        j                  |      5  t	        j
                         }t        j                  ||      }|xr |j                  }t        j                  ||j                  ||j                  |||j                        }t        j                  |j                  d       d d d        y # 1 sw Y   y xY w)N)region)enable_loggingenable_console_logginglabelsdescriptionzai platform model)kind)r   GetModelRegionr
   MlEndpointOverridesr   ModelsClientParseCreateLabelsr4   r*   r   r3   r6   r   CreatedResourcename)	selfargsr$   r2   model_regionsmodels_clientr5   r4   r   s	            r&   _RunzCreate._Run_   s    '66t<FM		*	*&	9))+m,,]DAf
!
Ad&A&A   

**
,,!7&&(e 
%**+>? 
:	9	9s   BCCc                 &    | j                  |       y r-   rB   r>   r?   s     r&   Runz
Create.Runp   s    IIdOr(   NF)__name__
__module____qualname____doc__staticmethodr0   rB   rF    r(   r&   r*   r*   W   s"    ' @"r(   r*   c                   &    e Zd ZdZed        Zd Zy)
CreateBetar+   c                     t        | d       y NT)r$   r.   r/   s    r&   r0   zCreateBeta.Argsx   s    648r(   c                 *    | j                  |d       y rQ   rD   rE   s     r&   rF   zCreateBeta.Run|   s    IIdDI1r(   N)rH   rI   rJ   rK   rL   r0   rF   rM   r(   r&   rO   rO   t   s    '9 92r(   rO   NrG   )rK   
__future__r   r   r    googlecloudsdk.api_lib.ml_enginer   googlecloudsdk.callioper   r   $googlecloudsdk.command_lib.ml_enginer	   r
   r   r   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer   r    r'   ReleaseTracksReleaseTrackGACreateCommandr*   BETAALPHArO   rM   r(   r&   <module>r_      s    ) &  ' 3 / ( : > 6 < < # & ,1#+L D%%(()T  *8 D%%**D,=,=,C,CD2 2 E2r(   