diff --git a/src/datamigration/HISTORY.rst b/src/datamigration/HISTORY.rst index 5748887d9ff..66a945ed365 100644 --- a/src/datamigration/HISTORY.rst +++ b/src/datamigration/HISTORY.rst @@ -3,6 +3,14 @@ Release History =============== +======= +1.0.0 +++++++ +* Released the first stable version with three new commands. +* [NEW COMMAND] `az datamigration sql-db retry` - Retry on going migration for the database. +* [NEW COMMAND] `az datamigration sql-managed-instance delete` - Delete SQL MI Database Migration resource. +* [NEW COMMAND] `az datamigration sql-vm delete` - Delete SQL VM Database Migration resource. + ======= 1.0.0b6 ++++++ diff --git a/src/datamigration/azext_datamigration/__init__.py b/src/datamigration/azext_datamigration/__init__.py index 1ca255c4cba..b512f71aefa 100644 --- a/src/datamigration/azext_datamigration/__init__.py +++ b/src/datamigration/azext_datamigration/__init__.py @@ -26,6 +26,17 @@ def __init__(self, cli_ctx=None): def load_command_table(self, args): from azext_datamigration.generated.commands import load_command_table + from azure.cli.core.aaz import load_aaz_command_table + try: + from . import aaz + except ImportError: + aaz = None + if aaz: + load_aaz_command_table( + loader=self, + aaz_pkg_name=aaz.__name__, + args=args + ) load_command_table(self, args) try: from azext_datamigration.manual.commands import load_command_table as load_command_table_manual diff --git a/src/datamigration/azext_datamigration/aaz/__init__.py b/src/datamigration/azext_datamigration/aaz/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/datamigration/azext_datamigration/aaz/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- diff --git a/src/datamigration/azext_datamigration/aaz/latest/__init__.py b/src/datamigration/azext_datamigration/aaz/latest/__init__.py new file mode 100644 index 00000000000..f6acc11aa4e --- /dev/null +++ b/src/datamigration/azext_datamigration/aaz/latest/__init__.py @@ -0,0 +1,10 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + diff --git a/src/datamigration/azext_datamigration/aaz/latest/datamigration/__cmd_group.py b/src/datamigration/azext_datamigration/aaz/latest/datamigration/__cmd_group.py new file mode 100644 index 00000000000..47875219aca --- /dev/null +++ b/src/datamigration/azext_datamigration/aaz/latest/datamigration/__cmd_group.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "datamigration", +) +class __CMDGroup(AAZCommandGroup): + """Manage Datamigration + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/datamigration/azext_datamigration/aaz/latest/datamigration/__init__.py b/src/datamigration/azext_datamigration/aaz/latest/datamigration/__init__.py new file mode 100644 index 00000000000..5a9d61963d6 --- /dev/null +++ b/src/datamigration/azext_datamigration/aaz/latest/datamigration/__init__.py @@ -0,0 +1,11 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * diff --git a/src/datamigration/azext_datamigration/aaz/latest/datamigration/sql_db/__cmd_group.py b/src/datamigration/azext_datamigration/aaz/latest/datamigration/sql_db/__cmd_group.py new file mode 100644 index 00000000000..4c7fa886ad6 --- /dev/null +++ b/src/datamigration/azext_datamigration/aaz/latest/datamigration/sql_db/__cmd_group.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "datamigration sql-db", +) +class __CMDGroup(AAZCommandGroup): + """Manage Sql Db + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/datamigration/azext_datamigration/aaz/latest/datamigration/sql_db/__init__.py b/src/datamigration/azext_datamigration/aaz/latest/datamigration/sql_db/__init__.py new file mode 100644 index 00000000000..dba0e6840e3 --- /dev/null +++ b/src/datamigration/azext_datamigration/aaz/latest/datamigration/sql_db/__init__.py @@ -0,0 +1,12 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._retry import * diff --git a/src/datamigration/azext_datamigration/aaz/latest/datamigration/sql_db/_retry.py b/src/datamigration/azext_datamigration/aaz/latest/datamigration/sql_db/_retry.py new file mode 100644 index 00000000000..a9bf78a9a6d --- /dev/null +++ b/src/datamigration/azext_datamigration/aaz/latest/datamigration/sql_db/_retry.py @@ -0,0 +1,188 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "datamigration sql-db retry", +) +class Retry(AAZCommand): + """Retry on going migration for the database. + + :example: Retry Database Migration resource. + az datamigration sql-db retry --resource-group testrg --sql-db-instance-name sqldbinstance --target-db-name db1 --migration-operation-id 9a90bb84-e70f-46f7-b0ae-1aef5b3b9f07 + """ + + _aaz_info = { + "version": "2025-06-30", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.sql/servers/{}/providers/microsoft.datamigration/databasemigrations/{}/retry", "2025-06-30"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + help="Name of the Azure resource group", + required=True, + ) + _args_schema.sql_db_instance_name = AAZStrArg( + options=["--sql-db-instance-name"], + help="Name of the SQL database instance", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,127}$", + ), + ) + _args_schema.target_db_name = AAZStrArg( + options=["--target-db-name"], + help="The name of the target database.", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,127}$", + ), + ) + + # define Arg Group "MigrationOperationInput" + + _args_schema = cls._args_schema + _args_schema.migration_operation_id = AAZUuidArg( + options=["--migration-operation-id"], + arg_group="MigrationOperationInput", + help="Unique ID for tracking the migration operation", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.DatabaseMigrationsSqlDbRetry(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class DatabaseMigrationsSqlDbRetry(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + None, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{sqlDbInstanceName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDbName}/retry", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "sqlDbInstanceName", self.ctx.args.sql_db_instance_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "targetDbName", self.ctx.args.target_db_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2025-06-30", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("migrationOperationId", AAZStrType, ".migration_operation_id") + + return self.serialize_content(_content_value) + + +class _RetryHelper: + """Helper class for Retry""" + + +__all__ = ["Retry"] diff --git a/src/datamigration/azext_datamigration/aaz/latest/datamigration/sql_managed_instance/__cmd_group.py b/src/datamigration/azext_datamigration/aaz/latest/datamigration/sql_managed_instance/__cmd_group.py new file mode 100644 index 00000000000..ead05e28b8f --- /dev/null +++ b/src/datamigration/azext_datamigration/aaz/latest/datamigration/sql_managed_instance/__cmd_group.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "datamigration sql-managed-instance", +) +class __CMDGroup(AAZCommandGroup): + """Manage Sql Managed Instance + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/datamigration/azext_datamigration/aaz/latest/datamigration/sql_managed_instance/__init__.py b/src/datamigration/azext_datamigration/aaz/latest/datamigration/sql_managed_instance/__init__.py new file mode 100644 index 00000000000..af9cedd3228 --- /dev/null +++ b/src/datamigration/azext_datamigration/aaz/latest/datamigration/sql_managed_instance/__init__.py @@ -0,0 +1,12 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._delete import * diff --git a/src/datamigration/azext_datamigration/aaz/latest/datamigration/sql_managed_instance/_delete.py b/src/datamigration/azext_datamigration/aaz/latest/datamigration/sql_managed_instance/_delete.py new file mode 100644 index 00000000000..8d2061e93fb --- /dev/null +++ b/src/datamigration/azext_datamigration/aaz/latest/datamigration/sql_managed_instance/_delete.py @@ -0,0 +1,596 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "datamigration sql-managed-instance delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete Database Migration resource. + + :example: Delete Database Migration resource with Minimum parameters. + az datamigration sql-managed-instance delete --resource-group testrg --managed-instance-name managedInstance1 --target-db-name db1 + """ + + _aaz_info = { + "version": "2025-06-30", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.sql/managedinstances/{}/providers/microsoft.datamigration/databasemigrations/{}", "2025-06-30"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.managed_instance_name = AAZStrArg( + options=["--managed-instance-name"], + help="Name of the sql managed instance", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + help="Name of the Azure resource group", + required=True, + ) + _args_schema.target_db_name = AAZStrArg( + options=["-n", "--name", "--target-db-name"], + help="The name of the target database.", + required=True, + id_part="child_name_1", + ) + _args_schema.force = AAZBoolArg( + options=["--force"], + help="Optional force delete boolean. If this is provided as true, migration will be deleted even if active.", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.DatabaseMigrationsSqlMiDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class DatabaseMigrationsSqlMiDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDbName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "managedInstanceName", self.ctx.args.managed_instance_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "targetDbName", self.ctx.args.target_db_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "force", self.ctx.args.force, + ), + **self.serialize_query_param( + "api-version", "2025-06-30", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.backup_configuration = AAZObjectType( + serialized_name="backupConfiguration", + ) + properties.ended_on = AAZStrType( + serialized_name="endedOn", + flags={"read_only": True}, + ) + properties.kind = AAZStrType( + flags={"required": True}, + ) + properties.migration_failure_error = AAZObjectType( + serialized_name="migrationFailureError", + flags={"read_only": True}, + ) + properties.migration_operation_id = AAZStrType( + serialized_name="migrationOperationId", + ) + properties.migration_service = AAZStrType( + serialized_name="migrationService", + ) + properties.migration_status = AAZStrType( + serialized_name="migrationStatus", + flags={"read_only": True}, + ) + properties.migration_status_details = AAZObjectType( + serialized_name="migrationStatusDetails", + flags={"read_only": True}, + ) + properties.offline_configuration = AAZObjectType( + serialized_name="offlineConfiguration", + ) + properties.provisioning_error = AAZStrType( + serialized_name="provisioningError", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.scope = AAZStrType() + properties.source_database_name = AAZStrType( + serialized_name="sourceDatabaseName", + ) + properties.source_server_name = AAZStrType( + serialized_name="sourceServerName", + flags={"read_only": True}, + ) + properties.source_sql_connection = AAZObjectType( + serialized_name="sourceSqlConnection", + ) + properties.started_on = AAZStrType( + serialized_name="startedOn", + flags={"read_only": True}, + ) + properties.target_database_collation = AAZStrType( + serialized_name="targetDatabaseCollation", + ) + + backup_configuration = cls._schema_on_200.properties.backup_configuration + backup_configuration.source_location = AAZObjectType( + serialized_name="sourceLocation", + ) + backup_configuration.target_location = AAZObjectType( + serialized_name="targetLocation", + ) + + source_location = cls._schema_on_200.properties.backup_configuration.source_location + source_location.azure_blob = AAZObjectType( + serialized_name="azureBlob", + ) + source_location.file_share = AAZObjectType( + serialized_name="fileShare", + ) + source_location.file_storage_type = AAZStrType( + serialized_name="fileStorageType", + flags={"read_only": True}, + ) + + azure_blob = cls._schema_on_200.properties.backup_configuration.source_location.azure_blob + azure_blob.account_key = AAZStrType( + serialized_name="accountKey", + flags={"secret": True}, + ) + azure_blob.auth_type = AAZStrType( + serialized_name="authType", + ) + azure_blob.blob_container_name = AAZStrType( + serialized_name="blobContainerName", + ) + azure_blob.identity = AAZIdentityObjectType() + azure_blob.storage_account_resource_id = AAZStrType( + serialized_name="storageAccountResourceId", + ) + + identity = cls._schema_on_200.properties.backup_configuration.source_location.azure_blob.identity + identity.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"read_only": True}, + ) + identity.type = AAZStrType( + flags={"required": True}, + ) + identity.user_assigned_identities = AAZDictType( + serialized_name="userAssignedIdentities", + ) + + user_assigned_identities = cls._schema_on_200.properties.backup_configuration.source_location.azure_blob.identity.user_assigned_identities + user_assigned_identities.Element = AAZObjectType( + nullable=True, + ) + + _element = cls._schema_on_200.properties.backup_configuration.source_location.azure_blob.identity.user_assigned_identities.Element + _element.client_id = AAZStrType( + serialized_name="clientId", + flags={"read_only": True}, + ) + _element.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + + file_share = cls._schema_on_200.properties.backup_configuration.source_location.file_share + file_share.path = AAZStrType() + file_share.username = AAZStrType() + + target_location = cls._schema_on_200.properties.backup_configuration.target_location + target_location.account_key = AAZStrType( + serialized_name="accountKey", + ) + target_location.storage_account_resource_id = AAZStrType( + serialized_name="storageAccountResourceId", + ) + + migration_failure_error = cls._schema_on_200.properties.migration_failure_error + migration_failure_error.code = AAZStrType( + flags={"read_only": True}, + ) + migration_failure_error.message = AAZStrType( + flags={"read_only": True}, + ) + + migration_status_details = cls._schema_on_200.properties.migration_status_details + migration_status_details.active_backup_sets = AAZListType( + serialized_name="activeBackupSets", + flags={"read_only": True}, + ) + migration_status_details.blob_container_name = AAZStrType( + serialized_name="blobContainerName", + flags={"read_only": True}, + ) + migration_status_details.complete_restore_error_message = AAZStrType( + serialized_name="completeRestoreErrorMessage", + flags={"read_only": True}, + ) + migration_status_details.current_restoring_filename = AAZStrType( + serialized_name="currentRestoringFilename", + flags={"read_only": True}, + ) + migration_status_details.file_upload_blocking_errors = AAZListType( + serialized_name="fileUploadBlockingErrors", + flags={"read_only": True}, + ) + migration_status_details.full_backup_set_info = AAZObjectType( + serialized_name="fullBackupSetInfo", + flags={"read_only": True}, + ) + _DeleteHelper._build_schema_sql_backup_set_info_read(migration_status_details.full_backup_set_info) + migration_status_details.invalid_files = AAZListType( + serialized_name="invalidFiles", + flags={"read_only": True}, + ) + migration_status_details.is_full_backup_restored = AAZBoolType( + serialized_name="isFullBackupRestored", + flags={"read_only": True}, + ) + migration_status_details.last_restored_backup_set_info = AAZObjectType( + serialized_name="lastRestoredBackupSetInfo", + flags={"read_only": True}, + ) + _DeleteHelper._build_schema_sql_backup_set_info_read(migration_status_details.last_restored_backup_set_info) + migration_status_details.last_restored_filename = AAZStrType( + serialized_name="lastRestoredFilename", + flags={"read_only": True}, + ) + migration_status_details.migration_state = AAZStrType( + serialized_name="migrationState", + flags={"read_only": True}, + ) + migration_status_details.pending_log_backups_count = AAZIntType( + serialized_name="pendingLogBackupsCount", + flags={"read_only": True}, + ) + migration_status_details.restore_blocking_reason = AAZStrType( + serialized_name="restoreBlockingReason", + flags={"read_only": True}, + ) + + active_backup_sets = cls._schema_on_200.properties.migration_status_details.active_backup_sets + active_backup_sets.Element = AAZObjectType() + _DeleteHelper._build_schema_sql_backup_set_info_read(active_backup_sets.Element) + + file_upload_blocking_errors = cls._schema_on_200.properties.migration_status_details.file_upload_blocking_errors + file_upload_blocking_errors.Element = AAZStrType() + + invalid_files = cls._schema_on_200.properties.migration_status_details.invalid_files + invalid_files.Element = AAZStrType() + + offline_configuration = cls._schema_on_200.properties.offline_configuration + offline_configuration.last_backup_name = AAZStrType( + serialized_name="lastBackupName", + ) + offline_configuration.offline = AAZBoolType() + + source_sql_connection = cls._schema_on_200.properties.source_sql_connection + source_sql_connection.authentication = AAZStrType() + source_sql_connection.data_source = AAZStrType( + serialized_name="dataSource", + ) + source_sql_connection.encrypt_connection = AAZBoolType( + serialized_name="encryptConnection", + ) + source_sql_connection.password = AAZStrType( + flags={"secret": True}, + ) + source_sql_connection.trust_server_certificate = AAZBoolType( + serialized_name="trustServerCertificate", + ) + source_sql_connection.user_name = AAZStrType( + serialized_name="userName", + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + _schema_sql_backup_set_info_read = None + + @classmethod + def _build_schema_sql_backup_set_info_read(cls, _schema): + if cls._schema_sql_backup_set_info_read is not None: + _schema.backup_finish_date = cls._schema_sql_backup_set_info_read.backup_finish_date + _schema.backup_set_id = cls._schema_sql_backup_set_info_read.backup_set_id + _schema.backup_start_date = cls._schema_sql_backup_set_info_read.backup_start_date + _schema.backup_type = cls._schema_sql_backup_set_info_read.backup_type + _schema.family_count = cls._schema_sql_backup_set_info_read.family_count + _schema.first_lsn = cls._schema_sql_backup_set_info_read.first_lsn + _schema.has_backup_checksums = cls._schema_sql_backup_set_info_read.has_backup_checksums + _schema.ignore_reasons = cls._schema_sql_backup_set_info_read.ignore_reasons + _schema.is_backup_restored = cls._schema_sql_backup_set_info_read.is_backup_restored + _schema.last_lsn = cls._schema_sql_backup_set_info_read.last_lsn + _schema.list_of_backup_files = cls._schema_sql_backup_set_info_read.list_of_backup_files + return + + cls._schema_sql_backup_set_info_read = _schema_sql_backup_set_info_read = AAZObjectType( + flags={"read_only": True} + ) + + sql_backup_set_info_read = _schema_sql_backup_set_info_read + sql_backup_set_info_read.backup_finish_date = AAZStrType( + serialized_name="backupFinishDate", + flags={"read_only": True}, + ) + sql_backup_set_info_read.backup_set_id = AAZStrType( + serialized_name="backupSetId", + flags={"read_only": True}, + ) + sql_backup_set_info_read.backup_start_date = AAZStrType( + serialized_name="backupStartDate", + flags={"read_only": True}, + ) + sql_backup_set_info_read.backup_type = AAZStrType( + serialized_name="backupType", + flags={"read_only": True}, + ) + sql_backup_set_info_read.family_count = AAZIntType( + serialized_name="familyCount", + flags={"read_only": True}, + ) + sql_backup_set_info_read.first_lsn = AAZStrType( + serialized_name="firstLSN", + flags={"read_only": True}, + ) + sql_backup_set_info_read.has_backup_checksums = AAZBoolType( + serialized_name="hasBackupChecksums", + flags={"read_only": True}, + ) + sql_backup_set_info_read.ignore_reasons = AAZListType( + serialized_name="ignoreReasons", + flags={"read_only": True}, + ) + sql_backup_set_info_read.is_backup_restored = AAZBoolType( + serialized_name="isBackupRestored", + flags={"read_only": True}, + ) + sql_backup_set_info_read.last_lsn = AAZStrType( + serialized_name="lastLSN", + flags={"read_only": True}, + ) + sql_backup_set_info_read.list_of_backup_files = AAZListType( + serialized_name="listOfBackupFiles", + flags={"read_only": True}, + ) + + ignore_reasons = _schema_sql_backup_set_info_read.ignore_reasons + ignore_reasons.Element = AAZStrType() + + list_of_backup_files = _schema_sql_backup_set_info_read.list_of_backup_files + list_of_backup_files.Element = AAZObjectType() + + _element = _schema_sql_backup_set_info_read.list_of_backup_files.Element + _element.copy_duration = AAZIntType( + serialized_name="copyDuration", + flags={"read_only": True}, + ) + _element.copy_throughput = AAZFloatType( + serialized_name="copyThroughput", + flags={"read_only": True}, + ) + _element.data_read = AAZIntType( + serialized_name="dataRead", + flags={"read_only": True}, + ) + _element.data_written = AAZIntType( + serialized_name="dataWritten", + flags={"read_only": True}, + ) + _element.family_sequence_number = AAZIntType( + serialized_name="familySequenceNumber", + flags={"read_only": True}, + ) + _element.file_name = AAZStrType( + serialized_name="fileName", + flags={"read_only": True}, + ) + _element.status = AAZStrType( + flags={"read_only": True}, + ) + _element.total_size = AAZIntType( + serialized_name="totalSize", + flags={"read_only": True}, + ) + + _schema.backup_finish_date = cls._schema_sql_backup_set_info_read.backup_finish_date + _schema.backup_set_id = cls._schema_sql_backup_set_info_read.backup_set_id + _schema.backup_start_date = cls._schema_sql_backup_set_info_read.backup_start_date + _schema.backup_type = cls._schema_sql_backup_set_info_read.backup_type + _schema.family_count = cls._schema_sql_backup_set_info_read.family_count + _schema.first_lsn = cls._schema_sql_backup_set_info_read.first_lsn + _schema.has_backup_checksums = cls._schema_sql_backup_set_info_read.has_backup_checksums + _schema.ignore_reasons = cls._schema_sql_backup_set_info_read.ignore_reasons + _schema.is_backup_restored = cls._schema_sql_backup_set_info_read.is_backup_restored + _schema.last_lsn = cls._schema_sql_backup_set_info_read.last_lsn + _schema.list_of_backup_files = cls._schema_sql_backup_set_info_read.list_of_backup_files + + +__all__ = ["Delete"] diff --git a/src/datamigration/azext_datamigration/aaz/latest/datamigration/sql_vm/__cmd_group.py b/src/datamigration/azext_datamigration/aaz/latest/datamigration/sql_vm/__cmd_group.py new file mode 100644 index 00000000000..8eb48e363e9 --- /dev/null +++ b/src/datamigration/azext_datamigration/aaz/latest/datamigration/sql_vm/__cmd_group.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "datamigration sql-vm", +) +class __CMDGroup(AAZCommandGroup): + """Manage Sql Vm + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/datamigration/azext_datamigration/aaz/latest/datamigration/sql_vm/__init__.py b/src/datamigration/azext_datamigration/aaz/latest/datamigration/sql_vm/__init__.py new file mode 100644 index 00000000000..af9cedd3228 --- /dev/null +++ b/src/datamigration/azext_datamigration/aaz/latest/datamigration/sql_vm/__init__.py @@ -0,0 +1,12 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._delete import * diff --git a/src/datamigration/azext_datamigration/aaz/latest/datamigration/sql_vm/_delete.py b/src/datamigration/azext_datamigration/aaz/latest/datamigration/sql_vm/_delete.py new file mode 100644 index 00000000000..92261e7fee9 --- /dev/null +++ b/src/datamigration/azext_datamigration/aaz/latest/datamigration/sql_vm/_delete.py @@ -0,0 +1,596 @@ +# -------------------------------------------------------------------------------------------- +# 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 aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "datamigration sql-vm delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete Database Migration resource. + + :example: Create or Update Database Migration resource with Minimum parameters. + az data-migration sql-vm delete --resource-group testrg --sql-virtual-machine-name testvm --target-db-name db1 + """ + + _aaz_info = { + "version": "2025-06-30", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.sqlvirtualmachine/sqlvirtualmachines/{}/providers/microsoft.datamigration/databasemigrations/{}", "2025-06-30"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + help="Name of the Azure resource group", + required=True, + ) + _args_schema.sql_vm_name = AAZStrArg( + options=["--sql-vm-name"], + help="Name of the sql virtual machine", + required=True, + id_part="name", + ) + _args_schema.target_db_name = AAZStrArg( + options=["-n", "--name", "--target-db-name"], + help="The name of the target database.", + required=True, + id_part="child_name_1", + ) + _args_schema.force = AAZBoolArg( + options=["--force"], + help="Optional force delete boolean. If this is provided as true, migration will be deleted even if active.", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.DatabaseMigrationsSqlVmDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class DatabaseMigrationsSqlVmDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDbName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "sqlVirtualMachineName", self.ctx.args.sql_vm_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "targetDbName", self.ctx.args.target_db_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "force", self.ctx.args.force, + ), + **self.serialize_query_param( + "api-version", "2025-06-30", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.backup_configuration = AAZObjectType( + serialized_name="backupConfiguration", + ) + properties.ended_on = AAZStrType( + serialized_name="endedOn", + flags={"read_only": True}, + ) + properties.kind = AAZStrType( + flags={"required": True}, + ) + properties.migration_failure_error = AAZObjectType( + serialized_name="migrationFailureError", + flags={"read_only": True}, + ) + properties.migration_operation_id = AAZStrType( + serialized_name="migrationOperationId", + ) + properties.migration_service = AAZStrType( + serialized_name="migrationService", + ) + properties.migration_status = AAZStrType( + serialized_name="migrationStatus", + flags={"read_only": True}, + ) + properties.migration_status_details = AAZObjectType( + serialized_name="migrationStatusDetails", + flags={"read_only": True}, + ) + properties.offline_configuration = AAZObjectType( + serialized_name="offlineConfiguration", + ) + properties.provisioning_error = AAZStrType( + serialized_name="provisioningError", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.scope = AAZStrType() + properties.source_database_name = AAZStrType( + serialized_name="sourceDatabaseName", + ) + properties.source_server_name = AAZStrType( + serialized_name="sourceServerName", + flags={"read_only": True}, + ) + properties.source_sql_connection = AAZObjectType( + serialized_name="sourceSqlConnection", + ) + properties.started_on = AAZStrType( + serialized_name="startedOn", + flags={"read_only": True}, + ) + properties.target_database_collation = AAZStrType( + serialized_name="targetDatabaseCollation", + ) + + backup_configuration = cls._schema_on_200.properties.backup_configuration + backup_configuration.source_location = AAZObjectType( + serialized_name="sourceLocation", + ) + backup_configuration.target_location = AAZObjectType( + serialized_name="targetLocation", + ) + + source_location = cls._schema_on_200.properties.backup_configuration.source_location + source_location.azure_blob = AAZObjectType( + serialized_name="azureBlob", + ) + source_location.file_share = AAZObjectType( + serialized_name="fileShare", + ) + source_location.file_storage_type = AAZStrType( + serialized_name="fileStorageType", + flags={"read_only": True}, + ) + + azure_blob = cls._schema_on_200.properties.backup_configuration.source_location.azure_blob + azure_blob.account_key = AAZStrType( + serialized_name="accountKey", + flags={"secret": True}, + ) + azure_blob.auth_type = AAZStrType( + serialized_name="authType", + ) + azure_blob.blob_container_name = AAZStrType( + serialized_name="blobContainerName", + ) + azure_blob.identity = AAZIdentityObjectType() + azure_blob.storage_account_resource_id = AAZStrType( + serialized_name="storageAccountResourceId", + ) + + identity = cls._schema_on_200.properties.backup_configuration.source_location.azure_blob.identity + identity.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"read_only": True}, + ) + identity.type = AAZStrType( + flags={"required": True}, + ) + identity.user_assigned_identities = AAZDictType( + serialized_name="userAssignedIdentities", + ) + + user_assigned_identities = cls._schema_on_200.properties.backup_configuration.source_location.azure_blob.identity.user_assigned_identities + user_assigned_identities.Element = AAZObjectType( + nullable=True, + ) + + _element = cls._schema_on_200.properties.backup_configuration.source_location.azure_blob.identity.user_assigned_identities.Element + _element.client_id = AAZStrType( + serialized_name="clientId", + flags={"read_only": True}, + ) + _element.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + + file_share = cls._schema_on_200.properties.backup_configuration.source_location.file_share + file_share.path = AAZStrType() + file_share.username = AAZStrType() + + target_location = cls._schema_on_200.properties.backup_configuration.target_location + target_location.account_key = AAZStrType( + serialized_name="accountKey", + ) + target_location.storage_account_resource_id = AAZStrType( + serialized_name="storageAccountResourceId", + ) + + migration_failure_error = cls._schema_on_200.properties.migration_failure_error + migration_failure_error.code = AAZStrType( + flags={"read_only": True}, + ) + migration_failure_error.message = AAZStrType( + flags={"read_only": True}, + ) + + migration_status_details = cls._schema_on_200.properties.migration_status_details + migration_status_details.active_backup_sets = AAZListType( + serialized_name="activeBackupSets", + flags={"read_only": True}, + ) + migration_status_details.blob_container_name = AAZStrType( + serialized_name="blobContainerName", + flags={"read_only": True}, + ) + migration_status_details.complete_restore_error_message = AAZStrType( + serialized_name="completeRestoreErrorMessage", + flags={"read_only": True}, + ) + migration_status_details.current_restoring_filename = AAZStrType( + serialized_name="currentRestoringFilename", + flags={"read_only": True}, + ) + migration_status_details.file_upload_blocking_errors = AAZListType( + serialized_name="fileUploadBlockingErrors", + flags={"read_only": True}, + ) + migration_status_details.full_backup_set_info = AAZObjectType( + serialized_name="fullBackupSetInfo", + flags={"read_only": True}, + ) + _DeleteHelper._build_schema_sql_backup_set_info_read(migration_status_details.full_backup_set_info) + migration_status_details.invalid_files = AAZListType( + serialized_name="invalidFiles", + flags={"read_only": True}, + ) + migration_status_details.is_full_backup_restored = AAZBoolType( + serialized_name="isFullBackupRestored", + flags={"read_only": True}, + ) + migration_status_details.last_restored_backup_set_info = AAZObjectType( + serialized_name="lastRestoredBackupSetInfo", + flags={"read_only": True}, + ) + _DeleteHelper._build_schema_sql_backup_set_info_read(migration_status_details.last_restored_backup_set_info) + migration_status_details.last_restored_filename = AAZStrType( + serialized_name="lastRestoredFilename", + flags={"read_only": True}, + ) + migration_status_details.migration_state = AAZStrType( + serialized_name="migrationState", + flags={"read_only": True}, + ) + migration_status_details.pending_log_backups_count = AAZIntType( + serialized_name="pendingLogBackupsCount", + flags={"read_only": True}, + ) + migration_status_details.restore_blocking_reason = AAZStrType( + serialized_name="restoreBlockingReason", + flags={"read_only": True}, + ) + + active_backup_sets = cls._schema_on_200.properties.migration_status_details.active_backup_sets + active_backup_sets.Element = AAZObjectType() + _DeleteHelper._build_schema_sql_backup_set_info_read(active_backup_sets.Element) + + file_upload_blocking_errors = cls._schema_on_200.properties.migration_status_details.file_upload_blocking_errors + file_upload_blocking_errors.Element = AAZStrType() + + invalid_files = cls._schema_on_200.properties.migration_status_details.invalid_files + invalid_files.Element = AAZStrType() + + offline_configuration = cls._schema_on_200.properties.offline_configuration + offline_configuration.last_backup_name = AAZStrType( + serialized_name="lastBackupName", + ) + offline_configuration.offline = AAZBoolType() + + source_sql_connection = cls._schema_on_200.properties.source_sql_connection + source_sql_connection.authentication = AAZStrType() + source_sql_connection.data_source = AAZStrType( + serialized_name="dataSource", + ) + source_sql_connection.encrypt_connection = AAZBoolType( + serialized_name="encryptConnection", + ) + source_sql_connection.password = AAZStrType( + flags={"secret": True}, + ) + source_sql_connection.trust_server_certificate = AAZBoolType( + serialized_name="trustServerCertificate", + ) + source_sql_connection.user_name = AAZStrType( + serialized_name="userName", + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + _schema_sql_backup_set_info_read = None + + @classmethod + def _build_schema_sql_backup_set_info_read(cls, _schema): + if cls._schema_sql_backup_set_info_read is not None: + _schema.backup_finish_date = cls._schema_sql_backup_set_info_read.backup_finish_date + _schema.backup_set_id = cls._schema_sql_backup_set_info_read.backup_set_id + _schema.backup_start_date = cls._schema_sql_backup_set_info_read.backup_start_date + _schema.backup_type = cls._schema_sql_backup_set_info_read.backup_type + _schema.family_count = cls._schema_sql_backup_set_info_read.family_count + _schema.first_lsn = cls._schema_sql_backup_set_info_read.first_lsn + _schema.has_backup_checksums = cls._schema_sql_backup_set_info_read.has_backup_checksums + _schema.ignore_reasons = cls._schema_sql_backup_set_info_read.ignore_reasons + _schema.is_backup_restored = cls._schema_sql_backup_set_info_read.is_backup_restored + _schema.last_lsn = cls._schema_sql_backup_set_info_read.last_lsn + _schema.list_of_backup_files = cls._schema_sql_backup_set_info_read.list_of_backup_files + return + + cls._schema_sql_backup_set_info_read = _schema_sql_backup_set_info_read = AAZObjectType( + flags={"read_only": True} + ) + + sql_backup_set_info_read = _schema_sql_backup_set_info_read + sql_backup_set_info_read.backup_finish_date = AAZStrType( + serialized_name="backupFinishDate", + flags={"read_only": True}, + ) + sql_backup_set_info_read.backup_set_id = AAZStrType( + serialized_name="backupSetId", + flags={"read_only": True}, + ) + sql_backup_set_info_read.backup_start_date = AAZStrType( + serialized_name="backupStartDate", + flags={"read_only": True}, + ) + sql_backup_set_info_read.backup_type = AAZStrType( + serialized_name="backupType", + flags={"read_only": True}, + ) + sql_backup_set_info_read.family_count = AAZIntType( + serialized_name="familyCount", + flags={"read_only": True}, + ) + sql_backup_set_info_read.first_lsn = AAZStrType( + serialized_name="firstLSN", + flags={"read_only": True}, + ) + sql_backup_set_info_read.has_backup_checksums = AAZBoolType( + serialized_name="hasBackupChecksums", + flags={"read_only": True}, + ) + sql_backup_set_info_read.ignore_reasons = AAZListType( + serialized_name="ignoreReasons", + flags={"read_only": True}, + ) + sql_backup_set_info_read.is_backup_restored = AAZBoolType( + serialized_name="isBackupRestored", + flags={"read_only": True}, + ) + sql_backup_set_info_read.last_lsn = AAZStrType( + serialized_name="lastLSN", + flags={"read_only": True}, + ) + sql_backup_set_info_read.list_of_backup_files = AAZListType( + serialized_name="listOfBackupFiles", + flags={"read_only": True}, + ) + + ignore_reasons = _schema_sql_backup_set_info_read.ignore_reasons + ignore_reasons.Element = AAZStrType() + + list_of_backup_files = _schema_sql_backup_set_info_read.list_of_backup_files + list_of_backup_files.Element = AAZObjectType() + + _element = _schema_sql_backup_set_info_read.list_of_backup_files.Element + _element.copy_duration = AAZIntType( + serialized_name="copyDuration", + flags={"read_only": True}, + ) + _element.copy_throughput = AAZFloatType( + serialized_name="copyThroughput", + flags={"read_only": True}, + ) + _element.data_read = AAZIntType( + serialized_name="dataRead", + flags={"read_only": True}, + ) + _element.data_written = AAZIntType( + serialized_name="dataWritten", + flags={"read_only": True}, + ) + _element.family_sequence_number = AAZIntType( + serialized_name="familySequenceNumber", + flags={"read_only": True}, + ) + _element.file_name = AAZStrType( + serialized_name="fileName", + flags={"read_only": True}, + ) + _element.status = AAZStrType( + flags={"read_only": True}, + ) + _element.total_size = AAZIntType( + serialized_name="totalSize", + flags={"read_only": True}, + ) + + _schema.backup_finish_date = cls._schema_sql_backup_set_info_read.backup_finish_date + _schema.backup_set_id = cls._schema_sql_backup_set_info_read.backup_set_id + _schema.backup_start_date = cls._schema_sql_backup_set_info_read.backup_start_date + _schema.backup_type = cls._schema_sql_backup_set_info_read.backup_type + _schema.family_count = cls._schema_sql_backup_set_info_read.family_count + _schema.first_lsn = cls._schema_sql_backup_set_info_read.first_lsn + _schema.has_backup_checksums = cls._schema_sql_backup_set_info_read.has_backup_checksums + _schema.ignore_reasons = cls._schema_sql_backup_set_info_read.ignore_reasons + _schema.is_backup_restored = cls._schema_sql_backup_set_info_read.is_backup_restored + _schema.last_lsn = cls._schema_sql_backup_set_info_read.last_lsn + _schema.list_of_backup_files = cls._schema_sql_backup_set_info_read.list_of_backup_files + + +__all__ = ["Delete"] diff --git a/src/datamigration/azext_datamigration/azext_metadata.json b/src/datamigration/azext_datamigration/azext_metadata.json index 30fdaf614ee..3b228c83dd2 100644 --- a/src/datamigration/azext_datamigration/azext_metadata.json +++ b/src/datamigration/azext_datamigration/azext_metadata.json @@ -1,4 +1,4 @@ { - "azext.isPreview": true, - "azext.minCliCoreVersion": "2.15.0" + "azext.isPreview": false, + "azext.minCliCoreVersion": "2.75.0" } \ No newline at end of file diff --git a/src/datamigration/azext_datamigration/generated/commands.py b/src/datamigration/azext_datamigration/generated/commands.py index 94c9063aebe..2c5770383b6 100644 --- a/src/datamigration/azext_datamigration/generated/commands.py +++ b/src/datamigration/azext_datamigration/generated/commands.py @@ -90,6 +90,3 @@ def load_command_table(self, _): g.custom_command('cancel', 'datamigration_sql_vm_cancel', supports_no_wait=True) g.custom_command('cutover', 'datamigration_sql_vm_cutover', supports_no_wait=True) g.custom_wait_command('wait', 'datamigration_sql_vm_show') - - with self.command_group('datamigration', is_experimental=True): - pass diff --git a/src/datamigration/setup.py b/src/datamigration/setup.py index 119e62eb775..777c84e92d9 100644 --- a/src/datamigration/setup.py +++ b/src/datamigration/setup.py @@ -10,7 +10,7 @@ from setuptools import setup, find_packages # HISTORY.rst entry. -VERSION = '1.0.0b6' +VERSION = '1.0.0' # The full list of classifiers is available at # https://pypi.python.org/pypi?%3Aaction=list_classifiers