Skip to content

Commit a357473

Browse files
authored
docs(js): add durability options (#8133)
* docs(js): add durability options * chore: add copy example for expected bucket owner
1 parent 64403cf commit a357473

File tree

5 files changed

+20
-3
lines changed

5 files changed

+20
-3
lines changed

src/pages/[platform]/build-a-backend/storage/copy-files/index.mdx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ const copyFile = async () => {
8686
path: 'album/2024/1.jpg',
8787
// Specify a target bucket using name assigned in Amplify Backend
8888
// or bucket name from console and associated region
89-
bucket: 'assignedNameInAmplifyBackend'
89+
bucket: 'assignedNameInAmplifyBackend',
90+
expectedBucketOwner: '123456789012'
9091
},
9192
destination: {
9293
path: 'shared/2024/1.jpg',
@@ -95,7 +96,8 @@ const copyFile = async () => {
9596
bucket: {
9697
bucketName: 'generated-second-bucket-name',
9798
region: 'us-east-2'
98-
}
99+
},
100+
expectedBucketOwner: '123456789013'
99101
}
100102
});
101103
} catch (error) {
@@ -114,6 +116,9 @@ Option | Type | Default | Description |
114116
| -- | :--: | :--: | ----------- |
115117
| path | string \| <br/>(\{ identityId \}) => string | Required | A string or callback that represents the path in source and destination bucket to copy the object to or from. <br /> **Each segment of the path in `source` must by URI encoded.** |
116118
| bucket | string \| <br />\{ bucketName: string;<br/> region: string; \} | Default bucket and region from Amplify configuration | A string representing the target bucket's assigned name in Amplify Backend or an object specifying the bucket name and region from the console.<br/><br/>Read more at [Configure additional storage buckets](/[platform]/build-a-backend/storage/set-up-storage/#configure-additional-storage-buckets). |
119+
| eTag | string | Optional | The copy **source object** entity tag (ETag) value. Only Copies the object if its ETag matches the specified tag. |
120+
| notModifiedSince | Date | Optional | Copies the **source object** if it hasn't been modified since the specified time. <br /><br/> **This is evaluated only when `eTag` is NOT supplied**|
121+
| expectedBucketOwner | string | Optional | `source.expectedBucketOwner`: The account ID that owns the source bucket. <br /><br /> `destination.expectedBucketOwner`: The account ID that owns the destination bucket. |
117122

118123
</InlineFilter>
119124

src/pages/[platform]/build-a-backend/storage/download-files/index.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ const linkToStorageFile = await getUrl({
106106
expiresIn: 300,
107107
// whether to use accelerate endpoint
108108
useAccelerateEndpoint: true,
109+
// The account ID that owns the requested bucket.
110+
expectedBucketOwner: '123456789012',
109111
}
110112
});
111113
```
@@ -116,6 +118,7 @@ Option | Type | Default | Description |
116118
| validateObjectExistence | boolean | false | Whether to head object to make sure the object existence before downloading. |
117119
| expiresIn | number | 900 | Number of seconds till the URL expires. <br/><br/> The expiration time of the presigned url is dependent on the session and will max out at 1 hour. |
118120
| useAccelerateEndpoint | boolean | false | Whether to use accelerate endpoint. <br/><br/> Read more at [Transfer Acceleration](/[platform]/build-a-backend/storage/extend-s3-resources/#example---enable-transfer-acceleration) |
121+
| expectedBucketOwner | string | Optional | The account ID that owns requested bucket. |
119122

120123
</InlineFilter>
121124

@@ -1188,6 +1191,7 @@ Option | Type | Default | Description |
11881191
| onProgress | callback || Callback function tracking the upload/download progress. |
11891192
| bytesRange | \{ start: number; end:number; \} || Bytes range parameter to download a part of the file. |
11901193
| useAccelerateEndpoint | boolean | false | Whether to use accelerate endpoint.<br/><br/>Read more at [Transfer Acceleration](/[platform]/build-a-backend/storage/extend-s3-resources/#example---enable-transfer-acceleration) |
1194+
| expectedBucketOwner | string | Optional | The account ID that owns requested bucket. |
11911195

11921196
## Frequently Asked Questions
11931197

src/pages/[platform]/build-a-backend/storage/list-files/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ const result = await list({
240240
| nextToken | string | — | Indicates whether the list is being continued on this bucket with a token |
241241
| subpathStrategy | \{ strategy: 'include' \} \|<br/>\{ 'exclude',<br />delimiter?: string \} | \{ strategy: 'include' \} | An object representing the subpath inclusion strategy and the delimiter used to group results for exclusion. <br/><br/> Read more at [Excluding subpaths](/[platform]/build-a-backend/storage/list-files/#excluding-subpaths) |
242242
| useAccelerateEndpoint | boolean | false | Whether to use accelerate endpoint. <br/><br/> Read more at [Transfer Acceleration](/[platform]/build-a-backend/storage/extend-s3-resources/#example---enable-transfer-acceleration) |
243+
| expectedBucketOwner | string | Optional | The account ID that owns requested bucket. |
243244
244245
</InlineFilter>
245246

src/pages/[platform]/build-a-backend/storage/remove-files/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,4 +389,5 @@ Future<void> remove() async {
389389
Option | Type | Default | Description |
390390
| -- | :--: | :--: | ----------- |
391391
| bucket | string \| <br />\{ bucketName: string;<br/> region: string; \} | Default bucket and region from Amplify configuration | A string representing the target bucket's assigned name in Amplify Backend or an object specifying the bucket name and region from the console.<br/><br/>Read more at [Configure additional storage buckets](/[platform]/build-a-backend/storage/set-up-storage/#configure-additional-storage-buckets) |
392+
| expectedBucketOwner | string | Optional | The account ID that owns requested bucket. |
392393
</InlineFilter>

src/pages/[platform]/build-a-backend/storage/upload-files/index.mdx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1566,7 +1566,11 @@ const result = await uploadData({
15661566
// configure how object is presented
15671567
contentDisposition: "attachment",
15681568
// whether to use accelerate endpoint
1569-
useAccelerateEndpoint: true
1569+
useAccelerateEndpoint: true,
1570+
// the account ID that owns requested bucket
1571+
expectedBucketOwner: '123456789012',
1572+
// whether to check if an object with the same key already exists before completing the upload
1573+
preventOverwrite: true,
15701574
},
15711575
});
15721576
```
@@ -1578,6 +1582,8 @@ Option | Type | Default | Description |
15781582
| contentDisposition | string || Specifies presentational information for the object. <br/><br/> Read more at [Content-Disposition documentation](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition) |
15791583
| metadata | map\<string\> || A map of metadata to store with the object in S3. <br/><br/> Read more at [S3 metadata documentation](https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingMetadata.html#UserMetadata) |
15801584
| useAccelerateEndpoint | boolean | false | Whether to use accelerate endpoint. <br/><br/> Read more at [Transfer Acceleration](/[platform]/build-a-backend/storage/upload-files/#transfer-acceleration) |
1585+
| expectedBucketOwner | string | - | The account ID that owns requested bucket. |
1586+
| preventOverwrite | boolean | false | Whether to check if an object with the same key already exists before completing the upload. If exists, a `Precondition Failed` error will be thrown |
15811587

15821588
<Callout>
15831589

0 commit comments

Comments
 (0)