createSoftwareUpdateJob method

Future<CreateSoftwareUpdateJobResponse> createSoftwareUpdateJob({
  1. required String s3UrlSignerRole,
  2. required SoftwareToUpdate softwareToUpdate,
  3. required List<String> updateTargets,
  4. required UpdateTargetsArchitecture updateTargetsArchitecture,
  5. required UpdateTargetsOperatingSystem updateTargetsOperatingSystem,
  6. String? amznClientToken,
  7. UpdateAgentLogLevel? updateAgentLogLevel,
})

Creates a software update for a core or group of cores (specified as an IoT thing group.) Use this to update the OTA Agent as well as the Greengrass core software. It makes use of the IoT Jobs feature which provides additional commands to manage a Greengrass core software update job.

May throw BadRequestException. May throw InternalServerErrorException.

Parameter amznClientToken : A client token used to correlate requests and responses.

Implementation

Future<CreateSoftwareUpdateJobResponse> createSoftwareUpdateJob({
  required String s3UrlSignerRole,
  required SoftwareToUpdate softwareToUpdate,
  required List<String> updateTargets,
  required UpdateTargetsArchitecture updateTargetsArchitecture,
  required UpdateTargetsOperatingSystem updateTargetsOperatingSystem,
  String? amznClientToken,
  UpdateAgentLogLevel? updateAgentLogLevel,
}) async {
  ArgumentError.checkNotNull(s3UrlSignerRole, 's3UrlSignerRole');
  ArgumentError.checkNotNull(softwareToUpdate, 'softwareToUpdate');
  ArgumentError.checkNotNull(updateTargets, 'updateTargets');
  ArgumentError.checkNotNull(
      updateTargetsArchitecture, 'updateTargetsArchitecture');
  ArgumentError.checkNotNull(
      updateTargetsOperatingSystem, 'updateTargetsOperatingSystem');
  final headers = <String, String>{
    if (amznClientToken != null)
      'X-Amzn-Client-Token': amznClientToken.toString(),
  };
  final $payload = <String, dynamic>{
    'S3UrlSignerRole': s3UrlSignerRole,
    'SoftwareToUpdate': softwareToUpdate.toValue(),
    'UpdateTargets': updateTargets,
    'UpdateTargetsArchitecture': updateTargetsArchitecture.toValue(),
    'UpdateTargetsOperatingSystem': updateTargetsOperatingSystem.toValue(),
    if (updateAgentLogLevel != null)
      'UpdateAgentLogLevel': updateAgentLogLevel.toValue(),
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/greengrass/updates',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return CreateSoftwareUpdateJobResponse.fromJson(response);
}