
                             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
  SS	S
.r " S S\R                  5      r\\l        g)z'logging links create' command.    )util)waiter)arg_parsers)base)log)	resourcesz7
        Create a linked dataset for a log bucket.
    zz
     To create a linked dataset in a project, run:

        $ {command} my-link --bucket=my-bucket --location=global
    )DESCRIPTIONEXAMPLESc                   .    \ rS rSrSr\S 5       rS rSrg)Create&   z3Create a linked dataset on an analytics log bucket.c                 .   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  [        R                  R                  U 5        g)z Register flags for this command.LINK_IDz#ID of the linked dataset to create.)helpz--descriptionz-A textual description for the linked dataset.zlinked dataset to createTz:Location of the bucket that will hold the linked datasert.z--bucketz.+zmust be non-emptyz2ID of the bucket that will hold the linked dataset)requiredtyper   N)	add_argumentr   AddParentArgsAddBucketLocationArgr   RegexpValidatorr   
ASYNC_FLAGAddToParser)parsers    #lib/surface/logging/links/create.pyArgsCreate.Args)   s     	(MN
M   	v9:D
 ((0CDA	   	OO'    c                 z   0 nUR                  S5      (       a  UR                  US'   [        R                  " 5       nUR                  R                  [        R                  " 5       R                  UR                  [        R                  " [        R                  " [        R                  " UR                  5      R                  5       SUR                  5      SUR                  5      [        R                  " 5       R                  " S0 UD6S95      nUR                   (       a"  ["        R$                  " UR&                  SSS9  U$ [(        R*                  R-                  UR&                  SS	9n[.        R0                  " [.        R2                  " UR4                  5      US
R7                  UR&                  5      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:
  Linked dataset creation operation.
description	locationsbuckets)linkIdparentlinkr$   T)is_asyncz%logging.projects.locations.operations)
collectionz&Waiting for operation [{}] to complete )IsSpecifiedr   r   	GetClient projects_locations_buckets_linksr   GetMessages1LoggingProjectsLocationsBucketsLinksCreateRequestr   CreateResourceNameGetProjectResourceprojectRelativeNamelocationbucketLinkasync_r   CreatedResourcenamer   REGISTRYParseRelativeNamer   WaitForCloudOperationPollerNoResourcesprojects_locations_operationsformat)selfargs	link_dataclient	create_opcreate_op_refs         r   Run
Create.Run>   sd    I&&!%!1!1i^^F77>>LL<<**''++DLL9FFHMM
  !!#((595 	M 	
I {{	)..&4@((::
..< ; m ^^

0
022 
2
9
9)..
I r   r'   N)	__name__
__module____qualname____firstlineno____doc__staticmethodr   rC   __static_attributes__r'   r   r   r   r   &   s    ;( ((,r   r   N)rI   googlecloudsdk.api_lib.loggingr   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper   r   googlecloudsdk.corer   r   DETAILED_HELPCreateCommandr   detailed_helpr'   r   r   <module>rS      sN     & 0 . / ( # )		DT DN % r   