
    m                        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 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.                  j0                  e
j.                  j2                  e
j.                  j4                         G d de
j6                                      Zy)z+Bigtable materialized views update command.    N)Optional)
exceptions)materialized_views)util)base)parser_arguments)parser_extensions)	arguments)log)	resources)bigtableadmin_v2_messagesc                       e Zd ZdZd ej
                  d      iZedej                  ddfd       Z
dej                  d	ej                  dej                   fd
Zd	ej                  deej                      fdZy)UpdateMaterializedViewz$Update a Bigtable materialized view.EXAMPLESz          To update a materialized view, run:

            $ {command} my-materialized-view-id --instance=my-instance-id --deletion-protection=true
          parserreturnNc                     t        j                  | d       t        j                  |       j                  d      j	                          y )Nz	to updateT)r
   AddMaterializedViewResourceArgArgAdderAddDeletionProtectionAddAsync)r   s    1lib/surface/bigtable/materialized_views/update.pyArgszUpdateMaterializedView.Args2   s4    ,,V[Av44T:CCE    materialized_view_refargsc                 B    t        j                  ||j                        S )a@  Updates a materialized view with the given arguments.

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

    Returns:
      Updated materialized view resource object.
    )r   Updatedeletion_protection)selfr   r   s      r   _UpdateMaterializedViewz.UpdateMaterializedView._UpdateMaterializedView7   s"     $$t77 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:
      Updated resource.
    zUpdating materialized view {0}zmaterialized view)kindis_asyncN)CONCEPTSmaterialized_viewParser!   async_r   GetOperationRefAwaitMaterializedViewformatNamer   UpdatedResource)r    r   r   	operationoperation_refs        r   RunzUpdateMaterializedView.RunJ   s     !MM;;AAC,,-BDII;;**95m''

*
1
12G2L2L2N
O 
 ""$ 
 r   )__name__
__module____qualname____doc__textwrapdedentdetailed_helpstaticmethodr   ArgumentInterceptorr   r   Resourcer	   	Namespacer   MaterializedViewr!   r   r0    r   r   r   r   #   s    
 - /(// # - F#77 FD F F&// '' !11	&#--)::;r   r   )r4   r5   typingr   apitools.base.pyr   googlecloudsdk.api_lib.bigtabler   r   googlecloudsdk.callioper   r   r	   #googlecloudsdk.command_lib.bigtabler
   googlecloudsdk.corer   r   6googlecloudsdk.generated_clients.apis.bigtableadmin.v2r   	HttpErrorUniverseCompatibleReleaseTracksReleaseTrackGABETAALPHAUpdateCommandr   r=   r   r   <module>rM      s    2   ' > 0 ( 4 5 9 # ) \   	 $++00$2C2C2I2I=T// = =r   