From 83abb89015584a0af9824b95e7d4a26067b1ae2f Mon Sep 17 00:00:00 2001 From: Azure SDK Bot Date: Wed, 18 Sep 2019 11:13:47 +0800 Subject: [PATCH] Generated from 9402dbf3fb3d5fffcb80f501b1fc857ff97ab723 (#7329) Fixing PR validation errors --- .../azure/mgmt/sql/_sql_management_client.py | 15 +- .../azure/mgmt/sql/models/__init__.py | 17 +- .../azure/mgmt/sql/models/_models.py | 84 +++++++- .../azure/mgmt/sql/models/_models_py3.py | 84 +++++++- .../azure/mgmt/sql/models/_paged_models.py | 26 +-- .../models/_sql_management_client_enums.py | 49 ++--- .../azure/mgmt/sql/operations/__init__.py | 6 +- ...ged_database_restore_details_operations.py | 110 ++++++++++ .../_managed_databases_operations.py | 188 +++++++++--------- 9 files changed, 432 insertions(+), 147 deletions(-) create mode 100644 sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_restore_details_operations.py diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/_sql_management_client.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/_sql_management_client.py index ab9e5cc4dcb7..79a5a1986c21 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/_sql_management_client.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/_sql_management_client.py @@ -65,7 +65,6 @@ from .operations import LongTermRetentionBackupsOperations from .operations import BackupLongTermRetentionPoliciesOperations from .operations import ManagedBackupShortTermRetentionPoliciesOperations -from .operations import ManagedDatabasesOperations from .operations import ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations from .operations import ServerAutomaticTuningOperations from .operations import ServerDnsAliasesOperations @@ -96,6 +95,8 @@ from .operations import InstancePoolsOperations from .operations import UsagesOperations from .operations import ManagedInstancesOperations +from .operations import ManagedDatabaseRestoreDetailsOperations +from .operations import ManagedDatabasesOperations from .operations import PrivateEndpointConnectionsOperations from .operations import PrivateLinkResourcesOperations from . import models @@ -211,8 +212,6 @@ class SqlManagementClient(SDKClient): :vartype backup_long_term_retention_policies: azure.mgmt.sql.operations.BackupLongTermRetentionPoliciesOperations :ivar managed_backup_short_term_retention_policies: ManagedBackupShortTermRetentionPolicies operations :vartype managed_backup_short_term_retention_policies: azure.mgmt.sql.operations.ManagedBackupShortTermRetentionPoliciesOperations - :ivar managed_databases: ManagedDatabases operations - :vartype managed_databases: azure.mgmt.sql.operations.ManagedDatabasesOperations :ivar managed_restorable_dropped_database_backup_short_term_retention_policies: ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies operations :vartype managed_restorable_dropped_database_backup_short_term_retention_policies: azure.mgmt.sql.operations.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations :ivar server_automatic_tuning: ServerAutomaticTuning operations @@ -273,6 +272,10 @@ class SqlManagementClient(SDKClient): :vartype usages: azure.mgmt.sql.operations.UsagesOperations :ivar managed_instances: ManagedInstances operations :vartype managed_instances: azure.mgmt.sql.operations.ManagedInstancesOperations + :ivar managed_database_restore_details: ManagedDatabaseRestoreDetails operations + :vartype managed_database_restore_details: azure.mgmt.sql.operations.ManagedDatabaseRestoreDetailsOperations + :ivar managed_databases: ManagedDatabases operations + :vartype managed_databases: azure.mgmt.sql.operations.ManagedDatabasesOperations :ivar private_endpoint_connections: PrivateEndpointConnections operations :vartype private_endpoint_connections: azure.mgmt.sql.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResources operations @@ -401,8 +404,6 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.managed_backup_short_term_retention_policies = ManagedBackupShortTermRetentionPoliciesOperations( self._client, self.config, self._serialize, self._deserialize) - self.managed_databases = ManagedDatabasesOperations( - self._client, self.config, self._serialize, self._deserialize) self.managed_restorable_dropped_database_backup_short_term_retention_policies = ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations( self._client, self.config, self._serialize, self._deserialize) self.server_automatic_tuning = ServerAutomaticTuningOperations( @@ -463,6 +464,10 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.managed_instances = ManagedInstancesOperations( self._client, self.config, self._serialize, self._deserialize) + self.managed_database_restore_details = ManagedDatabaseRestoreDetailsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.managed_databases = ManagedDatabasesOperations( + self._client, self.config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self.config, self._serialize, self._deserialize) self.private_link_resources = PrivateLinkResourcesOperations( diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py index e8f1059a4dc4..41026edf11ae 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py @@ -80,6 +80,7 @@ from ._models_py3 import LongTermRetentionBackup from ._models_py3 import ManagedBackupShortTermRetentionPolicy from ._models_py3 import ManagedDatabase + from ._models_py3 import ManagedDatabaseRestoreDetailsResult from ._models_py3 import ManagedDatabaseSecurityAlertPolicy from ._models_py3 import ManagedDatabaseUpdate from ._models_py3 import ManagedInstance @@ -242,6 +243,7 @@ from ._models import LongTermRetentionBackup from ._models import ManagedBackupShortTermRetentionPolicy from ._models import ManagedDatabase + from ._models import ManagedDatabaseRestoreDetailsResult from ._models import ManagedDatabaseSecurityAlertPolicy from ._models import ManagedDatabaseUpdate from ._models import ManagedInstance @@ -456,9 +458,6 @@ JobStepActionSource, JobStepOutputType, JobTargetGroupMembershipType, - ManagedDatabaseStatus, - CatalogCollationType, - ManagedDatabaseCreateMode, AutomaticTuningServerMode, AutomaticTuningServerReason, RestorePointType, @@ -470,6 +469,7 @@ CreateMode, SampleName, DatabaseStatus, + CatalogCollationType, DatabaseLicenseType, DatabaseReadScale, ElasticPoolState, @@ -481,6 +481,8 @@ ManagedServerCreateMode, ManagedInstanceLicenseType, ManagedInstanceProxyOverride, + ManagedDatabaseStatus, + ManagedDatabaseCreateMode, LongTermRetentionDatabaseState, VulnerabilityAssessmentPolicyBaselineName, SensitivityLabelSource, @@ -558,6 +560,7 @@ 'LongTermRetentionBackup', 'ManagedBackupShortTermRetentionPolicy', 'ManagedDatabase', + 'ManagedDatabaseRestoreDetailsResult', 'ManagedDatabaseSecurityAlertPolicy', 'ManagedDatabaseUpdate', 'ManagedInstance', @@ -695,7 +698,6 @@ 'JobVersionPaged', 'LongTermRetentionBackupPaged', 'ManagedBackupShortTermRetentionPolicyPaged', - 'ManagedDatabasePaged', 'ServerDnsAliasPaged', 'ServerSecurityAlertPolicyPaged', 'RestorableDroppedManagedDatabasePaged', @@ -717,6 +719,7 @@ 'InstancePoolPaged', 'UsagePaged', 'ManagedInstancePaged', + 'ManagedDatabasePaged', 'PrivateEndpointConnectionPaged', 'PrivateLinkResourcePaged', 'CheckNameAvailabilityReason', @@ -771,9 +774,6 @@ 'JobStepActionSource', 'JobStepOutputType', 'JobTargetGroupMembershipType', - 'ManagedDatabaseStatus', - 'CatalogCollationType', - 'ManagedDatabaseCreateMode', 'AutomaticTuningServerMode', 'AutomaticTuningServerReason', 'RestorePointType', @@ -785,6 +785,7 @@ 'CreateMode', 'SampleName', 'DatabaseStatus', + 'CatalogCollationType', 'DatabaseLicenseType', 'DatabaseReadScale', 'ElasticPoolState', @@ -796,6 +797,8 @@ 'ManagedServerCreateMode', 'ManagedInstanceLicenseType', 'ManagedInstanceProxyOverride', + 'ManagedDatabaseStatus', + 'ManagedDatabaseCreateMode', 'LongTermRetentionDatabaseState', 'VulnerabilityAssessmentPolicyBaselineName', 'SensitivityLabelSource', diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_models.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_models.py index 7b083c6352ac..a95758afa368 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_models.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_models.py @@ -4440,7 +4440,7 @@ class ManagedDatabase(TrackedResource): :param collation: Collation of the managed database. :type collation: str :ivar status: Status of the database. Possible values include: 'Online', - 'Offline', 'Shutdown', 'Creating', 'Inaccessible', 'Updating' + 'Offline', 'Shutdown', 'Creating', 'Inaccessible', 'Restoring', 'Updating' :vartype status: str or ~azure.mgmt.sql.models.ManagedDatabaseStatus :ivar creation_date: Creation date of the database. :vartype creation_date: datetime @@ -4543,6 +4543,86 @@ def __init__(self, **kwargs): self.recoverable_database_id = kwargs.get('recoverable_database_id', None) +class ManagedDatabaseRestoreDetailsResult(ProxyResource): + """A managed database restore details. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar status: Restore status. + :vartype status: str + :ivar current_restoring_file_name: Current restoring file name. + :vartype current_restoring_file_name: str + :ivar last_restored_file_name: Last restored file name. + :vartype last_restored_file_name: str + :ivar last_restored_file_time: Last restored file time. + :vartype last_restored_file_time: datetime + :ivar percent_completed: Percent completed. + :vartype percent_completed: float + :ivar unrestorable_files: List of unrestorable files. + :vartype unrestorable_files: list[str] + :ivar number_of_files_detected: Number of files detected. + :vartype number_of_files_detected: long + :ivar last_uploaded_file_name: Last uploaded file name. + :vartype last_uploaded_file_name: str + :ivar last_uploaded_file_time: Last uploaded file time. + :vartype last_uploaded_file_time: datetime + :ivar block_reason: The reason why restore is in Blocked state. + :vartype block_reason: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'status': {'readonly': True}, + 'current_restoring_file_name': {'readonly': True}, + 'last_restored_file_name': {'readonly': True}, + 'last_restored_file_time': {'readonly': True}, + 'percent_completed': {'readonly': True}, + 'unrestorable_files': {'readonly': True}, + 'number_of_files_detected': {'readonly': True}, + 'last_uploaded_file_name': {'readonly': True}, + 'last_uploaded_file_time': {'readonly': True}, + 'block_reason': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'current_restoring_file_name': {'key': 'properties.currentRestoringFileName', 'type': 'str'}, + 'last_restored_file_name': {'key': 'properties.lastRestoredFileName', 'type': 'str'}, + 'last_restored_file_time': {'key': 'properties.lastRestoredFileTime', 'type': 'iso-8601'}, + 'percent_completed': {'key': 'properties.percentCompleted', 'type': 'float'}, + 'unrestorable_files': {'key': 'properties.unrestorableFiles', 'type': '[str]'}, + 'number_of_files_detected': {'key': 'properties.numberOfFilesDetected', 'type': 'long'}, + 'last_uploaded_file_name': {'key': 'properties.lastUploadedFileName', 'type': 'str'}, + 'last_uploaded_file_time': {'key': 'properties.lastUploadedFileTime', 'type': 'iso-8601'}, + 'block_reason': {'key': 'properties.blockReason', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ManagedDatabaseRestoreDetailsResult, self).__init__(**kwargs) + self.status = None + self.current_restoring_file_name = None + self.last_restored_file_name = None + self.last_restored_file_time = None + self.percent_completed = None + self.unrestorable_files = None + self.number_of_files_detected = None + self.last_uploaded_file_name = None + self.last_uploaded_file_time = None + self.block_reason = None + + class ManagedDatabaseSecurityAlertPolicy(ProxyResource): """A managed database security alert policy. @@ -4628,7 +4708,7 @@ class ManagedDatabaseUpdate(Model): :param collation: Collation of the managed database. :type collation: str :ivar status: Status of the database. Possible values include: 'Online', - 'Offline', 'Shutdown', 'Creating', 'Inaccessible', 'Updating' + 'Offline', 'Shutdown', 'Creating', 'Inaccessible', 'Restoring', 'Updating' :vartype status: str or ~azure.mgmt.sql.models.ManagedDatabaseStatus :ivar creation_date: Creation date of the database. :vartype creation_date: datetime diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_models_py3.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_models_py3.py index d115113635ee..5e4ee3184444 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_models_py3.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_models_py3.py @@ -4440,7 +4440,7 @@ class ManagedDatabase(TrackedResource): :param collation: Collation of the managed database. :type collation: str :ivar status: Status of the database. Possible values include: 'Online', - 'Offline', 'Shutdown', 'Creating', 'Inaccessible', 'Updating' + 'Offline', 'Shutdown', 'Creating', 'Inaccessible', 'Restoring', 'Updating' :vartype status: str or ~azure.mgmt.sql.models.ManagedDatabaseStatus :ivar creation_date: Creation date of the database. :vartype creation_date: datetime @@ -4543,6 +4543,86 @@ def __init__(self, *, location: str, tags=None, collation: str=None, restore_poi self.recoverable_database_id = recoverable_database_id +class ManagedDatabaseRestoreDetailsResult(ProxyResource): + """A managed database restore details. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar status: Restore status. + :vartype status: str + :ivar current_restoring_file_name: Current restoring file name. + :vartype current_restoring_file_name: str + :ivar last_restored_file_name: Last restored file name. + :vartype last_restored_file_name: str + :ivar last_restored_file_time: Last restored file time. + :vartype last_restored_file_time: datetime + :ivar percent_completed: Percent completed. + :vartype percent_completed: float + :ivar unrestorable_files: List of unrestorable files. + :vartype unrestorable_files: list[str] + :ivar number_of_files_detected: Number of files detected. + :vartype number_of_files_detected: long + :ivar last_uploaded_file_name: Last uploaded file name. + :vartype last_uploaded_file_name: str + :ivar last_uploaded_file_time: Last uploaded file time. + :vartype last_uploaded_file_time: datetime + :ivar block_reason: The reason why restore is in Blocked state. + :vartype block_reason: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'status': {'readonly': True}, + 'current_restoring_file_name': {'readonly': True}, + 'last_restored_file_name': {'readonly': True}, + 'last_restored_file_time': {'readonly': True}, + 'percent_completed': {'readonly': True}, + 'unrestorable_files': {'readonly': True}, + 'number_of_files_detected': {'readonly': True}, + 'last_uploaded_file_name': {'readonly': True}, + 'last_uploaded_file_time': {'readonly': True}, + 'block_reason': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'current_restoring_file_name': {'key': 'properties.currentRestoringFileName', 'type': 'str'}, + 'last_restored_file_name': {'key': 'properties.lastRestoredFileName', 'type': 'str'}, + 'last_restored_file_time': {'key': 'properties.lastRestoredFileTime', 'type': 'iso-8601'}, + 'percent_completed': {'key': 'properties.percentCompleted', 'type': 'float'}, + 'unrestorable_files': {'key': 'properties.unrestorableFiles', 'type': '[str]'}, + 'number_of_files_detected': {'key': 'properties.numberOfFilesDetected', 'type': 'long'}, + 'last_uploaded_file_name': {'key': 'properties.lastUploadedFileName', 'type': 'str'}, + 'last_uploaded_file_time': {'key': 'properties.lastUploadedFileTime', 'type': 'iso-8601'}, + 'block_reason': {'key': 'properties.blockReason', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(ManagedDatabaseRestoreDetailsResult, self).__init__(**kwargs) + self.status = None + self.current_restoring_file_name = None + self.last_restored_file_name = None + self.last_restored_file_time = None + self.percent_completed = None + self.unrestorable_files = None + self.number_of_files_detected = None + self.last_uploaded_file_name = None + self.last_uploaded_file_time = None + self.block_reason = None + + class ManagedDatabaseSecurityAlertPolicy(ProxyResource): """A managed database security alert policy. @@ -4628,7 +4708,7 @@ class ManagedDatabaseUpdate(Model): :param collation: Collation of the managed database. :type collation: str :ivar status: Status of the database. Possible values include: 'Online', - 'Offline', 'Shutdown', 'Creating', 'Inaccessible', 'Updating' + 'Offline', 'Shutdown', 'Creating', 'Inaccessible', 'Restoring', 'Updating' :vartype status: str or ~azure.mgmt.sql.models.ManagedDatabaseStatus :ivar creation_date: Creation date of the database. :vartype creation_date: datetime diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_paged_models.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_paged_models.py index 365d65190064..b825107a3c2d 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_paged_models.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_paged_models.py @@ -610,19 +610,6 @@ class ManagedBackupShortTermRetentionPolicyPaged(Paged): def __init__(self, *args, **kwargs): super(ManagedBackupShortTermRetentionPolicyPaged, self).__init__(*args, **kwargs) -class ManagedDatabasePaged(Paged): - """ - A paging container for iterating over a list of :class:`ManagedDatabase ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ManagedDatabase]'} - } - - def __init__(self, *args, **kwargs): - - super(ManagedDatabasePaged, self).__init__(*args, **kwargs) class ServerDnsAliasPaged(Paged): """ A paging container for iterating over a list of :class:`ServerDnsAlias ` object @@ -896,6 +883,19 @@ class ManagedInstancePaged(Paged): def __init__(self, *args, **kwargs): super(ManagedInstancePaged, self).__init__(*args, **kwargs) +class ManagedDatabasePaged(Paged): + """ + A paging container for iterating over a list of :class:`ManagedDatabase ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ManagedDatabase]'} + } + + def __init__(self, *args, **kwargs): + + super(ManagedDatabasePaged, self).__init__(*args, **kwargs) class PrivateEndpointConnectionPaged(Paged): """ A paging container for iterating over a list of :class:`PrivateEndpointConnection ` object diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_sql_management_client_enums.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_sql_management_client_enums.py index 3e22324c90b6..063f31975a3f 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_sql_management_client_enums.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_sql_management_client_enums.py @@ -484,30 +484,6 @@ class JobTargetGroupMembershipType(str, Enum): exclude = "Exclude" -class ManagedDatabaseStatus(str, Enum): - - online = "Online" - offline = "Offline" - shutdown = "Shutdown" - creating = "Creating" - inaccessible = "Inaccessible" - updating = "Updating" - - -class CatalogCollationType(str, Enum): - - database_default = "DATABASE_DEFAULT" - sql_latin1_general_cp1_ci_as = "SQL_Latin1_General_CP1_CI_AS" - - -class ManagedDatabaseCreateMode(str, Enum): - - default = "Default" - restore_external_backup = "RestoreExternalBackup" - point_in_time_restore = "PointInTimeRestore" - recovery = "Recovery" - - class AutomaticTuningServerMode(str, Enum): custom = "Custom" @@ -615,6 +591,12 @@ class DatabaseStatus(str, Enum): disabled = "Disabled" +class CatalogCollationType(str, Enum): + + database_default = "DATABASE_DEFAULT" + sql_latin1_general_cp1_ci_as = "SQL_Latin1_General_CP1_CI_AS" + + class DatabaseLicenseType(str, Enum): license_included = "LicenseIncluded" @@ -685,6 +667,25 @@ class ManagedInstanceProxyOverride(str, Enum): default = "Default" +class ManagedDatabaseStatus(str, Enum): + + online = "Online" + offline = "Offline" + shutdown = "Shutdown" + creating = "Creating" + inaccessible = "Inaccessible" + restoring = "Restoring" + updating = "Updating" + + +class ManagedDatabaseCreateMode(str, Enum): + + default = "Default" + restore_external_backup = "RestoreExternalBackup" + point_in_time_restore = "PointInTimeRestore" + recovery = "Recovery" + + class LongTermRetentionDatabaseState(str, Enum): all = "All" diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py index e68de80de158..306f66028ce5 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py @@ -61,7 +61,6 @@ from ._long_term_retention_backups_operations import LongTermRetentionBackupsOperations from ._backup_long_term_retention_policies_operations import BackupLongTermRetentionPoliciesOperations from ._managed_backup_short_term_retention_policies_operations import ManagedBackupShortTermRetentionPoliciesOperations -from ._managed_databases_operations import ManagedDatabasesOperations from ._managed_restorable_dropped_database_backup_short_term_retention_policies_operations import ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations from ._server_automatic_tuning_operations import ServerAutomaticTuningOperations from ._server_dns_aliases_operations import ServerDnsAliasesOperations @@ -92,6 +91,8 @@ from ._instance_pools_operations import InstancePoolsOperations from ._usages_operations import UsagesOperations from ._managed_instances_operations import ManagedInstancesOperations +from ._managed_database_restore_details_operations import ManagedDatabaseRestoreDetailsOperations +from ._managed_databases_operations import ManagedDatabasesOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations @@ -148,7 +149,6 @@ 'LongTermRetentionBackupsOperations', 'BackupLongTermRetentionPoliciesOperations', 'ManagedBackupShortTermRetentionPoliciesOperations', - 'ManagedDatabasesOperations', 'ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations', 'ServerAutomaticTuningOperations', 'ServerDnsAliasesOperations', @@ -179,6 +179,8 @@ 'InstancePoolsOperations', 'UsagesOperations', 'ManagedInstancesOperations', + 'ManagedDatabaseRestoreDetailsOperations', + 'ManagedDatabasesOperations', 'PrivateEndpointConnectionsOperations', 'PrivateLinkResourcesOperations', ] diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_restore_details_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_restore_details_operations.py new file mode 100644 index 000000000000..69a7c9be070d --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_restore_details_operations.py @@ -0,0 +1,110 @@ +# 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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class ManagedDatabaseRestoreDetailsOperations(object): + """ManagedDatabaseRestoreDetailsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar restore_details_name: The name of the restore details to retrieve. Constant value: "Default". + :ivar api_version: The API version to use for the request. Constant value: "2018-06-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.restore_details_name = "Default" + self.api_version = "2018-06-01-preview" + + self.config = config + + def get( + self, resource_group_name, managed_instance_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets managed database restore details. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the database. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ManagedDatabaseRestoreDetailsResult or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.sql.models.ManagedDatabaseRestoreDetailsResult or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'restoreDetailsName': self._serialize.url("self.restore_details_name", self.restore_details_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ManagedDatabaseRestoreDetailsResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/restoreDetails/{restoreDetailsName}'} diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_databases_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_databases_operations.py index 9825283b3ab6..2d5207987157 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_databases_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_databases_operations.py @@ -27,7 +27,7 @@ class ManagedDatabasesOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". + :ivar api_version: The API version to use for the request. Constant value: "2018-06-01-preview". """ models = models @@ -37,100 +37,10 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2017-03-01-preview" + self.api_version = "2018-06-01-preview" self.config = config - - def _complete_restore_initial( - self, location_name, operation_id, last_backup_name, custom_headers=None, raw=False, **operation_config): - parameters = models.CompleteDatabaseRestoreDefinition(last_backup_name=last_backup_name) - - # Construct URL - url = self.complete_restore.metadata['url'] - path_format_arguments = { - 'locationName': self._serialize.url("location_name", location_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'CompleteDatabaseRestoreDefinition') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def complete_restore( - self, location_name, operation_id, last_backup_name, custom_headers=None, raw=False, polling=True, **operation_config): - """Completes the restore operation on a managed database. - - :param location_name: The name of the region where the resource is - located. - :type location_name: str - :param operation_id: Management operation id that this request tries - to complete. - :type operation_id: str - :param last_backup_name: The last backup name to apply - :type last_backup_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` - """ - raw_result = self._complete_restore_initial( - location_name=location_name, - operation_id=operation_id, - last_backup_name=last_backup_name, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - complete_restore.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/managedDatabaseRestoreAzureAsyncOperation/{operationId}/completeRestore'} - def list_by_instance( self, resource_group_name, managed_instance_name, custom_headers=None, raw=False, **operation_config): """Gets a list of managed databases. @@ -569,3 +479,97 @@ def get_long_running_output(response): else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}'} + + + def _complete_restore_initial( + self, resource_group_name, managed_instance_name, database_name, last_backup_name, custom_headers=None, raw=False, **operation_config): + parameters = models.CompleteDatabaseRestoreDefinition(last_backup_name=last_backup_name) + + # Construct URL + url = self.complete_restore.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'CompleteDatabaseRestoreDefinition') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def complete_restore( + self, resource_group_name, managed_instance_name, database_name, last_backup_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Completes the restore operation on a managed database. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the database. + :type database_name: str + :param last_backup_name: The last backup name to apply + :type last_backup_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._complete_restore_initial( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + database_name=database_name, + last_backup_name=last_backup_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + complete_restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/completeRestore'}