createFuotaTask method

Future<CreateFuotaTaskResponse> createFuotaTask({
  1. required String firmwareUpdateImage,
  2. required String firmwareUpdateRole,
  3. String? clientRequestToken,
  4. String? description,
  5. String? descriptor,
  6. int? fragmentIntervalMS,
  7. int? fragmentSizeBytes,
  8. LoRaWANFuotaTask? loRaWAN,
  9. String? name,
  10. int? redundancyPercent,
  11. List<Tag>? tags,
})

Creates a FUOTA task.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Implementation

Future<CreateFuotaTaskResponse> createFuotaTask({
  required String firmwareUpdateImage,
  required String firmwareUpdateRole,
  String? clientRequestToken,
  String? description,
  String? descriptor,
  int? fragmentIntervalMS,
  int? fragmentSizeBytes,
  LoRaWANFuotaTask? loRaWAN,
  String? name,
  int? redundancyPercent,
  List<Tag>? tags,
}) async {
  _s.validateNumRange(
    'fragmentIntervalMS',
    fragmentIntervalMS,
    1,
    1152921504606846976,
  );
  _s.validateNumRange(
    'fragmentSizeBytes',
    fragmentSizeBytes,
    1,
    1152921504606846976,
  );
  _s.validateNumRange(
    'redundancyPercent',
    redundancyPercent,
    0,
    100,
  );
  final $payload = <String, dynamic>{
    'FirmwareUpdateImage': firmwareUpdateImage,
    'FirmwareUpdateRole': firmwareUpdateRole,
    'ClientRequestToken': clientRequestToken ?? _s.generateIdempotencyToken(),
    if (description != null) 'Description': description,
    if (descriptor != null) 'Descriptor': descriptor,
    if (fragmentIntervalMS != null) 'FragmentIntervalMS': fragmentIntervalMS,
    if (fragmentSizeBytes != null) 'FragmentSizeBytes': fragmentSizeBytes,
    if (loRaWAN != null) 'LoRaWAN': loRaWAN,
    if (name != null) 'Name': name,
    if (redundancyPercent != null) 'RedundancyPercent': redundancyPercent,
    if (tags != null) 'Tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/fuota-tasks',
    exceptionFnMap: _exceptionFns,
  );
  return CreateFuotaTaskResponse.fromJson(response);
}