-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Adding new module DataMigration #4298
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
Merged
kairu-ms
merged 23 commits into
Azure:main
from
ashutoshsuman99:AddingDataMigrationModule
Jan 25, 2022
Merged
Changes from 9 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
4434f5c
Adding initial settings to module
c7e0a66
Working on Linter, License and Cred scan errors
0a872ea
Working on Static analysis error
8f81634
Hiding Register-ir commands for now
7ec01a5
Lint and Integration Tests solving
56c1c53
Unhiding register-ir command and adding windows test to assessment co…
bccfbc4
Making error messages proper
3a219d5
Nit changes from comments
08453c2
MultiServer support for Assessment and nit changes
9b78ff2
Adding Proper Json format, lower case for access, seperate util for W…
61c2443
Correcting Lint and Static errors
b93ced7
Removing to-* from command names
353e310
Adding correct error formats
224c703
Removing Update operation from DatabaseMigration
0fda2bb
Updating readme and help
cff3ee7
Nit: Readme corrections
330453f
Added CLI Test Cases
sagangwar 8acf3a7
Removed IR AuthKeys and Unused Imports
sagangwar 699a966
Adding Default IR Program files path for 32-bit error
ac73167
Nit and Static analysis fix
5794c5a
Added File Extension Validation
sagangwar 5d3366c
Removed unnecessary spaces and fixed static analysis Issues
sagangwar 75edbf6
Deferred IR path and MSI Extension validations
sagangwar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -219,3 +219,5 @@ | |
| /src/image-gallery/ @zhoxing-ms | ||
|
|
||
| /src/init/ @zhoxing-ms @HuangYT2000 | ||
|
|
||
| /src/datamigration/ @ashutoshsuman99 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| .. :changelog: | ||
|
|
||
| Release History | ||
| =============== | ||
|
|
||
| 0.1.0 | ||
| ++++++ | ||
| * Initial release. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,139 @@ | ||
| # Azure CLI datamigration Extension # | ||
| This is the extension for datamigration | ||
|
|
||
| ### How to use ### | ||
| Install this extension using the below CLI command | ||
| ``` | ||
| az extension add --name datamigration | ||
| ``` | ||
|
|
||
| ### Included Features ### | ||
| #### datamigration to-sql-managed-instance #### | ||
| ##### Create ##### | ||
| ``` | ||
| az datamigration to-sql-managed-instance create --managed-instance-name "managedInstance1" \ | ||
| --source-location "{\\"fileShare\\":{\\"path\\":\\"C:\\\\\\\\aaa\\\\\\\\bbb\\\\\\\\ccc\\",\\"password\\":\\"placeholder\\",\\"username\\":\\"name\\"}}" \ | ||
| --target-location account-key="abcd" storage-account-resource-id="account.database.windows.net" \ | ||
| --migration-service "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.DataMigration/sqlMigrationServices/testagent" \ | ||
| --offline-configuration last-backup-name="last_backup_file_name" offline=true \ | ||
| --scope "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/instance" \ | ||
| --source-database-name "aaa" \ | ||
| --source-sql-connection authentication="WindowsAuthentication" data-source="aaa" encrypt-connection=true password="placeholder" trust-server-certificate=true user-name="bbb" \ | ||
| --resource-group "testrg" --target-db-name "db1" | ||
| ``` | ||
| ##### Create ##### | ||
| ``` | ||
| az datamigration to-sql-managed-instance create --managed-instance-name "managedInstance1" \ | ||
| --source-location "{\\"fileShare\\":{\\"path\\":\\"C:\\\\\\\\aaa\\\\\\\\bbb\\\\\\\\ccc\\",\\"password\\":\\"placeholder\\",\\"username\\":\\"name\\"}}" \ | ||
|
ashutoshsuman99 marked this conversation as resolved.
Outdated
|
||
| --target-location account-key="abcd" storage-account-resource-id="account.database.windows.net" \ | ||
| --migration-service "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.DataMigration/sqlMigrationServices/testagent" \ | ||
| --offline-configuration last-backup-name="last_backup_file_name" offline=true \ | ||
| --scope "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/instance" \ | ||
| --source-database-name "aaa" \ | ||
| --source-sql-connection authentication="WindowsAuthentication" data-source="aaa" encrypt-connection=true password="placeholder" trust-server-certificate=true user-name="bbb" \ | ||
| --resource-group "testrg" --target-db-name "db1" | ||
| ``` | ||
| ##### Show ##### | ||
| ``` | ||
| az datamigration to-sql-managed-instance show --managed-instance-name "managedInstance1" --resource-group "testrg" \ | ||
| --target-db-name "db1" | ||
| ``` | ||
| ##### Cancel ##### | ||
| ``` | ||
| az datamigration to-sql-managed-instance cancel --managed-instance-name "managedInstance1" \ | ||
| --migration-operation-id "4124fe90-d1b6-4b50-b4d9-46d02381f59a" --resource-group "testrg" --target-db-name "db1" | ||
| ``` | ||
| ##### Cutover ##### | ||
| ``` | ||
| az datamigration to-sql-managed-instance cutover --managed-instance-name "managedInstance1" \ | ||
| --migration-operation-id "4124fe90-d1b6-4b50-b4d9-46d02381f59a" --resource-group "testrg" --target-db-name "db1" | ||
| ``` | ||
| #### datamigration to-sql-vm #### | ||
| ##### Create ##### | ||
| ``` | ||
| az datamigration to-sql-vm create \ | ||
| --source-location "{\\"fileShare\\":{\\"path\\":\\"C:\\\\\\\\aaa\\\\\\\\bbb\\\\\\\\ccc\\",\\"password\\":\\"placeholder\\",\\"username\\":\\"name\\"}}" \ | ||
|
ashutoshsuman99 marked this conversation as resolved.
Outdated
|
||
| --target-location account-key="abcd" storage-account-resource-id="account.database.windows.net" \ | ||
| --migration-service "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.DataMigration/sqlMigrationServices/testagent" \ | ||
| --offline-configuration last-backup-name="last_backup_file_name" offline=true \ | ||
| --scope "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/testvm" \ | ||
| --source-database-name "aaa" \ | ||
| --source-sql-connection authentication="WindowsAuthentication" data-source="aaa" encrypt-connection=true password="placeholder" trust-server-certificate=true user-name="bbb" \ | ||
| --resource-group "testrg" --sql-virtual-machine-name "testvm" --target-db-name "db1" | ||
| ``` | ||
| ##### Create ##### | ||
| ``` | ||
| az datamigration to-sql-vm create \ | ||
| --source-location "{\\"fileShare\\":{\\"path\\":\\"C:\\\\\\\\aaa\\\\\\\\bbb\\\\\\\\ccc\\",\\"password\\":\\"placeholder\\",\\"username\\":\\"name\\"}}" \ | ||
|
ashutoshsuman99 marked this conversation as resolved.
Outdated
|
||
| --target-location account-key="abcd" storage-account-resource-id="account.database.windows.net" \ | ||
| --migration-service "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.DataMigration/sqlMigrationServices/testagent" \ | ||
| --offline-configuration last-backup-name="last_backup_file_name" offline=true \ | ||
| --scope "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/testvm" \ | ||
| --source-database-name "aaa" \ | ||
| --source-sql-connection authentication="WindowsAuthentication" data-source="aaa" encrypt-connection=true password="placeholder" trust-server-certificate=true user-name="bbb" \ | ||
| --resource-group "testrg" --sql-virtual-machine-name "testvm" --target-db-name "db1" | ||
| ``` | ||
| ##### Show ##### | ||
| ``` | ||
| az datamigration to-sql-vm show --resource-group "testrg" --sql-virtual-machine-name "testvm" --target-db-name "db1" | ||
| ``` | ||
| ##### Cancel ##### | ||
| ``` | ||
| az datamigration to-sql-vm cancel --migration-operation-id "4124fe90-d1b6-4b50-b4d9-46d02381f59a" \ | ||
| --resource-group "testrg" --sql-virtual-machine-name "testvm" --target-db-name "db1" | ||
| ``` | ||
| ##### Cutover ##### | ||
| ``` | ||
| az datamigration to-sql-vm cutover --migration-operation-id "4124fe90-d1b6-4b50-b4d9-46d02381f59a" \ | ||
| --resource-group "testrg" --sql-virtual-machine-name "testvm" --target-db-name "db1" | ||
| ``` | ||
| #### datamigration sql-service #### | ||
| ##### Create ##### | ||
| ``` | ||
| az datamigration sql-service create --location "northeurope" --resource-group "testrg" --name "testagent" | ||
|
|
||
| az datamigration sql-service wait --created --resource-group "{rg}" --name "{mySqlMigrationService}" | ||
| ``` | ||
| ##### Create ##### | ||
| ``` | ||
| az datamigration sql-service create --location "northeurope" --resource-group "testrg" --name "testagent" | ||
|
|
||
| az datamigration sql-service wait --created --resource-group "{rg}" --name "{mySqlMigrationService}" | ||
| ``` | ||
| ##### List ##### | ||
| ``` | ||
| az datamigration sql-service list --resource-group "testrg" | ||
| ``` | ||
| ##### Show ##### | ||
| ``` | ||
| az datamigration sql-service show --resource-group "testrg" --name "service1" | ||
| ``` | ||
| ##### Update ##### | ||
| ``` | ||
| az datamigration sql-service update --tags mytag="myval" --resource-group "testrg" --name "testagent" | ||
| ``` | ||
| ##### Delete-node ##### | ||
| ``` | ||
| az datamigration sql-service delete-node --integration-runtime-name "IRName" --node-name "nodeName" \ | ||
| --resource-group "testrg" --name "service1" | ||
| ``` | ||
| ##### List-auth-key ##### | ||
| ``` | ||
| az datamigration sql-service list-auth-key --resource-group "testrg" --name "service1" | ||
| ``` | ||
| ##### List-integration-runtime-metric ##### | ||
| ``` | ||
| az datamigration sql-service list-integration-runtime-metric --resource-group "testrg" --name "service1" | ||
| ``` | ||
| ##### List-migration ##### | ||
| ``` | ||
| az datamigration sql-service list-migration --resource-group "testrg" --name "service1" | ||
| ``` | ||
| ##### Regenerate-auth-key ##### | ||
| ``` | ||
| az datamigration sql-service regenerate-auth-key --key-name "authKey1" --resource-group "testrg" --name "service1" | ||
| ``` | ||
| ##### Delete ##### | ||
| ``` | ||
| az datamigration sql-service delete --resource-group "testrg" --name "service1" | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| # -------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for | ||
| # license information. | ||
| # | ||
| # Code generated by Microsoft (R) AutoRest Code Generator. | ||
| # Changes may cause incorrect behavior and will be lost if the code is | ||
| # regenerated. | ||
| # -------------------------------------------------------------------------- | ||
| # pylint: disable=unused-import | ||
|
|
||
| from azure.cli.core import AzCommandsLoader | ||
| import azext_datamigration._help | ||
|
|
||
|
|
||
| class DataMigrationManagementClientCommandsLoader(AzCommandsLoader): | ||
|
|
||
| def __init__(self, cli_ctx=None): | ||
| from azure.cli.core.commands import CliCommandType | ||
| from azext_datamigration.generated._client_factory import cf_datamigration_cl | ||
| datamigration_custom = CliCommandType( | ||
| operations_tmpl='azext_datamigration.custom#{}', | ||
| client_factory=cf_datamigration_cl) | ||
| parent = super(DataMigrationManagementClientCommandsLoader, self) | ||
| parent.__init__(cli_ctx=cli_ctx, custom_command_type=datamigration_custom) | ||
|
|
||
| def load_command_table(self, args): | ||
| from azext_datamigration.generated.commands import load_command_table | ||
| load_command_table(self, args) | ||
| try: | ||
| from azext_datamigration.manual.commands import load_command_table as load_command_table_manual | ||
| load_command_table_manual(self, args) | ||
| except ImportError as e: | ||
| if e.name.endswith('manual.commands'): | ||
| pass | ||
| else: | ||
| raise e | ||
| return self.command_table | ||
|
|
||
| def load_arguments(self, command): | ||
| from azext_datamigration.generated._params import load_arguments | ||
| load_arguments(self, command) | ||
| try: | ||
| from azext_datamigration.manual._params import load_arguments as load_arguments_manual | ||
| load_arguments_manual(self, command) | ||
| except ImportError as e: | ||
| if e.name.endswith('manual._params'): | ||
| pass | ||
| else: | ||
| raise e | ||
|
|
||
|
|
||
| COMMAND_LOADER_CLS = DataMigrationManagementClientCommandsLoader |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # -------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for | ||
| # license information. | ||
| # | ||
| # Code generated by Microsoft (R) AutoRest Code Generator. | ||
| # Changes may cause incorrect behavior and will be lost if the code is | ||
| # regenerated. | ||
| # -------------------------------------------------------------------------- | ||
| # pylint: disable=wildcard-import | ||
| # pylint: disable=unused-wildcard-import | ||
| # pylint: disable=unused-import | ||
| from .generated._help import helps # pylint: disable=reimported | ||
| try: | ||
| from .manual._help import helps # pylint: disable=reimported | ||
| except ImportError as e: | ||
| if e.name.endswith('manual._help'): | ||
| pass | ||
| else: | ||
| raise e |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # -------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for | ||
| # license information. | ||
| # | ||
| # Code generated by Microsoft (R) AutoRest Code Generator. | ||
| # Changes may cause incorrect behavior and will be lost if the code is | ||
| # regenerated. | ||
| # -------------------------------------------------------------------------- | ||
| # pylint: disable=wildcard-import | ||
| # pylint: disable=unused-wildcard-import | ||
|
|
||
| from .generated.action import * # noqa: F403 | ||
| try: | ||
| from .manual.action import * # noqa: F403 | ||
| except ImportError as e: | ||
| if e.name.endswith('manual.action'): | ||
| pass | ||
| else: | ||
| raise e |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "azext.isExperimental": true, | ||
| "azext.minCliCoreVersion": "2.15.0" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # -------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for | ||
| # license information. | ||
| # | ||
| # Code generated by Microsoft (R) AutoRest Code Generator. | ||
| # Changes may cause incorrect behavior and will be lost if the code is | ||
| # regenerated. | ||
| # -------------------------------------------------------------------------- | ||
| # pylint: disable=wildcard-import | ||
| # pylint: disable=unused-wildcard-import | ||
|
|
||
| from .generated.custom import * # noqa: F403 | ||
| try: | ||
| from .manual.custom import * # noqa: F403 | ||
| except ImportError as e: | ||
| if e.name.endswith('manual.custom'): | ||
| pass | ||
| else: | ||
| raise e |
12 changes: 12 additions & 0 deletions
12
src/datamigration/azext_datamigration/generated/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # coding=utf-8 | ||
| # -------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for | ||
| # license information. | ||
| # | ||
| # Code generated by Microsoft (R) AutoRest Code Generator. | ||
| # Changes may cause incorrect behavior and will be lost if the code is | ||
| # regenerated. | ||
| # -------------------------------------------------------------------------- | ||
|
|
||
| __path__ = __import__('pkgutil').extend_path(__path__, __name__) |
28 changes: 28 additions & 0 deletions
28
src/datamigration/azext_datamigration/generated/_client_factory.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # -------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for | ||
| # license information. | ||
| # | ||
| # Code generated by Microsoft (R) AutoRest Code Generator. | ||
| # Changes may cause incorrect behavior and will be lost if the code is | ||
| # regenerated. | ||
| # -------------------------------------------------------------------------- | ||
|
|
||
|
|
||
| def cf_datamigration_cl(cli_ctx, *_): | ||
| from azure.cli.core.commands.client_factory import get_mgmt_service_client | ||
| from azext_datamigration.vendored_sdks.datamigration import DataMigrationManagementClient | ||
| return get_mgmt_service_client(cli_ctx, | ||
| DataMigrationManagementClient) | ||
|
|
||
|
|
||
| def cf_database_migration_sqlmi(cli_ctx, *_): | ||
| return cf_datamigration_cl(cli_ctx).database_migrations_sql_mi | ||
|
|
||
|
|
||
| def cf_database_migration_sqlvm(cli_ctx, *_): | ||
| return cf_datamigration_cl(cli_ctx).database_migrations_sql_vm | ||
|
|
||
|
|
||
| def cf_sqlmigration_service(cli_ctx, *_): | ||
| return cf_datamigration_cl(cli_ctx).sql_migration_services |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.