
                         z   S r SSKJr  SSKJr  SSKJr  SSKrSSKrSSK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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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KJ r   SSKJ!r!  SSK"J#r#  SSK"J$r$  Sr%Sr&Sr'Sr(S r)S!r*S"r+S#r,S$ r-S7S% jr.S7S& jr/S7S' jr0\Rb                  Rd                  4S( jr3\Rb                  Rd                  4S) jr4S* r5S+ r6S, r7\Rp                  S- 5       r9S. r: S7S/ jr;S0 r<S1 r= S7S2 jr> S7S3 jr?S4 r@S5 rAS7S6 jrBg)8zxGeneric logic for cp and mv command surfaces.

Uses command surface tests. Ex: cp_test.py, not cp_command_util_test.py.
    )absolute_import)division)unicode_literalsN)	cloud_api)arg_parsers)base)encryption_util)errors)errors_util)flags)folder_util)name_expansion)plurality_checkable_iterator)rm_command_util)stdin_iterator)storage_url)user_request_args_factory)task_executor)task_graph_executor)task_status)copy_task_iterator)log)
properties)files)	platformsaX  Copy all source versions from a source bucket or folder. If not set, only the
live version of each source object is copied.

Note: This option is only useful when the destination bucket has Object
Versioning enabled. Additionally, the generation numbers of copied versions do
not necessarily match the order of the original generation numbers.
a%  Applies gzip transport encoding to any file upload whose
extension matches the input extension list. This is useful when
uploading files with compressible content such as .js, .css,
or .html files. This also saves network bandwidth while
leaving the data uncompressed in Cloud Storage.

When you specify the `--gzip-in-flight` option, files being
uploaded are compressed in-memory and on-the-wire only. Both the local
files and Cloud Storage objects remain uncompressed. The
uploaded objects retain the `Content-Type` and name of the
original files.a5  Applies gzip transport encoding to file uploads. This option
works like the `--gzip-in-flight` option described above,
but it applies to all uploaded files, regardless of extension.

CAUTION: If some of the source files don't compress well, such
as binary data, using this option may result in longer uploads.a  Applies gzip content encoding to any file upload whose
extension matches the input extension list. This is useful when
uploading files with compressible content such as .js, .css,
or .html files. This saves network bandwidth and space in Cloud Storage.

When you specify the `--gzip-local` option, the data from
files is compressed before it is uploaded, but the original files are left
uncompressed on the local disk. The uploaded objects retain the `Content-Type`
and name of the original files. However, the `Content-Encoding` metadata
is set to `gzip` and the `Cache-Control` metadata set to `no-transform`.
The data remains compressed on Cloud Storage servers and will not be
decompressed on download by gcloud storage because of the `no-transform`
field.

Since the local gzip option compresses data prior to upload, it is not subject
to the same compression buffer bottleneck of the in-flight gzip option.am  Applies gzip content encoding to file uploads. This option
works like the `--gzip-local` option described above,
but it applies to all uploaded files, regardless of extension.

CAUTION: If some of the source files don't compress well, such as binary data,
using this option may result in files taking up more space in the cloud than
they would if left uncompressed.a  Outputs a manifest log file with detailed information about each item that
was copied. This manifest contains the following information for each item:

- Source path.
- Destination path.
- Source size.
- Bytes transferred.
- MD5 hash.
- Transfer start time and date in UTC and ISO 8601 format.
- Transfer completion time and date in UTC and ISO 8601 format.
- Final result of the attempted transfer: OK, error, or skipped.
- Details, if any.

If the manifest file already exists, gcloud storage appends log items to the
existing file.

Objects that are marked as "OK" or "skipped" in the existing manifest file
are not retried by future commands. Objects marked as "error" are retried.
ag  Causes POSIX attributes to be preserved when objects are copied. With this feature enabled,
gcloud storage will copy several fields provided by the stat command:
access time, modification time, owner UID, owner group GID, and the mode
(permissions) of the file.

