Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Oracle To Pg scenario support #3289

Merged
merged 10 commits into from
May 25, 2021
11 changes: 5 additions & 6 deletions src/dms-preview/azext_dms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,27 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from azure.cli.command_modules.dms.commands import dms_api_exception_handler
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dms_api_exception_handler does not exist in azure-cli repo

from azure.cli.core import AzCommandsLoader
from azure.cli.core.commands import CliCommandType
from azext_dms.commands import load_command_table
from azext_dms._params import load_arguments

import azext_dms._help # pylint: disable=unused-import


class DmsCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from azure.cli.command_modules.dms.commands import dms_api_exception_handler
dms_custom = CliCommandType(operations_tmpl='azext_dms.custom#{}',
exception_handler=dms_api_exception_handler)
super(DmsCommandsLoader, self).__init__(cli_ctx=cli_ctx,
custom_command_type=dms_custom)
super().__init__(cli_ctx=cli_ctx, custom_command_type=dms_custom)

def load_command_table(self, args):
from azext_dms.commands import load_command_table
load_command_table(self, args)
return self.command_table

def load_arguments(self, command):
from azext_dms._params import load_arguments
load_arguments(self, command)


Expand Down
9 changes: 3 additions & 6 deletions src/dms-preview/azext_dms/_client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from azure.cli.core.commands.client_factory import get_mgmt_service_client
from azext_dms.vendored_sdks.datamigration import DataMigrationServiceClient


