
                            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                   G d d	ej                                              Zy
)z'logging buckets move' command.    )absolute_import)division)unicode_literals)util)base)
console_ioc                   &    e Zd ZdZed        Zd Zy)Movea  Move a bucket.

  In order to be movable, a bucket must satisfy the following restrictions:

   - Be a ```_Default``` or ```_Required``` bucket
   - Have a location of global
   - Have a non-project parent when it is a ```_Default``` bucket

  ## EXAMPLES

  To move the ```_Required``` bucket from `global` to another location, run:

    $ {command} _Required --location=global --new-location=us-central1
  c                     | j                  dd       | j                  ddd       t        j                  | dd       t        j                  | d	       | j                  j                  d
       y
)z Register flags for this command.	BUCKET_IDzID of the bucket to move.)helpz--new-locationTz#New location to move the bucket to.)requiredr   zLocation of the bucket.zbucket to moveN)add_argumentr   AddBucketLocationArgAddParentArgsdisplay_infoAddCacheUpdater)parsers    #lib/surface/logging/buckets/move.pyArgsz	Move.Args.   sq     *EF
2  4 	/1v/0
''-    c                    t        j                  |      }t        j                  t        j                  |d|j                        d|j                        }t        j                  t        j                  |d|j
                        d|j                        }t        j                  d|d|dd       t        j                         j                  j                  t        j                         j                  ||            S )	a  This 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:
      A long running operation containing related information.
    	locationsbucketszReally move bucket [z] to [z]? T)cancel_on_no)namenewName)r   GetParentFromArgsCreateResourceNamelocationr   new_locationr   PromptContinue	GetClientprojects_locations_bucketsr
   GetMessagesMoveBucketRequest)selfargsparent_namesource_bucket
new_buckets        r   RunzMove.Run;   s     ((.K++[$--H4>>#M (([$:K:KL4>>#J /<jI >>66;;,,
 	- 	45 5r   N)__name__
__module____qualname____doc__staticmethodr   r,    r   r   r
   r
      s      
. 
.5r   r
   N)r0   
__future__r   r   r   googlecloudsdk.api_lib.loggingr   googlecloudsdk.callioper   googlecloudsdk.core.consoler   DefaultUniverseOnlyReleaseTracksReleaseTrackGAHiddenCommandr
   r2   r   r   <module>r=      sn     & &  ' / ( 2 D%%(()554<< 55  * 55r   