Skip to content

Commit 453f462

Browse files
author
awstools
committed
feat(client-s3): Amazon Simple Storage Service / Features: Add support for ETag based conditional writes in PutObject and CompleteMultiPartUpload APIs to prevent unintended object modifications.
1 parent 4a7eea0 commit 453f462

12 files changed

+173
-129
lines changed

clients/client-s3/src/commands/CompleteMultipartUploadCommand.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ export interface CompleteMultipartUploadCommandOutput extends CompleteMultipartU
232232
* ChecksumSHA256: "STRING_VALUE",
233233
* RequestPayer: "requester",
234234
* ExpectedBucketOwner: "STRING_VALUE",
235+
* IfMatch: "STRING_VALUE",
235236
* IfNoneMatch: "STRING_VALUE",
236237
* SSECustomerAlgorithm: "STRING_VALUE",
237238
* SSECustomerKey: "STRING_VALUE",

clients/client-s3/src/commands/CreateBucketCommand.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -234,39 +234,39 @@ export interface CreateBucketCommandOutput extends CreateBucketOutput, __Metadat
234234
* <p>Base exception class for all service exceptions from S3 service.</p>
235235
*
236236
* @public
237-
* @example To create a bucket in a specific region
237+
* @example To create a bucket
238238
* ```javascript
239-
* // The following example creates a bucket. The request specifies an AWS region where to create the bucket.
239+
* // The following example creates a bucket.
240240
* const input = {
241-
* "Bucket": "examplebucket",
242-
* "CreateBucketConfiguration": {
243-
* "LocationConstraint": "eu-west-1"
244-
* }
241+
* "Bucket": "examplebucket"
245242
* };
246243
* const command = new CreateBucketCommand(input);
247244
* const response = await client.send(command);
248245
* /* response ==
249246
* {
250-
* "Location": "http://examplebucket.<Region>.s3.amazonaws.com/"
247+
* "Location": "/examplebucket"
251248
* }
252249
* *\/
253-
* // example id: to-create-a-bucket-in-a-specific-region-1483399072992
250+
* // example id: to-create-a-bucket--1472851826060
254251
* ```
255252
*
256-
* @example To create a bucket
253+
* @example To create a bucket in a specific region
257254
* ```javascript
258-
* // The following example creates a bucket.
255+
* // The following example creates a bucket. The request specifies an AWS region where to create the bucket.
259256
* const input = {
260-
* "Bucket": "examplebucket"
257+
* "Bucket": "examplebucket",
258+
* "CreateBucketConfiguration": {
259+
* "LocationConstraint": "eu-west-1"
260+
* }
261261
* };
262262
* const command = new CreateBucketCommand(input);
263263
* const response = await client.send(command);
264264
* /* response ==
265265
* {
266-
* "Location": "/examplebucket"
266+
* "Location": "http://examplebucket.<Region>.s3.amazonaws.com/"
267267
* }
268268
* *\/
269-
* // example id: to-create-a-bucket--1472851826060
269+
* // example id: to-create-a-bucket-in-a-specific-region-1483399072992
270270
* ```
271271
*
272272
*/

clients/client-s3/src/commands/DeleteObjectCommand.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -157,28 +157,28 @@ export interface DeleteObjectCommandOutput extends DeleteObjectOutput, __Metadat
157157
* <p>Base exception class for all service exceptions from S3 service.</p>
158158
*
159159
* @public
160-
* @example To delete an object (from a non-versioned bucket)
160+
* @example To delete an object
161161
* ```javascript
162-
* // The following example deletes an object from a non-versioned bucket.
162+
* // The following example deletes an object from an S3 bucket.
163163
* const input = {
164-
* "Bucket": "ExampleBucket",
165-
* "Key": "HappyFace.jpg"
164+
* "Bucket": "examplebucket",
165+
* "Key": "objectkey.jpg"
166166
* };
167167
* const command = new DeleteObjectCommand(input);
168168
* await client.send(command);
169-
* // example id: to-delete-an-object-from-a-non-versioned-bucket-1481588533089
169+
* // example id: to-delete-an-object-1472850136595
170170
* ```
171171
*
172-
* @example To delete an object
172+
* @example To delete an object (from a non-versioned bucket)
173173
* ```javascript
174-
* // The following example deletes an object from an S3 bucket.
174+
* // The following example deletes an object from a non-versioned bucket.
175175
* const input = {
176-
* "Bucket": "examplebucket",
177-
* "Key": "objectkey.jpg"
176+
* "Bucket": "ExampleBucket",
177+
* "Key": "HappyFace.jpg"
178178
* };
179179
* const command = new DeleteObjectCommand(input);
180180
* await client.send(command);
181-
* // example id: to-delete-an-object-1472850136595
181+
* // example id: to-delete-an-object-from-a-non-versioned-bucket-1481588533089
182182
* ```
183183
*
184184
*/

