notifyMigrationTaskState method

Future<void> notifyMigrationTaskState({
  1. required String migrationTaskName,
  2. required int nextUpdateSeconds,
  3. required String progressUpdateStream,
  4. required Task task,
  5. required DateTime updateDateTime,
  6. bool? dryRun,
})

Notifies Migration Hub of the current status, progress, or other detail regarding a migration task. This API has the following traits:

  • Migration tools will call the NotifyMigrationTaskState API to share the latest progress and status.
  • MigrationTaskName is used for addressing updates to the correct target.
  • ProgressUpdateStream is used for access control and to provide a namespace for each migration tool.

May throw AccessDeniedException. May throw ThrottlingException. May throw InternalServerError. May throw ServiceUnavailableException. May throw DryRunOperation. May throw UnauthorizedOperation. May throw InvalidInputException. May throw ResourceNotFoundException. May throw HomeRegionNotSetException.

Parameter migrationTaskName : Unique identifier that references the migration task. Do not store personal data in this field.

Parameter nextUpdateSeconds : Number of seconds after the UpdateDateTime within which the Migration Hub can expect an update. If Migration Hub does not receive an update within the specified interval, then the migration task will be considered stale.

Parameter progressUpdateStream : The name of the ProgressUpdateStream.

Parameter task : Information about the task's progress and status.

Parameter updateDateTime : The timestamp when the task was gathered.

Parameter dryRun : Optional boolean flag to indicate whether any effect should take place. Used to test if the caller has permission to make the call.

Implementation

Future<void> notifyMigrationTaskState({
  required String migrationTaskName,
  required int nextUpdateSeconds,
  required String progressUpdateStream,
  required Task task,
  required DateTime updateDateTime,
  bool? dryRun,
}) async {
  ArgumentError.checkNotNull(migrationTaskName, 'migrationTaskName');
  _s.validateStringLength(
    'migrationTaskName',
    migrationTaskName,
    1,
    256,
    isRequired: true,
  );
  ArgumentError.checkNotNull(nextUpdateSeconds, 'nextUpdateSeconds');
  _s.validateNumRange(
    'nextUpdateSeconds',
    nextUpdateSeconds,
    0,
    1152921504606846976,
    isRequired: true,
  );
  ArgumentError.checkNotNull(progressUpdateStream, 'progressUpdateStream');
  _s.validateStringLength(
    'progressUpdateStream',
    progressUpdateStream,
    1,
    50,
    isRequired: true,
  );
  ArgumentError.checkNotNull(task, 'task');
  ArgumentError.checkNotNull(updateDateTime, 'updateDateTime');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSMigrationHub.NotifyMigrationTaskState'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'MigrationTaskName': migrationTaskName,
      'NextUpdateSeconds': nextUpdateSeconds,
      'ProgressUpdateStream': progressUpdateStream,
      'Task': task,
      'UpdateDateTime': unixTimestampToJson(updateDateTime),
      if (dryRun != null) 'DryRun': dryRun,
    },
  );
}