
                             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
 ddl	mZ dd	lmZ dd
lmZ dddZ G d dej                         Zee_        y)z'logging links delete' command.    )absolute_import)division)unicode_literals)util)waiter)arg_parsers)base)log)	resourcesz/
        Delete a bucket's linked dataset.
    zv
     To delete a bucket's linked dataset, run:

        $ {command} my-link --bucket=my-bucket --location=global
    )DESCRIPTIONEXAMPLESc                   &    e Zd ZdZed        Zd Zy)DeletezDelete a linked dataset.c                 J   | j                  dd       t        j                  | dd       t        j                  | d       | j                  ddt	        j
                  dd	      d
       t        j                  j                  |        | j                  j                  d       y)z Register flags for this command.LINK_IDz#ID of the linked dataset to delete.)helpTzLocation of the bucket.zlinked dataset to deletez--bucketz.+zmust be non-emptyzID of bucket)requiredtyper   N)add_argumentr   AddBucketLocationArgAddParentArgsr   RegexpValidatorr	   
ASYNC_FLAGAddToParserdisplay_infoAddCacheUpdater)parsers    #lib/surface/logging/links/delete.pyArgszDelete.Args,   s     	(MNfd,EFv9:
((0CD	   	OO'
''-    c                    t        j                         }|j                  j                  t        j                         j                  t        j                  t        j                  t        j                  |      d|j                        d|j                                    }|j                  r$t        j                  |j                  dd       |S t        j                  j!                  |j                  d      }t#        j$                  t#        j&                  |j(                        |d	j+                  |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:
      Linked dataset delete operation.
    bucketslinks)namelinkT)is_asyncz%logging.projects.locations.operations)
collectionz&Waiting for operation [{}] to complete)r   	GetClient projects_locations_buckets_linksr   GetMessages1LoggingProjectsLocationsBucketsLinksDeleteRequestCreateResourceNameGetBucketLocationFromArgsbucketr   async_r
   DeletedResourcer$   r   REGISTRYParseRelativeNamer   WaitForCloudOperationPollerNoResourcesprojects_locations_operationsformat)selfargsclient	delete_opdelete_op_refs        r   Runz
Delete.Run;   s    ^^F77>>LL((''2248KK
  	M 
	
I {{	)..&4@((::
..< ; m ^^

0
022 
2
9
9)..
I r    N)__name__
__module____qualname____doc__staticmethodr   r<    r    r   r   r   )   s     . .&r    r   N)r@   
__future__r   r   r   googlecloudsdk.api_lib.loggingr   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper   r	   googlecloudsdk.corer
   r   DETAILED_HELPDeleteCommandr   detailed_helprB   r    r   <module>rK      sS     & &  ' / . / ( # )		8T 8t % r    