importMigrationTask method

Future<void> importMigrationTask({
  1. required String migrationTaskName,
  2. required String progressUpdateStream,
  3. bool? dryRun,
})

Registers a new migration task which represents a server, database, etc., being migrated to AWS by a migration tool.

This API is a prerequisite to calling the NotifyMigrationTaskState API as the migration tool must first register the migration task with Migration Hub.

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 progressUpdateStream : The name of the ProgressUpdateStream. >

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> importMigrationTask({
  required String migrationTaskName,
  required String progressUpdateStream,
  bool? dryRun,
}) async {
  ArgumentError.checkNotNull(migrationTaskName, 'migrationTaskName');
  _s.validateStringLength(
    'migrationTaskName',
    migrationTaskName,
    1,
    256,
    isRequired: true,
  );
  ArgumentError.checkNotNull(progressUpdateStream, 'progressUpdateStream');
  _s.validateStringLength(
    'progressUpdateStream',
    progressUpdateStream,
    1,
    50,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSMigrationHub.ImportMigrationTask'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'MigrationTaskName': migrationTaskName,
      'ProgressUpdateStream': progressUpdateStream,
      if (dryRun != null) 'DryRun': dryRun,
    },
  );
}