
                         >   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	 e	j                   e	j                  e	j                  j                  e	j                  j                  e	j                  j                         G d d	e	j                                       Zy
)z 'logging scopes create' command.    )absolute_import)division)unicode_literals)util)arg_parsers)basec                   ,    e Zd ZdZed        Zd Zd Zy)Createa  Create a log scope.

  After creating a log scope, you can use it to view logs in 1 or more
  resources.

  ## EXAMPLES

  To create a log scope in a project, run:

    $ {command} my-scope --resource-names=projects/my-project

  To create a log scope in a project with a description, run:

    $ {command} my-scope --resource-names=projects/my-project --description="my
    custom log scope"

  To create a log scope that contains more than 1 resource, such as projects and
  views, run:

    $ {command} my-scope
    --resource-names=projects/my-project,projects/my-project2,
    projects/my-project/locations/global/buckets/my-bucket/views/my-view1,
    projects/my-project/locations/global/buckets/my-bucket/views/my-view2,
  c                     | j                  dd       | j                  dd       | j                  dddd	t        j                         
       t        j                  | dd	       y)z Register flags for this command.LOG_SCOPE_IDzID of the log scope to create.)helpz--descriptionz(A textual description for the log scope.z--resource-namesaK   Comma-separated list of resource names in this log scope. It could be one or more parent resources or one or more views.  A log scope can include a maximum of 50 projects and a maximum of 100 resources in total. For example, projects/[PROJECT_ID], projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`RESOURCE_NAMEST)r   metavarrequiredtypezlog scope to create)exclude_billing_accountN)add_argumentr   ArgListr   AddParentArgs)parsers    $lib/surface/logging/scopes/create.pyArgszCreate.Args8   s{     -MN
H   b !  "   	%t    c                    i }|j                  d      r|j                  |d<   |j                  d      r|j                  |d<   t        j                         j
                  j                  t        j                         j                   t        j                         j                  di ||j                  t        j                  t        j                  |j                        j                         dd                  S y )Ndescriptionresource_namesresourceNames	locationsglobal)logScope
logScopeIdparent )IsSpecifiedr   r   r   	GetClientprojects_locations_logScopesr
   GetMessages.LoggingProjectsLocationsLogScopesCreateRequestLogScoper   CreateResourceNameGetProjectResourceprojectRelativeName)selfargs
scope_datas      r   _RunzCreate._RunP   s    J&"&"2"2j()$($7$7j!^^::AA




K
K2t'')22@Z@**,,))$,,7DDF L 
 
 *r   c                 $    | j                  |      S )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 log scope.
    )r1   )r.   r/   s     r   Runz
Create.Runc   s     99T?r   N)__name__
__module____qualname____doc__staticmethodr   r1   r3   r#   r   r   r
   r
      s%    
2  .&
r   r
   N)r7   
__future__r   r   r   googlecloudsdk.api_lib.loggingr   googlecloudsdk.callioper   r   UniverseCompatibleReleaseTracksReleaseTrackALPHABETAGACreateCommandr
   r#   r   r   <module>rC      s    ' &  ' / / ( T..33T5F5F5I5IOT O Or   