createDataMigration method

Future<CreateDataMigrationResponse> createDataMigration({
  1. required MigrationTypeValue dataMigrationType,
  2. required String migrationProjectIdentifier,
  3. required String serviceAccessRoleArn,
  4. String? dataMigrationName,
  5. bool? enableCloudwatchLogs,
  6. int? numberOfJobs,
  7. String? selectionRules,
  8. List<SourceDataSetting>? sourceDataSettings,
  9. List<Tag>? tags,
  10. List<TargetDataSetting>? targetDataSettings,
})

Creates a data migration using the provided settings.

May throw FailedDependencyFault. May throw InvalidOperationFault. May throw ResourceAlreadyExistsFault. May throw ResourceNotFoundFault. May throw ResourceQuotaExceededFault.

Parameter dataMigrationType : Specifies if the data migration is full-load only, change data capture (CDC) only, or full-load and CDC.

Parameter migrationProjectIdentifier : An identifier for the migration project.

Parameter serviceAccessRoleArn : The Amazon Resource Name (ARN) for the service access role that you want to use to create the data migration.

Parameter dataMigrationName : A user-friendly name for the data migration. Data migration names have the following constraints:

  • Must begin with a letter, and can only contain ASCII letters, digits, and hyphens.
  • Can't end with a hyphen or contain two consecutive hyphens.
  • Length must be from 1 to 255 characters.

Parameter enableCloudwatchLogs : Specifies whether to enable CloudWatch logs for the data migration.

Parameter numberOfJobs : The number of parallel jobs that trigger parallel threads to unload the tables from the source, and then load them to the target.

Parameter selectionRules : An optional JSON string specifying what tables, views, and schemas to include or exclude from the migration.

Parameter sourceDataSettings : Specifies information about the source data provider.

Parameter tags : One or more tags to be assigned to the data migration.

Parameter targetDataSettings : Specifies information about the target data provider.

Implementation

Future<CreateDataMigrationResponse> createDataMigration({
  required MigrationTypeValue dataMigrationType,
  required String migrationProjectIdentifier,
  required String serviceAccessRoleArn,
  String? dataMigrationName,
  bool? enableCloudwatchLogs,
  int? numberOfJobs,
  String? selectionRules,
  List<SourceDataSetting>? sourceDataSettings,
  List<Tag>? tags,
  List<TargetDataSetting>? targetDataSettings,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonDMSv20160101.CreateDataMigration'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DataMigrationType': dataMigrationType.value,
      'MigrationProjectIdentifier': migrationProjectIdentifier,
      'ServiceAccessRoleArn': serviceAccessRoleArn,
      if (dataMigrationName != null) 'DataMigrationName': dataMigrationName,
      if (enableCloudwatchLogs != null)
        'EnableCloudwatchLogs': enableCloudwatchLogs,
      if (numberOfJobs != null) 'NumberOfJobs': numberOfJobs,
      if (selectionRules != null) 'SelectionRules': selectionRules,
      if (sourceDataSettings != null)
        'SourceDataSettings': sourceDataSettings,
      if (tags != null) 'Tags': tags,
      if (targetDataSettings != null)
        'TargetDataSettings': targetDataSettings,
    },
  );

  return CreateDataMigrationResponse.fromJson(jsonResponse.body);
}