Skip to content

Commit

Permalink
feat(client-s3): Add support for conditional deletes for the S3 Delet…
Browse files Browse the repository at this point in the history
…eObject and DeleteObjects APIs. Add support for write offset bytes option used to append to objects with the S3 PutObject API.
  • Loading branch information
awstools committed Nov 21, 2024
1 parent 576ea4e commit d5b27f3
Show file tree
Hide file tree
Showing 99 changed files with 3,069 additions and 1,932 deletions.
29 changes: 16 additions & 13 deletions clients/client-s3/src/commands/AbortMultipartUploadCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,24 @@ export interface AbortMultipartUploadCommandOutput extends AbortMultipartUploadO
* to abort a given multipart upload multiple times in order to completely free all storage
* consumed by all parts. </p>
* <p>To verify that all parts have been removed and prevent getting charged for the part
* storage, you should call the <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListParts.html">ListParts</a> API operation and ensure that
* the parts list is empty.</p>
* storage, you should call the <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListParts.html">ListParts</a> API operation and ensure
* that the parts list is empty.</p>
* <note>
* <ul>
* <li>
* <p>
* <b>Directory buckets</b> -
* If multipart uploads in a directory bucket are in progress, you can't delete the bucket until all the in-progress multipart uploads are aborted or completed.
* To delete these in-progress multipart uploads, use the
* <code>ListMultipartUploads</code> operation to list the in-progress multipart
* uploads in the bucket and use the <code>AbortMultipartUpload</code> operation to
* abort all the in-progress multipart uploads.
* </p>
* <b>Directory buckets</b> - If multipart
* uploads in a directory bucket are in progress, you can't delete the bucket until
* all the in-progress multipart uploads are aborted or completed. To delete these
* in-progress multipart uploads, use the <code>ListMultipartUploads</code> operation
* to list the in-progress multipart uploads in the bucket and use the
* <code>AbortMultipartUpload</code> operation to abort all the in-progress
* multipart uploads. </p>
* </li>
* <li>
* <p>
* <b>Directory buckets</b> - For directory buckets, you must make requests for this API operation to the Zonal endpoint. These endpoints support virtual-hosted-style requests in the format <code>https://<i>bucket_name</i>.s3express-<i>az_id</i>.<i>region</i>.amazonaws.com/<i>key-name</i>
* <b>Directory buckets</b> -
* For directory buckets, you must make requests for this API operation to the Zonal endpoint. These endpoints support virtual-hosted-style requests in the format <code>https://<i>bucket_name</i>.s3express-<i>az_id</i>.<i>region</i>.amazonaws.com/<i>key-name</i>
* </code>. Path-style requests are not supported. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-express-Regions-and-Zones.html">Regional and Zonal endpoints</a> in the
* <i>Amazon S3 User Guide</i>.</p>
* </li>
Expand All @@ -64,9 +65,10 @@ export interface AbortMultipartUploadCommandOutput extends AbortMultipartUploadO
* <ul>
* <li>
* <p>
* <b>General purpose bucket permissions</b> - For information about permissions required to use the multipart upload, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html">Multipart Upload
* and Permissions</a> in the <i>Amazon S3
* User Guide</i>.</p>
* <b>General purpose bucket permissions</b> - For
* information about permissions required to use the multipart upload, see
* <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html">Multipart Upload and
* Permissions</a> in the <i>Amazon S3 User Guide</i>.</p>
* </li>
* <li>
* <p>
Expand Down Expand Up @@ -126,6 +128,7 @@ export interface AbortMultipartUploadCommandOutput extends AbortMultipartUploadO
* UploadId: "STRING_VALUE", // required
* RequestPayer: "requester",
* ExpectedBucketOwner: "STRING_VALUE",
* IfMatchInitiatedTime: new Date("TIMESTAMP"),
* };
* const command = new AbortMultipartUploadCommand(input);
* const response = await client.send(command);
Expand Down
89 changes: 47 additions & 42 deletions clients/client-s3/src/commands/CompleteMultipartUploadCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,41 +37,44 @@ export interface CompleteMultipartUploadCommandOutput extends CompleteMultipartU
/**
* <p>Completes a multipart upload by assembling previously uploaded parts.</p>
* <p>You first initiate the multipart upload and then upload all parts using the <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPart.html">UploadPart</a>
* operation or the <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPartCopy.html">UploadPartCopy</a>
* operation. After successfully uploading all relevant parts of an upload, you call this
* <code>CompleteMultipartUpload</code> operation to complete the upload. Upon receiving this request, Amazon S3 concatenates all the parts
* in ascending order by part number to create a new object. In the CompleteMultipartUpload
* request, you must provide the parts list and ensure that the parts list is complete.
* The CompleteMultipartUpload API operation concatenates the parts that you provide in the list. For each part in the list,
* you must provide the <code>PartNumber</code> value and the <code>ETag</code> value that are returned after that part
* was uploaded.</p>
* operation or the <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPartCopy.html">UploadPartCopy</a> operation.
* After successfully uploading all relevant parts of an upload, you call this
* <code>CompleteMultipartUpload</code> operation to complete the upload. Upon receiving
* this request, Amazon S3 concatenates all the parts in ascending order by part number to create a
* new object. In the CompleteMultipartUpload request, you must provide the parts list and
* ensure that the parts list is complete. The CompleteMultipartUpload API operation
* concatenates the parts that you provide in the list. For each part in the list, you must
* provide the <code>PartNumber</code> value and the <code>ETag</code> value that are returned
* after that part was uploaded.</p>
* <p>The processing of a CompleteMultipartUpload request could take several minutes to
* finalize. After Amazon S3 begins processing the request, it sends an HTTP response header that
* specifies a <code>200 OK</code> response. While processing is in progress, Amazon S3 periodically sends white
* space characters to keep the connection from timing out. A request could fail after the
* initial <code>200 OK</code> response has been sent. This means that a <code>200 OK</code> response can
* contain either a success or an error. The error response might be embedded in the <code>200 OK</code> response.
* If you call this API operation directly, make sure to design
* your application to parse the contents of the response and handle it appropriately. If you
* use Amazon Web Services SDKs, SDKs handle this condition. The SDKs detect the embedded error and apply
* error handling per your configuration settings (including automatically retrying the
* request as appropriate). If the condition persists, the SDKs throw an exception (or, for
* the SDKs that don't use exceptions, they return an error). </p>
* specifies a <code>200 OK</code> response. While processing is in progress, Amazon S3
* periodically sends white space characters to keep the connection from timing out. A request
* could fail after the initial <code>200 OK</code> response has been sent. This means that a
* <code>200 OK</code> response can contain either a success or an error. The error
* response might be embedded in the <code>200 OK</code> response. If you call this API
* operation directly, make sure to design your application to parse the contents of the
* response and handle it appropriately. If you use Amazon Web Services SDKs, SDKs handle this condition.
* The SDKs detect the embedded error and apply error handling per your configuration settings
* (including automatically retrying the request as appropriate). If the condition persists,
* the SDKs throw an exception (or, for the SDKs that don't use exceptions, they return an
* error). </p>
* <p>Note that if <code>CompleteMultipartUpload</code> fails, applications should be prepared
* to retry any failed requests (including 500 error responses). For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/ErrorBestPractices.html">Amazon S3 Error Best
* Practices</a>.</p>
* to retry any failed requests (including 500 error responses). For more information, see
* <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/ErrorBestPractices.html">Amazon S3 Error
* Best Practices</a>.</p>
* <important>
* <p>You can't use <code>Content-Type: application/x-www-form-urlencoded</code> for the
* CompleteMultipartUpload requests. Also, if you don't provide a
* <code>Content-Type</code> header, <code>CompleteMultipartUpload</code> can still return a <code>200
* OK</code> response.</p>
* CompleteMultipartUpload requests. Also, if you don't provide a <code>Content-Type</code>
* header, <code>CompleteMultipartUpload</code> can still return a <code>200 OK</code>
* response.</p>
* </important>
* <p>For more information about multipart uploads, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/uploadobjusingmpu.html">Uploading Objects Using Multipart
* Upload</a> in the <i>Amazon S3
* User Guide</i>.</p>
* Upload</a> in the <i>Amazon S3 User Guide</i>.</p>
* <note>
* <p>
* <b>Directory buckets</b> - For directory buckets, you must make requests for this API operation to the Zonal endpoint. These endpoints support virtual-hosted-style requests in the format <code>https://<i>bucket_name</i>.s3express-<i>az_id</i>.<i>region</i>.amazonaws.com/<i>key-name</i>
* <b>Directory buckets</b> -
* For directory buckets, you must make requests for this API operation to the Zonal endpoint. These endpoints support virtual-hosted-style requests in the format <code>https://<i>bucket_name</i>.s3express-<i>az_id</i>.<i>region</i>.amazonaws.com/<i>key-name</i>
* </code>. Path-style requests are not supported. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-express-Regions-and-Zones.html">Regional and Zonal endpoints</a> in the
* <i>Amazon S3 User Guide</i>.</p>
* </note>
Expand All @@ -86,10 +89,10 @@ export interface CompleteMultipartUploadCommandOutput extends CompleteMultipartU
* <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html">Multipart Upload and
* Permissions</a> in the <i>Amazon S3 User Guide</i>.</p>
* <p>If you provide an <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_Checksum.html">additional checksum
* value</a> in your <code>MultipartUpload</code> requests and the
* value</a> in your <code>MultipartUpload</code> requests and the
* object is encrypted with Key Management Service, you must have permission to use the
* <code>kms:Decrypt</code> action for the
* <code>CompleteMultipartUpload</code> request to succeed.</p>
* <code>kms:Decrypt</code> action for the
* <code>CompleteMultipartUpload</code> request to succeed.</p>
* </li>
* <li>
* <p>
Expand All @@ -99,9 +102,10 @@ export interface CompleteMultipartUploadCommandOutput extends CompleteMultipartU
* Amazon Web Services CLI or SDKs create session and refresh the session token automatically to avoid service interruptions when a session expires. For more information about authorization, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateSession.html">
* <code>CreateSession</code>
* </a>.</p>
* <p>If the object is encrypted with
* SSE-KMS, you must also have the
* <code>kms:GenerateDataKey</code> and <code>kms:Decrypt</code> permissions in IAM identity-based policies and KMS key policies for the KMS key.</p>
* <p>If the object is encrypted with SSE-KMS, you must also have the
* <code>kms:GenerateDataKey</code> and <code>kms:Decrypt</code> permissions
* in IAM identity-based policies and KMS key policies for the KMS
* key.</p>
* </li>
* </ul>
* </dd>
Expand All @@ -113,8 +117,9 @@ export interface CompleteMultipartUploadCommandOutput extends CompleteMultipartU
* </p>
* <ul>
* <li>
* <p>Description: Your proposed upload is smaller than the minimum allowed object
* size. Each part must be at least 5 MB in size, except the last part.</p>
* <p>Description: Your proposed upload is smaller than the minimum
* allowed object size. Each part must be at least 5 MB in size, except
* the last part.</p>
* </li>
* <li>
* <p>HTTP Status Code: 400 Bad Request</p>
Expand All @@ -126,9 +131,9 @@ export interface CompleteMultipartUploadCommandOutput extends CompleteMultipartU
* </p>
* <ul>
* <li>
* <p>Description: One or more of the specified parts could not be found. The part
* might not have been uploaded, or the specified ETag might not have
* matched the uploaded part's ETag.</p>
* <p>Description: One or more of the specified parts could not be found.
* The part might not have been uploaded, or the specified ETag might not
* have matched the uploaded part's ETag.</p>
* </li>
* <li>
* <p>HTTP Status Code: 400 Bad Request</p>
Expand All @@ -140,8 +145,8 @@ export interface CompleteMultipartUploadCommandOutput extends CompleteMultipartU
* </p>
* <ul>
* <li>
* <p>Description: The list of parts was not in ascending order. The parts list
* must be specified in order by part number.</p>
* <p>Description: The list of parts was not in ascending order. The
* parts list must be specified in order by part number.</p>
* </li>
* <li>
* <p>HTTP Status Code: 400 Bad Request</p>
Expand All @@ -153,9 +158,9 @@ export interface CompleteMultipartUploadCommandOutput extends CompleteMultipartU
* </p>
* <ul>
* <li>
* <p>Description: The specified multipart upload does not exist. The upload ID
* might be invalid, or the multipart upload might have been aborted or
* completed.</p>
* <p>Description: The specified multipart upload does not exist. The
* upload ID might be invalid, or the multipart upload might have been
* aborted or completed.</p>
* </li>
* <li>
* <p>HTTP Status Code: 404 Not Found</p>
Expand Down
Loading

0 comments on commit d5b27f3

Please sign in to comment.