createStorageProfile method

Future<CreateStorageProfileResponse> createStorageProfile({
  1. required String displayName,
  2. required String farmId,
  3. required StorageProfileOperatingSystemFamily osFamily,
  4. String? clientToken,
  5. List<FileSystemLocation>? fileSystemLocations,
})

Creates a storage profile that specifies the operating system, file type, and file location of resources used on a farm.

May throw AccessDeniedException. May throw InternalServerErrorException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter displayName : The display name of the storage profile.

Parameter farmId : The farm ID of the farm to connect to the storage profile.

Parameter osFamily : The type of operating system (OS) for the storage profile.

Parameter clientToken : The unique token which the server uses to recognize retries of the same request.

Parameter fileSystemLocations : File system paths to include in the storage profile.

Implementation

Future<CreateStorageProfileResponse> createStorageProfile({
  required String displayName,
  required String farmId,
  required StorageProfileOperatingSystemFamily osFamily,
  String? clientToken,
  List<FileSystemLocation>? fileSystemLocations,
}) async {
  final headers = <String, String>{
    if (clientToken != null) 'X-Amz-Client-Token': clientToken.toString(),
  };
  final $payload = <String, dynamic>{
    'displayName': displayName,
    'osFamily': osFamily.value,
    if (fileSystemLocations != null)
      'fileSystemLocations': fileSystemLocations,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/2023-10-12/farms/${Uri.encodeComponent(farmId)}/storage-profiles',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return CreateStorageProfileResponse.fromJson(response);
}