Converts source selection rules into their target counterparts for schema conversion operations.
Required permissions: dms:GetTargetSelectionRules. For more information, see Actions, resources, and condition keys for Database Migration Service.
Parameters:
-
migration_project_identifier
(MigrationProjectIdentifier)
–
The migration project name or Amazon Resource Name (ARN).
-
selection_rules
(String)
–
A JSON string that contains the source selection rules to convert into their target counterparts. For the selection rule format and examples, see Selection rules in DMS Schema Conversion.
Usage:
-
Accepts only source selection rules, where server-name in the object locator matches the source data provider.
-
Supports only explicit rule actions.
-
Does not support category-name in the object locator.
-
Up to 10 rules are allowed.
Raises:
Examples:
Convert source selection rules to target selection rules
The following example converts source selection rules that select the ExampleTable table in the ExampleSchema schema into target selection rules that reference its converted counterpart.
>>> await client.get_target_selection_rules(migration_project_identifier='arn:aws:dms:us-east-1:111122223333:migration-project:EXAMPLEABCDEFGHIJKLMNOPQRS', selection_rules='{"rules": [{"rule-type": "selection", "rule-id": "1", "rule-name": "1", "object-locator": {"server-name": "example-source-server.us-east-1.rds.amazonaws.com", "database-name": "ExampleDatabase", "schema-name": "ExampleSchema", "table-name": "ExampleTable"}, "rule-action": "explicit"}]}')
Source code in docs_src/capo_database_migration_service/_services/async_database_migration_service.py
| async def get_target_selection_rules(
self,
migration_project_identifier: "capo_database_migration_service.types.migration_project_identifier.MigrationProjectIdentifier",
selection_rules: "capo_database_migration_service.types.string.String",
*,
config_overrides: Optional[AsyncDatabaseMigrationServiceClientConfig] = None,
) -> "capo_database_migration_service.types.get_target_selection_rules_response.GetTargetSelectionRulesResponse":
"""<p>Converts source selection rules into their target counterparts for schema conversion operations.</p> <p> <b>Required permissions:</b> <code>dms:GetTargetSelectionRules</code>. For more information, see <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsdatabasemigrationservice.html">Actions, resources, and condition keys for Database Migration Service</a>.</p>
Args:
migration_project_identifier: <p>The migration project name or Amazon Resource Name (ARN).</p>
selection_rules: <p>A JSON string that contains the source selection rules to convert into their target counterparts. For the selection rule format and examples, see <a href="https://docs.aws.amazon.com/dms/latest/userguide/sc-selection-rules.html">Selection rules in DMS Schema Conversion</a>.</p> <p>Usage:</p> <ul> <li> <p>Accepts only source selection rules, where <code>server-name</code> in the object locator matches the source data provider.</p> </li> <li> <p>Supports only <code>explicit</code> rule actions.</p> </li> <li> <p>Does not support <code>category-name</code> in the object locator.</p> </li> <li> <p>Up to 10 rules are allowed.</p> </li> </ul>
Raises:
capo_database_migration_service.errors.access_denied_fault.AccessDeniedFault: <p>DMS was denied access to the endpoint. Check that the role is correctly configured.</p>
capo_database_migration_service.errors.invalid_resource_state_fault.InvalidResourceStateFault: <p>The resource is in a state that prevents it from being used for database migration.</p>
capo_database_migration_service.errors.resource_not_found_fault.ResourceNotFoundFault: <p>The resource could not be found.</p>
capo_database_migration_service.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
Convert source selection rules to target selection rules
The following example converts source selection rules that select the ExampleTable table in the ExampleSchema schema into target selection rules that reference its converted counterpart.
>>> await client.get_target_selection_rules(migration_project_identifier='arn:aws:dms:us-east-1:111122223333:migration-project:EXAMPLEABCDEFGHIJKLMNOPQRS', selection_rules='{"rules": [{"rule-type": "selection", "rule-id": "1", "rule-name": "1", "object-locator": {"server-name": "example-source-server.us-east-1.rds.amazonaws.com", "database-name": "ExampleDatabase", "schema-name": "ExampleSchema", "table-name": "ExampleTable"}, "rule-action": "explicit"}]}')
"""
async def _handler(
req: "AsyncOperationRequest[capo_database_migration_service.types.get_target_selection_rules_message.GetTargetSelectionRulesMessage]",
) -> AsyncOperationResponse[
"capo_database_migration_service.types.get_target_selection_rules_response.GetTargetSelectionRulesResponse"
]:
import capo_database_migration_service._operations.amazon_dm_sv20160101.get_target_selection_rules
(
output,
http_response,
) = await capo_database_migration_service._operations.amazon_dm_sv20160101.get_target_selection_rules.async_get_target_selection_rules(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("GetTargetSelectionRules")
)
input_: capo_database_migration_service.types.get_target_selection_rules_message.GetTargetSelectionRulesMessage = {
"migration_project_identifier": migration_project_identifier,
"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
|