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

2021 08 2 extension updates #3740

Merged
merged 9 commits into from
Aug 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/dms-preview/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
0.15.0
++++++++++++++++++

* Adding tests for extension.
* Removing online MySql migration.
* Removing PgSQL and using core instead.
* Migrating vendored SDKs to track2.

0.14.0
++++++++++++++++++

Expand Down
4 changes: 1 addition & 3 deletions src/dms-preview/azext_dms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# 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
from azure.cli.core import AzCommandsLoader
from azure.cli.core.commands import CliCommandType
from azext_dms.commands import load_command_table
Expand All @@ -15,8 +14,7 @@
class DmsCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
dms_custom = CliCommandType(operations_tmpl='azext_dms.custom#{}',
exception_handler=dms_api_exception_handler)
dms_custom = CliCommandType(operations_tmpl='azext_dms.custom#{}')
super().__init__(cli_ctx=cli_ctx, custom_command_type=dms_custom)

def load_command_table(self, args):
Expand Down
4 changes: 2 additions & 2 deletions src/dms-preview/azext_dms/_client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
# --------------------------------------------------------------------------------------------

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


def dms_client_factory(cli_ctx, **_):
return get_mgmt_service_client(cli_ctx, DataMigrationServiceClient)
return get_mgmt_service_client(cli_ctx, DataMigrationManagementClient)


def dms_cf_projects(cli_ctx, *_):
Expand Down
78 changes: 25 additions & 53 deletions src/dms-preview/azext_dms/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,47 @@

helps['dms project create'] = """
type: command
short-summary: Create a migration Project which can contain multiple Tasks.
short-summary: Create a migration project which can contain multiple tasks.
long-summary: |
The following project configurations are supported:
-) source -> target
1) SQL -> SQLDB
2) MySQL -> AzureDbForMySql
3) PostgreSQL -> AzureDbForPostgreSQL
4) MongoDB -> MongoDB (for migrating to Cosmos DB via their MongoDB API)
2) PostgreSQL -> AzureDbForPostgreSQL
3) MongoDB -> MongoDB (for migrating to Cosmos DB via their MongoDB API)

parameters:
- name: --source-platform
type: string
short-summary: >
The type of server for the source database. The supported types are: SQL, MySQL, PostgreSQL, MongoDB.
The type of server for the source database. The supported types are: SQL, PostgreSQL, MongoDB.
- name: --target-platform
type: string
short-summary: >
The type of service for the target database. The supported types are: SQLDB, AzureDbForMySql, AzureDbForPostgreSQL, MongoDB.
The type of service for the target database. The supported types are: SQLDB, AzureDbForPostgreSQL, MongoDB.
examples:
- name: Create a SQL Project for a DMS instance.
- name: Create a SQL to SQLDB project for a DMS instance.
text: >
az dms project create -l westus -n myproject -g myresourcegroup --service-name mydms --source-platform SQL --target-platform SQLDB --tags tagName1=tagValue1 tagWithNoValue
az dms project create -l westus -n sqlproject -g myresourcegroup --service-name mydms --source-platform SQL --target-platform SQLDB --tags tagName1=tagValue1 tagWithNoValue
- name: Create a PostgreSql to AzureDbForPostgreSql project for a DMS instance.
text: >
az dms project create -l westus -n pgproject -g myresourcegroup --service-name mydms --source-platform PostgreSQL --target-platform AzureDbForPostgreSQL --tags tagName1=tagValue1 tagWithNoValue
"""