clients/client-s3/src/commands/DeleteObjectsCommand.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -227,18 +227,20 @@ export interface DeleteObjectsCommandOutput extends DeleteObjectsOutput, __Metad
227227
* <p>Base exception class for all service exceptions from S3 service.</p>
228228
*
229229
* @public
230-
* @example To delete multiple objects from a versioned bucket
230+
* @example To delete multiple object versions from a versioned bucket
231231
* ```javascript
232-
* // The following example deletes objects from a bucket. The bucket is versioned, and the request does not specify the object version to delete. In this case, all versions remain in the bucket and S3 adds a delete marker.
232+
* // The following example deletes objects from a bucket. The request specifies object versions. S3 deletes specific object versions and returns the key and versions of deleted objects in the response.
233233
* const input = {
234234
* "Bucket": "examplebucket",
235235
* "Delete": {
236236
* "Objects": [
237237
* {
238-
* "Key": "objectkey1"
238+
* "Key": "HappyFace.jpg",
239+
* "VersionId": "2LWg7lQLnY41.maGB5Z6SWW.dcq0vx7b"
239240
* },
240241
* {
241-
* "Key": "objectkey2"
242+
* "Key": "HappyFace.jpg",
243+
* "VersionId": "yoz3HB.ZhCS_tKVEmIOr7qYyyAaZSKVd"
242244
* }
243245
* ],
244246
* "Quiet": false
@@ -250,35 +252,31 @@ export interface DeleteObjectsCommandOutput extends DeleteObjectsOutput, __Metad
250252
* {
251253
* "Deleted": [
252254
* {
253-
* "DeleteMarker": "true",
254-
* "DeleteMarkerVersionId": "A._w1z6EFiCF5uhtQMDal9JDkID9tQ7F",
255-
* "Key": "objectkey1"
255+
* "Key": "HappyFace.jpg",
256+
* "VersionId": "yoz3HB.ZhCS_tKVEmIOr7qYyyAaZSKVd"
256257
* },
257258
* {
258-
* "DeleteMarker": "true",
259-
* "DeleteMarkerVersionId": "iOd_ORxhkKe_e8G8_oSGxt2PjsCZKlkt",
260-
* "Key": "objectkey2"
259+
* "Key": "HappyFace.jpg",
260+
* "VersionId": "2LWg7lQLnY41.maGB5Z6SWW.dcq0vx7b"
261261
* }
262262
* ]
263263
* }
264264
* *\/
265-
* // example id: to-delete-multiple-objects-from-a-versioned-bucket-1483146248805
265+
* // example id: to-delete-multiple-object-versions-from-a-versioned-bucket-1483147087737
266266
* ```
267267
*
268-
* @example To delete multiple object versions from a versioned bucket
268+
* @example To delete multiple objects from a versioned bucket
269269
* ```javascript
270-
* // The following example deletes objects from a bucket. The request specifies object versions. S3 deletes specific object versions and returns the key and versions of deleted objects in the response.
270+
* // The following example deletes objects from a bucket. The bucket is versioned, and the request does not specify the object version to delete. In this case, all versions remain in the bucket and S3 adds a delete marker.
271271
* const input = {
272272
* "Bucket": "examplebucket",
273273
* "Delete": {
274274
* "Objects": [
275275
* {
276-
* "Key": "HappyFace.jpg",
277-
* "VersionId": "2LWg7lQLnY41.maGB5Z6SWW.dcq0vx7b"
276+
* "Key": "objectkey1"
278277
* },
279278
* {
280-
* "Key": "HappyFace.jpg",
281-
* "VersionId": "yoz3HB.ZhCS_tKVEmIOr7qYyyAaZSKVd"
279+
* "Key": "objectkey2"
282280
* }
283281
* ],
284282
* "Quiet": false
@@ -290,17 +288,19 @@ export interface DeleteObjectsCommandOutput extends DeleteObjectsOutput, __Metad
290288
* {
291289
* "Deleted": [
292290
* {
293-
* "Key": "HappyFace.jpg",
294-
* "VersionId": "yoz3HB.ZhCS_tKVEmIOr7qYyyAaZSKVd"
291+
* "DeleteMarker": "true",
292+
* "DeleteMarkerVersionId": "A._w1z6EFiCF5uhtQMDal9JDkID9tQ7F",
293+
* "Key": "objectkey1"
295294
* },
296295
* {
297-
* "Key": "HappyFace.jpg",
298-
* "VersionId": "2LWg7lQLnY41.maGB5Z6SWW.dcq0vx7b"
296+
* "DeleteMarker": "true",
297+
* "DeleteMarkerVersionId": "iOd_ORxhkKe_e8G8_oSGxt2PjsCZKlkt",
298+
* "Key": "objectkey2"
299299
* }
300300
* ]
301301
* }
302302
* *\/
303-
* // example id: to-delete-multiple-object-versions-from-a-versioned-bucket-1483147087737
303+
* // example id: to-delete-multiple-objects-from-a-versioned-bucket-1483146248805
304304
* ```
305305
*
306306
*/

