MCPcopy Create free account
hub / github.com/aws/aws-cli / copy

Method copy

awscli/s3transfer/manager.py:399–460  ·  view source on GitHub ↗

Copies a file in S3 :type copy_source: dict :param copy_source: The name of the source bucket, key name of the source object, and optional version ID of the source object. The dictionary format is: ``{'Bucket': 'bucket', 'Key': 'key', 'VersionId':

(
        self,
        copy_source,
        bucket,
        key,
        extra_args=None,
        subscribers=None,
        source_client=None,
    )

Source from the content-addressed store, hash-verified

397 )
398
399 def copy(
400 self,
401 copy_source,
402 bucket,
403 key,
404 extra_args=None,
405 subscribers=None,
406 source_client=None,
407 ):
408 """Copies a file in S3
409
410 :type copy_source: dict
411 :param copy_source: The name of the source bucket, key name of the
412 source object, and optional version ID of the source object. The
413 dictionary format is:
414 ``{'Bucket': 'bucket', 'Key': 'key', 'VersionId': 'id'}``. Note
415 that the ``VersionId`` key is optional and may be omitted.
416
417 :type bucket: str
418 :param bucket: The name of the bucket to copy to
419
420 :type key: str
421 :param key: The name of the key to copy to
422
423 :type extra_args: dict
424 :param extra_args: Extra arguments that may be passed to the
425 client operation
426
427 :type subscribers: a list of subscribers
428 :param subscribers: The list of subscribers to be invoked in the
429 order provided based on the event emit during the process of
430 the transfer request.
431
432 :type source_client: botocore or boto3 Client
433 :param source_client: The client to be used for operation that
434 may happen at the source object. For example, this client is
435 used for the head_object that determines the size of the copy.
436 If no client is provided, the transfer manager's client is used
437 as the client for the source object.
438
439 :rtype: s3transfer.futures.TransferFuture
440 :returns: Transfer future representing the copy
441 """
442 if extra_args is None:
443 extra_args = {}
444 if subscribers is None:
445 subscribers = []
446 if source_client is None:
447 source_client = self._client
448 self._validate_all_known_args(extra_args, self.ALLOWED_COPY_ARGS)
449 if isinstance(copy_source, dict):
450 self._validate_if_bucket_supported(copy_source.get('Bucket'))
451 self._validate_if_bucket_supported(bucket)
452 call_args = CallArgs(
453 copy_source=copy_source,
454 bucket=bucket,
455 key=key,
456 extra_args=extra_args,

Callers 5

associated_futuresMethod · 0.45
_get_all_main_kwargsMethod · 0.45
uploadMethod · 0.45

Calls 4

_submit_transferMethod · 0.95
CallArgsClass · 0.90

Tested by

no test coverage detected