-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(storage): add multi-bucket feature support (#5681)
- Loading branch information
Showing
53 changed files
with
1,826 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 20 additions & 2 deletions
22
infra-gen2/backends/storage/main/amplify/storage/resource.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
packages/amplify_core/lib/src/config/amplify_outputs/storage/bucket_outputs.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import 'package:amplify_core/amplify_core.dart'; | ||
|
||
part 'bucket_outputs.g.dart'; | ||
|
||
/// {@template amplify_core.amplify_outputs.bucket_outputs} | ||
/// The Amplify Gen 2 outputs for Buckets in the Storage category. | ||
/// {@endtemplate} | ||
@zAmplifyOutputsSerializable | ||
class BucketOutputs | ||
with AWSEquatable<BucketOutputs>, AWSSerializable, AWSDebuggable { | ||
/// {@macro amplify_core.amplify_outputs.bucket_outputs} | ||
const BucketOutputs({ | ||
required this.name, | ||
required this.bucketName, | ||
required this.awsRegion, | ||
}); | ||
|
||
factory BucketOutputs.fromJson(Map<String, Object?> json) => | ||
_$BucketOutputsFromJson(json); | ||
|
||
/// The user friendly name of the bucket | ||
final String name; | ||
|
||
/// The Amazon S3 bucket name. | ||
final String bucketName; | ||
|
||
/// The AWS region of Amazon S3 resources. | ||
final String awsRegion; | ||
|
||
@override | ||
List<Object?> get props => [ | ||
name, | ||
bucketName, | ||
awsRegion, | ||
]; | ||
|
||
@override | ||
String get runtimeTypeName => 'BucketOutputs'; | ||
|
||
@override | ||
Object? toJson() { | ||
return _$BucketOutputsToJson(this); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
packages/amplify_core/lib/src/config/amplify_outputs/storage/bucket_outputs.g.dart
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 21 additions & 5 deletions
26
packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.g.dart
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
packages/amplify_core/lib/src/types/exception/storage/invalid_storage_bucket_exception.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
part of '../amplify_exception.dart'; | ||
|
||
/// {@template amplify_core.storage.invalid_storage_bucket_exception} | ||
/// Exception thrown when the [StorageBucket] is invalid. | ||
/// {@endtemplate} | ||
class InvalidStorageBucketException extends StorageException { | ||
const InvalidStorageBucketException( | ||
super.message, { | ||
super.recoverySuggestion, | ||
super.underlyingException, | ||
}); | ||
|
||
@override | ||
String get runtimeTypeName => 'InvalidStorageBucketException'; | ||
} |
24 changes: 24 additions & 0 deletions
24
packages/amplify_core/lib/src/types/storage/bucket_info.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import 'package:amplify_core/amplify_core.dart'; | ||
|
||
/// {@template amplify_core.storage.bucket_info} | ||
/// Presents a storage bucket information. | ||
/// {@endtemplate} | ||
class BucketInfo | ||
with AWSEquatable<BucketInfo>, AWSSerializable<Map<String, Object?>> { | ||
/// {@macro amplify_core.storage.bucket_info} | ||
const BucketInfo({required this.bucketName, required this.region}); | ||
final String bucketName; | ||
final String region; | ||
|
||
@override | ||
List<Object?> get props => [ | ||
bucketName, | ||
region, | ||
]; | ||
|
||
@override | ||
Map<String, Object?> toJson() => { | ||
'bucketName': bucketName, | ||
'region': region, | ||
}; | ||
} |
24 changes: 24 additions & 0 deletions
24
packages/amplify_core/lib/src/types/storage/copy_buckets.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import 'package:amplify_core/amplify_core.dart'; | ||
|
||
/// Presents storage buckets for a copy operation. | ||
class CopyBuckets with AWSSerializable<Map<String, Object?>> { | ||
/// Creates a [CopyBuckets] with [source] and [destination] buckets. | ||
const CopyBuckets({ | ||
required this.source, | ||
required this.destination, | ||
}); | ||
|
||
/// Creates a [CopyBuckets] with the same [bucket] for the [source] and [destination]. | ||
CopyBuckets.sameBucket(StorageBucket bucket) | ||
: source = bucket, | ||
destination = bucket; | ||
|
||
final StorageBucket source; | ||
final StorageBucket destination; | ||
|
||
@override | ||
Map<String, Object?> toJson() => { | ||
'source': source.toJson(), | ||
'destination': destination.toJson(), | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.