createFileSystem method
Creates an S3 File System resource scoped to a bucket or prefix within a bucket, enabling file system access to S3 data. To create a file system, you need an S3 bucket and an IAM role that grants the service permission to access the bucket.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ValidationException.
Parameter bucket :
The Amazon Resource Name (ARN) of the S3 bucket that will be accessible
through the file system. The bucket must exist and be in the same Amazon
Web Services Region as the file system.
Parameter roleArn :
The ARN of the IAM role that grants the S3 Files service permission to
read and write data between the file system and the S3 bucket. This role
must have the necessary permissions to access the specified bucket and
prefix.
Parameter acceptBucketWarning :
Set to true to acknowledge and accept any warnings about the bucket
configuration. If not specified, the operation may fail if there are
bucket configuration warnings.
Parameter clientToken :
A unique, case-sensitive identifier that you provide to ensure idempotent
creation. Up to 64 ASCII characters are allowed. If you don't specify a
client token, the Amazon Web Services SDK automatically generates one.
Parameter kmsKeyId :
The ARN, key ID, or alias of the KMS key to use for encryption. If not
specified, the service uses a service-owned key for encryption. You can
specify a KMS key using the following formats: key ID, ARN, key alias, or
key alias ARN. If you use KmsKeyId, the file system will be
encrypted.
Parameter prefix :
An optional prefix within the S3 bucket to scope the file system access.
If specified, the file system provides access only to objects with keys
that begin with this prefix. If not specified, the file system provides
access to the entire bucket.
Parameter tags :
An array of key-value pairs to apply as tags to the file system resource.
Each tag is a user-defined key-value pair. You can use tags to categorize
and manage your file systems. Each key must be unique for the resource.
Implementation
Future<CreateFileSystemResponse> createFileSystem({
required String bucket,
required String roleArn,
bool? acceptBucketWarning,
String? clientToken,
String? kmsKeyId,
String? prefix,
List<Tag>? tags,
}) async {
final $payload = <String, dynamic>{
'bucket': bucket,
'roleArn': roleArn,
if (acceptBucketWarning != null)
'acceptBucketWarning': acceptBucketWarning,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (kmsKeyId != null) 'kmsKeyId': kmsKeyId,
if (prefix != null) 'prefix': prefix,
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'PUT',
requestUri: '/file-systems',
exceptionFnMap: _exceptionFns,
);
return CreateFileSystemResponse.fromJson(response);
}