S3CloudStorage constructor
S3CloudStorage({})
Creates a new S3CloudStorage reference.
Implementation
S3CloudStorage({
required Serverpod serverpod,
required String storageId,
required this.public,
required this.region,
required this.bucket,
String? publicHost,
}) : assert(serverpod.getPassword('AWSAccessKeyId') != null,
'AWSAccessKeyId must be present in your password.yaml file'),
assert(serverpod.getPassword('AWSSecretKey') != null,
'AWSSecretKey must be present in your password.yaml file'),
_awsAccessKeyId = serverpod.getPassword('AWSAccessKeyId')!,
_awsSecretKey = serverpod.getPassword('AWSSecretKey')!,
super(storageId) {
// Create client
_s3Client = AwsS3Client(
accessKey: _awsAccessKeyId,
secretKey: _awsSecretKey,
bucketId: bucket,
region: region,
);
this.publicHost = publicHost ?? '$bucket.s3.$region.amazonaws.com';
}