helps['dms project task create'] = """
type: command
short-summary: Create and start a migration Task.
short-summary: Create and start a migration task.
long-summary: |
The following task configurations are supported:
-) source -> target :: task type
1) SQL -> SQLDB :: OfflineMigration
2) MySQL -> AzureDbForMySql :: OnlineMigration
3) PostgreSQL -> AzureDbForPostgreSQL :: OnlineMigration
4) MongoDB -> MongoDB (for migrating to Cosmos DB via their MongoDB API) :: OfflineMigration
2) PostgreSQL -> AzureDbForPostgreSQL :: OnlineMigration
3) MongoDB -> MongoDB (for migrating to Cosmos DB via their MongoDB API) :: OfflineMigration

parameters:
- name: --task-type
type: string
short-summary: >
The type of data movement the task will support. The supported types are: OnlineMigration, OfflineMigration.
The type of data movement the task will support. The supported types are: OnlineMigration, OfflineMigration. If not provided, will default to OfflineMigration for SQL, MongoDB and OnlineMigration for PostgreSQL.
- name: --database-options-json
type: string
short-summary: >
Expand All @@ -68,7 +69,7 @@
...n
]

For MySQL and PostgreSQL, the format of the database options JSON object.
For PostgreSQL, the format of the database options JSON object.
[
{
"name": "source database",
Expand All @@ -91,8 +92,7 @@
"setting1": "value1",
...n
},
// Applies only for PostgreSQL
// List tables that you want included in the migration.
// Optional parameter to list tables that you want included in the migration.
"selectedTables": [
"schemaName1.tableName1",
...n
Expand Down Expand Up @@ -171,23 +171,15 @@
"trustServerCertificate": false // highly recommended to leave as false
}

The format of the connection JSON object for MySql connections.
{
"userName": "user name", // if this is missing or null, you will be prompted
"password": null, // if this is missing or null (highly recommended) you will be prompted
"serverName": "server name",
"port": 3306 // if this is missing, it will default to 3306
}

The format of the connection JSON object for PostgreSQL connections.
{
"userName": "user name", // if this is missing or null, you will be prompted
"password": null, // if this is missing or null (highly recommended) you will be prompted
"serverName": "server name",
"databaseName": "database name", // if this is missing, it will default to the 'postgres' database
"port": 5432, // if this is missing, it will default to 5432
"encryptConnection": true, // highly recommended to leave as true (For PostgreSQL to Azure PostgreSQL migration only)
"trustServerCertificate": false // highly recommended to leave as false (For PostgreSQL to Azure PostgreSQL migration only)
"encryptConnection": true, // highly recommended to leave as true
"trustServerCertificate": false // highly recommended to leave as false
}

The format of the connection JSON object for MongoDB connections.
Expand All @@ -204,19 +196,21 @@
- name: --enable-data-integrity-validation
type: bool
short-summary: >
(For SQL only) Whether to perform a checksum based data integrity validation between source and target for the selected database and tables.
For SQL only. Whether to perform a checksum based data integrity validation between source and target for the selected database and tables.
- name: --enable-query-analysis-validation
type: bool
short-summary: >
(For SQL only) Whether to perform a quick and intelligent query analysis by retrieving queries from the source database and executing them in the target. The result will have execution statistics for executions in source and target databases for the extracted queries.
For SQL only. Whether to perform a quick and intelligent query analysis by retrieving queries from the source database and
executing them in the target. The result will have execution statistics for executions in source and target databases
for the extracted queries.
- name: --enable-schema-validation
type: bool
short-summary: >
(For SQL only) Whether to compare the schema information between source and target.
For SQL only. Whether to compare the schema information between source and target.
- name: --validate-only
type: bool
short-summary: >
(For MongoDB to Cosmos DB only) Whether to run validation only and NOT run migration. It is mandatory to run a 'validate only' task before attempting an actual migration. Once the validation is complete, pass the name of this 'validate only' task to a new task's 'validated task name' argument.
For MongoDB to Cosmos DB only. Whether to run validation only and NOT run migration. It is mandatory to run a 'validate only' task before attempting an actual migration. Once the validation is complete, pass the name of this 'validate only' task to a new task's 'validated task name' argument.
- name: --validated-task-name
type: string
short-summary: >
Expand Down Expand Up @@ -245,31 +239,9 @@
The qualified name of the database or collection you wish to stop. Leave blank to stop the entire migration.
"""

helps['dms project task cutover'] = """
type: command
short-summary: For an online migration task, complete the migration by performing a cutover.
long-summary: |
To see the result of the request, please use the 'task show' command:
az dms project task show ... --expand command

parameters:
- name: --object-name
type: string
short-summary: >
For MongoDB migrations, the qualified name of the database or collection you wish to cutover.
Leave blank to cutover the entire migration.
For all other migration types, the name of the database on the source you wish to cutover.
- name: --immediate
type: bool
short-summary: >
For MongoDB migrations, whether to cutover immediately or to let the currently loaded events
get migrated.
For all other migration types, this has no effect.
"""

helps['dms project task restart'] = """
type: command
short-sumary: Restart either the entire migration or just a specified object. Currently only supported by MongoDB migrations.
short-summary: Restart either the entire migration or just a specified object. Currently only supported by MongoDB migrations.
long-summary: |
To see the result of the request, please use the 'task show' command:
az dms project task show ... --expand command
Expand Down
2 changes: 1 addition & 1 deletion src/dms-preview/azext_dms/azext_metadata.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"azext.minCliCoreVersion": "2.0.43",
"azext.minCliCoreVersion": "2.27.0",
"azext.isPreview": true
}
3 changes: 1 addition & 2 deletions src/dms-preview/azext_dms/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ def load_command_table(self, _):
g.custom_command('create', 'create_or_update_project')

with self.command_group('dms project task', dms_tasks_sdk, client_factory=dms_cf_tasks) as g:
g.custom_command('cancel', 'stop_task')
g.custom_command('create', 'create_task')
g.custom_command('cutover', 'cutover_sync_task')
g.custom_command('cancel', 'stop_task')
g.custom_command('restart', 'restart_task')
g.custom_command('stop', 'stop_task')
Loading