createVolume method

Future<CreateVolumeResponse> createVolume({
  1. required String name,
  2. required VolumeType volumeType,
  3. String? clientRequestToken,
  4. CreateOntapVolumeConfiguration? ontapConfiguration,
  5. CreateOpenZFSVolumeConfiguration? openZFSConfiguration,
  6. List<Tag>? tags,
})

Creates an FSx for ONTAP or Amazon FSx for OpenZFS storage volume.

May throw BadRequest. May throw FileSystemNotFound. May throw IncompatibleParameterError. May throw InternalServerError. May throw MissingVolumeConfiguration. May throw ServiceLimitExceeded. May throw StorageVirtualMachineNotFound. May throw UnsupportedOperation.

Parameter name : Specifies the name of the volume that you're creating.

Parameter volumeType : Specifies the type of volume to create; ONTAP and OPENZFS are the only valid volume types.

Parameter ontapConfiguration : Specifies the configuration to use when creating the ONTAP volume.

Parameter openZFSConfiguration : Specifies the configuration to use when creating the OpenZFS volume.

Implementation

Future<CreateVolumeResponse> createVolume({
  required String name,
  required VolumeType volumeType,
  String? clientRequestToken,
  CreateOntapVolumeConfiguration? ontapConfiguration,
  CreateOpenZFSVolumeConfiguration? openZFSConfiguration,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSSimbaAPIService_v20180301.CreateVolume'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Name': name,
      'VolumeType': volumeType.value,
      'ClientRequestToken':
          clientRequestToken ?? _s.generateIdempotencyToken(),
      if (ontapConfiguration != null)
        'OntapConfiguration': ontapConfiguration,
      if (openZFSConfiguration != null)
        'OpenZFSConfiguration': openZFSConfiguration,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateVolumeResponse.fromJson(jsonResponse.body);
}