
    <                     8   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  e	j                  e	j                  j                   e	j                  j"                  e	j                  j$                         G d
 de	j&                               Zy)zCommand to move a folder.    )absolute_import)division)unicode_literals)folders)
operations)base)flags)logc                   &    e Zd ZdZed        Zd Zy)Movea  Move a folder to a new position within the same organization.

  Move the given folder under a new parent folder or under the organization.
  Exactly one of --folder or --organization must be provided.

  This command can fail for the following reasons:
      * There is no folder with the given ID.
      * There is no parent with the given type and ID.
      * The new parent is not in the same organization of the given folder.
      * Permission missing for performing this move.

  ## EXAMPLES

  The following command moves a folder with the ID `123456789` into a
  folder with the ID `2345`:

    $ {command} 123456789 --folder=2345

  The following command moves a folder with the ID `123456789` into an
  organization with ID `1234`:

    $ {command} 123456789 --organization=1234
  c                     t        j                  d      j                  |        t        j                         j                  |        t        j                  |        y )Nzyou want to move.)r	   FolderIdArgAddToParserOperationAsyncFlagAddParentFlagsToParser)parsers    ,lib/surface/resource_manager/folders/move.pyArgsz	Move.Args7   sA    	)*66v>	**62	  (    c                 <   t        j                  |       t        j                         }|j	                  |j
                  |j                  t        j                  |                  }t        j                         j                  |      }|j                  r|S |j                  r,|j                  s t        j                  j                  d       y t!        j"                  |      }t!        j$                  ||j&                        }t        j(                  |       y )N)destinationParent)	foldersIdmoveFolderRequestzNo changes necessary.)r	   CheckParentFlagsr   FoldersMessages&CloudresourcemanagerFoldersMoveRequestidMoveFolderRequestGetParentFromFlagsFoldersServicer   async_donenamer
   statusPrintr   WaitForOperationExtractOperationResponseFolderUpdatedResource)selfargsmessagesmove_request	operationfinished_opresults          r   RunzMove.Run=   s    	4 &&(HBB''"44#66t< 5 > C ?L &&(--l;I{{		

01//	:k22;Pf	&!r   N)__name__
__module____qualname____doc__staticmethodr   r1    r   r   r   r      s     0 ) )
"r   r   N)r5   
__future__r   r   r   'googlecloudsdk.api_lib.resource_managerr   r   googlecloudsdk.callioper   +googlecloudsdk.command_lib.resource_managerr	   googlecloudsdk.corer
   ReleaseTracksReleaseTrackALPHABETAGAUpdateCommandr   r7   r   r   <module>rC      s{      &  ' ; > ( = # D%%++T->->-C-C%%((*/"4 /"*/"r   