
                             S r SSKJr  SSKJr  SSKJr  SSKJr  SSS.r\R                   " S	 S
\R                  5      5       r\\l        g)z'logging views update' command.    )util)arg_parsers)base)
exceptionsz/
        Updates the properties of a view.
    z
     To update a view in your project, run:

        $ {command} my-view --bucket=my-bucket --location=global
     --description=my-new-description
    )DESCRIPTIONEXAMPLESc                   .    \ rS rSrSr\S 5       rS rSrg)Update%   zGUpdate a view.

Changes one or more properties associated with a view.
c                    U R                  SSS9  U R                  SSS9  U R                  SSS9  [        R                  " U S5        [        R                  " U S	S
5        U R                  SS	[        R
                  " SS5      SS9  g)z Register flags for this command.VIEW_IDzId of the view to update.)help--descriptionzNew description for the view.--log-filterzNew filter for the view.zview to updateTz.Location of the bucket that contains the view.z--bucketz.+zmust be non-emptyz$ID of the bucket that holds the view)requiredtyper   N)add_argumentr   AddParentArgsAddBucketLocationArgr   RegexpValidator)parsers    #lib/surface/logging/views/update.pyArgsUpdate.Args,   s     3  5
,  . '  ) 	v/0FH
T((0CD3  5    c                 B   0 n/ nSS/nUR                  S5      (       a   UR                  US'   UR                  S5        UR                  S5      (       a   UR                  US'   UR                  S5        U(       d  [        R
                  " US5      e[        R                  " 5       R                  R                  [        R                  " 5       R                  [        R                  " [        R                  " [        R                  " [        R                  " UR                  5      R                  5       SUR                   5      SUR"                  5      S	UR$                  5      [        R                  " 5       R&                  " S0 UD6S
R)                  U5      S95      $ )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:
  The updated view.
r   r   
log_filterfilterdescriptionz.Please specify at least one property to update	locationsbucketsviews,)namelogView
updateMask )IsSpecifiedr   appendr   calliope_exceptionsMinimumArgumentExceptionr   	GetClient projects_locations_buckets_viewsPatchGetMessages0LoggingProjectsLocationsBucketsViewsPatchRequestCreateResourceNameGetProjectResourceprojectRelativeNamelocationbucketr   LogViewjoin)selfargs	view_dataupdate_maskparameter_namess        r   Run
Update.Run?   s\    IK%7O%% OOi"&&!%!1!1i'88

:< < >><<BBKK(()@)@''++DLL9FFHMM# 4;;*(
 *1$,,@ $$&..;;xx, 	L 	.	/ 	/r   r'   N)	__name__
__module____qualname____firstlineno____doc__staticmethodr   r>   __static_attributes__r'   r   r   r
   r
   %   s     
 5 5$"/r   r
   N)rD   googlecloudsdk.api_lib.loggingr   googlecloudsdk.callioper   r   r   r*   DETAILED_HELPUniverseCompatibleUpdateCommandr
   detailed_helpr'   r   r   <module>rM      s[     & 0 / ( E	
 ;/T ;/ ;/z % r   