createVolume method
Creates a new volume for WorkSpace Instances.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter availabilityZone :
Availability zone for the volume.
Parameter clientToken :
Unique token to prevent duplicate volume creation.
Parameter encrypted :
Indicates if the volume should be encrypted.
Parameter iops :
Input/output operations per second for the volume.
Parameter kmsKeyId :
KMS key for volume encryption.
Parameter sizeInGB :
Volume size in gigabytes.
Parameter snapshotId :
Source snapshot for volume creation.
Parameter tagSpecifications :
Metadata tags for the volume.
Parameter throughput :
Volume throughput performance.
Parameter volumeType :
Type of EBS volume.
Implementation
Future<CreateVolumeResponse> createVolume({
required String availabilityZone,
String? clientToken,
bool? encrypted,
int? iops,
String? kmsKeyId,
int? sizeInGB,
String? snapshotId,
List<TagSpecification>? tagSpecifications,
int? throughput,
VolumeTypeEnum? volumeType,
}) async {
_s.validateNumRange(
'iops',
iops,
0,
1152921504606846976,
);
_s.validateNumRange(
'sizeInGB',
sizeInGB,
0,
1152921504606846976,
);
_s.validateNumRange(
'throughput',
throughput,
0,
1152921504606846976,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'EUCMIFrontendAPIService.CreateVolume'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'AvailabilityZone': availabilityZone,
'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
if (encrypted != null) 'Encrypted': encrypted,
if (iops != null) 'Iops': iops,
if (kmsKeyId != null) 'KmsKeyId': kmsKeyId,
if (sizeInGB != null) 'SizeInGB': sizeInGB,
if (snapshotId != null) 'SnapshotId': snapshotId,
if (tagSpecifications != null) 'TagSpecifications': tagSpecifications,
if (throughput != null) 'Throughput': throughput,
if (volumeType != null) 'VolumeType': volumeType.value,
},
);
return CreateVolumeResponse.fromJson(jsonResponse.body);
}