
                         ^   d Z ddl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 ej                  Zej                   ej                  ej                   j"                  ej                   j$                  ej                   j&                         G d	 d
ej(                                      Zy)z&Bigtable logical views create command.    N)
exceptions)logical_views)util)base)	arguments)logc                   T    e Zd ZdZd ej
                  d      iZed        Zd Z	d Z
y)CreateLogicalViewz#Create a new Bigtable logical view.EXAMPLESz          To create a logical view, run:

            $ {command} my-logical-view-id --instance=my-instance-id --query="SELECT my-column-family FROM my-table"

          c                     t        j                  | d       t        j                  |       j                  d      j	                         j                          y )Nz	to createT)required)r   AddLogicalViewResourceArgArgAdderAddViewQueryAddAsyncAddDeletionProtection)parsers    ,lib/surface/bigtable/logical_views/create.pyArgszCreateLogicalView.Args-   sC    ''<v++ , hj&&(    c                 X    t        j                  ||j                  |j                        S )a,  Creates a logical view with the given arguments.

    Args:
      logical_view_ref: A resource reference of the new logical view.
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Returns:
      Created logical view resource object.
    )r   Createquerydeletion_protection)selflogical_view_refargss      r   _CreateLogicalViewz$CreateLogicalView._CreateLogicalView4   s(     $**d&>&> r   c                 x   |j                   j                  j                         }| j                  ||      }|j                  sHt        j                  |      }t        j                  |dj                  |j                                     S t        j                  |j                         d|j                         y)zThis is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Returns:
      Created resource.
    zCreating logical view {0}zlogical view)kindis_asyncN)CONCEPTSlogical_viewParser   async_r   GetOperationRefAwaitLogicalViewformatNamer   CreatedResource)r   r   r   	operationoperation_refs        r   RunzCreateLogicalView.RunC   s     }}11779''(8$?I;;**95m""

%
,
,-=-B-B-D
E  nt{{ r   N)__name__
__module____qualname____doc__textwrapdedentdetailed_helpstaticmethodr   r   r-    r   r   r
   r
      sC    
 , /(// # - ) )r   r
   )r1   r2   apitools.base.pyr   googlecloudsdk.api_lib.bigtabler   r   googlecloudsdk.callioper   #googlecloudsdk.command_lib.bigtabler   googlecloudsdk.corer   	HttpErrorUniverseCompatibleReleaseTracksReleaseTrackGABETAALPHACreateCommandr
   r6   r   r   <module>rD      s    -  ' 9 0 ( 9 #  	 $++00$2C2C2I2I7** 7 7r   