Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Nika Hassani committed Sep 25, 2024
1 parent 17d3312 commit bd489f7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,26 @@ class StorageBucketFromOutputs implements StorageBucket {
'file has storage configuration.',
),
);

final bucket = storageOutputs!.buckets?.singleWhere(
(e) => e.name == _name,
orElse: () => throw const InvalidStorageBucketException(
'Unable to lookup bucket from provided name in Amplify Outputs file.',
recoverySuggestion: 'Make sure Amplify Outputs file has the specified '
'bucket configuration.',
),
);
if (bucket == null) {
final buckets = storageOutputs!.buckets;
if (buckets == null) {
throw const InvalidStorageBucketException(
'Amplify Outputs storage configuration does not have buckets specified.',
recoverySuggestion:
'Make sure Amplify Outputs file has storage configuration with '
'buckets specified.',
);
}
return BucketInfo(bucketName: bucket.bucketName, region: bucket.awsRegion);
final bucket = buckets.singleWhere(
(e) => e.name == _name,
orElse: () => throw const InvalidStorageBucketException(
'Unable to lookup bucket from provided name in Amplify Outputs file.',
recoverySuggestion: 'Make sure Amplify Outputs file has the specified '
'bucket configuration.',
),
);
return BucketInfo(
bucketName: bucket.bucketName,
region: bucket.awsRegion,
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:amplify_storage_s3_dart/src/sdk/src/s3/s3_client.dart';
import 'package:meta/meta.dart';
import 'package:smithy_aws/smithy_aws.dart';

/// It holds Amazon S3 client information.
@internal
class S3ClientInfo {
const S3ClientInfo({required this.client, required this.config});
Expand Down

0 comments on commit bd489f7

Please sign in to comment.