
    
                         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	  \	R                   " S S	\	R                  5      5       rg
)z'logging views create' command.    )absolute_import)division)unicode_literals)util)arg_parsers)basec                   .    \ rS rSrSr\S 5       rS rSrg)Create   zCreate a log view on a log bucket.

## EXAMPLES

To create a view that matches all Google Compute Engine logs in a bucket, run:

  $ {command} my-view --bucket=my-bucket --location=global
  --log-filter='resource.type="gce_instance"'
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 create.)helpz--descriptionz#A textual description for the view.z--log-filterzA filter for the view.zview to createTz/Location of the bucket that will hold the view.z--bucketz.+zmust be non-emptyz(ID of the bucket that will hold the view)requiredtyper   N)add_argumentr   AddParentArgsAddBucketLocationArgr   RegexpValidator)parsers    #lib/surface/logging/views/create.pyArgsCreate.Args(   s     	(CD
C   -EFv/0G ((0CD7	      c                    0 nUR                  S5      (       a  UR                  US'   UR                  S5      (       a  UR                  US'   [        R                  " 5       R
                  R                  [        R                  " 5       R                  UR                  [        R                  " [        R                  " U5      SUR                  5      [        R                  " 5       R                  " S0 UD6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 created view.
description
log_filterfilterbuckets)viewIdparentlogView )IsSpecifiedr   r   r   	GetClient projects_locations_buckets_viewsr
   GetMessages1LoggingProjectsLocationsBucketsViewsCreateRequestr   CreateResourceNameGetBucketLocationFromArgsbucketLogView)selfargs	view_datas      r   Run
Create.Run;   s     I&&!%!1!1i%% OOi>><<CCLL<<**..t4i $$&..;; 	M 	
 r   r"   N)	__name__
__module____qualname____firstlineno____doc__staticmethodr   r/   __static_attributes__r"   r   r   r
   r
      s       $r   r
   N)r5   
__future__r   r   r   googlecloudsdk.api_lib.loggingr   googlecloudsdk.callioper   r   UniverseCompatibleCreateCommandr
   r"   r   r   <module>r=      sC     & &  ' / / ( 7T 7 7r   