UNPKG

@aws-sdk/client-s3

Version:

AWS SDK for JavaScript S3 Client for Node.js, Browser and React Native

1,008 lines (1,003 loc) 415 kB
import { S3Client } from "./S3Client"; import { AbortMultipartUploadCommand, AbortMultipartUploadCommandInput, AbortMultipartUploadCommandOutput, } from "./commands/AbortMultipartUploadCommand"; import { CompleteMultipartUploadCommand, CompleteMultipartUploadCommandInput, CompleteMultipartUploadCommandOutput, } from "./commands/CompleteMultipartUploadCommand"; import { CopyObjectCommand, CopyObjectCommandInput, CopyObjectCommandOutput } from "./commands/CopyObjectCommand"; import { CreateBucketCommand, CreateBucketCommandInput, CreateBucketCommandOutput, } from "./commands/CreateBucketCommand"; import { CreateMultipartUploadCommand, CreateMultipartUploadCommandInput, CreateMultipartUploadCommandOutput, } from "./commands/CreateMultipartUploadCommand"; import { DeleteBucketAnalyticsConfigurationCommand, DeleteBucketAnalyticsConfigurationCommandInput, DeleteBucketAnalyticsConfigurationCommandOutput, } from "./commands/DeleteBucketAnalyticsConfigurationCommand"; import { DeleteBucketCommand, DeleteBucketCommandInput, DeleteBucketCommandOutput, } from "./commands/DeleteBucketCommand"; import { DeleteBucketCorsCommand, DeleteBucketCorsCommandInput, DeleteBucketCorsCommandOutput, } from "./commands/DeleteBucketCorsCommand"; import { DeleteBucketEncryptionCommand, DeleteBucketEncryptionCommandInput, DeleteBucketEncryptionCommandOutput, } from "./commands/DeleteBucketEncryptionCommand"; import { DeleteBucketIntelligentTieringConfigurationCommand, DeleteBucketIntelligentTieringConfigurationCommandInput, DeleteBucketIntelligentTieringConfigurationCommandOutput, } from "./commands/DeleteBucketIntelligentTieringConfigurationCommand"; import { DeleteBucketInventoryConfigurationCommand, DeleteBucketInventoryConfigurationCommandInput, DeleteBucketInventoryConfigurationCommandOutput, } from "./commands/DeleteBucketInventoryConfigurationCommand"; import { DeleteBucketLifecycleCommand, DeleteBucketLifecycleCommandInput, DeleteBucketLifecycleCommandOutput, } from "./commands/DeleteBucketLifecycleCommand"; import { DeleteBucketMetricsConfigurationCommand, DeleteBucketMetricsConfigurationCommandInput, DeleteBucketMetricsConfigurationCommandOutput, } from "./commands/DeleteBucketMetricsConfigurationCommand"; import { DeleteBucketOwnershipControlsCommand, DeleteBucketOwnershipControlsCommandInput, DeleteBucketOwnershipControlsCommandOutput, } from "./commands/DeleteBucketOwnershipControlsCommand"; import { DeleteBucketPolicyCommand, DeleteBucketPolicyCommandInput, DeleteBucketPolicyCommandOutput, } from "./commands/DeleteBucketPolicyCommand"; import { DeleteBucketReplicationCommand, DeleteBucketReplicationCommandInput, DeleteBucketReplicationCommandOutput, } from "./commands/DeleteBucketReplicationCommand"; import { DeleteBucketTaggingCommand, DeleteBucketTaggingCommandInput, DeleteBucketTaggingCommandOutput, } from "./commands/DeleteBucketTaggingCommand"; import { DeleteBucketWebsiteCommand, DeleteBucketWebsiteCommandInput, DeleteBucketWebsiteCommandOutput, } from "./commands/DeleteBucketWebsiteCommand"; import { DeleteObjectCommand, DeleteObjectCommandInput, DeleteObjectCommandOutput, } from "./commands/DeleteObjectCommand"; import { DeleteObjectTaggingCommand, DeleteObjectTaggingCommandInput, DeleteObjectTaggingCommandOutput, } from "./commands/DeleteObjectTaggingCommand"; import { DeleteObjectsCommand, DeleteObjectsCommandInput, DeleteObjectsCommandOutput, } from "./commands/DeleteObjectsCommand"; import { DeletePublicAccessBlockCommand, DeletePublicAccessBlockCommandInput, DeletePublicAccessBlockCommandOutput, } from "./commands/DeletePublicAccessBlockCommand"; import { GetBucketAccelerateConfigurationCommand, GetBucketAccelerateConfigurationCommandInput, GetBucketAccelerateConfigurationCommandOutput, } from "./commands/GetBucketAccelerateConfigurationCommand"; import { GetBucketAclCommand, GetBucketAclCommandInput, GetBucketAclCommandOutput, } from "./commands/GetBucketAclCommand"; import { GetBucketAnalyticsConfigurationCommand, GetBucketAnalyticsConfigurationCommandInput, GetBucketAnalyticsConfigurationCommandOutput, } from "./commands/GetBucketAnalyticsConfigurationCommand"; import { GetBucketCorsCommand, GetBucketCorsCommandInput, GetBucketCorsCommandOutput, } from "./commands/GetBucketCorsCommand"; import { GetBucketEncryptionCommand, GetBucketEncryptionCommandInput, GetBucketEncryptionCommandOutput, } from "./commands/GetBucketEncryptionCommand"; import { GetBucketIntelligentTieringConfigurationCommand, GetBucketIntelligentTieringConfigurationCommandInput, GetBucketIntelligentTieringConfigurationCommandOutput, } from "./commands/GetBucketIntelligentTieringConfigurationCommand"; import { GetBucketInventoryConfigurationCommand, GetBucketInventoryConfigurationCommandInput, GetBucketInventoryConfigurationCommandOutput, } from "./commands/GetBucketInventoryConfigurationCommand"; import { GetBucketLifecycleConfigurationCommand, GetBucketLifecycleConfigurationCommandInput, GetBucketLifecycleConfigurationCommandOutput, } from "./commands/GetBucketLifecycleConfigurationCommand"; import { GetBucketLocationCommand, GetBucketLocationCommandInput, GetBucketLocationCommandOutput, } from "./commands/GetBucketLocationCommand"; import { GetBucketLoggingCommand, GetBucketLoggingCommandInput, GetBucketLoggingCommandOutput, } from "./commands/GetBucketLoggingCommand"; import { GetBucketMetricsConfigurationCommand, GetBucketMetricsConfigurationCommandInput, GetBucketMetricsConfigurationCommandOutput, } from "./commands/GetBucketMetricsConfigurationCommand"; import { GetBucketNotificationConfigurationCommand, GetBucketNotificationConfigurationCommandInput, GetBucketNotificationConfigurationCommandOutput, } from "./commands/GetBucketNotificationConfigurationCommand"; import { GetBucketOwnershipControlsCommand, GetBucketOwnershipControlsCommandInput, GetBucketOwnershipControlsCommandOutput, } from "./commands/GetBucketOwnershipControlsCommand"; import { GetBucketPolicyCommand, GetBucketPolicyCommandInput, GetBucketPolicyCommandOutput, } from "./commands/GetBucketPolicyCommand"; import { GetBucketPolicyStatusCommand, GetBucketPolicyStatusCommandInput, GetBucketPolicyStatusCommandOutput, } from "./commands/GetBucketPolicyStatusCommand"; import { GetBucketReplicationCommand, GetBucketReplicationCommandInput, GetBucketReplicationCommandOutput, } from "./commands/GetBucketReplicationCommand"; import { GetBucketRequestPaymentCommand, GetBucketRequestPaymentCommandInput, GetBucketRequestPaymentCommandOutput, } from "./commands/GetBucketRequestPaymentCommand"; import { GetBucketTaggingCommand, GetBucketTaggingCommandInput, GetBucketTaggingCommandOutput, } from "./commands/GetBucketTaggingCommand"; import { GetBucketVersioningCommand, GetBucketVersioningCommandInput, GetBucketVersioningCommandOutput, } from "./commands/GetBucketVersioningCommand"; import { GetBucketWebsiteCommand, GetBucketWebsiteCommandInput, GetBucketWebsiteCommandOutput, } from "./commands/GetBucketWebsiteCommand"; import { GetObjectAclCommand, GetObjectAclCommandInput, GetObjectAclCommandOutput, } from "./commands/GetObjectAclCommand"; import { GetObjectCommand, GetObjectCommandInput, GetObjectCommandOutput } from "./commands/GetObjectCommand"; import { GetObjectLegalHoldCommand, GetObjectLegalHoldCommandInput, GetObjectLegalHoldCommandOutput, } from "./commands/GetObjectLegalHoldCommand"; import { GetObjectLockConfigurationCommand, GetObjectLockConfigurationCommandInput, GetObjectLockConfigurationCommandOutput, } from "./commands/GetObjectLockConfigurationCommand"; import { GetObjectRetentionCommand, GetObjectRetentionCommandInput, GetObjectRetentionCommandOutput, } from "./commands/GetObjectRetentionCommand"; import { GetObjectTaggingCommand, GetObjectTaggingCommandInput, GetObjectTaggingCommandOutput, } from "./commands/GetObjectTaggingCommand"; import { GetObjectTorrentCommand, GetObjectTorrentCommandInput, GetObjectTorrentCommandOutput, } from "./commands/GetObjectTorrentCommand"; import { GetPublicAccessBlockCommand, GetPublicAccessBlockCommandInput, GetPublicAccessBlockCommandOutput, } from "./commands/GetPublicAccessBlockCommand"; import { HeadBucketCommand, HeadBucketCommandInput, HeadBucketCommandOutput } from "./commands/HeadBucketCommand"; import { HeadObjectCommand, HeadObjectCommandInput, HeadObjectCommandOutput } from "./commands/HeadObjectCommand"; import { ListBucketAnalyticsConfigurationsCommand, ListBucketAnalyticsConfigurationsCommandInput, ListBucketAnalyticsConfigurationsCommandOutput, } from "./commands/ListBucketAnalyticsConfigurationsCommand"; import { ListBucketIntelligentTieringConfigurationsCommand, ListBucketIntelligentTieringConfigurationsCommandInput, ListBucketIntelligentTieringConfigurationsCommandOutput, } from "./commands/ListBucketIntelligentTieringConfigurationsCommand"; import { ListBucketInventoryConfigurationsCommand, ListBucketInventoryConfigurationsCommandInput, ListBucketInventoryConfigurationsCommandOutput, } from "./commands/ListBucketInventoryConfigurationsCommand"; import { ListBucketMetricsConfigurationsCommand, ListBucketMetricsConfigurationsCommandInput, ListBucketMetricsConfigurationsCommandOutput, } from "./commands/ListBucketMetricsConfigurationsCommand"; import { ListBucketsCommand, ListBucketsCommandInput, ListBucketsCommandOutput } from "./commands/ListBucketsCommand"; import { ListMultipartUploadsCommand, ListMultipartUploadsCommandInput, ListMultipartUploadsCommandOutput, } from "./commands/ListMultipartUploadsCommand"; import { ListObjectVersionsCommand, ListObjectVersionsCommandInput, ListObjectVersionsCommandOutput, } from "./commands/ListObjectVersionsCommand"; import { ListObjectsCommand, ListObjectsCommandInput, ListObjectsCommandOutput } from "./commands/ListObjectsCommand"; import { ListObjectsV2Command, ListObjectsV2CommandInput, ListObjectsV2CommandOutput, } from "./commands/ListObjectsV2Command"; import { ListPartsCommand, ListPartsCommandInput, ListPartsCommandOutput } from "./commands/ListPartsCommand"; import { PutBucketAccelerateConfigurationCommand, PutBucketAccelerateConfigurationCommandInput, PutBucketAccelerateConfigurationCommandOutput, } from "./commands/PutBucketAccelerateConfigurationCommand"; import { PutBucketAclCommand, PutBucketAclCommandInput, PutBucketAclCommandOutput, } from "./commands/PutBucketAclCommand"; import { PutBucketAnalyticsConfigurationCommand, PutBucketAnalyticsConfigurationCommandInput, PutBucketAnalyticsConfigurationCommandOutput, } from "./commands/PutBucketAnalyticsConfigurationCommand"; import { PutBucketCorsCommand, PutBucketCorsCommandInput, PutBucketCorsCommandOutput, } from "./commands/PutBucketCorsCommand"; import { PutBucketEncryptionCommand, PutBucketEncryptionCommandInput, PutBucketEncryptionCommandOutput, } from "./commands/PutBucketEncryptionCommand"; import { PutBucketIntelligentTieringConfigurationCommand, PutBucketIntelligentTieringConfigurationCommandInput, PutBucketIntelligentTieringConfigurationCommandOutput, } from "./commands/PutBucketIntelligentTieringConfigurationCommand"; import { PutBucketInventoryConfigurationCommand, PutBucketInventoryConfigurationCommandInput, PutBucketInventoryConfigurationCommandOutput, } from "./commands/PutBucketInventoryConfigurationCommand"; import { PutBucketLifecycleConfigurationCommand, PutBucketLifecycleConfigurationCommandInput, PutBucketLifecycleConfigurationCommandOutput, } from "./commands/PutBucketLifecycleConfigurationCommand"; import { PutBucketLoggingCommand, PutBucketLoggingCommandInput, PutBucketLoggingCommandOutput, } from "./commands/PutBucketLoggingCommand"; import { PutBucketMetricsConfigurationCommand, PutBucketMetricsConfigurationCommandInput, PutBucketMetricsConfigurationCommandOutput, } from "./commands/PutBucketMetricsConfigurationCommand"; import { PutBucketNotificationConfigurationCommand, PutBucketNotificationConfigurationCommandInput, PutBucketNotificationConfigurationCommandOutput, } from "./commands/PutBucketNotificationConfigurationCommand"; import { PutBucketOwnershipControlsCommand, PutBucketOwnershipControlsCommandInput, PutBucketOwnershipControlsCommandOutput, } from "./commands/PutBucketOwnershipControlsCommand"; import { PutBucketPolicyCommand, PutBucketPolicyCommandInput, PutBucketPolicyCommandOutput, } from "./commands/PutBucketPolicyCommand"; import { PutBucketReplicationCommand, PutBucketReplicationCommandInput, PutBucketReplicationCommandOutput, } from "./commands/PutBucketReplicationCommand"; import { PutBucketRequestPaymentCommand, PutBucketRequestPaymentCommandInput, PutBucketRequestPaymentCommandOutput, } from "./commands/PutBucketRequestPaymentCommand"; import { PutBucketTaggingCommand, PutBucketTaggingCommandInput, PutBucketTaggingCommandOutput, } from "./commands/PutBucketTaggingCommand"; import { PutBucketVersioningCommand, PutBucketVersioningCommandInput, PutBucketVersioningCommandOutput, } from "./commands/PutBucketVersioningCommand"; import { PutBucketWebsiteCommand, PutBucketWebsiteCommandInput, PutBucketWebsiteCommandOutput, } from "./commands/PutBucketWebsiteCommand"; import { PutObjectAclCommand, PutObjectAclCommandInput, PutObjectAclCommandOutput, } from "./commands/PutObjectAclCommand"; import { PutObjectCommand, PutObjectCommandInput, PutObjectCommandOutput } from "./commands/PutObjectCommand"; import { PutObjectLegalHoldCommand, PutObjectLegalHoldCommandInput, PutObjectLegalHoldCommandOutput, } from "./commands/PutObjectLegalHoldCommand"; import { PutObjectLockConfigurationCommand, PutObjectLockConfigurationCommandInput, PutObjectLockConfigurationCommandOutput, } from "./commands/PutObjectLockConfigurationCommand"; import { PutObjectRetentionCommand, PutObjectRetentionCommandInput, PutObjectRetentionCommandOutput, } from "./commands/PutObjectRetentionCommand"; import { PutObjectTaggingCommand, PutObjectTaggingCommandInput, PutObjectTaggingCommandOutput, } from "./commands/PutObjectTaggingCommand"; import { PutPublicAccessBlockCommand, PutPublicAccessBlockCommandInput, PutPublicAccessBlockCommandOutput, } from "./commands/PutPublicAccessBlockCommand"; import { RestoreObjectCommand, RestoreObjectCommandInput, RestoreObjectCommandOutput, } from "./commands/RestoreObjectCommand"; import { SelectObjectContentCommand, SelectObjectContentCommandInput, SelectObjectContentCommandOutput, } from "./commands/SelectObjectContentCommand"; import { UploadPartCommand, UploadPartCommandInput, UploadPartCommandOutput } from "./commands/UploadPartCommand"; import { UploadPartCopyCommand, UploadPartCopyCommandInput, UploadPartCopyCommandOutput, } from "./commands/UploadPartCopyCommand"; import { HttpHandlerOptions as __HttpHandlerOptions } from "@aws-sdk/types"; /** * <p></p> */ export class S3 extends S3Client { /** * <p>This operation aborts a multipart upload. After a multipart upload is aborted, no * additional parts can be uploaded using that upload ID. The storage consumed by any * previously uploaded parts will be freed. However, if any part uploads are currently in * progress, those part uploads might or might not succeed. As a result, it might be necessary * 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, so you don't get charged for the part * storage, you should call the <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListParts.html">ListParts</a> operation and ensure that * the parts list is empty.</p> * <p>For information about permissions required to use the multipart upload API, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html">Multipart Upload API and * Permissions</a>.</p> * <p>The following operations are related to <code>AbortMultipartUpload</code>:</p> * <ul> * <li> * <p> * <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateMultipartUpload.html">CreateMultipartUpload</a> * </p> * </li> * <li> * <p> * <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPart.html">UploadPart</a> * </p> * </li> * <li> * <p> * <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_CompleteMultipartUpload.html">CompleteMultipartUpload</a> * </p> * </li> * <li> * <p> * <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListParts.html">ListParts</a> * </p> * </li> * <li> * <p> * <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListMultipartUploads.html">ListMultipartUploads</a> * </p> * </li> * </ul> */ public abortMultipartUpload( args: AbortMultipartUploadCommandInput, options?: __HttpHandlerOptions ): Promise<AbortMultipartUploadCommandOutput>; public abortMultipartUpload( args: AbortMultipartUploadCommandInput, cb: (err: any, data?: AbortMultipartUploadCommandOutput) => void ): void; public abortMultipartUpload( args: AbortMultipartUploadCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: AbortMultipartUploadCommandOutput) => void ): void; public abortMultipartUpload( args: AbortMultipartUploadCommandInput, optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: AbortMultipartUploadCommandOutput) => void), cb?: (err: any, data?: AbortMultipartUploadCommandOutput) => void ): Promise<AbortMultipartUploadCommandOutput> | void { const command = new AbortMultipartUploadCommand(args); if (typeof optionsOrCb === "function") { this.send(command, optionsOrCb); } else if (typeof cb === "function") { if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`); this.send(command, optionsOrCb || {}, cb); } else { return this.send(command, optionsOrCb); } } /** * <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. After successfully uploading all relevant parts of an upload, you call this * 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 Complete * Multipart Upload request, you must provide the parts list. You must ensure that the parts * list is complete. This operation concatenates the parts that you provide in the list. For * each part in the list, you must provide the part number and the <code>ETag</code> value, * returned after that part was uploaded.</p> * <p>Processing of a Complete Multipart Upload request could take several minutes to * complete. After Amazon S3 begins processing the request, it sends an HTTP response header that * specifies a 200 OK response. While processing is in progress, Amazon S3 periodically sends white * space characters to keep the connection from timing out. Because a request could fail after * the initial 200 OK response has been sent, it is important that you check the response body * to determine whether the request succeeded.</p> * <p>Note that if <code>CompleteMultipartUpload</code> fails, applications should be prepared * to retry the failed requests. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/ErrorBestPractices.html">Amazon S3 Error Best Practices</a>.</p> * <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>.</p> * <p>For information about permissions required to use the multipart upload API, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html">Multipart Upload API and * Permissions</a>.</p> * * * <p> * <code>CompleteMultipartUpload</code> has the following special errors:</p> * <ul> * <li> * <p>Error code: <code>EntityTooSmall</code> * </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> * </li> * <li> * <p>400 Bad Request</p> * </li> * </ul> * </li> * <li> * <p>Error code: <code>InvalidPart</code> * </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 entity tag might not have * matched the part's entity tag.</p> * </li> * <li> * <p>400 Bad Request</p> * </li> * </ul> * </li> * <li> * <p>Error code: <code>InvalidPartOrder</code> * </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> * </li> * <li> * <p>400 Bad Request</p> * </li> * </ul> * </li> * <li> * <p>Error code: <code>NoSuchUpload</code> * </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> * </li> * <li> * <p>404 Not Found</p> * </li> * </ul> * </li> * </ul> * * <p>The following operations are related to <code>CompleteMultipartUpload</code>:</p> * <ul> * <li> * <p> * <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateMultipartUpload.html">CreateMultipartUpload</a> * </p> * </li> * <li> * <p> * <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPart.html">UploadPart</a> * </p> * </li> * <li> * <p> * <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_AbortMultipartUpload.html">AbortMultipartUpload</a> * </p> * </li> * <li> * <p> * <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListParts.html">ListParts</a> * </p> * </li> * <li> * <p> * <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListMultipartUploads.html">ListMultipartUploads</a> * </p> * </li> * </ul> */ public completeMultipartUpload( args: CompleteMultipartUploadCommandInput, options?: __HttpHandlerOptions ): Promise<CompleteMultipartUploadCommandOutput>; public completeMultipartUpload( args: CompleteMultipartUploadCommandInput, cb: (err: any, data?: CompleteMultipartUploadCommandOutput) => void ): void; public completeMultipartUpload( args: CompleteMultipartUploadCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: CompleteMultipartUploadCommandOutput) => void ): void; public completeMultipartUpload( args: CompleteMultipartUploadCommandInput, optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: CompleteMultipartUploadCommandOutput) => void), cb?: (err: any, data?: CompleteMultipartUploadCommandOutput) => void ): Promise<CompleteMultipartUploadCommandOutput> | void { const command = new CompleteMultipartUploadCommand(args); if (typeof optionsOrCb === "function") { this.send(command, optionsOrCb); } else if (typeof cb === "function") { if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`); this.send(command, optionsOrCb || {}, cb); } else { return this.send(command, optionsOrCb); } } /** * <p>Creates a copy of an object that is already stored in Amazon S3.</p> * <note> * <p>You can store individual objects of up to 5 TB in Amazon S3. You create a copy of your * object up to 5 GB in size in a single atomic operation using this API. However, to copy * an object greater than 5 GB, you must use the multipart upload Upload Part - Copy API. * For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/CopyingObjctsUsingRESTMPUapi.html">Copy Object Using the REST Multipart Upload API</a>.</p> * </note> * <p>All copy requests must be authenticated. Additionally, you must have * <i>read</i> access to the source object and <i>write</i> * access to the destination bucket. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html">REST Authentication</a>. Both the Region * that you want to copy the object from and the Region that you want to copy the object to * must be enabled for your account.</p> * <p>A copy request might return an error when Amazon S3 receives the copy request or while Amazon S3 * is copying the files. If the error occurs before the copy operation starts, you receive a * standard Amazon S3 error. If the error occurs during the copy operation, the error response is * embedded in the <code>200 OK</code> response. This means that a <code>200 OK</code> * response can contain either a success or an error. Design your application to parse the * contents of the response and handle it appropriately.</p> * <p>If the copy is successful, you receive a response with information about the copied * object.</p> * <note> * <p>If the request is an HTTP 1.1 request, the response is chunk encoded. If it were not, * it would not contain the content-length, and you would need to read the entire * body.</p> * </note> * <p>The copy request charge is based on the storage class and Region that you specify for * the destination object. For pricing information, see <a href="https://aws.amazon.com/s3/pricing/">Amazon S3 pricing</a>.</p> * <important> * <p>Amazon S3 transfer acceleration does not support cross-Region copies. If you request a * cross-Region copy using a transfer acceleration endpoint, you get a 400 <code>Bad * Request</code> error. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html">Transfer Acceleration</a>.</p> * </important> * <p> * <b>Metadata</b> * </p> * <p>When copying an object, you can preserve all metadata (default) or specify new metadata. * However, the ACL is not preserved and is set to private for the user making the request. To * override the default ACL setting, specify a new ACL when generating a copy request. For * more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/S3_ACLs_UsingACLs.html">Using ACLs</a>. </p> * <p>To specify whether you want the object metadata copied from the source object or * replaced with metadata provided in the request, you can optionally add the * <code>x-amz-metadata-directive</code> header. When you grant permissions, you can use * the <code>s3:x-amz-metadata-directive</code> condition key to enforce certain metadata * behavior when objects are uploaded. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/amazon-s3-policy-keys.html">Specifying Conditions in a * Policy</a> in the <i>Amazon S3 Developer Guide</i>. For a complete list of * Amazon S3-specific condition keys, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/list_amazons3.html">Actions, Resources, and Condition Keys for * Amazon S3</a>.</p> * <p> * <b> * <code>x-amz-copy-source-if</code> Headers</b> * </p> * <p>To only copy an object under certain conditions, such as whether the <code>Etag</code> * matches or whether the object was modified before or after a specified date, use the * following request parameters:</p> * <ul> * <li> * <p> * <code>x-amz-copy-source-if-match</code> * </p> * </li> * <li> * <p> * <code>x-amz-copy-source-if-none-match</code> * </p> * </li> * <li> * <p> * <code>x-amz-copy-source-if-unmodified-since</code> * </p> * </li> * <li> * <p> * <code>x-amz-copy-source-if-modified-since</code> * </p> * </li> * </ul> * <p> If both the <code>x-amz-copy-source-if-match</code> and * <code>x-amz-copy-source-if-unmodified-since</code> headers are present in the request * and evaluate as follows, Amazon S3 returns <code>200 OK</code> and copies the data:</p> * <ul> * <li> * <p> * <code>x-amz-copy-source-if-match</code> condition evaluates to true</p> * </li> * <li> * <p> * <code>x-amz-copy-source-if-unmodified-since</code> condition evaluates to * false</p> * </li> * </ul> * * <p>If both the <code>x-amz-copy-source-if-none-match</code> and * <code>x-amz-copy-source-if-modified-since</code> headers are present in the request and * evaluate as follows, Amazon S3 returns the <code>412 Precondition Failed</code> response * code:</p> * <ul> * <li> * <p> * <code>x-amz-copy-source-if-none-match</code> condition evaluates to false</p> * </li> * <li> * <p> * <code>x-amz-copy-source-if-modified-since</code> condition evaluates to * true</p> * </li> * </ul> * * <note> * <p>All headers with the <code>x-amz-</code> prefix, including * <code>x-amz-copy-source</code>, must be signed.</p> * </note> * <p> * <b>Server-side encryption</b> * </p> * <p>When you perform a CopyObject operation, you can optionally use the appropriate encryption-related headers to encrypt the object using server-side encryption with AWS managed encryption keys (SSE-S3 or SSE-KMS) or a customer-provided encryption key. With server-side encryption, Amazon S3 encrypts your data as it writes it to disks in its data centers and decrypts the data when you access it. For more information about server-side encryption, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/serv-side-encryption.html">Using * Server-Side Encryption</a>.</p> * <p>If a target object uses SSE-KMS, you can enable an S3 Bucket Key for the object. For more * information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-key.html">Amazon S3 Bucket Keys</a> in the <i>Amazon Simple Storage Service Developer Guide</i>.</p> * <p> * <b>Access Control List (ACL)-Specific Request * Headers</b> * </p> * <p>When copying an object, you can optionally use headers to grant ACL-based permissions. * By default, all objects are private. Only the owner has full access control. When adding a * new object, you can grant permissions to individual AWS accounts or to predefined groups * defined by Amazon S3. These permissions are then added to the ACL on the object. For more * information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html">Access Control List (ACL) Overview</a> and <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-using-rest-api.html">Managing ACLs Using the REST * API</a>. </p> * * <p> * <b>Storage Class Options</b> * </p> * <p>You can use the <code>CopyObject</code> operation to change the storage class of an * object that is already stored in Amazon S3 using the <code>StorageClass</code> parameter. For * more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-class-intro.html">Storage * Classes</a> in the <i>Amazon S3 Service Developer Guide</i>.</p> * <p> * <b>Versioning</b> * </p> * <p>By default, <code>x-amz-copy-source</code> identifies the current version of an object * to copy. If the current version is a delete marker, Amazon S3 behaves as if the object was * deleted. To copy a different version, use the <code>versionId</code> subresource.</p> * <p>If you enable versioning on the target bucket, Amazon S3 generates a unique version ID for * the object being copied. This version ID is different from the version ID of the source * object. Amazon S3 returns the version ID of the copied object in the * <code>x-amz-version-id</code> response header in the response.</p> * <p>If you do not enable versioning or suspend it on the target bucket, the version ID that * Amazon S3 generates is always null.</p> * <p>If the source object's storage class is GLACIER, you must restore a copy of this object * before you can use it as a source object for the copy operation. For more information, see * <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_RestoreObject.html">RestoreObject</a>.</p> * <p>The following operations are related to <code>CopyObject</code>:</p> * <ul> * <li> * <p> * <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html">PutObject</a> * </p> * </li> * <li> * <p> * <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html">GetObject</a> * </p> * </li> * </ul> * <p>For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/CopyingObjectsExamples.html">Copying * Objects</a>.</p> */ public copyObject(args: CopyObjectCommandInput, options?: __HttpHandlerOptions): Promise<CopyObjectCommandOutput>; public copyObject(args: CopyObjectCommandInput, cb: (err: any, data?: CopyObjectCommandOutput) => void): void; public copyObject( args: CopyObjectCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: CopyObjectCommandOutput) => void ): void; public copyObject( args: CopyObjectCommandInput, optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: CopyObjectCommandOutput) => void), cb?: (err: any, data?: CopyObjectCommandOutput) => void ): Promise<CopyObjectCommandOutput> | void { const command = new CopyObjectCommand(args); if (typeof optionsOrCb === "function") { this.send(command, optionsOrCb); } else if (typeof cb === "function") { if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`); this.send(command, optionsOrCb || {}, cb); } else { return this.send(command, optionsOrCb); } } /** * <p>Creates a new S3 bucket. To create a bucket, you must register with Amazon S3 and have a * valid AWS Access Key ID to authenticate requests. Anonymous requests are never allowed to * create buckets. By creating the bucket, you become the bucket owner.</p> * <p>Not every string is an acceptable bucket name. For information about bucket naming * restrictions, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html">Working with Amazon S3 * buckets</a>. </p> * <p>If you want to create an Amazon S3 on Outposts bucket, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateBucket.html">Create Bucket</a>. </p> * <p>By default, the bucket is created in the US East (N. Virginia) Region. You can * optionally specify a Region in the request body. You might choose a Region to optimize * latency, minimize costs, or address regulatory requirements. For example, if you reside in * Europe, you will probably find it advantageous to create buckets in the Europe (Ireland) * Region. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html#access-bucket-intro">Accessing a * bucket</a>.</p> * <note> * <p>If you send your create bucket request to the <code>s3.amazonaws.com</code> endpoint, * the request goes to the us-east-1 Region. Accordingly, the signature calculations in * Signature Version 4 must use us-east-1 as the Region, even if the location constraint in * the request specifies another Region where the bucket is to be created. If you create a * bucket in a Region other than US East (N. Virginia), your application must be able to * handle 307 redirect. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html">Virtual hosting of buckets</a>.</p> * </note> * <p>When creating a bucket using this operation, you can optionally specify the accounts or * groups that should be granted specific permissions on the bucket. There are two ways to * grant the appropriate permissions using the request headers.</p> * <ul> * <li> * <p>Specify a canned ACL using the <code>x-amz-acl</code> request header. Amazon S3 * supports a set of predefined ACLs, known as <i>canned ACLs</i>. Each * canned ACL has a predefined set of grantees and permissions. For more information, * see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#CannedACL">Canned ACL</a>.</p> * </li> * <li> * <p>Specify access permissions explicitly using the <code>x-amz-grant-read</code>, * <code>x-amz-grant-write</code>, <code>x-amz-grant-read-acp</code>, * <code>x-amz-grant-write-acp</code>, and <code>x-amz-grant-full-control</code> * headers. These headers map to the set of permissions Amazon S3 supports in an ACL. For * more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html">Access control list * (ACL) overview</a>.</p> * <p>You specify each grantee as a type=value pair, where the type is one of the * following:</p> * <ul> * <li> * <p> * <code>id</code> – if the value specified is the canonical user ID of an AWS * account</p> * </li> * <li> * <p> * <code>uri</code> – if you are granting permissions to a predefined * group</p> * </li> * <li> * <p> * <code>emailAddress</code> – if the value specified is the email address of * an AWS account</p> * <note> * <p>Using email addresses to specify a grantee is only supported in the following AWS Regions: </p> * <ul> * <li> * <p>US East (N. Virginia)</p> * </li> * <li> * <p>US West (N. California)</p> * </li> * <li> * <p> US West (Oregon)</p> * </li> * <li> * <p> Asia Pacific (Singapore)</p> * </li> * <li> * <p>Asia Pacific (Sydney)</p> * </li> * <li> * <p>Asia Pacific (Tokyo)</p> * </li> * <li> * <p>Europe (Ireland)</p> * </li> * <li> * <p>South America (São Paulo)</p> * </li> * </ul> * <p>For a list of all the Amazon S3 supported Regions and endpoints, see <a href="https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region">Regions and Endpoints</a> in the AWS General Reference.</p> * </note> * </li> * </ul> * <p>For example, the following <code>x-amz-grant-read</code> header grants the AWS accounts identified by account IDs permissions to read object data and its metadata:</p> * <p> * <code>x-amz-grant-read: id="11112222333", id="444455556666" </code> * </p> * </li> * </ul> * <note> * <p>You can use either a canned ACL or specify access permissions explicitly. You cannot * do both.</p> * </note> * * * <p>The following operations are related to <code>CreateBucket</code>:</p> * <ul> * <li> * <p> * <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html">PutObject</a> * </p> * </li> * <li> * <p> * <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucket.html">DeleteBucket</a> * </p> * </li> * </ul> */ public createBucket( args: CreateBucketCommandInput, options?: __HttpHandlerOptions ): Promise<CreateBucketCommandOutput>; public createBucket(args: CreateBucketCommandInput, cb: (err: any, data?: CreateBucketCommandOutput) => void): void; public createBucket( args: CreateBucketCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: CreateBucketCommandOutput) => void ): void; public createBucket( args: CreateBucketCommandInput, optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: CreateBucketCommandOutput) => void), cb?: (err: any, data?: CreateBucketCommandOutput) => void ): Promise<CreateBucketCommandOutput> | void { const command = new CreateBucketCommand(args); if (typeof optionsOrCb === "function") { this.send(command, optionsOrCb); } else if (typeof cb === "function") { if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`); this.send(command, optionsOrCb || {}, cb); } else { return this.send(command, optionsOrCb); } } /** * <p>This operation initiates a multipart upload and returns an upload ID. This upload ID is * used to associate all of the parts in the specific multipart upload. You specify this * upload ID in each of your subsequent upload part requests (see <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPart.html">UploadPart</a>). You also include this * upload ID in the final request to either complete or abort the multipart upload * request.</p> * * <p>For more information about multipart uploads, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html">Multipart Upload Overview</a>.</p> * * <p>If you have configured a lifecycle rule to abort incomplete multipart uploads, the * upload must complete within the number of days specified in the bucket lifecycle * configuration. Otherwise, the incomplete multipart upload becomes eligible for an abort * operation and Amazon S3 aborts the multipart upload. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html#mpu-abort-incomplete-mpu-lifecycle-config">Aborting * Incomplete Multipart Uploads Using a Bucket Lifecycle Policy</a>.</p> * * <p>For information about the permissions required to use the multipart upload API, see * <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html">Multipart Upload API and * Permissions</a>.</p> * * <p>For request signing, multipart upload is just a series of regular requests. You initiate * a multipart upload, send one or more requests to upload parts, and then complete the * multipart upload process. You sign each request individually. There is nothing special * about signing multipart upload requests. For more information about signing, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html">Authenticating * Requests (AWS Signature Version 4)</a>.</p> * * <note> * <p> After you initiate a multipart upload and upload one or more parts, to stop being * charged for storing the uploaded parts, you must either complete or abort the multipart * upload. Amazon S3 frees up the space used to store the parts and stop charging you for * storing them only after you either complete or abort a multipart upload. </p> * </note> * * <p>You can optionally request server-side encryption. For server-side encryption, Amazon S3 * encrypts your data as it writes it to disks in its data centers and decrypts it when you * access it. You can provide your own encryption key, or use AWS Key Management Service (AWS * KMS) customer master keys (CMKs) or Amazon S3-managed encryption keys. If you choose to provide * your own encryption key, the request headers you provide in <a href="AmazonS3/latest/API/API_UploadPart.html">UploadPart</a> and <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPartCopy.html">UploadPartCopy</a> requests must match the headers you used in the request to * initiate the upload by using <code>CreateMultipartUpload</code>. </p> * <p>To perform a multipart upload with encryption using an AWS KMS CMK, the requester must * have permission to the <code>