You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
amplify-libraries Flutter multibucket support documentation update (#8115)
* updated storage section for multibucket support
* updated api explanations for consistency
* removed section on passwordless since flutter doesnt support it yet
### Override Cognito UserPool to enable passwordless sign-in methods
121
123
122
124
You can modify the underlying Cognito user pool resource to enable sign in with passwordless methods. [Learn more about passwordless sign-in methods](/[platform]/build-a-backend/auth/concepts/passwordless/).
Copy file name to clipboardExpand all lines: src/pages/[platform]/build-a-backend/storage/copy-files/index.mdx
+40-1
Original file line number
Diff line number
Diff line change
@@ -139,12 +139,48 @@ Future<void> copy() async {
139
139
}
140
140
}
141
141
```
142
+
## Specify a bucket or copy across buckets / regions
142
143
143
-
## More `copy` options
144
+
You can also perform a `copy` operation to a specific bucket by providing the `CopyBuckets` option.
145
+
This option is an object that takes two `StorageBucket` parameters, which can be constructed by the specified name in the Amplify Backend, or the bucket name and region from the console.
In order to copy to or from a bucket other than your default, the source and/or destination paths must exist in that bucket
176
+
</Callout>
177
+
178
+
## `copy` options
144
179
145
180
Option | Type | Description |
146
181
| -- | -- | ----------- |
147
182
| getProperties | boolean | Whether to retrieve properties for the copied object using theAmplify.Storage.getProperties() after the operation completes. When set to true the returned item will contain additional info such as metadata and content type. |
183
+
| buckets | CopyBuckets | An object that accepts two `StorageBucket` parameters. To copy to and from the same bucket, use the `CopyBuckets.sameBucket(targetBucket)` method, where `targetBucket` is a `StorageBucket`. Read more at [Configure additional storage buckets](/[platform]/build-a-backend/storage/set-up-storage/#configure-additional-storage-buckets)|
148
184
149
185
Example of `copy` with options:
150
186
@@ -156,6 +192,9 @@ final result = Amplify.Storage.copy(
| bucket | StorageBucket | The target bucket from the assigned name in the Amplify Backend or from the bucket name and region in the console<br/><br/>Defaults to the default bucket and region from the Amplify configuration if this option is not provided.<br/><br/>Read more at [Configure additional storage buckets](/[platform]/build-a-backend/storage/set-up-storage/#configure-additional-storage-buckets)|
1107
1114
| getProperties | boolean | Whether to retrieve properties for the downloaded object using theAmplify.Storage.getProperties() after the operation completes. When set to true the returned item will contain additional info such as metadata and content type. |
1108
1115
| useAccelerateEndpoint | boolean | Whether to use accelerate endpoint. <br/><br/> Read more at [Transfer Acceleration](/[platform]/build-a-backend/storage/upload-files/#transfer-acceleration)|
1109
1116
| bytesRange | S3DataBytesRange | The byte range to download from the object |
@@ -1119,6 +1126,7 @@ final operation = Amplify.Storage.downloadFile(
@@ -1138,6 +1146,42 @@ final operation = Amplify.Storage.downloadData(
1138
1146
);
1139
1147
```
1140
1148
1149
+
You can also perform a `downloadData` or `downloadFile` operation to a specific bucket by providing the `bucket` option. You can pass in a `StorageBucket` object representing the target bucket from the name defined in the Amplify Backend.
You can also perform a `list` operation to a specific bucket by providing the `bucket` option. You can pass in a `StorageBucket` object representing the target bucket from the name defined in the Amplify Backend.
// Alternatively, provide bucket name from console and associated region
1039
+
bucket: StorageBucket.fromBucketInfo(
1040
+
BucketInfo(
1041
+
bucketName: 'second-bucket-name-from-console',
1042
+
region: 'us-east-2',
1043
+
),
1044
+
),
1045
+
// highlight-end
1046
+
),
1047
+
).result;
1048
+
```
1049
+
</InlineFilter>
1015
1050
1016
1051
### More `list` options
1017
1052
1018
1053
| Option | Type | Description |
1019
1054
| --- | --- | --- |
1055
+
| bucket | StorageBucket | The target bucket from the assigned name in the Amplify Backend or from the bucket name and region in the console<br/><br/>Defaults to the default bucket and region from the Amplify configuration if this option is not provided.<br/><br/>Read more at [Configure additional storage buckets](/[platform]/build-a-backend/storage/set-up-storage/#configure-additional-storage-buckets)|
1020
1056
| excludeSubPaths | boolean | Whether to exclude objects under the sub paths of the path to list. Defaults to false. |
1021
1057
| delimiter | String | The delimiter to use when evaluating sub paths. If excludeSubPaths is false, this value has no impact on behavior. |
Copy file name to clipboardExpand all lines: src/pages/[platform]/build-a-backend/storage/remove-files/index.mdx
+40-14
Original file line number
Diff line number
Diff line change
@@ -341,28 +341,42 @@ let removedObject = try await Amplify.Storage.remove(
341
341
342
342
<InlineFilterfilters={["flutter"]}>
343
343
344
-
## Remove single file
345
-
346
-
You can remove a single file using `Amplify.Storage.remove` with the `key` and its associated access level:
344
+
You can also perform a `remove` operation to a specific bucket by providing the `bucket` option. You can pass in a `StorageBucket` object representing the target bucket from the name defined in the Amplify Backend.
// Alternatively, provide bucket name from console and associated region
366
+
bucket: StorageBucket.fromBucketInfo(
367
+
BucketInfo(
368
+
bucketName: 'second-bucket-name-from-console',
369
+
region: 'us-east-2',
370
+
),
371
+
),
372
+
// highlight-end
373
+
),
374
+
).result;
361
375
```
362
376
363
377
## Remove multiple Files
364
378
365
-
You can remove multiple files using `Amplify.Storage.removeMany` with the `keys`, the files to be removed in a batch should have the same access level:
379
+
You can remove multiple files using `Amplify.Storage.removeMany`, as well as specify a bucket to target, the files to be removed in a batch should have the same access level:
Copy file name to clipboardExpand all lines: src/pages/[platform]/build-a-backend/storage/set-up-storage/index.mdx
+48
Original file line number
Diff line number
Diff line change
@@ -363,6 +363,54 @@ let downloadTask = Amplify.Storage.downloadData(
363
363
```
364
364
</InlineFilter>
365
365
366
+
<InlineFilterfilters={["flutter"]}>
367
+
### Storage bucket client usage
368
+
369
+
Additional storage buckets can be referenced from application code by passing the `bucket` option to Amplify Storage APIs. You can provide a target bucket's name assigned in Amplify Backend.
Alternatively, you can also pass in an object by specifying the bucket name and region from the console. See each Amplify Storage API page for additional usage examples.
0 commit comments