def dms_client_factory(cli_ctx, **_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from azext_dms.vendored_sdks.datamigration import DataMigrationServiceClient
return get_mgmt_service_client(cli_ctx, DataMigrationServiceClient)


Expand All @@ -16,7 +17,3 @@ def dms_cf_projects(cli_ctx, *_):

def dms_cf_tasks(cli_ctx, *_):
return dms_client_factory(cli_ctx).tasks


def dms_cf_service_tasks(cli_ctx, *_):
return dms_client_factory(cli_ctx).service_tasks
143 changes: 0 additions & 143 deletions src/dms-preview/azext_dms/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,105 +5,6 @@

from knack.help_files import helps

helps['dms task'] = """
type: group
short-summary: Manage service-level tasks for a Database Migration Service instance.
long-summary: |
Service-level tasks are non-migration tasks that are performed at the service level. This is usually for administrative and maintenance work which applies to the service's agent and VM.
"""

helps['dms task cancel'] = """
type: command
short-summary: Cancel a service-level Task if it's currently queued or running.

examples:
- name: Cancel a service-level task
text: >
az dms task cancel -g myresourcegroup --service-name mydms -n mytask
"""

helps['dms task create'] = """
type: command
short-summary: Create and start a service-level task.
long-summary: |
The following tasks are currently supported:
1) Check OCI driver against Oracle source to check for compatibility
2) Upload OCI driver install package
3) Install an already uploaded OCI driver package

parameters:
- name: --task-type
type: string
short-summary: >
The type of task to create. The supported types are CheckOciDriver, UploadOciDriver, and InstallOciDriver.
- name: --task-options-json
type: string
short-summary: >
Information and settings relevant to the particular task's type. This can be either a JSON-formatted string or the location to a file containing the JSON object. See examples below for the format.
long-summary: >
For CheckOciDriver:
{
// The version of your Oracle source server against which to check the driver's compatibility.
// Can also be null to get a list of supported versions.
"serverVersion": "Oracle source version"
}

For UploadOciDriver:
{
"ociDriverPath": File share path of the driver install package,
"userName": "user name", // if this is missing or null, you will be prompted
"password": "password" // if this is missing or null (highly recommended) you will be prompted
}

For InstallOciDriver:
{
// The output of the UploadOciDriver task can be used here
"ociDriverPackageName": "Oci driver installer package name"
}
examples:
- name: Create a service-level task which checks if the currently installed OCI driver supports
text: >
az dms task create -g myresourcegroup --service-name mydms -n checkocitask1 --task-options-json "{\"serverVersion\": \"12.2.0.1\"}" --task-type CheckOciDriver
"""

helps['dms task delete'] = """
type: command
short-summary: Delete a service-level Task.
parameters:
- name: --delete-running-tasks
type: bool
short-summary: >
Delete the service-level Task even if the Task is currently running.
"""

helps['dms task list'] = """
type: command
short-summary: List the service-level Tasks within a DMS instance. Some tasks may have a status of Unknown, which indicates that an error occurred while querying the status of that task.
parameters:
- name: --task-type
type: string
short-summary: >
The type of task to be listed. For the list of possible types see "az dms check-status".
examples:
- name: List all Tasks within a DMS instance.
text: >
az dms task list -g myresourcegroup -n mydms
- name: List only the tasks that check the OCI driver compatibility within a DMS instance.
text: >
az dms task list -g myresourcegroup -n mydms --task-type Service.Check.OCI
"""

helps['dms task show'] = """
type: command
short-summary: Show the details of a service-level Task. Use the "--expand" to get more details.
parameters:
- name: --expand
type: string
short-summary: >
Expand the response to provide more details. Use with "command" to see more details of the Task.
Use with "output" to see the results of the Task's migration.
"""

helps['dms project create'] = """
type: command
short-summary: Create a migration Project which can contain multiple Tasks.
Expand Down Expand Up @@ -255,44 +156,6 @@
}
}

For Oracle to PostgreSQL, the format of the database options JSON object.
[
{
// "Preserve" or "ToLower". Not valid when providing "tableMap".
"caseManipulation": "",
// When provided, copies all tables within this schema, preserving the casing of the source object names,
// or using the value of "caseManipulation" if provided.
// Not valid if providing "tableMap".
"schemaName": "",
// Defines custom mapping of schemas and tables. As seen, offers freedom for mapping tables to different schemas, changing schema and table names, and modifying object name casing.
// Not valid if providing "schemaName".
"tableMap": {
"SCHEMA1.TABLE1": "SCHEMA1.TABLE1",
"SCHEMA2.TABLE2": "SCHEMA1.TABLE2",
"SCHEMA2.TABLE3": "schema2.OtherTableName
...n
},
"targetDatabaseName": "database_name",
// Used for manipulating the underlying migration engine.
// Only provide if instructed to do so or if you really know what you are doing.
"migrationSetting": {
"setting1": "value1",
...n
},
// Used for manipulating the underlying migration engine.
// Only provide if instructed to do so or if you really know what you are doing.
"sourceSetting": {
"setting1": "value1",
...n
},
// Used for manipulating the underlying migration engine.
// Only provide if instructed to do so or if you really know what you are doing.
"targetSetting": {
"setting1": "value1",
...n
}
}
]
- name: --source-connection-json
type: string
short-summary: >
Expand Down Expand Up @@ -334,12 +197,6 @@
"connectionString": "mongodb://hostOrIp:port"
}

The format of the connection JSON object for Oracle connections.
{
"userName": null, // if this is missing or null, you will be prompted
"password": null, // if this is missing or null (highly recommended) you will be prompted
"dataSource": "//hostOrIp:port/serviceName" // accepts EZConnect or Tnsnames formats
}
- name: --target-connection-json
type: string
short-summary: >
Expand Down
12 changes: 1 addition & 11 deletions src/dms-preview/azext_dms/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,12 @@

from knack.arguments import CLIArgumentType

from azure.cli.core.commands.parameters import resource_group_name_type, tags_type
from azure.cli.core.commands.parameters import tags_type


def load_arguments(self, _):
name_arg_type = CLIArgumentType(options_list=['--name', '-n'], metavar='NAME')

with self.argument_context('dms task') as c:
c.argument('group_name', resource_group_name_type)
c.argument('service_name', options_list=['--service-name'], help="The name of the Service.")
c.argument('task_name', name_arg_type,
help='The name of the Task. A DMS Task is the activity that performs service-level \
related work. There could be multiple Tasks associated with a service. ')

with self.argument_context('dms task list') as c:
c.argument('service_name', name_arg_type, help='The name of the Service.')

with self.argument_context('dms project') as c:
c.argument('service_name', options_list=['--service-name'],
help="The name of the Service. DMS Service is an Azure instance that performs database migrations.")
Expand Down
15 changes: 1 addition & 14 deletions src/dms-preview/azext_dms/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

from azext_dms._client_factory import (dms_client_factory,
dms_cf_projects,
dms_cf_tasks,
dms_cf_service_tasks)
dms_cf_tasks)


def load_command_table(self, _):
Expand All @@ -22,11 +21,6 @@ def load_command_table(self, _):
client_factory=dms_client_factory
)

dms_service_tasks_sdk = CliCommandType(
operations_tmpl='azext_dms.vendored_sdks.datamigration.operations._service_tasks_operations#ServiceTasksOperations.{}', # pylint: disable=line-too-long
client_factory=dms_client_factory
)

with self.command_group('dms project', dms_projects_sdk, client_factory=dms_cf_projects) as g:
g.custom_command('create', 'create_or_update_project')

Expand All @@ -36,10 +30,3 @@ def load_command_table(self, _):
g.custom_command('cutover', 'cutover_sync_task')
g.custom_command('restart', 'restart_task')
g.custom_command('stop', 'stop_task')

with self.command_group('dms task', dms_service_tasks_sdk, client_factory=dms_cf_service_tasks) as g:
g.custom_command('create', 'create_service_task')
g.command('delete', 'delete', confirmation=True)
g.command('list', 'list')
g.show_command('show', 'get')
g.command('cancel', 'cancel')
Loading