For uploads, these attributes are read off of local files and stored in the
cloud as custom metadata. For downloads, custom cloud metadata is set as POSIX
attributes on files after they are downloaded.

On Windows, this flag will only set and restore access time and modification
time because Windows doesn't have a notion of POSIX UID, GID, and mode.
a  Preserve symlinks instead of copying what they point to. With this feature
enabled, uploaded symlinks will be represented as placeholders in the cloud
whose content consists of the linked path. Inversely, such placeholders will be
converted to symlinks when downloaded while this feature is enabled, as
described at https://cloud.google.com/storage-transfer/docs/metadata-preservation#posix_to.

Directory symlinks are only followed if this flag is specified.

CAUTION: No validation is applied to the symlink target paths. Once downloaded,
preserved symlinks will point to whatever path was specified by the placeholder,
regardless of the location or permissions of the path, or whether it actually
exists.

This feature is not supported on Windows.
c                     U R                  SSS[        S9  U R                  SSS[        R                  " 5       [        S9  g	)
z&Adds flags for gzip parsing in flight.z-Jz--gzip-in-flight-all
store_trueactionhelpz-jz--gzip-in-flightFILE_EXTENSIONSmetavartyper    N)add_argument_GZIP_IN_FLIGHT_ALL_HELP_TEXTr   ArgList$_GZIP_IN_FLIGHT_EXTENSIONS_HELP_TEXTparsers    9lib/googlecloudsdk/command_lib/storage/cp_command_util.pyadd_gzip_in_flight_flagsr,      sN    
(	   	
 /      c                 B    SnSnU R                  SSSU(       a  UOUS9  g)zAdds --include-managed-folders flag to the parser.

Args:
  parser: (parser_arguments.ArgumentInterceptor): Parser passed to surface.
  hns_feature_warning: (bool) Whether to add a warning for HNS buckets to the
    flag.
a  Includes managed folders in command operations. For transfers, gcloud storage will set up managed folders in the destination with the same IAM policy bindings as the source. Managed folders are only included with recursive cloud-to-cloud transfers. Please note that for hierarchical namespace buckets, managed folders are always included. Hence this flag would not be applicable to hierarchical namespace buckets.zIncludes managed folders in command operations. For transfers, gcloud storage will set up managed folders in the destination with the same IAM policy bindings as the source. Managed folders are only included with recursive cloud-to-cloud transfers.z--include-managed-foldersr   Fr   defaultr    Nr%   )r*   hns_feature_warninghns_feature_warning_help_text	help_texts       r+    add_include_managed_folders_flagr5      s<    7    	!,?(Y	  r-   c                 (    U R                  SSUSS9  g)z(Adds flag for skipping copying symlinks.z--ignore-symlinksr   z;Ignore file symlinks instead of copying what they point to.r/   Nr1   parser_or_groupr0   s     r+   add_ignore_symlinks_flagr9      s!    
G  r-   c                 0    U R                  SSU[        S9  g)z"Adds flag for preserving symlinks.z--preserve-symlinksr   r/   N)r%   _PRESERVE_SYMLINKS_HELP_TESTr7   s     r+   add_preserve_symlinks_flagr<      s!    '	  r-   c                 F   [         R                  " U 5        [         R                  " U 5        [         R                  " XS9  [         R                  " U 5        U R                  SSSS9  U R                  SSSS	S
9  U R                  SSS[        S
9  U R                  SSSSS
9  g)z'Adds flags shared by cp, mv, and rsync.release_trackz--content-md5
MD5_DIGESTzManually specified MD5 hash digest for the contents of an uploaded file. This flag cannot be used when uploading multiple files. The custom digest is used by the cloud provider for validation.)r#   r    z-nz--no-clobberr   zDo not overwrite existing files or objects at the destination. Skipped items will be printed. This option may perform an additional GET request for cloud objects before attempting an upload.r   z-Pz--preserve-posixz-Uz--skip-unsupportedz+Skip objects with unsupported object types.N)r   add_additional_headers_flagadd_continue_on_error_flagadd_object_metadata_flagsadd_precondition_flagsr%   _PRESERVE_POSIX_HELP_TEXT)r*   r?   s     r+   add_cp_mv_rsync_flagsrF      s    ##F+""6*!!&Fv&K  M 	
  
 	
$	   	
8	  r-   c                    U R                  SSSS9  U R                  SSS9  [        XS9  U R                  S	S
S[        S9  U R                  SSSS9  U R                  SSSSS9  [        U SS9  U R	                  SSS9n[        U5        [        U5        U R                  SS[        S9  U R                  SSSSS9  U R                  SSSS9  U R	                  SS9n[        U5        UR                  SS S[        S9  UR                  S!S"S#[        R                  " 5       [        S$9  U R	                  5       n[        R                  " U5        [        R                  " U5        [        R                   " U 5        [        R"                  " U S%S&9  g')(z1Adds flags to cp, mv, or other cp-based commands.source*zThe source path(s) to copy.)nargsr    destinationzThe destination path.)r    r>   z-Az--all-versionsr   r   z--do-not-decompressz6Do not automatically decompress downloaded gzip files.z-Dz--daisy-chaina  Copy in "daisy chain" mode, which means copying an object by first downloading it to the machine where the command is run, then uploading it to the destination bucket. The default mode is a "copy in the cloud," where data is copied without uploading or downloading. During a copy in the cloud, a source composite object remains composite at its destination. However, you can use daisy chain mode to change a composite object into a non-composite object. Note: Daisy chain mode is automatically used when copying between providers.T)r2   zNFlags to influence behavior when handling symlinks. Only one value may be set.)mutexr    z-Lz--manifest-pathz-vz--print-created-messagez7Prints the version-specific URL for each copied object.z-sz--storage-classzSpecify the storage class of the destination object. If not specified, the default storage class of the destination bucket is used. This option is not valid for copying to non-cloud destinations.)rL   z-Zz--gzip-local-allz-zz--gzip-localr!   r"   a  Read the list of resources to copy from stdin. No need to enter a source argument if this flag is present.
Example: "storage cp -I gs://bucket/destination"
 Note: To copy the contents of one file directly from stdin, use "-" as the source argument without the "-I" flag.)r4   N)r%   rF   _ALL_VERSIONS_HELP_TEXTr5   	add_groupr9   r<   _MANIFEST_HELP_TEXTr,   _GZIP_LOCAL_ALL_HELP_TEXTr   r'    _GZIP_LOCAL_EXTENSIONS_HELP_TEXTr   add_predefined_acl_flagadd_preserve_acl_flagadd_encryption_flagsadd_read_paths_from_stdin_flag)r*   r?   symlinks_groupgzip_flags_groupacl_flags_groups        r+   add_cp_and_mv_flagsrY     s   hc0MNm*AB<
\8O  QC  E 	
	   #6tD## $ . >*^,d-4GH
D	  F
 	
O  P %%D%1+,
$	    
 +    $$&/0o.V$&&;	r-   c                 *    U R                  SSSSSS9  g)zAdds flag for copying with recursion.

Not used by mv.

Args:
  parser (parser_arguments.ArgumentInterceptor): Parser passed to surface.
z-Rz-rz--recursiver   zWRecursively copy the contents of any directories that match the source path expression.r   Nr1   r)   s    r+   add_recursion_flagr[   Z  s(     	

%  	r-   c                 V   U R                   (       d  g[        U[        R                  5      (       a%  [        R
                  " SR                  U5      5      e[        U SS5      (       a  [        R
                  " S5      eU H]  n[        R                  " U5      n[        U[        R                  5      (       d  M:  [        R
                  " SR                  U5      5      e   U R                  (       d  [        R
                  " S5      e[        R                  " U R                  U5        g)zGValidates that arguments are consistent with managed folder operations.Nz?Cannot include managed folders with a non-cloud destination: {}read_paths_from_stdinzCannot include managed folders when reading paths from stdin, as this would require storing all paths passed to gcloud storage in memory.z:Cannot include managed folders with a non-cloud source: {}z;Cannot include managed folders unless recursion is enabled.)include_managed_folders
isinstancer   FileUrlr
   Errorformatgetattrstorage_url_from_string	recursiver   raise_error_if_not_gcscommand_path)argsraw_source_urlsraw_destination_url
url_stringurls        r+    validate_include_managed_foldersrm   n  s    
 
	%	%
#[%8%899
,,I	#	$ 
 T*D11
,,	O 
 $j

-
-j
9C#{**++LL
F
M
M  $ 

,,E  $$T%6%68KLr-   c                    U R                   (       a'  U R                  (       a  [        R                  " S5      eU R                  (       a9  [
        R                  R                  5       (       a  [        R                  " S5      e[        U[        R                  5      (       a6  U R                  (       a%  [        R                  " SR                  U5      5      e[        X R                  U5        g)z*Raises errors if invalid flags are passed.z;Cannot specify both generation precondition and no-clobber.z2Symlink preservation is not supported for Windows.z<Cannot specify storage class for a non-cloud destination: {}N)
no_clobberif_generation_matchr
   ra   preserve_symlinksr   OperatingSystem	IsWindowsr_   r   r`   storage_classrb   rm   rH   )rh   rj   s     r+   _validate_argsru     s    	__11
,,E  
	 9 9 C C E E
,,K
LL$k&9&9::

,,FMM	
 
 #46IJr-   c              #   6  #    UR                   (       a  [        R                  " SS5      v   gUR                  (       aD  [        R
                  " S5        [        R                  " U R                  5       nUv   SSS5        gSv   g! , (       d  f       g= f7f)a  Context manager for streams used in streaming downloads.

Warns the user when downloading to a named pipe.

Args:
  args (parser_extensions.Namespace): Flags passed by the user.
  raw_destination_url (storage_url.StorageUrl): The destination of the
    transfer. May contain unexpanded wildcards.

Yields:
  A stream used for downloads, or None if the transfer is not a streaming
  download. The stream is closed by the context manager if it is not stdout.
   wbzEDownloading to a pipe. This command may stall until the pipe is read.N)	is_stdioosfdopen	is_streamr   warningr   BinaryFileWriterrK   )rh   rj   streams      r+   _get_shared_streamr     so      !!
))At
$$KK B C			 0 0	1Vl 
2	1 J 
2	1s   A3B5B:B
BBc                    [         R                  R                  R                  R	                  5       [         R                  R                  R
                  R	                  5       1n[        USS1-
  5      nU R                  (       a  U(       a  [        R                  " S5        gUR                  (       a  U(       a  [        R                  " S5        gUR                  (       a  U(       a  [        R                  " S5        gg)a  Determines whether a a `cp` workload is parallelizable.

Logs warnings if gcloud storage is configured to parallelize workloads, but
doing so is not possible.

Args:
  args (parser_extensions.Namespace): Flags passed by the user.
  raw_destination_url (storage_url.StorageUrl): The destination of the
    transfer. May contain unexpanded wildcards.
  first_source_url (storage_url.StorageUrl): The first source URL passed by
    the user. May contain unexpanded wildcards.

Returns:
  True if the transfer is parallelizable, False otherwise.
Nrw   zUsing sequential instead of parallel task execution. This will maintain version ordering when copying all versions of an object.FzIUsing sequential instead of parallel task execution to write to a stream.zKUsing sequential instead of parallel task execution to transfer from stdin.T)r   VALUESstorageprocess_countGetIntthread_countboolall_versionsr   r}   r|   ry   )rh   rj   first_source_urlparallelism_propertiesrequested_parallelisms        r+   _is_parallelizabler     s    & --446,,335 5q	AB		kkOP ""	kk  	kk * +	r-   c                    UR                   (       a  SnO[        R                  R                  5       n[        R
                  " U [        R                  R                  S9n[        X5       n[        R                  " UU R                  U R                  UU R                  U R                  U R                  UU R                   UUUS9n	U(       a5  ["        R$                  " U	5      n	U	R'                  5       (       a
   SSS5        g[(        R*                  " U	UU[,        R.                  " [,        R0                  R2                  UR4                  S9U R6                  S9sSSS5        $ ! , (       d  f       g= f)zFReturns appropriate exit code after creating and executing copy tasks.N)metadata_type)
custom_md5_digestdelete_sourcedo_not_decompressforce_daisy_chainprint_created_messageshared_streamskip_unsupportedtask_status_queueuser_request_argsfolders_onlyr   )manifest_path)parallelizabler   progress_manager_argscontinue_on_error)ry   r   multiprocessing_contextQueuer   'get_user_request_args_from_command_argsMetadataTypeOBJECTr   r   CopyTaskIteratorrK   content_md5r   daisy_chainr   r   r   PluralityCheckableIteratoris_emptyr   execute_tasksr   ProgressManagerArgsIncrementTypeFILES_AND_BYTESr   r   )
rh   r   r   rj   source_expansion_iteratorr   r   r   r   task_iterators
             r+   _execute_copy_tasksr     s@    !!+CCIIK  GG
7DDKKM  $4&77!**#00**"88#..++!M 2MM
m 
			!	! 1 544 &&%+)==%%55+99
 00	5 544s   +BE#AE##
E1c           	          [         R                  " U R                  [        R                  R
                  [        R                  R                  S[         R                  R                  US9$ )NFmanaged_folder_settingfolder_settingraise_error_for_unmatched_urlsrecursion_requestedurl_found_match_tracker)
r   NameExpansionIteratorrH   r   ManagedFolderSettingLIST_WITHOUT_OBJECTSFolderSettingDO_NOT_LISTRecursionSettingYES)rh   r   s     r+   _get_managed_folder_iteratorr   *  sO    		-	-
kk

*
*
?
? ..::%*(99==5	
 	r-   c           	         U R                   (       aG  [        U[        R                  5      (       a(  UR                  [        R
                  R                  :X  d  gU(       a  U R                  (       d  [        U R                  SS9n[        R                  " 5       n[        R                  " U[        R                  R                   [        R"                  R$                  S[        R&                  R(                  US9n[+        U USUUSS9  [-        U R                  UUUSS9  [        U R                  SS9n[        R                  " 5       n[        R                  " U[        R                  R                   [        R"                  R$                  S[        R&                  R.                  US9n[+        U SSUUSS9  [-        U R                  UUU5        g)a  Handles copies or renames specifically for Folders.

Folders (of HNS buckets) are technically not objects. Hence the usual
copy_object approach does not work for them.
For renaming, while there is a specific API, it only works when renaming
folders in the same bucket and for cross bucket renaming, we still require
folder by folder approach.

Hence, as a first step, in the case of rename only, this method tries to
use the rename_folder API. If its successfully done, we need not handle
individual folders.
However, if that is not possible, or we are in the copy case, we need to
handle things folder by folder and for that we have the second iterator
and which creates a second set of copy tasks.

Args:
  args: The command line arguments.
  delete_source: Boolean indicating if the source should be deleted after the
    copy operation. Pointing to the fact that this is a mv command.
  raw_destination_url: The destination URL.
  url_found_match_tracker: The url found match tracker.
NT)is_rename_foldersFr   )rh   r   r   rj   r   r   )re   r_   r   CloudUrlschemeProviderPrefixGCSr   *_filter_and_modify_source_for_folders_onlyrH   collectionsOrderedDictr   r   r   r   r   r   LIST_AS_FOLDERSr   NOr   5_correct_url_found_match_tracker_for_copy_and_renamesr   )rh   r   rj   r   updated_sourcesfolder_rename_match_trackerr   folder_match_trackers           r+   _copy_or_rename_foldersr   7  s   4 nn
(+*>*>
?
?

$
$(B(B(F(F
F
4++ AtO #."9"9"; . D D*??KK"00@@',*;;>> ;! #/"; :#" ?
kkU/ %002,BB(==II ..>>%*(99==2 - 9 8
kk	r-   c                 h   U  H  nXS;   a  X5   (       a  X5   X%'   UR                  S5      (       d  UR                  S5      (       d  ME  U(       a!  UR                  S5      (       a  USS OUSS nO UR                  S5      (       a  USS OUSS nXa;   d  M  Xc;   d  M  X6   (       d  M  X6   X%'   M     g)a  Corrects the results of url match tracker for copy and renames.

Args:
  original_sources: Original sources given by the user.
  updated_sources: Updated sources after filtering and modifying for folders
    only.
  url_found_match_tracker: The common url found match tracker.
  folders_tracker: The url found match tracker we have created specifically
    for folders feature.
  is_rename_folders: Is the rename folders case.
/**/**/**N)endswith)original_sourcesr   r   folders_trackerr   rl   possible_updated_urls          r+   r   r     s    $ c
/"6%4%9"
||Ecll622	+.<<+=+=s3Bx3s8
 ,/<<+=+=s3Bx3s8 
1"533'6'L$) r-   c                    / nU  H  n[        [        R                  " U5      5      (       d  M)  UR                  S5      (       d  UR                  S5      (       ab  U(       a!  UR                  S5      (       a  USS OUSS nO UR                  S5      (       a  USS OUSS nX@;  a  UR	                  U5        M  M  UR	                  U5        M     U$ )a  Filters and modifies sources urls for the purpose of HNS bucket rename_folder.

We filter out any source URL which is not a GCS URL as rename folders is only
applicable to HNS buckets which is a GCS feature.
Apart from this, if the given URL ends with a **, we change it to a single *
to match the filesystem behaviour.
In case of a regular Linux filesystem, a ** or a * will rename folders under
the given path to the destination. But in case of Gcloud, we would recursively
list all sub-directories under it and try to renma them. This is not required
for rename_folder operations.
Hence, by replacing them with a *, we can simply rename the given sub-folders.

Args:
  sources: List of source URLs given by the user to the command.
  is_rename_folders: Boolean indicating if the operation is for renaming
    folders.

Returns:
  A list of source URLs which are filtered and modified for the purpose of
  rename_folders only operation.
r   r   r   Nr   r   r   )is_gcs_cloud_urlr   rd   r   append)sourcesr   updated_source_listrH   updated_sources        r+   r   r     s    0 fK??GHHu!8!8	(.(=(=6#2;(.(=(=6#2;		&"">2 
'   (  
r-   c           	         / nU R                    H:  n[        [        R                  " U5      5      (       d  M)  UR	                  U5        M<     U(       d  g[
        R                  " U[        R                  R                  [        R                  R                  S[
        R                  R                  US9n[        R                  " U[         R"                  R%                  5       5      $ )a  Helper method to remove folders from HNS buckets.

Removing folders is only applicable for HNS buckets.
In the case where a source is a FileURL, we will see a failure in the
DeleteTaskIteratorFactory as we try to call is_bucket() on a FileURL.
This happens specifically in the case where we use --no-clobber flag and where
the destination already exists. For such cases, we would skip deletion of the
source. So the NameExpansionIterator will contain a FileURL which the
DeleteTaskIteratorFactory will not be able to handle.

Hence, we are skipping a given source if it's not a CloudURL since Folders
are only applicable to CloudURLs (which are GCS) and running any attempt to
find and delete a Folder is of no use on any other type of URL.

Args:
  args: User provided arguments for the command.
  url_found_match_tracker: The common url found match tracker.

Returns:
  Exit code for the operation.
r   Fr   )rH   r   r   rd   r   r   r   r   r   r   r   r   r   r   r   remove_foldersr   r   r   )rh   r   
cloud_urlsrk   folder_expansion_iterators        r+   _remove_foldersr     s    6 *KKj;;JGHH
#   
 ,BB(==II ..>>%*(99==5 
	'	'11779
 r-   c                     [        U [        R                  5      =(       a&    U R                  [        R                  R
                  L $ )zIReturns True if the URL is of type CloudURL and has a GCS ProviderPrefix.)r_   r   r   r   r   r   )rl   s    r+   r   r   +  s6     k**+ 7
**2266
6r-   c                    [         R                  " U R                  5      n[        X5        [        R
                  " U 5        [        R                  " 5       n[        XX#5        U R                  (       a!  [        X5      n[        U SSUUS9nU(       a  U$ [        R                  " [        R                  " U R                   U R"                  5      5      n[         R                  " UR%                  5       5      n['        XU5      nU R(                  (       a  [*        R,                  R.                  n	O[*        R,                  R0                  n	[2        R4                  " UU	U R6                  [8        R:                  R<                  [8        R>                  R@                  [B        RD                  " U 5      U RF                  U RH                  (       a  [2        RJ                  RL                  O[2        RJ                  RN                  US9	n[        U UUUUS9nU(       a  [Q        X5      n
U
S:w  a  U
nU R                  (       a  [2        R4                  " U R                   [8        R:                  RR                  [8        R>                  R<                  S[2        RJ                  RL                  US9n[T        RV                  " U U[X        RZ                  R]                  5       5      nU$ )zCRuns implementation of cp surface with tweaks for similar commands.F)rh   r   r   rj   r   )fields_scopeignore_symlinksr   r   object_staterq   r   r   r   r   )/r   rd   rK   ru   r	   initialize_key_storer   r   r   r^   r   r   r   r   r   get_urls_iterablerH   r]   peekr   preserve_aclr   FieldsScopeFULLNO_ACLr   r   r   r   r   r   r   LIST_AS_PREFIXESr   get_object_state_from_flagsrq   re   r   r   NO_WITH_WARNINGr   r   r   remove_managed_foldersr   r   r   )rh   r   rj   r   r   	exit_coderaw_source_string_iteratorr   r   r   folder_exit_code!managed_folder_expansion_iterators               r+   run_cpr   3  s\   #;;D<L<LM+&&t,'335
.
 
!! <! $/";I   #==

*
*kk455  !88 %%' &
!1. 
((--L((//L,BB **(==II ..??44T:..	 )99==**::5 "!#- 9) &tE1 #i##*8*N*N
++!,!A!A!V!V$22>>).,==AA"9+' "88

+

5
5
;
;
=i 
r-   )F)C__doc__
__future__r   r   r   r   
contextlibrz   googlecloudsdk.api_lib.storager   googlecloudsdk.callioper   r   "googlecloudsdk.command_lib.storager	   r
   r   r   r   r   r   r   r   r   r   (googlecloudsdk.command_lib.storage.tasksr   r   r   +googlecloudsdk.command_lib.storage.tasks.cpr   googlecloudsdk.corer   r   googlecloudsdk.core.utilr   r   rM   r(   r&   rQ   rP   rO   rE   r;   r,   r5   r9   r<   ReleaseTrackGArF   rY   r[   rm   ru   contextmanagerr   r   r   r   r   r   r   r   r   r    r-   r+   <module>r     sW  
 '  '   	 4 / ( > 5 : 4 : = K > = : H B H @ J # * * . ( $!C $K  "$  (   $"!H	 150A0A0D0D "J /3.?.?.B.B L^("MJK(  2.n 5p
kf &MT  %&R1h\r-   