You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.
Class: Aws::S3::MultipartUploadPart
- Inherits:
-
Resources::Resource
- Object
- Resources::Resource
- Aws::S3::MultipartUploadPart
- Defined in:
- (unknown)
Instance Attribute Summary collapse
-
#bucket_name ⇒ String
readonly
-
#etag ⇒ String
readonly
Entity tag returned when the part was uploaded.
-
#last_modified ⇒ Time
readonly
Date and time at which the part was uploaded.
-
#multipart_upload_id ⇒ String
readonly
-
#object_key ⇒ String
readonly
-
#part_number ⇒ String
readonly
-
#size ⇒ Integer
readonly
Size in bytes of the uploaded part data.
Attributes inherited from Resources::Resource
Instance Method Summary collapse
-
#copy_from(options = {}) ⇒ Types::UploadPartCopyOutput
Uploads a part by copying data from an existing object as data source.
-
#initialize ⇒ Object
constructor
-
#multipart_upload ⇒ MultipartUpload
-
#upload(options = {}) ⇒ Types::UploadPartOutput
Uploads a part in a multipart upload.
In this operation, you provide part data in your request.
Methods inherited from Resources::Resource
add_data_attribute, add_identifier, #data, data_attributes, #data_loaded?, identifiers, #load, #wait_until
Methods included from Resources::OperationMethods
#add_batch_operation, #add_operation, #batch_operation, #batch_operation_names, #batch_operations, #operation, #operation_names, #operations
Constructor Details
Instance Attribute Details
#bucket_name ⇒ String (readonly)
#etag ⇒ String (readonly)
Entity tag returned when the part was uploaded.
#last_modified ⇒ Time (readonly)
Date and time at which the part was uploaded.
#multipart_upload_id ⇒ String (readonly)
#object_key ⇒ String (readonly)
#part_number ⇒ String (readonly)
#size ⇒ Integer (readonly)
Size in bytes of the uploaded part data.
Instance Method Details
#copy_from(options = {}) ⇒ Types::UploadPartCopyOutput
Uploads a part by copying data from an existing object as data source. You specify the data source by adding the request header x-amz-copy-source
in your request and a byte range by adding the request header x-amz-copy-source-range
in your request.
The minimum allowable part size for a multipart upload is 5 MB. For more information about multipart upload limits, go to Quick Facts in the Amazon Simple Storage Service Developer Guide.
Instead of using an existing object as part data, you might use the UploadPart operation and provide data in your request.
You must initiate a multipart upload before you can upload any part. In response to your initiate request. Amazon S3 returns a unique identifier, the upload ID, that you must include in your upload part request.
For more information about using the UploadPartCopy
operation, see the following:
-
For conceptual information about multipart uploads, see Uploading Objects Using Multipart Upload in the Amazon Simple Storage Service Developer Guide.
-
For information about permissions required to use the multipart upload API, see Multipart Upload API and Permissions in the Amazon Simple Storage Service Developer Guide.
-
For information about copying objects using a single atomic operation vs. the multipart upload, see Operations on Objects in the Amazon Simple Storage Service Developer Guide.
-
For information about using server-side encryption with customer-provided encryption keys with the UploadPartCopy operation, see CopyObject and UploadPart.
Note the following additional considerations about the request headers x-amz-copy-source-if-match
, x-amz-copy-source-if-none-match
, x-amz-copy-source-if-unmodified-since
, and x-amz-copy-source-if-modified-since
:
-
Consideration 1 - If both of the
x-amz-copy-source-if-match
andx-amz-copy-source-if-unmodified-since
headers are present in the request as follows:x-amz-copy-source-if-match
condition evaluates totrue
, and;x-amz-copy-source-if-unmodified-since
condition evaluates tofalse
;Amazon S3 returns
200 OK
and copies the data. -
Consideration 2 - If both of the
x-amz-copy-source-if-none-match
andx-amz-copy-source-if-modified-since
headers are present in the request as follows:x-amz-copy-source-if-none-match
condition evaluates tofalse
, and;x-amz-copy-source-if-modified-since
condition evaluates totrue
;Amazon S3 returns
412 Precondition Failed
response code.
Versioning
If your bucket has versioning enabled, you could have multiple versions of the same object. By default, x-amz-copy-source
identifies the current version of the object to copy. If the current version is a delete marker and you don't specify a versionId in the x-amz-copy-source
, Amazon S3 returns a 404 error, because the object does not exist. If you specify versionId in the x-amz-copy-source
and the versionId is a delete marker, Amazon S3 returns an HTTP 400 error, because you are not allowed to specify a delete marker as a version for the x-amz-copy-source
.
You can optionally specify a specific version of the source object to copy by adding the versionId
subresource as shown in the following example:
x-amz-copy-source: /bucket/object?versionId=version id
Special Errors
-
-
Code: NoSuchUpload
-
Cause: The specified multipart upload does not exist. The upload ID might be invalid, or the multipart upload might have been aborted or completed.
-
HTTP Status Code: 404 Not Found
-
-
-
Code: InvalidRequest
-
Cause: The specified copy source is not supported as a byte-range copy source.
-
HTTP Status Code: 400 Bad Request
-
Related Resources
#multipart_upload ⇒ MultipartUpload
#upload(options = {}) ⇒ Types::UploadPartOutput
Uploads a part in a multipart upload.
In this operation, you provide part data in your request. However, you have an option to specify your existing Amazon S3 object as a data source for the part you are uploading. To upload a part from an existing object, you use the UploadPartCopy operation.
You must initiate a multipart upload (see CreateMultipartUpload) before you can upload any part. In response to your initiate request, Amazon S3 returns an upload ID, a unique identifier, that you must include in your upload part request.
Part numbers can be any number from 1 to 10,000, inclusive. A part number uniquely identifies a part and also defines its position within the object being created. If you upload a new part using the same part number that was used with a previous part, the previously uploaded part is overwritten. Each part must be at least 5 MB in size, except the last part. There is no size limit on the last part of your multipart upload.
To ensure that data is not corrupted when traversing the network, specify the Content-MD5
header in the upload part request. Amazon S3 checks the part data against the provided MD5 value. If they do not match, Amazon S3 returns an error.
If the upload request is signed with Signature Version 4, then AWS S3 uses the x-amz-content-sha256
header as a checksum instead of Content-MD5
. For more information see Authenticating Requests: Using the Authorization Header (AWS Signature Version 4).
Note: After you initiate multipart upload and upload one or more parts, you must either complete or abort multipart upload in order to stop getting charged for storage of the uploaded parts. Only after you either complete or abort multipart upload, Amazon S3 frees up the parts storage and stops charging you for the parts storage.
For more information on multipart uploads, go to Multipart Upload Overview in the Amazon Simple Storage Service Developer Guide .
For information on the permissions required to use the multipart upload API, go to Multipart Upload API and Permissions in the Amazon Simple Storage Service Developer Guide.
You can optionally request server-side encryption where Amazon S3 encrypts your data as it writes it to disks in its data centers and decrypts it for you when you access it. You have the option of providing your own encryption key, or you can use the AWS managed encryption keys. If you choose to provide your own encryption key, the request headers you provide in the request must match the headers you used in the request to initiate the upload by using CreateMultipartUpload. For more information, go to Using Server-Side Encryption in the Amazon Simple Storage Service Developer Guide.
Server-side encryption is supported by the S3 Multipart Upload actions. Unless you are using a customer-provided encryption key, you don't need to specify the encryption parameters in each UploadPart request. Instead, you only need to specify the server-side encryption parameters in the initial Initiate Multipart request. For more information, see CreateMultipartUpload.
If you requested server-side encryption using a customer-provided encryption key in your initiate multipart upload request, you must provide identical encryption information in each part upload using the following headers.
-
x-amz-server-side-encryption-customer-algorithm
-
x-amz-server-side-encryption-customer-key
-
x-amz-server-side-encryption-customer-key-MD5
Special Errors
-
-
Code: NoSuchUpload
-
Cause: The specified multipart upload does not exist. The upload ID might be invalid, or the multipart upload might have been aborted or completed.
-
HTTP Status Code: 404 Not Found
-
SOAP Fault Code Prefix: Client
-
Related Resources