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

Function handle_copy_source_param

awscli/botocore/handlers.py:378–402  ·  view source on GitHub ↗

Convert CopySource param for CopyObject/UploadPartCopy. This handler will deal with two cases: * CopySource provided as a string. We'll make a best effort to URL encode the key name as required. This will require parsing the bucket and version id from the CopySour

(params, **kwargs)

Source from the content-addressed store, hash-verified

376
377
378def handle_copy_source_param(params, **kwargs):
379 """Convert CopySource param for CopyObject/UploadPartCopy.
380
381 This handler will deal with two cases:
382
383 * CopySource provided as a string. We'll make a best effort
384 to URL encode the key name as required. This will require
385 parsing the bucket and version id from the CopySource value
386 and only encoding the key.
387 * CopySource provided as a dict. In this case we're
388 explicitly given the Bucket, Key, and VersionId so we're
389 able to encode the key and ensure this value is serialized
390 and correctly sent to S3.
391
392 """
393 source = params.get('CopySource')
394 if source is None:
395 # The call will eventually fail but we'll let the
396 # param validator take care of this. It will
397 # give a better error message.
398 return
399 if isinstance(source, str):
400 params['CopySource'] = _quote_source_header(source)
401 elif isinstance(source, dict):
402 params['CopySource'] = _quote_source_header_from_dict(source)
403
404
405def _quote_source_header_from_dict(source_dict):

Callers

nothing calls this directly

Calls 2

_quote_source_headerFunction · 0.85

Tested by

no test coverage detected