Skip to content

create_data_migration async

create_data_migration(
    migration_project_identifier: String,
    data_migration_type: MigrationTypeValue,
    service_access_role_arn: String,
    *,
    config_overrides: Optional[AsyncDatabaseMigrationServiceClientConfig] = None,
    data_migration_name: Optional[String] = None,
    enable_cloudwatch_logs: Optional[BooleanOptional] = None,
    source_data_settings: Optional[SourceDataSettings] = None,
    target_data_settings: Optional[TargetDataSettings] = None,
    number_of_jobs: Optional[IntegerOptional] = None,
    tags: Optional[TagList] = None,
    selection_rules: Optional[SecretString] = None,
) -> CreateDataMigrationResponse

Creates a data migration using the provided settings.

Parameters:

  • data_migration_name (Optional[String], default: None ) –

    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.

  • migration_project_identifier (String) –

    An identifier for the migration project.

  • data_migration_type (MigrationTypeValue) –

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

  • service_access_role_arn (String) –

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

  • enable_cloudwatch_logs (Optional[BooleanOptional], default: None ) –

    Specifies whether to enable CloudWatch logs for the data migration.

  • source_data_settings (Optional[SourceDataSettings], default: None ) –

    Specifies information about the source data provider.

  • target_data_settings (Optional[TargetDataSettings], default: None ) –

    Specifies information about the target data provider.

  • number_of_jobs (Optional[IntegerOptional], default: None ) –

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

  • tags (Optional[TagList], default: None ) –

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

  • selection_rules (Optional[SecretString], default: None ) –

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

Raises:

Source code in docs_src/capo_database_migration_service/_services/async_database_migration_service.py
async def create_data_migration(
    self,
    migration_project_identifier: "capo_database_migration_service.types.string.String",
    data_migration_type: "capo_database_migration_service.types.migration_type_value.MigrationTypeValue",
    service_access_role_arn: "capo_database_migration_service.types.string.String",
    *,
    config_overrides: Optional[AsyncDatabaseMigrationServiceClientConfig] = None,
    data_migration_name: Optional[
        "capo_database_migration_service.types.string.String"
    ] = None,
    enable_cloudwatch_logs: Optional[
        "capo_database_migration_service.types.boolean_optional.BooleanOptional"
    ] = None,
    source_data_settings: Optional[
        "capo_database_migration_service.types.source_data_settings.SourceDataSettings"
    ] = None,
    target_data_settings: Optional[
        "capo_database_migration_service.types.target_data_settings.TargetDataSettings"
    ] = None,
    number_of_jobs: Optional[
        "capo_database_migration_service.types.integer_optional.IntegerOptional"
    ] = None,
    tags: Optional["capo_database_migration_service.types.tag_list.TagList"] = None,
    selection_rules: Optional[
        "capo_database_migration_service.types.secret_string.SecretString"
    ] = None,
) -> "capo_database_migration_service.types.create_data_migration_response.CreateDataMigrationResponse":
    """<p>Creates a data migration using the provided settings.</p>

    Args:
        data_migration_name: <p>A user-friendly name for the data migration. Data migration names have the following constraints:</p> <ul> <li> <p>Must begin with a letter, and can only contain ASCII letters, digits, and hyphens. </p> </li> <li> <p>Can't end with a hyphen or contain two consecutive hyphens.</p> </li> <li> <p>Length must be from 1 to 255 characters.</p> </li> </ul>
        migration_project_identifier: <p>An identifier for the migration project.</p>
        data_migration_type: <p>Specifies if the data migration is full-load only, change data capture (CDC) only, or full-load and CDC.</p>
        service_access_role_arn: <p>The Amazon Resource Name (ARN) for the service access role that you want to use to create the data migration.</p>
        enable_cloudwatch_logs: <p>Specifies whether to enable CloudWatch logs for the data migration.</p>
        source_data_settings: <p>Specifies information about the source data provider.</p>
        target_data_settings: <p>Specifies information about the target data provider.</p>
        number_of_jobs: <p>The number of parallel jobs that trigger parallel threads to unload the tables from the source, and then load them to the target.</p>
        tags: <p>One or more tags to be assigned to the data migration.</p>
        selection_rules: <p>An optional JSON string specifying what tables, views, and schemas to include or exclude from the migration.</p>

    Raises:
        capo_database_migration_service.errors.failed_dependency_fault.FailedDependencyFault: <p>A dependency threw an exception.</p>
        capo_database_migration_service.errors.invalid_operation_fault.InvalidOperationFault: <p>The action or operation requested isn't valid.</p>
        capo_database_migration_service.errors.resource_already_exists_fault.ResourceAlreadyExistsFault: <p>The resource you are attempting to create already exists.</p>
        capo_database_migration_service.errors.resource_not_found_fault.ResourceNotFoundFault: <p>The resource could not be found.</p>
        capo_database_migration_service.errors.resource_quota_exceeded_fault.ResourceQuotaExceededFault: <p>The quota for this resource quota has been exceeded.</p>
        capo_database_migration_service.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_database_migration_service.types.create_data_migration_message.CreateDataMigrationMessage]",
    ) -> AsyncOperationResponse[
        "capo_database_migration_service.types.create_data_migration_response.CreateDataMigrationResponse"
    ]:
        import capo_database_migration_service._operations.amazon_dm_sv20160101.create_data_migration

        (
            output,
            http_response,
        ) = await capo_database_migration_service._operations.amazon_dm_sv20160101.create_data_migration.async_create_data_migration(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_database_migration_service.types.create_data_migration_message.CreateDataMigrationMessage",
    ) -> dict[str, Any]:
        import capo_database_migration_service.types.create_data_migration_message

        return capo_database_migration_service.types.create_data_migration_message.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_database_migration_service.types.create_data_migration_response.CreateDataMigrationResponse",
    ) -> dict[str, Any]:
        import capo_database_migration_service.types.create_data_migration_response

        return capo_database_migration_service.types.create_data_migration_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreateDataMigration",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_database_migration_service.types.create_data_migration_message.CreateDataMigrationMessage = {
        "migration_project_identifier": migration_project_identifier,
        "data_migration_type": data_migration_type,
        "service_access_role_arn": service_access_role_arn,
    }
    if data_migration_name is not None:
        input_["data_migration_name"] = data_migration_name
    if enable_cloudwatch_logs is not None:
        input_["enable_cloudwatch_logs"] = enable_cloudwatch_logs
    if source_data_settings is not None:
        input_["source_data_settings"] = source_data_settings
    if target_data_settings is not None:
        input_["target_data_settings"] = target_data_settings
    if number_of_jobs is not None:
        input_["number_of_jobs"] = number_of_jobs
    if tags is not None:
        input_["tags"] = tags
    if selection_rules is not None:
        input_["selection_rules"] = selection_rules

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output