clients/client-s3/src/commands/GetObjectCommand.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -311,53 +311,53 @@ export interface GetObjectCommandOutput extends Omit<GetObjectOutput, "Body">, _
311311
* <p>Base exception class for all service exceptions from S3 service.</p>
312312
*
313313
* @public
314-
* @example To retrieve an object
314+
* @example To retrieve a byte range of an object
315315
* ```javascript
316-
* // The following example retrieves an object for an S3 bucket.
316+
* // The following example retrieves an object for an S3 bucket. The request specifies the range header to retrieve a specific byte range.
317317
* const input = {
318318
* "Bucket": "examplebucket",
319-
* "Key": "HappyFace.jpg"
319+
* "Key": "SampleFile.txt",
320+
* "Range": "bytes=0-9"
320321
* };
321322
* const command = new GetObjectCommand(input);
322323
* const response = await client.send(command);
323324
* /* response ==
324325
* {
325326
* "AcceptRanges": "bytes",
326-
* "ContentLength": "3191",
327-
* "ContentType": "image/jpeg",
328-
* "ETag": "\"6805f2cfc46c0f04559748bb039d69ae\"",
329-
* "LastModified": "2016-12-15T01:19:41.000Z",
327+
* "ContentLength": "10",
328+
* "ContentRange": "bytes 0-9/43",
329+
* "ContentType": "text/plain",
330+
* "ETag": "\"0d94420ffd0bc68cd3d152506b97a9cc\"",
331+
* "LastModified": "2014-10-09T22:57:28.000Z",
330332
* "Metadata": {},
331-
* "TagCount": 2,
332333
* "VersionId": "null"
333334
* }
334335
* *\/
335-
* // example id: to-retrieve-an-object-1481827837012
336+
* // example id: to-retrieve-a-byte-range-of-an-object--1481832674603
336337
* ```
337338
*
338-
* @example To retrieve a byte range of an object
339+
* @example To retrieve an object
339340
* ```javascript
340-
* // The following example retrieves an object for an S3 bucket. The request specifies the range header to retrieve a specific byte range.
341+
* // The following example retrieves an object for an S3 bucket.
341342
* const input = {
342343
* "Bucket": "examplebucket",
343-
* "Key": "SampleFile.txt",
344-
* "Range": "bytes=0-9"
344+
* "Key": "HappyFace.jpg"
345345
* };
346346
* const command = new GetObjectCommand(input);
347347
* const response = await client.send(command);
348348
* /* response ==
349349
* {
350350
* "AcceptRanges": "bytes",
351-
* "ContentLength": "10",
352-
* "ContentRange": "bytes 0-9/43",
353-
* "ContentType": "text/plain",
354-
* "ETag": "\"0d94420ffd0bc68cd3d152506b97a9cc\"",
355-
* "LastModified": "2014-10-09T22:57:28.000Z",
351+
* "ContentLength": "3191",
352+
* "ContentType": "image/jpeg",
353+
* "ETag": "\"6805f2cfc46c0f04559748bb039d69ae\"",
354+
* "LastModified": "2016-12-15T01:19:41.000Z",
356355
* "Metadata": {},
356+
* "TagCount": 2,
357357
* "VersionId": "null"
358358
* }
359359
* *\/
360-
* // example id: to-retrieve-a-byte-range-of-an-object--1481832674603
360+
* // example id: to-retrieve-an-object-1481827837012
361361
* ```
362362
*
363363
*/

0 commit comments

Comments
 (0)