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 2fdfb98f421d..3420a650b752 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 @@ -15,7 +15,6 @@ from ._configuration import SqlManagementClientConfiguration from .operations import RecoverableDatabasesOperations from .operations import RestorableDroppedDatabasesOperations -from .operations import ServersOperations from .operations import ServerConnectionPoliciesOperations from .operations import DatabaseThreatDetectionPoliciesOperations from .operations import DataMaskingPoliciesOperations @@ -93,14 +92,16 @@ 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 .operations import ServerAzureADAdministratorsOperations +from .operations import ServersOperations from .operations import CapabilitiesOperations +from .operations import LongTermRetentionManagedInstanceBackupsOperations +from .operations import ManagedInstanceLongTermRetentionPoliciesOperations from .operations import WorkloadGroupsOperations from .operations import WorkloadClassifiersOperations +from .operations import ManagedDatabasesOperations +from .operations import ServerAzureADAdministratorsOperations from . import models @@ -114,8 +115,6 @@ class SqlManagementClient(SDKClient): :vartype recoverable_databases: azure.mgmt.sql.operations.RecoverableDatabasesOperations :ivar restorable_dropped_databases: RestorableDroppedDatabases operations :vartype restorable_dropped_databases: azure.mgmt.sql.operations.RestorableDroppedDatabasesOperations - :ivar servers: Servers operations - :vartype servers: azure.mgmt.sql.operations.ServersOperations :ivar server_connection_policies: ServerConnectionPolicies operations :vartype server_connection_policies: azure.mgmt.sql.operations.ServerConnectionPoliciesOperations :ivar database_threat_detection_policies: DatabaseThreatDetectionPolicies operations @@ -270,22 +269,26 @@ 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 :vartype private_link_resources: azure.mgmt.sql.operations.PrivateLinkResourcesOperations - :ivar server_azure_ad_administrators: ServerAzureADAdministrators operations - :vartype server_azure_ad_administrators: azure.mgmt.sql.operations.ServerAzureADAdministratorsOperations + :ivar servers: Servers operations + :vartype servers: azure.mgmt.sql.operations.ServersOperations :ivar capabilities: Capabilities operations :vartype capabilities: azure.mgmt.sql.operations.CapabilitiesOperations + :ivar long_term_retention_managed_instance_backups: LongTermRetentionManagedInstanceBackups operations + :vartype long_term_retention_managed_instance_backups: azure.mgmt.sql.operations.LongTermRetentionManagedInstanceBackupsOperations + :ivar managed_instance_long_term_retention_policies: ManagedInstanceLongTermRetentionPolicies operations + :vartype managed_instance_long_term_retention_policies: azure.mgmt.sql.operations.ManagedInstanceLongTermRetentionPoliciesOperations :ivar workload_groups: WorkloadGroups operations :vartype workload_groups: azure.mgmt.sql.operations.WorkloadGroupsOperations :ivar workload_classifiers: WorkloadClassifiers operations :vartype workload_classifiers: azure.mgmt.sql.operations.WorkloadClassifiersOperations + :ivar managed_databases: ManagedDatabases operations + :vartype managed_databases: azure.mgmt.sql.operations.ManagedDatabasesOperations + :ivar server_azure_ad_administrators: ServerAzureADAdministrators operations + :vartype server_azure_ad_administrators: azure.mgmt.sql.operations.ServerAzureADAdministratorsOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -310,8 +313,6 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.restorable_dropped_databases = RestorableDroppedDatabasesOperations( self._client, self.config, self._serialize, self._deserialize) - self.servers = ServersOperations( - self._client, self.config, self._serialize, self._deserialize) self.server_connection_policies = ServerConnectionPoliciesOperations( self._client, self.config, self._serialize, self._deserialize) self.database_threat_detection_policies = DatabaseThreatDetectionPoliciesOperations( @@ -466,19 +467,23 @@ 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( self._client, self.config, self._serialize, self._deserialize) - self.server_azure_ad_administrators = ServerAzureADAdministratorsOperations( + self.servers = ServersOperations( self._client, self.config, self._serialize, self._deserialize) self.capabilities = CapabilitiesOperations( self._client, self.config, self._serialize, self._deserialize) + self.long_term_retention_managed_instance_backups = LongTermRetentionManagedInstanceBackupsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.managed_instance_long_term_retention_policies = ManagedInstanceLongTermRetentionPoliciesOperations( + self._client, self.config, self._serialize, self._deserialize) self.workload_groups = WorkloadGroupsOperations( self._client, self.config, self._serialize, self._deserialize) self.workload_classifiers = WorkloadClassifiersOperations( self._client, self.config, self._serialize, self._deserialize) + self.managed_databases = ManagedDatabasesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.server_azure_ad_administrators = ServerAzureADAdministratorsOperations( + self._client, self.config, self._serialize, self._deserialize) 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 fe146e9e9505..0f11c28e178c 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 @@ -84,7 +84,6 @@ 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 @@ -93,6 +92,8 @@ from ._models_py3 import ManagedInstanceEncryptionProtector from ._models_py3 import ManagedInstanceFamilyCapability from ._models_py3 import ManagedInstanceKey + from ._models_py3 import ManagedInstanceLongTermRetentionBackup + from ._models_py3 import ManagedInstanceLongTermRetentionPolicy from ._models_py3 import ManagedInstancePairInfo from ._models_py3 import ManagedInstanceUpdate from ._models_py3 import ManagedInstanceVcoresCapability @@ -115,6 +116,7 @@ from ._models_py3 import PartnerRegionInfo from ._models_py3 import PerformanceLevelCapability from ._models_py3 import PrivateEndpointConnection + from ._models_py3 import PrivateEndpointConnectionProperties from ._models_py3 import PrivateEndpointProperty from ._models_py3 import PrivateLinkResource from ._models_py3 import PrivateLinkResourceProperties @@ -143,6 +145,7 @@ from ._models_py3 import ServerDnsAlias from ._models_py3 import ServerDnsAliasAcquisition from ._models_py3 import ServerKey + from ._models_py3 import ServerPrivateEndpointConnection from ._models_py3 import ServerSecurityAlertPolicy from ._models_py3 import ServerUpdate from ._models_py3 import ServerUsage @@ -256,7 +259,6 @@ 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 @@ -265,6 +267,8 @@ from ._models import ManagedInstanceEncryptionProtector from ._models import ManagedInstanceFamilyCapability from ._models import ManagedInstanceKey + from ._models import ManagedInstanceLongTermRetentionBackup + from ._models import ManagedInstanceLongTermRetentionPolicy from ._models import ManagedInstancePairInfo from ._models import ManagedInstanceUpdate from ._models import ManagedInstanceVcoresCapability @@ -287,6 +291,7 @@ from ._models import PartnerRegionInfo from ._models import PerformanceLevelCapability from ._models import PrivateEndpointConnection + from ._models import PrivateEndpointConnectionProperties from ._models import PrivateEndpointProperty from ._models import PrivateLinkResource from ._models import PrivateLinkResourceProperties @@ -315,6 +320,7 @@ from ._models import ServerDnsAlias from ._models import ServerDnsAliasAcquisition from ._models import ServerKey + from ._models import ServerPrivateEndpointConnection from ._models import ServerSecurityAlertPolicy from ._models import ServerUpdate from ._models import ServerUsage @@ -384,6 +390,8 @@ from ._paged_models import ManagedInstanceAdministratorPaged from ._paged_models import ManagedInstanceEncryptionProtectorPaged from ._paged_models import ManagedInstanceKeyPaged +from ._paged_models import ManagedInstanceLongTermRetentionBackupPaged +from ._paged_models import ManagedInstanceLongTermRetentionPolicyPaged from ._paged_models import ManagedInstancePaged from ._paged_models import ManagedInstanceVulnerabilityAssessmentPaged from ._paged_models import ManagedServerSecurityAlertPolicyPaged @@ -428,7 +436,6 @@ from ._paged_models import WorkloadClassifierPaged from ._paged_models import WorkloadGroupPaged from ._sql_management_client_enums import ( - CheckNameAvailabilityReason, ServerConnectionType, SecurityAlertPolicyState, SecurityAlertPolicyEmailAccountAdmins, @@ -461,7 +468,6 @@ ReadOnlyEndpointFailoverPolicy, FailoverGroupReplicationRole, OperationOrigin, - IdentityType, SyncAgentState, SyncMemberDbType, SyncGroupLogType, @@ -483,6 +489,7 @@ AutomaticTuningServerMode, AutomaticTuningServerReason, RestorePointType, + SensitivityLabelRank, ManagementOperationState, CreateMode, SampleName, @@ -496,21 +503,33 @@ VulnerabilityAssessmentScanState, InstanceFailoverGroupReplicationRole, InstancePoolLicenseType, + IdentityType, ManagedServerCreateMode, ManagedInstanceLicenseType, ManagedInstanceProxyOverride, - ManagedDatabaseStatus, - ManagedDatabaseCreateMode, + PrivateLinkServiceConnectionStateStatus, + PrivateLinkServiceConnectionStateActionsRequire, + PrivateEndpointProvisioningState, + ServerPublicNetworkAccess, + CheckNameAvailabilityReason, MaxSizeUnit, LogSizeUnit, CapabilityStatus, PerformanceLevelUnit, PauseDelayTimeUnit, + ManagedDatabaseStatus, + ManagedDatabaseCreateMode, LongTermRetentionDatabaseState, VulnerabilityAssessmentPolicyBaselineName, SensitivityLabelSource, ReplicaType, CapabilityGroup, + DatabaseState1, + DatabaseState2, + DatabaseState3, + DatabaseState4, + DatabaseState5, + DatabaseState6, ) __all__ = [ @@ -588,7 +607,6 @@ 'LongTermRetentionBackup', 'ManagedBackupShortTermRetentionPolicy', 'ManagedDatabase', - 'ManagedDatabaseRestoreDetailsResult', 'ManagedDatabaseSecurityAlertPolicy', 'ManagedDatabaseUpdate', 'ManagedInstance', @@ -597,6 +615,8 @@ 'ManagedInstanceEncryptionProtector', 'ManagedInstanceFamilyCapability', 'ManagedInstanceKey', + 'ManagedInstanceLongTermRetentionBackup', + 'ManagedInstanceLongTermRetentionPolicy', 'ManagedInstancePairInfo', 'ManagedInstanceUpdate', 'ManagedInstanceVcoresCapability', @@ -619,6 +639,7 @@ 'PartnerRegionInfo', 'PerformanceLevelCapability', 'PrivateEndpointConnection', + 'PrivateEndpointConnectionProperties', 'PrivateEndpointProperty', 'PrivateLinkResource', 'PrivateLinkResourceProperties', @@ -647,6 +668,7 @@ 'ServerDnsAlias', 'ServerDnsAliasAcquisition', 'ServerKey', + 'ServerPrivateEndpointConnection', 'ServerSecurityAlertPolicy', 'ServerUpdate', 'ServerUsage', @@ -687,7 +709,6 @@ 'WorkloadGroup', 'RecoverableDatabasePaged', 'RestorableDroppedDatabasePaged', - 'ServerPaged', 'DataMaskingRulePaged', 'FirewallRulePaged', 'GeoBackupPolicyPaged', @@ -753,13 +774,15 @@ 'InstancePoolPaged', 'UsagePaged', 'ManagedInstancePaged', - 'ManagedDatabasePaged', 'PrivateEndpointConnectionPaged', 'PrivateLinkResourcePaged', - 'ServerAzureADAdministratorPaged', + 'ServerPaged', + 'ManagedInstanceLongTermRetentionBackupPaged', + 'ManagedInstanceLongTermRetentionPolicyPaged', 'WorkloadGroupPaged', 'WorkloadClassifierPaged', - 'CheckNameAvailabilityReason', + 'ManagedDatabasePaged', + 'ServerAzureADAdministratorPaged', 'ServerConnectionType', 'SecurityAlertPolicyState', 'SecurityAlertPolicyEmailAccountAdmins', @@ -792,7 +815,6 @@ 'ReadOnlyEndpointFailoverPolicy', 'FailoverGroupReplicationRole', 'OperationOrigin', - 'IdentityType', 'SyncAgentState', 'SyncMemberDbType', 'SyncGroupLogType', @@ -814,6 +836,7 @@ 'AutomaticTuningServerMode', 'AutomaticTuningServerReason', 'RestorePointType', + 'SensitivityLabelRank', 'ManagementOperationState', 'CreateMode', 'SampleName', @@ -827,19 +850,31 @@ 'VulnerabilityAssessmentScanState', 'InstanceFailoverGroupReplicationRole', 'InstancePoolLicenseType', + 'IdentityType', 'ManagedServerCreateMode', 'ManagedInstanceLicenseType', 'ManagedInstanceProxyOverride', - 'ManagedDatabaseStatus', - 'ManagedDatabaseCreateMode', + 'PrivateLinkServiceConnectionStateStatus', + 'PrivateLinkServiceConnectionStateActionsRequire', + 'PrivateEndpointProvisioningState', + 'ServerPublicNetworkAccess', + 'CheckNameAvailabilityReason', 'MaxSizeUnit', 'LogSizeUnit', 'CapabilityStatus', 'PerformanceLevelUnit', 'PauseDelayTimeUnit', + 'ManagedDatabaseStatus', + 'ManagedDatabaseCreateMode', 'LongTermRetentionDatabaseState', 'VulnerabilityAssessmentPolicyBaselineName', 'SensitivityLabelSource', 'ReplicaType', 'CapabilityGroup', + 'DatabaseState1', + 'DatabaseState2', + 'DatabaseState3', + 'DatabaseState4', + 'DatabaseState5', + 'DatabaseState6', ] 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 1d4c30a625e4..53272c0c8ccb 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 @@ -308,10 +308,9 @@ class CheckNameAvailabilityRequest(Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name whose availability is to be checked. + :param name: Required. :type name: str - :ivar type: Required. The type of resource that is used as the scope of - the availability check. Default value: "Microsoft.Sql/servers" . + :ivar type: Required. Default value: "Microsoft.Sql/servers" . :vartype type: str """ @@ -333,45 +332,44 @@ def __init__(self, **kwargs): class CheckNameAvailabilityResponse(Model): - """A response indicating whether the specified name for a resource is - available. + """The result of a name availability check. Variables are only populated by the server, and will be ignored when sending a request. - :ivar available: True if the name is available, otherwise false. - :vartype available: bool - :ivar message: A message explaining why the name is unavailable. Will be - null if the name is available. - :vartype message: str :ivar name: The name whose availability was checked. :vartype name: str + :ivar available: True if the name is available, otherwise false. + :vartype available: bool :ivar reason: The reason code explaining why the name is unavailable. Will - be null if the name is available. Possible values include: 'Invalid', + be undefined if the name is available. Possible values include: 'Invalid', 'AlreadyExists' :vartype reason: str or ~azure.mgmt.sql.models.CheckNameAvailabilityReason + :ivar message: A message explaining why the name is unavailable. Will be + undefined if the name is available. + :vartype message: str """ _validation = { - 'available': {'readonly': True}, - 'message': {'readonly': True}, 'name': {'readonly': True}, + 'available': {'readonly': True}, 'reason': {'readonly': True}, + 'message': {'readonly': True}, } _attribute_map = { - 'available': {'key': 'available', 'type': 'bool'}, - 'message': {'key': 'message', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, + 'available': {'key': 'available', 'type': 'bool'}, 'reason': {'key': 'reason', 'type': 'CheckNameAvailabilityReason'}, + 'message': {'key': 'message', 'type': 'str'}, } def __init__(self, **kwargs): super(CheckNameAvailabilityResponse, self).__init__(**kwargs) - self.available = None - self.message = None self.name = None + self.available = None self.reason = None + self.message = None class CloudError(Model): @@ -4684,7 +4682,7 @@ class ManagedDatabase(TrackedResource): by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. Possible values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore', - 'Recovery' + 'Recovery', 'RestoreLongTermRetentionBackup' :type create_mode: str or ~azure.mgmt.sql.models.ManagedDatabaseCreateMode :param storage_container_uri: Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri of the @@ -4706,6 +4704,9 @@ class ManagedDatabase(TrackedResource): :param recoverable_database_id: The resource identifier of the recoverable database associated with create operation of this database. :type recoverable_database_id: str + :param long_term_retention_backup_resource_id: The name of the Long Term + Retention backup to be used for restore of this managed database. + :type long_term_retention_backup_resource_id: str """ _validation = { @@ -4740,6 +4741,7 @@ class ManagedDatabase(TrackedResource): 'storage_container_sas_token': {'key': 'properties.storageContainerSasToken', 'type': 'str'}, 'failover_group_id': {'key': 'properties.failoverGroupId', 'type': 'str'}, 'recoverable_database_id': {'key': 'properties.recoverableDatabaseId', 'type': 'str'}, + 'long_term_retention_backup_resource_id': {'key': 'properties.longTermRetentionBackupResourceId', 'type': 'str'}, } def __init__(self, **kwargs): @@ -4758,86 +4760,7 @@ def __init__(self, **kwargs): self.storage_container_sas_token = kwargs.get('storage_container_sas_token', None) self.failover_group_id = None 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 + self.long_term_retention_backup_resource_id = kwargs.get('long_term_retention_backup_resource_id', None) class ManagedDatabaseSecurityAlertPolicy(ProxyResource): @@ -4952,7 +4875,7 @@ class ManagedDatabaseUpdate(Model): by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. Possible values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore', - 'Recovery' + 'Recovery', 'RestoreLongTermRetentionBackup' :type create_mode: str or ~azure.mgmt.sql.models.ManagedDatabaseCreateMode :param storage_container_uri: Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri of the @@ -4974,6 +4897,9 @@ class ManagedDatabaseUpdate(Model): :param recoverable_database_id: The resource identifier of the recoverable database associated with create operation of this database. :type recoverable_database_id: str + :param long_term_retention_backup_resource_id: The name of the Long Term + Retention backup to be used for restore of this managed database. + :type long_term_retention_backup_resource_id: str :param tags: Resource tags. :type tags: dict[str, str] """ @@ -5001,6 +4927,7 @@ class ManagedDatabaseUpdate(Model): 'storage_container_sas_token': {'key': 'properties.storageContainerSasToken', 'type': 'str'}, 'failover_group_id': {'key': 'properties.failoverGroupId', 'type': 'str'}, 'recoverable_database_id': {'key': 'properties.recoverableDatabaseId', 'type': 'str'}, + 'long_term_retention_backup_resource_id': {'key': 'properties.longTermRetentionBackupResourceId', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, } @@ -5020,6 +4947,7 @@ def __init__(self, **kwargs): self.storage_container_sas_token = kwargs.get('storage_container_sas_token', None) self.failover_group_id = None self.recoverable_database_id = kwargs.get('recoverable_database_id', None) + self.long_term_retention_backup_resource_id = kwargs.get('long_term_retention_backup_resource_id', None) self.tags = kwargs.get('tags', None) @@ -5443,6 +5371,118 @@ def __init__(self, **kwargs): self.creation_date = None +class ManagedInstanceLongTermRetentionBackup(ProxyResource): + """A long term retention backup for a managed database. + + 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 managed_instance_name: The managed instance that the backup database + belongs to. + :vartype managed_instance_name: str + :ivar managed_instance_create_time: The create time of the instance. + :vartype managed_instance_create_time: datetime + :ivar database_name: The name of the database the backup belong to + :vartype database_name: str + :ivar database_deletion_time: The delete time of the database + :vartype database_deletion_time: datetime + :ivar backup_time: The time the backup was taken + :vartype backup_time: datetime + :ivar backup_expiration_time: The time the long term retention backup will + expire. + :vartype backup_expiration_time: datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'managed_instance_name': {'readonly': True}, + 'managed_instance_create_time': {'readonly': True}, + 'database_name': {'readonly': True}, + 'database_deletion_time': {'readonly': True}, + 'backup_time': {'readonly': True}, + 'backup_expiration_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'managed_instance_name': {'key': 'properties.managedInstanceName', 'type': 'str'}, + 'managed_instance_create_time': {'key': 'properties.managedInstanceCreateTime', 'type': 'iso-8601'}, + 'database_name': {'key': 'properties.databaseName', 'type': 'str'}, + 'database_deletion_time': {'key': 'properties.databaseDeletionTime', 'type': 'iso-8601'}, + 'backup_time': {'key': 'properties.backupTime', 'type': 'iso-8601'}, + 'backup_expiration_time': {'key': 'properties.backupExpirationTime', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(ManagedInstanceLongTermRetentionBackup, self).__init__(**kwargs) + self.managed_instance_name = None + self.managed_instance_create_time = None + self.database_name = None + self.database_deletion_time = None + self.backup_time = None + self.backup_expiration_time = None + + +class ManagedInstanceLongTermRetentionPolicy(ProxyResource): + """A long term retention policy. + + 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 + :param weekly_retention: The weekly retention policy for an LTR backup in + an ISO 8601 format. + :type weekly_retention: str + :param monthly_retention: The monthly retention policy for an LTR backup + in an ISO 8601 format. + :type monthly_retention: str + :param yearly_retention: The yearly retention policy for an LTR backup in + an ISO 8601 format. + :type yearly_retention: str + :param week_of_year: The week of year to take the yearly backup in an ISO + 8601 format. + :type week_of_year: int + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'weekly_retention': {'key': 'properties.weeklyRetention', 'type': 'str'}, + 'monthly_retention': {'key': 'properties.monthlyRetention', 'type': 'str'}, + 'yearly_retention': {'key': 'properties.yearlyRetention', 'type': 'str'}, + 'week_of_year': {'key': 'properties.weekOfYear', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(ManagedInstanceLongTermRetentionPolicy, self).__init__(**kwargs) + self.weekly_retention = kwargs.get('weekly_retention', None) + self.monthly_retention = kwargs.get('monthly_retention', None) + self.yearly_retention = kwargs.get('yearly_retention', None) + self.week_of_year = kwargs.get('week_of_year', None) + + class ManagedInstancePairInfo(Model): """Pairs of Managed Instances in the failover group. @@ -6408,7 +6448,10 @@ class PrivateEndpointConnection(ProxyResource): :type private_link_service_connection_state: ~azure.mgmt.sql.models.PrivateLinkServiceConnectionStateProperty :ivar provisioning_state: State of the private endpoint connection. - :vartype provisioning_state: str + Possible values include: 'Approving', 'Ready', 'Dropping', 'Failed', + 'Rejecting' + :vartype provisioning_state: str or + ~azure.mgmt.sql.models.PrivateEndpointProvisioningState """ _validation = { @@ -6434,6 +6477,42 @@ def __init__(self, **kwargs): self.provisioning_state = None +class PrivateEndpointConnectionProperties(Model): + """Properties of a private endpoint connection. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param private_endpoint: Private endpoint which the connection belongs to. + :type private_endpoint: ~azure.mgmt.sql.models.PrivateEndpointProperty + :param private_link_service_connection_state: Connection state of the + private endpoint connection. + :type private_link_service_connection_state: + ~azure.mgmt.sql.models.PrivateLinkServiceConnectionStateProperty + :ivar provisioning_state: State of the private endpoint connection. + Possible values include: 'Approving', 'Ready', 'Dropping', 'Failed', + 'Rejecting' + :vartype provisioning_state: str or + ~azure.mgmt.sql.models.PrivateEndpointProvisioningState + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'private_endpoint': {'key': 'privateEndpoint', 'type': 'PrivateEndpointProperty'}, + 'private_link_service_connection_state': {'key': 'privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionStateProperty'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PrivateEndpointConnectionProperties, self).__init__(**kwargs) + self.private_endpoint = kwargs.get('private_endpoint', None) + self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) + self.provisioning_state = None + + class PrivateEndpointProperty(Model): """PrivateEndpointProperty. @@ -6522,13 +6601,16 @@ class PrivateLinkServiceConnectionStateProperty(Model): All required parameters must be populated in order to send to Azure. :param status: Required. The private link service connection status. - :type status: str + Possible values include: 'Approved', 'Pending', 'Rejected', 'Disconnected' + :type status: str or + ~azure.mgmt.sql.models.PrivateLinkServiceConnectionStateStatus :param description: Required. The private link service connection description. :type description: str :ivar actions_required: The actions required for private link service - connection. - :vartype actions_required: str + connection. Possible values include: 'None' + :vartype actions_required: str or + ~azure.mgmt.sql.models.PrivateLinkServiceConnectionStateActionsRequire """ _validation = { @@ -7252,6 +7334,9 @@ class SensitivityLabel(ProxyResource): recommended sensitivity label only. Specifies whether the sensitivity recommendation on this column is disabled (dismissed) or not. :vartype is_disabled: bool + :param rank: Possible values include: 'None', 'Low', 'Medium', 'High', + 'Critical' + :type rank: str or ~azure.mgmt.sql.models.SensitivityLabelRank """ _validation = { @@ -7270,6 +7355,7 @@ class SensitivityLabel(ProxyResource): 'information_type': {'key': 'properties.informationType', 'type': 'str'}, 'information_type_id': {'key': 'properties.informationTypeId', 'type': 'str'}, 'is_disabled': {'key': 'properties.isDisabled', 'type': 'bool'}, + 'rank': {'key': 'properties.rank', 'type': 'SensitivityLabelRank'}, } def __init__(self, **kwargs): @@ -7279,6 +7365,7 @@ def __init__(self, **kwargs): self.information_type = kwargs.get('information_type', None) self.information_type_id = kwargs.get('information_type_id', None) self.is_disabled = None + self.rank = kwargs.get('rank', None) class Server(TrackedResource): @@ -7317,6 +7404,18 @@ class Server(TrackedResource): :ivar fully_qualified_domain_name: The fully qualified domain name of the server. :vartype fully_qualified_domain_name: str + :ivar private_endpoint_connections: List of private endpoint connections + on a server + :vartype private_endpoint_connections: + list[~azure.mgmt.sql.models.ServerPrivateEndpointConnection] + :param minimal_tls_version: Minimal TLS version. Allowed values: '1.0', + '1.1', '1.2' + :type minimal_tls_version: str + :param public_network_access: Whether or not public endpoint access is + allowed for this server. Value is optional but if passed in, must be + 'Enabled' or 'Disabled'. Possible values include: 'Enabled', 'Disabled' + :type public_network_access: str or + ~azure.mgmt.sql.models.ServerPublicNetworkAccess """ _validation = { @@ -7327,6 +7426,7 @@ class Server(TrackedResource): 'kind': {'readonly': True}, 'state': {'readonly': True}, 'fully_qualified_domain_name': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, } _attribute_map = { @@ -7342,6 +7442,9 @@ class Server(TrackedResource): 'version': {'key': 'properties.version', 'type': 'str'}, 'state': {'key': 'properties.state', 'type': 'str'}, 'fully_qualified_domain_name': {'key': 'properties.fullyQualifiedDomainName', 'type': 'str'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[ServerPrivateEndpointConnection]'}, + 'minimal_tls_version': {'key': 'properties.minimalTlsVersion', 'type': 'str'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, } def __init__(self, **kwargs): @@ -7353,6 +7456,9 @@ def __init__(self, **kwargs): self.version = kwargs.get('version', None) self.state = None self.fully_qualified_domain_name = None + self.private_endpoint_connections = None + self.minimal_tls_version = kwargs.get('minimal_tls_version', None) + self.public_network_access = kwargs.get('public_network_access', None) class ServerAutomaticTuning(ProxyResource): @@ -7426,6 +7532,9 @@ class ServerAzureADAdministrator(ProxyResource): :type sid: str :param tenant_id: Tenant ID of the administrator. :type tenant_id: str + :param azure_ad_only_authentication: Azure Active Directory only + Authentication enabled. + :type azure_ad_only_authentication: bool """ _validation = { @@ -7445,6 +7554,7 @@ class ServerAzureADAdministrator(ProxyResource): 'login': {'key': 'properties.login', 'type': 'str'}, 'sid': {'key': 'properties.sid', 'type': 'str'}, 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'azure_ad_only_authentication': {'key': 'properties.azureADOnlyAuthentication', 'type': 'bool'}, } administrator_type = "ActiveDirectory" @@ -7454,6 +7564,7 @@ def __init__(self, **kwargs): self.login = kwargs.get('login', None) self.sid = kwargs.get('sid', None) self.tenant_id = kwargs.get('tenant_id', None) + self.azure_ad_only_authentication = kwargs.get('azure_ad_only_authentication', None) class ServerBlobAuditingPolicy(ProxyResource): @@ -7830,6 +7941,35 @@ def __init__(self, **kwargs): self.creation_date = kwargs.get('creation_date', None) +class ServerPrivateEndpointConnection(Model): + """A private endpoint connection under a server. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar properties: Private endpoint connection properties + :vartype properties: + ~azure.mgmt.sql.models.PrivateEndpointConnectionProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'properties': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'PrivateEndpointConnectionProperties'}, + } + + def __init__(self, **kwargs): + super(ServerPrivateEndpointConnection, self).__init__(**kwargs) + self.id = None + self.properties = None + + class ServerSecurityAlertPolicy(ProxyResource): """A server security alert policy. @@ -7925,6 +8065,18 @@ class ServerUpdate(Model): :ivar fully_qualified_domain_name: The fully qualified domain name of the server. :vartype fully_qualified_domain_name: str + :ivar private_endpoint_connections: List of private endpoint connections + on a server + :vartype private_endpoint_connections: + list[~azure.mgmt.sql.models.ServerPrivateEndpointConnection] + :param minimal_tls_version: Minimal TLS version. Allowed values: '1.0', + '1.1', '1.2' + :type minimal_tls_version: str + :param public_network_access: Whether or not public endpoint access is + allowed for this server. Value is optional but if passed in, must be + 'Enabled' or 'Disabled'. Possible values include: 'Enabled', 'Disabled' + :type public_network_access: str or + ~azure.mgmt.sql.models.ServerPublicNetworkAccess :param tags: Resource tags. :type tags: dict[str, str] """ @@ -7932,6 +8084,7 @@ class ServerUpdate(Model): _validation = { 'state': {'readonly': True}, 'fully_qualified_domain_name': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, } _attribute_map = { @@ -7940,6 +8093,9 @@ class ServerUpdate(Model): 'version': {'key': 'properties.version', 'type': 'str'}, 'state': {'key': 'properties.state', 'type': 'str'}, 'fully_qualified_domain_name': {'key': 'properties.fullyQualifiedDomainName', 'type': 'str'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[ServerPrivateEndpointConnection]'}, + 'minimal_tls_version': {'key': 'properties.minimalTlsVersion', 'type': 'str'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, } @@ -7950,6 +8106,9 @@ def __init__(self, **kwargs): self.version = kwargs.get('version', None) self.state = None self.fully_qualified_domain_name = None + self.private_endpoint_connections = None + self.minimal_tls_version = kwargs.get('minimal_tls_version', None) + self.public_network_access = kwargs.get('public_network_access', None) self.tags = kwargs.get('tags', None) 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 dd09869db010..c2aa3aefe186 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 @@ -308,10 +308,9 @@ class CheckNameAvailabilityRequest(Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name whose availability is to be checked. + :param name: Required. :type name: str - :ivar type: Required. The type of resource that is used as the scope of - the availability check. Default value: "Microsoft.Sql/servers" . + :ivar type: Required. Default value: "Microsoft.Sql/servers" . :vartype type: str """ @@ -333,45 +332,44 @@ def __init__(self, *, name: str, **kwargs) -> None: class CheckNameAvailabilityResponse(Model): - """A response indicating whether the specified name for a resource is - available. + """The result of a name availability check. Variables are only populated by the server, and will be ignored when sending a request. - :ivar available: True if the name is available, otherwise false. - :vartype available: bool - :ivar message: A message explaining why the name is unavailable. Will be - null if the name is available. - :vartype message: str :ivar name: The name whose availability was checked. :vartype name: str + :ivar available: True if the name is available, otherwise false. + :vartype available: bool :ivar reason: The reason code explaining why the name is unavailable. Will - be null if the name is available. Possible values include: 'Invalid', + be undefined if the name is available. Possible values include: 'Invalid', 'AlreadyExists' :vartype reason: str or ~azure.mgmt.sql.models.CheckNameAvailabilityReason + :ivar message: A message explaining why the name is unavailable. Will be + undefined if the name is available. + :vartype message: str """ _validation = { - 'available': {'readonly': True}, - 'message': {'readonly': True}, 'name': {'readonly': True}, + 'available': {'readonly': True}, 'reason': {'readonly': True}, + 'message': {'readonly': True}, } _attribute_map = { - 'available': {'key': 'available', 'type': 'bool'}, - 'message': {'key': 'message', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, + 'available': {'key': 'available', 'type': 'bool'}, 'reason': {'key': 'reason', 'type': 'CheckNameAvailabilityReason'}, + 'message': {'key': 'message', 'type': 'str'}, } def __init__(self, **kwargs) -> None: super(CheckNameAvailabilityResponse, self).__init__(**kwargs) - self.available = None - self.message = None self.name = None + self.available = None self.reason = None + self.message = None class CloudError(Model): @@ -4684,7 +4682,7 @@ class ManagedDatabase(TrackedResource): by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. Possible values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore', - 'Recovery' + 'Recovery', 'RestoreLongTermRetentionBackup' :type create_mode: str or ~azure.mgmt.sql.models.ManagedDatabaseCreateMode :param storage_container_uri: Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri of the @@ -4706,6 +4704,9 @@ class ManagedDatabase(TrackedResource): :param recoverable_database_id: The resource identifier of the recoverable database associated with create operation of this database. :type recoverable_database_id: str + :param long_term_retention_backup_resource_id: The name of the Long Term + Retention backup to be used for restore of this managed database. + :type long_term_retention_backup_resource_id: str """ _validation = { @@ -4740,9 +4741,10 @@ class ManagedDatabase(TrackedResource): 'storage_container_sas_token': {'key': 'properties.storageContainerSasToken', 'type': 'str'}, 'failover_group_id': {'key': 'properties.failoverGroupId', 'type': 'str'}, 'recoverable_database_id': {'key': 'properties.recoverableDatabaseId', 'type': 'str'}, + 'long_term_retention_backup_resource_id': {'key': 'properties.longTermRetentionBackupResourceId', 'type': 'str'}, } - def __init__(self, *, location: str, tags=None, collation: str=None, restore_point_in_time=None, catalog_collation=None, create_mode=None, storage_container_uri: str=None, source_database_id: str=None, restorable_dropped_database_id: str=None, storage_container_sas_token: str=None, recoverable_database_id: str=None, **kwargs) -> None: + def __init__(self, *, location: str, tags=None, collation: str=None, restore_point_in_time=None, catalog_collation=None, create_mode=None, storage_container_uri: str=None, source_database_id: str=None, restorable_dropped_database_id: str=None, storage_container_sas_token: str=None, recoverable_database_id: str=None, long_term_retention_backup_resource_id: str=None, **kwargs) -> None: super(ManagedDatabase, self).__init__(location=location, tags=tags, **kwargs) self.collation = collation self.status = None @@ -4758,86 +4760,7 @@ def __init__(self, *, location: str, tags=None, collation: str=None, restore_poi self.storage_container_sas_token = storage_container_sas_token self.failover_group_id = None 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 + self.long_term_retention_backup_resource_id = long_term_retention_backup_resource_id class ManagedDatabaseSecurityAlertPolicy(ProxyResource): @@ -4952,7 +4875,7 @@ class ManagedDatabaseUpdate(Model): by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. Possible values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore', - 'Recovery' + 'Recovery', 'RestoreLongTermRetentionBackup' :type create_mode: str or ~azure.mgmt.sql.models.ManagedDatabaseCreateMode :param storage_container_uri: Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri of the @@ -4974,6 +4897,9 @@ class ManagedDatabaseUpdate(Model): :param recoverable_database_id: The resource identifier of the recoverable database associated with create operation of this database. :type recoverable_database_id: str + :param long_term_retention_backup_resource_id: The name of the Long Term + Retention backup to be used for restore of this managed database. + :type long_term_retention_backup_resource_id: str :param tags: Resource tags. :type tags: dict[str, str] """ @@ -5001,10 +4927,11 @@ class ManagedDatabaseUpdate(Model): 'storage_container_sas_token': {'key': 'properties.storageContainerSasToken', 'type': 'str'}, 'failover_group_id': {'key': 'properties.failoverGroupId', 'type': 'str'}, 'recoverable_database_id': {'key': 'properties.recoverableDatabaseId', 'type': 'str'}, + 'long_term_retention_backup_resource_id': {'key': 'properties.longTermRetentionBackupResourceId', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, collation: str=None, restore_point_in_time=None, catalog_collation=None, create_mode=None, storage_container_uri: str=None, source_database_id: str=None, restorable_dropped_database_id: str=None, storage_container_sas_token: str=None, recoverable_database_id: str=None, tags=None, **kwargs) -> None: + def __init__(self, *, collation: str=None, restore_point_in_time=None, catalog_collation=None, create_mode=None, storage_container_uri: str=None, source_database_id: str=None, restorable_dropped_database_id: str=None, storage_container_sas_token: str=None, recoverable_database_id: str=None, long_term_retention_backup_resource_id: str=None, tags=None, **kwargs) -> None: super(ManagedDatabaseUpdate, self).__init__(**kwargs) self.collation = collation self.status = None @@ -5020,6 +4947,7 @@ def __init__(self, *, collation: str=None, restore_point_in_time=None, catalog_c self.storage_container_sas_token = storage_container_sas_token self.failover_group_id = None self.recoverable_database_id = recoverable_database_id + self.long_term_retention_backup_resource_id = long_term_retention_backup_resource_id self.tags = tags @@ -5443,6 +5371,118 @@ def __init__(self, *, server_key_type, uri: str=None, **kwargs) -> None: self.creation_date = None +class ManagedInstanceLongTermRetentionBackup(ProxyResource): + """A long term retention backup for a managed database. + + 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 managed_instance_name: The managed instance that the backup database + belongs to. + :vartype managed_instance_name: str + :ivar managed_instance_create_time: The create time of the instance. + :vartype managed_instance_create_time: datetime + :ivar database_name: The name of the database the backup belong to + :vartype database_name: str + :ivar database_deletion_time: The delete time of the database + :vartype database_deletion_time: datetime + :ivar backup_time: The time the backup was taken + :vartype backup_time: datetime + :ivar backup_expiration_time: The time the long term retention backup will + expire. + :vartype backup_expiration_time: datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'managed_instance_name': {'readonly': True}, + 'managed_instance_create_time': {'readonly': True}, + 'database_name': {'readonly': True}, + 'database_deletion_time': {'readonly': True}, + 'backup_time': {'readonly': True}, + 'backup_expiration_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'managed_instance_name': {'key': 'properties.managedInstanceName', 'type': 'str'}, + 'managed_instance_create_time': {'key': 'properties.managedInstanceCreateTime', 'type': 'iso-8601'}, + 'database_name': {'key': 'properties.databaseName', 'type': 'str'}, + 'database_deletion_time': {'key': 'properties.databaseDeletionTime', 'type': 'iso-8601'}, + 'backup_time': {'key': 'properties.backupTime', 'type': 'iso-8601'}, + 'backup_expiration_time': {'key': 'properties.backupExpirationTime', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs) -> None: + super(ManagedInstanceLongTermRetentionBackup, self).__init__(**kwargs) + self.managed_instance_name = None + self.managed_instance_create_time = None + self.database_name = None + self.database_deletion_time = None + self.backup_time = None + self.backup_expiration_time = None + + +class ManagedInstanceLongTermRetentionPolicy(ProxyResource): + """A long term retention policy. + + 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 + :param weekly_retention: The weekly retention policy for an LTR backup in + an ISO 8601 format. + :type weekly_retention: str + :param monthly_retention: The monthly retention policy for an LTR backup + in an ISO 8601 format. + :type monthly_retention: str + :param yearly_retention: The yearly retention policy for an LTR backup in + an ISO 8601 format. + :type yearly_retention: str + :param week_of_year: The week of year to take the yearly backup in an ISO + 8601 format. + :type week_of_year: int + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'weekly_retention': {'key': 'properties.weeklyRetention', 'type': 'str'}, + 'monthly_retention': {'key': 'properties.monthlyRetention', 'type': 'str'}, + 'yearly_retention': {'key': 'properties.yearlyRetention', 'type': 'str'}, + 'week_of_year': {'key': 'properties.weekOfYear', 'type': 'int'}, + } + + def __init__(self, *, weekly_retention: str=None, monthly_retention: str=None, yearly_retention: str=None, week_of_year: int=None, **kwargs) -> None: + super(ManagedInstanceLongTermRetentionPolicy, self).__init__(**kwargs) + self.weekly_retention = weekly_retention + self.monthly_retention = monthly_retention + self.yearly_retention = yearly_retention + self.week_of_year = week_of_year + + class ManagedInstancePairInfo(Model): """Pairs of Managed Instances in the failover group. @@ -6408,7 +6448,10 @@ class PrivateEndpointConnection(ProxyResource): :type private_link_service_connection_state: ~azure.mgmt.sql.models.PrivateLinkServiceConnectionStateProperty :ivar provisioning_state: State of the private endpoint connection. - :vartype provisioning_state: str + Possible values include: 'Approving', 'Ready', 'Dropping', 'Failed', + 'Rejecting' + :vartype provisioning_state: str or + ~azure.mgmt.sql.models.PrivateEndpointProvisioningState """ _validation = { @@ -6434,6 +6477,42 @@ def __init__(self, *, private_endpoint=None, private_link_service_connection_sta self.provisioning_state = None +class PrivateEndpointConnectionProperties(Model): + """Properties of a private endpoint connection. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param private_endpoint: Private endpoint which the connection belongs to. + :type private_endpoint: ~azure.mgmt.sql.models.PrivateEndpointProperty + :param private_link_service_connection_state: Connection state of the + private endpoint connection. + :type private_link_service_connection_state: + ~azure.mgmt.sql.models.PrivateLinkServiceConnectionStateProperty + :ivar provisioning_state: State of the private endpoint connection. + Possible values include: 'Approving', 'Ready', 'Dropping', 'Failed', + 'Rejecting' + :vartype provisioning_state: str or + ~azure.mgmt.sql.models.PrivateEndpointProvisioningState + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'private_endpoint': {'key': 'privateEndpoint', 'type': 'PrivateEndpointProperty'}, + 'private_link_service_connection_state': {'key': 'privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionStateProperty'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__(self, *, private_endpoint=None, private_link_service_connection_state=None, **kwargs) -> None: + super(PrivateEndpointConnectionProperties, self).__init__(**kwargs) + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = None + + class PrivateEndpointProperty(Model): """PrivateEndpointProperty. @@ -6522,13 +6601,16 @@ class PrivateLinkServiceConnectionStateProperty(Model): All required parameters must be populated in order to send to Azure. :param status: Required. The private link service connection status. - :type status: str + Possible values include: 'Approved', 'Pending', 'Rejected', 'Disconnected' + :type status: str or + ~azure.mgmt.sql.models.PrivateLinkServiceConnectionStateStatus :param description: Required. The private link service connection description. :type description: str :ivar actions_required: The actions required for private link service - connection. - :vartype actions_required: str + connection. Possible values include: 'None' + :vartype actions_required: str or + ~azure.mgmt.sql.models.PrivateLinkServiceConnectionStateActionsRequire """ _validation = { @@ -6543,7 +6625,7 @@ class PrivateLinkServiceConnectionStateProperty(Model): 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, } - def __init__(self, *, status: str, description: str, **kwargs) -> None: + def __init__(self, *, status, description: str, **kwargs) -> None: super(PrivateLinkServiceConnectionStateProperty, self).__init__(**kwargs) self.status = status self.description = description @@ -7252,6 +7334,9 @@ class SensitivityLabel(ProxyResource): recommended sensitivity label only. Specifies whether the sensitivity recommendation on this column is disabled (dismissed) or not. :vartype is_disabled: bool + :param rank: Possible values include: 'None', 'Low', 'Medium', 'High', + 'Critical' + :type rank: str or ~azure.mgmt.sql.models.SensitivityLabelRank """ _validation = { @@ -7270,15 +7355,17 @@ class SensitivityLabel(ProxyResource): 'information_type': {'key': 'properties.informationType', 'type': 'str'}, 'information_type_id': {'key': 'properties.informationTypeId', 'type': 'str'}, 'is_disabled': {'key': 'properties.isDisabled', 'type': 'bool'}, + 'rank': {'key': 'properties.rank', 'type': 'SensitivityLabelRank'}, } - def __init__(self, *, label_name: str=None, label_id: str=None, information_type: str=None, information_type_id: str=None, **kwargs) -> None: + def __init__(self, *, label_name: str=None, label_id: str=None, information_type: str=None, information_type_id: str=None, rank=None, **kwargs) -> None: super(SensitivityLabel, self).__init__(**kwargs) self.label_name = label_name self.label_id = label_id self.information_type = information_type self.information_type_id = information_type_id self.is_disabled = None + self.rank = rank class Server(TrackedResource): @@ -7317,6 +7404,18 @@ class Server(TrackedResource): :ivar fully_qualified_domain_name: The fully qualified domain name of the server. :vartype fully_qualified_domain_name: str + :ivar private_endpoint_connections: List of private endpoint connections + on a server + :vartype private_endpoint_connections: + list[~azure.mgmt.sql.models.ServerPrivateEndpointConnection] + :param minimal_tls_version: Minimal TLS version. Allowed values: '1.0', + '1.1', '1.2' + :type minimal_tls_version: str + :param public_network_access: Whether or not public endpoint access is + allowed for this server. Value is optional but if passed in, must be + 'Enabled' or 'Disabled'. Possible values include: 'Enabled', 'Disabled' + :type public_network_access: str or + ~azure.mgmt.sql.models.ServerPublicNetworkAccess """ _validation = { @@ -7327,6 +7426,7 @@ class Server(TrackedResource): 'kind': {'readonly': True}, 'state': {'readonly': True}, 'fully_qualified_domain_name': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, } _attribute_map = { @@ -7342,9 +7442,12 @@ class Server(TrackedResource): 'version': {'key': 'properties.version', 'type': 'str'}, 'state': {'key': 'properties.state', 'type': 'str'}, 'fully_qualified_domain_name': {'key': 'properties.fullyQualifiedDomainName', 'type': 'str'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[ServerPrivateEndpointConnection]'}, + 'minimal_tls_version': {'key': 'properties.minimalTlsVersion', 'type': 'str'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, } - def __init__(self, *, location: str, tags=None, identity=None, administrator_login: str=None, administrator_login_password: str=None, version: str=None, **kwargs) -> None: + def __init__(self, *, location: str, tags=None, identity=None, administrator_login: str=None, administrator_login_password: str=None, version: str=None, minimal_tls_version: str=None, public_network_access=None, **kwargs) -> None: super(Server, self).__init__(location=location, tags=tags, **kwargs) self.identity = identity self.kind = None @@ -7353,6 +7456,9 @@ def __init__(self, *, location: str, tags=None, identity=None, administrator_log self.version = version self.state = None self.fully_qualified_domain_name = None + self.private_endpoint_connections = None + self.minimal_tls_version = minimal_tls_version + self.public_network_access = public_network_access class ServerAutomaticTuning(ProxyResource): @@ -7426,6 +7532,9 @@ class ServerAzureADAdministrator(ProxyResource): :type sid: str :param tenant_id: Tenant ID of the administrator. :type tenant_id: str + :param azure_ad_only_authentication: Azure Active Directory only + Authentication enabled. + :type azure_ad_only_authentication: bool """ _validation = { @@ -7445,15 +7554,17 @@ class ServerAzureADAdministrator(ProxyResource): 'login': {'key': 'properties.login', 'type': 'str'}, 'sid': {'key': 'properties.sid', 'type': 'str'}, 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'azure_ad_only_authentication': {'key': 'properties.azureADOnlyAuthentication', 'type': 'bool'}, } administrator_type = "ActiveDirectory" - def __init__(self, *, login: str, sid: str, tenant_id: str=None, **kwargs) -> None: + def __init__(self, *, login: str, sid: str, tenant_id: str=None, azure_ad_only_authentication: bool=None, **kwargs) -> None: super(ServerAzureADAdministrator, self).__init__(**kwargs) self.login = login self.sid = sid self.tenant_id = tenant_id + self.azure_ad_only_authentication = azure_ad_only_authentication class ServerBlobAuditingPolicy(ProxyResource): @@ -7830,6 +7941,35 @@ def __init__(self, *, server_key_type, kind: str=None, uri: str=None, thumbprint self.creation_date = creation_date +class ServerPrivateEndpointConnection(Model): + """A private endpoint connection under a server. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar properties: Private endpoint connection properties + :vartype properties: + ~azure.mgmt.sql.models.PrivateEndpointConnectionProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'properties': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'PrivateEndpointConnectionProperties'}, + } + + def __init__(self, **kwargs) -> None: + super(ServerPrivateEndpointConnection, self).__init__(**kwargs) + self.id = None + self.properties = None + + class ServerSecurityAlertPolicy(ProxyResource): """A server security alert policy. @@ -7925,6 +8065,18 @@ class ServerUpdate(Model): :ivar fully_qualified_domain_name: The fully qualified domain name of the server. :vartype fully_qualified_domain_name: str + :ivar private_endpoint_connections: List of private endpoint connections + on a server + :vartype private_endpoint_connections: + list[~azure.mgmt.sql.models.ServerPrivateEndpointConnection] + :param minimal_tls_version: Minimal TLS version. Allowed values: '1.0', + '1.1', '1.2' + :type minimal_tls_version: str + :param public_network_access: Whether or not public endpoint access is + allowed for this server. Value is optional but if passed in, must be + 'Enabled' or 'Disabled'. Possible values include: 'Enabled', 'Disabled' + :type public_network_access: str or + ~azure.mgmt.sql.models.ServerPublicNetworkAccess :param tags: Resource tags. :type tags: dict[str, str] """ @@ -7932,6 +8084,7 @@ class ServerUpdate(Model): _validation = { 'state': {'readonly': True}, 'fully_qualified_domain_name': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, } _attribute_map = { @@ -7940,16 +8093,22 @@ class ServerUpdate(Model): 'version': {'key': 'properties.version', 'type': 'str'}, 'state': {'key': 'properties.state', 'type': 'str'}, 'fully_qualified_domain_name': {'key': 'properties.fullyQualifiedDomainName', 'type': 'str'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[ServerPrivateEndpointConnection]'}, + 'minimal_tls_version': {'key': 'properties.minimalTlsVersion', 'type': 'str'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, administrator_login: str=None, administrator_login_password: str=None, version: str=None, tags=None, **kwargs) -> None: + def __init__(self, *, administrator_login: str=None, administrator_login_password: str=None, version: str=None, minimal_tls_version: str=None, public_network_access=None, tags=None, **kwargs) -> None: super(ServerUpdate, self).__init__(**kwargs) self.administrator_login = administrator_login self.administrator_login_password = administrator_login_password self.version = version self.state = None self.fully_qualified_domain_name = None + self.private_endpoint_connections = None + self.minimal_tls_version = minimal_tls_version + self.public_network_access = public_network_access self.tags = tags 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 8b5d9a2a8e24..129f26cd2f5d 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 @@ -38,19 +38,6 @@ class RestorableDroppedDatabasePaged(Paged): def __init__(self, *args, **kwargs): super(RestorableDroppedDatabasePaged, self).__init__(*args, **kwargs) -class ServerPaged(Paged): - """ - A paging container for iterating over a list of :class:`Server ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Server]'} - } - - def __init__(self, *args, **kwargs): - - super(ServerPaged, self).__init__(*args, **kwargs) class DataMaskingRulePaged(Paged): """ A paging container for iterating over a list of :class:`DataMaskingRule ` object @@ -896,58 +883,71 @@ class ManagedInstancePaged(Paged): def __init__(self, *args, **kwargs): super(ManagedInstancePaged, self).__init__(*args, **kwargs) -class ManagedDatabasePaged(Paged): +class PrivateEndpointConnectionPaged(Paged): """ - A paging container for iterating over a list of :class:`ManagedDatabase ` object + A paging container for iterating over a list of :class:`PrivateEndpointConnection ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ManagedDatabase]'} + 'current_page': {'key': 'value', 'type': '[PrivateEndpointConnection]'} } def __init__(self, *args, **kwargs): - super(ManagedDatabasePaged, self).__init__(*args, **kwargs) -class PrivateEndpointConnectionPaged(Paged): + super(PrivateEndpointConnectionPaged, self).__init__(*args, **kwargs) +class PrivateLinkResourcePaged(Paged): """ - A paging container for iterating over a list of :class:`PrivateEndpointConnection ` object + A paging container for iterating over a list of :class:`PrivateLinkResource ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[PrivateEndpointConnection]'} + 'current_page': {'key': 'value', 'type': '[PrivateLinkResource]'} } def __init__(self, *args, **kwargs): - super(PrivateEndpointConnectionPaged, self).__init__(*args, **kwargs) -class PrivateLinkResourcePaged(Paged): + super(PrivateLinkResourcePaged, self).__init__(*args, **kwargs) +class ServerPaged(Paged): """ - A paging container for iterating over a list of :class:`PrivateLinkResource ` object + A paging container for iterating over a list of :class:`Server ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[PrivateLinkResource]'} + 'current_page': {'key': 'value', 'type': '[Server]'} } def __init__(self, *args, **kwargs): - super(PrivateLinkResourcePaged, self).__init__(*args, **kwargs) -class ServerAzureADAdministratorPaged(Paged): + super(ServerPaged, self).__init__(*args, **kwargs) +class ManagedInstanceLongTermRetentionBackupPaged(Paged): """ - A paging container for iterating over a list of :class:`ServerAzureADAdministrator ` object + A paging container for iterating over a list of :class:`ManagedInstanceLongTermRetentionBackup ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ServerAzureADAdministrator]'} + 'current_page': {'key': 'value', 'type': '[ManagedInstanceLongTermRetentionBackup]'} } def __init__(self, *args, **kwargs): - super(ServerAzureADAdministratorPaged, self).__init__(*args, **kwargs) + super(ManagedInstanceLongTermRetentionBackupPaged, self).__init__(*args, **kwargs) +class ManagedInstanceLongTermRetentionPolicyPaged(Paged): + """ + A paging container for iterating over a list of :class:`ManagedInstanceLongTermRetentionPolicy ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ManagedInstanceLongTermRetentionPolicy]'} + } + + def __init__(self, *args, **kwargs): + + super(ManagedInstanceLongTermRetentionPolicyPaged, self).__init__(*args, **kwargs) class WorkloadGroupPaged(Paged): """ A paging container for iterating over a list of :class:`WorkloadGroup ` object @@ -974,3 +974,29 @@ class WorkloadClassifierPaged(Paged): def __init__(self, *args, **kwargs): super(WorkloadClassifierPaged, 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 ServerAzureADAdministratorPaged(Paged): + """ + A paging container for iterating over a list of :class:`ServerAzureADAdministrator ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ServerAzureADAdministrator]'} + } + + def __init__(self, *args, **kwargs): + + super(ServerAzureADAdministratorPaged, self).__init__(*args, **kwargs) 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 8aa0b3ba1096..05e8fd0e5e2b 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 @@ -12,12 +12,6 @@ from enum import Enum -class CheckNameAvailabilityReason(str, Enum): - - invalid = "Invalid" - already_exists = "AlreadyExists" - - class ServerConnectionType(str, Enum): default = "Default" @@ -331,11 +325,6 @@ class OperationOrigin(str, Enum): system = "system" -class IdentityType(str, Enum): - - system_assigned = "SystemAssigned" - - class SyncAgentState(str, Enum): online = "Online" @@ -504,6 +493,15 @@ class RestorePointType(str, Enum): discrete = "DISCRETE" +class SensitivityLabelRank(str, Enum): + + none = "None" + low = "Low" + medium = "Medium" + high = "High" + critical = "Critical" + + class ManagementOperationState(str, Enum): pending = "Pending" @@ -617,6 +615,11 @@ class InstancePoolLicenseType(str, Enum): base_price = "BasePrice" +class IdentityType(str, Enum): + + system_assigned = "SystemAssigned" + + class ManagedServerCreateMode(str, Enum): default = "Default" @@ -636,23 +639,38 @@ class ManagedInstanceProxyOverride(str, Enum): default = "Default" -class ManagedDatabaseStatus(str, Enum): +class PrivateLinkServiceConnectionStateStatus(str, Enum): - online = "Online" - offline = "Offline" - shutdown = "Shutdown" - creating = "Creating" - inaccessible = "Inaccessible" - restoring = "Restoring" - updating = "Updating" + approved = "Approved" + pending = "Pending" + rejected = "Rejected" + disconnected = "Disconnected" -class ManagedDatabaseCreateMode(str, Enum): +class PrivateLinkServiceConnectionStateActionsRequire(str, Enum): + + none = "None" + + +class PrivateEndpointProvisioningState(str, Enum): + + approving = "Approving" + ready = "Ready" + dropping = "Dropping" + failed = "Failed" + rejecting = "Rejecting" - default = "Default" - restore_external_backup = "RestoreExternalBackup" - point_in_time_restore = "PointInTimeRestore" - recovery = "Recovery" + +class ServerPublicNetworkAccess(str, Enum): + + enabled = "Enabled" + disabled = "Disabled" + + +class CheckNameAvailabilityReason(str, Enum): + + invalid = "Invalid" + already_exists = "AlreadyExists" class MaxSizeUnit(str, Enum): @@ -691,6 +709,26 @@ class PauseDelayTimeUnit(str, Enum): minutes = "Minutes" +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" + restore_long_term_retention_backup = "RestoreLongTermRetentionBackup" + + class LongTermRetentionDatabaseState(str, Enum): all = "All" @@ -723,3 +761,45 @@ class CapabilityGroup(str, Enum): supported_managed_instance_versions = "supportedManagedInstanceVersions" supported_instance_pool_editions = "supportedInstancePoolEditions" supported_managed_instance_editions = "supportedManagedInstanceEditions" + + +class DatabaseState1(str, Enum): + + all = "All" + live = "Live" + deleted = "Deleted" + + +class DatabaseState2(str, Enum): + + all = "All" + live = "Live" + deleted = "Deleted" + + +class DatabaseState3(str, Enum): + + all = "All" + live = "Live" + deleted = "Deleted" + + +class DatabaseState4(str, Enum): + + all = "All" + live = "Live" + deleted = "Deleted" + + +class DatabaseState5(str, Enum): + + all = "All" + live = "Live" + deleted = "Deleted" + + +class DatabaseState6(str, Enum): + + all = "All" + live = "Live" + deleted = "Deleted" 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 1149a3cd94f9..b0f99f1b6866 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 @@ -11,7 +11,6 @@ from ._recoverable_databases_operations import RecoverableDatabasesOperations from ._restorable_dropped_databases_operations import RestorableDroppedDatabasesOperations -from ._servers_operations import ServersOperations from ._server_connection_policies_operations import ServerConnectionPoliciesOperations from ._database_threat_detection_policies_operations import DatabaseThreatDetectionPoliciesOperations from ._data_masking_policies_operations import DataMaskingPoliciesOperations @@ -89,19 +88,20 @@ 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 -from ._server_azure_ad_administrators_operations import ServerAzureADAdministratorsOperations +from ._servers_operations import ServersOperations from ._capabilities_operations import CapabilitiesOperations +from ._long_term_retention_managed_instance_backups_operations import LongTermRetentionManagedInstanceBackupsOperations +from ._managed_instance_long_term_retention_policies_operations import ManagedInstanceLongTermRetentionPoliciesOperations from ._workload_groups_operations import WorkloadGroupsOperations from ._workload_classifiers_operations import WorkloadClassifiersOperations +from ._managed_databases_operations import ManagedDatabasesOperations +from ._server_azure_ad_administrators_operations import ServerAzureADAdministratorsOperations __all__ = [ 'RecoverableDatabasesOperations', 'RestorableDroppedDatabasesOperations', - 'ServersOperations', 'ServerConnectionPoliciesOperations', 'DatabaseThreatDetectionPoliciesOperations', 'DataMaskingPoliciesOperations', @@ -179,12 +179,14 @@ 'InstancePoolsOperations', 'UsagesOperations', 'ManagedInstancesOperations', - 'ManagedDatabaseRestoreDetailsOperations', - 'ManagedDatabasesOperations', 'PrivateEndpointConnectionsOperations', 'PrivateLinkResourcesOperations', - 'ServerAzureADAdministratorsOperations', + 'ServersOperations', 'CapabilitiesOperations', + 'LongTermRetentionManagedInstanceBackupsOperations', + 'ManagedInstanceLongTermRetentionPoliciesOperations', 'WorkloadGroupsOperations', 'WorkloadClassifiersOperations', + 'ManagedDatabasesOperations', + 'ServerAzureADAdministratorsOperations', ] diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_long_term_retention_managed_instance_backups_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_long_term_retention_managed_instance_backups_operations.py new file mode 100644 index 000000000000..6de0045d6600 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_long_term_retention_managed_instance_backups_operations.py @@ -0,0 +1,884 @@ +# 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 msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class LongTermRetentionManagedInstanceBackupsOperations(object): + """LongTermRetentionManagedInstanceBackupsOperations 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 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.api_version = "2018-06-01-preview" + + self.config = config + + def get( + self, location_name, managed_instance_name, database_name, backup_name, custom_headers=None, raw=False, **operation_config): + """Gets a long term retention backup for a managed database. + + :param location_name: The location of the database. + :type location_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the managed database. + :type database_name: str + :param backup_name: The backup name. + :type backup_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: ManagedInstanceLongTermRetentionBackup or ClientRawResponse + if raw=true + :rtype: ~azure.mgmt.sql.models.ManagedInstanceLongTermRetentionBackup + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'backupName': self._serialize.url("backup_name", backup_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('ManagedInstanceLongTermRetentionBackup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}'} + + + def _delete_initial( + self, location_name, managed_instance_name, database_name, backup_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'backupName': self._serialize.url("backup_name", backup_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 = {} + 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.delete(url, query_parameters, header_parameters) + 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 delete( + self, location_name, managed_instance_name, database_name, backup_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes a long term retention backup. + + :param location_name: The location of the database. + :type location_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the managed database. + :type database_name: str + :param backup_name: The backup name. + :type 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._delete_initial( + location_name=location_name, + managed_instance_name=managed_instance_name, + database_name=database_name, + backup_name=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) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}'} + + def list_by_database( + self, location_name, managed_instance_name, database_name, only_latest_per_database=None, database_state=None, custom_headers=None, raw=False, **operation_config): + """Lists all long term retention backups for a managed database. + + :param location_name: The location of the database. + :type location_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the managed database. + :type database_name: str + :param only_latest_per_database: Whether or not to only get the latest + backup for each database. + :type only_latest_per_database: bool + :param database_state: Whether to query against just live databases, + just deleted databases, or all databases. Possible values include: + 'All', 'Live', 'Deleted' + :type database_state: str or ~azure.mgmt.sql.models.DatabaseState1 + :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: An iterator like instance of + ManagedInstanceLongTermRetentionBackup + :rtype: + ~azure.mgmt.sql.models.ManagedInstanceLongTermRetentionBackupPaged[~azure.mgmt.sql.models.ManagedInstanceLongTermRetentionBackup] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_database.metadata['url'] + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_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 = {} + if only_latest_per_database is not None: + query_parameters['onlyLatestPerDatabase'] = self._serialize.query("only_latest_per_database", only_latest_per_database, 'bool') + if database_state is not None: + query_parameters['databaseState'] = self._serialize.query("database_state", database_state, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # 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) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + 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 + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ManagedInstanceLongTermRetentionBackupPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups'} + + def list_by_instance( + self, location_name, managed_instance_name, only_latest_per_database=None, database_state=None, custom_headers=None, raw=False, **operation_config): + """Lists the long term retention backups for a given managed instance. + + :param location_name: The location of the database + :type location_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param only_latest_per_database: Whether or not to only get the latest + backup for each database. + :type only_latest_per_database: bool + :param database_state: Whether to query against just live databases, + just deleted databases, or all databases. Possible values include: + 'All', 'Live', 'Deleted' + :type database_state: str or ~azure.mgmt.sql.models.DatabaseState2 + :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: An iterator like instance of + ManagedInstanceLongTermRetentionBackup + :rtype: + ~azure.mgmt.sql.models.ManagedInstanceLongTermRetentionBackupPaged[~azure.mgmt.sql.models.ManagedInstanceLongTermRetentionBackup] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_instance.metadata['url'] + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_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 = {} + if only_latest_per_database is not None: + query_parameters['onlyLatestPerDatabase'] = self._serialize.query("only_latest_per_database", only_latest_per_database, 'bool') + if database_state is not None: + query_parameters['databaseState'] = self._serialize.query("database_state", database_state, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # 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) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + 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 + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ManagedInstanceLongTermRetentionBackupPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_instance.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups'} + + def list_by_location( + self, location_name, only_latest_per_database=None, database_state=None, custom_headers=None, raw=False, **operation_config): + """Lists the long term retention backups for managed databases in a given + location. + + :param location_name: The location of the database. + :type location_name: str + :param only_latest_per_database: Whether or not to only get the latest + backup for each database. + :type only_latest_per_database: bool + :param database_state: Whether to query against just live databases, + just deleted databases, or all databases. Possible values include: + 'All', 'Live', 'Deleted' + :type database_state: str or ~azure.mgmt.sql.models.DatabaseState3 + :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: An iterator like instance of + ManagedInstanceLongTermRetentionBackup + :rtype: + ~azure.mgmt.sql.models.ManagedInstanceLongTermRetentionBackupPaged[~azure.mgmt.sql.models.ManagedInstanceLongTermRetentionBackup] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_location.metadata['url'] + path_format_arguments = { + 'locationName': self._serialize.url("location_name", location_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 = {} + if only_latest_per_database is not None: + query_parameters['onlyLatestPerDatabase'] = self._serialize.query("only_latest_per_database", only_latest_per_database, 'bool') + if database_state is not None: + query_parameters['databaseState'] = self._serialize.query("database_state", database_state, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # 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) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + 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 + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ManagedInstanceLongTermRetentionBackupPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups'} + + def get_by_resource_group( + self, resource_group_name, location_name, managed_instance_name, database_name, backup_name, custom_headers=None, raw=False, **operation_config): + """Gets a long term retention backup for 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 location_name: The location of the database. + :type location_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the managed database. + :type database_name: str + :param backup_name: The backup name. + :type backup_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: ManagedInstanceLongTermRetentionBackup or ClientRawResponse + if raw=true + :rtype: ~azure.mgmt.sql.models.ManagedInstanceLongTermRetentionBackup + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_by_resource_group.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'backupName': self._serialize.url("backup_name", backup_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('ManagedInstanceLongTermRetentionBackup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}'} + + + def _delete_by_resource_group_initial( + self, resource_group_name, location_name, managed_instance_name, database_name, backup_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_by_resource_group.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'backupName': self._serialize.url("backup_name", backup_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 = {} + 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.delete(url, query_parameters, header_parameters) + 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 delete_by_resource_group( + self, resource_group_name, location_name, managed_instance_name, database_name, backup_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes a long term retention backup. + + :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 location_name: The location of the database + :type location_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the managed database. + :type database_name: str + :param backup_name: The backup name. + :type 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._delete_by_resource_group_initial( + resource_group_name=resource_group_name, + location_name=location_name, + managed_instance_name=managed_instance_name, + database_name=database_name, + backup_name=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) + delete_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}'} + + def list_by_resource_group_database( + self, resource_group_name, location_name, managed_instance_name, database_name, only_latest_per_database=None, database_state=None, custom_headers=None, raw=False, **operation_config): + """Lists all long term retention backups for 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 location_name: The location of the database + :type location_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the managed database. + :type database_name: str + :param only_latest_per_database: Whether or not to only get the latest + backup for each database. + :type only_latest_per_database: bool + :param database_state: Whether to query against just live databases, + just deleted databases, or all databases. Possible values include: + 'All', 'Live', 'Deleted' + :type database_state: str or ~azure.mgmt.sql.models.DatabaseState4 + :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: An iterator like instance of + ManagedInstanceLongTermRetentionBackup + :rtype: + ~azure.mgmt.sql.models.ManagedInstanceLongTermRetentionBackupPaged[~azure.mgmt.sql.models.ManagedInstanceLongTermRetentionBackup] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group_database.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'locationName': self._serialize.url("location_name", location_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 = {} + if only_latest_per_database is not None: + query_parameters['onlyLatestPerDatabase'] = self._serialize.query("only_latest_per_database", only_latest_per_database, 'bool') + if database_state is not None: + query_parameters['databaseState'] = self._serialize.query("database_state", database_state, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # 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) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + 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 + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ManagedInstanceLongTermRetentionBackupPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups'} + + def list_by_resource_group_instance( + self, resource_group_name, location_name, managed_instance_name, only_latest_per_database=None, database_state=None, custom_headers=None, raw=False, **operation_config): + """Lists the long term retention backups for a given managed instance. + + :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 location_name: The location of the database. + :type location_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param only_latest_per_database: Whether or not to only get the latest + backup for each database. + :type only_latest_per_database: bool + :param database_state: Whether to query against just live databases, + just deleted databases, or all databases. Possible values include: + 'All', 'Live', 'Deleted' + :type database_state: str or ~azure.mgmt.sql.models.DatabaseState5 + :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: An iterator like instance of + ManagedInstanceLongTermRetentionBackup + :rtype: + ~azure.mgmt.sql.models.ManagedInstanceLongTermRetentionBackupPaged[~azure.mgmt.sql.models.ManagedInstanceLongTermRetentionBackup] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group_instance.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_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 = {} + if only_latest_per_database is not None: + query_parameters['onlyLatestPerDatabase'] = self._serialize.query("only_latest_per_database", only_latest_per_database, 'bool') + if database_state is not None: + query_parameters['databaseState'] = self._serialize.query("database_state", database_state, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # 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) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + 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 + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ManagedInstanceLongTermRetentionBackupPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group_instance.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups'} + + def list_by_resource_group_location( + self, resource_group_name, location_name, only_latest_per_database=None, database_state=None, custom_headers=None, raw=False, **operation_config): + """Lists the long term retention backups for managed databases in a given + location. + + :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 location_name: The location of the database. + :type location_name: str + :param only_latest_per_database: Whether or not to only get the latest + backup for each database. + :type only_latest_per_database: bool + :param database_state: Whether to query against just live databases, + just deleted databases, or all databases. Possible values include: + 'All', 'Live', 'Deleted' + :type database_state: str or ~azure.mgmt.sql.models.DatabaseState6 + :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: An iterator like instance of + ManagedInstanceLongTermRetentionBackup + :rtype: + ~azure.mgmt.sql.models.ManagedInstanceLongTermRetentionBackupPaged[~azure.mgmt.sql.models.ManagedInstanceLongTermRetentionBackup] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group_location.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'locationName': self._serialize.url("location_name", location_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 = {} + if only_latest_per_database is not None: + query_parameters['onlyLatestPerDatabase'] = self._serialize.query("only_latest_per_database", only_latest_per_database, 'bool') + if database_state is not None: + query_parameters['databaseState'] = self._serialize.query("database_state", database_state, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # 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) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + 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 + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ManagedInstanceLongTermRetentionBackupPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group_location.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups'} 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 deleted file mode 100644 index 69a7c9be070d..000000000000 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_restore_details_operations.py +++ /dev/null @@ -1,110 +0,0 @@ -# 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 2d5207987157..07db1c34032a 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: "2018-06-01-preview". + :ivar api_version: The API version to use for the request. Constant value: "2019-06-01-preview". """ models = models @@ -37,7 +37,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-06-01-preview" + self.api_version = "2019-06-01-preview" self.config = config @@ -480,6 +480,80 @@ def get_long_running_output(response): 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 list_inaccessible_by_instance( + self, resource_group_name, managed_instance_name, custom_headers=None, raw=False, **operation_config): + """Gets a list of inaccessible managed databases in a managed instance. + + :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 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: An iterator like instance of ManagedDatabase + :rtype: + ~azure.mgmt.sql.models.ManagedDatabasePaged[~azure.mgmt.sql.models.ManagedDatabase] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_inaccessible_by_instance.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'), + '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') + + else: + url = next_link + query_parameters = {} + + # 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) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + 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 + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ManagedDatabasePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_inaccessible_by_instance.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/inaccessibleManagedDatabases'} + def _complete_restore_initial( self, resource_group_name, managed_instance_name, database_name, last_backup_name, custom_headers=None, raw=False, **operation_config): diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_long_term_retention_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_long_term_retention_policies_operations.py new file mode 100644 index 000000000000..e26952358e26 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_long_term_retention_policies_operations.py @@ -0,0 +1,299 @@ +# 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 msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class ManagedInstanceLongTermRetentionPoliciesOperations(object): + """ManagedInstanceLongTermRetentionPoliciesOperations 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 policy_name: The policy name. Should always be Default. 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.policy_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 a managed database's long term retention policy. + + :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: ManagedInstanceLongTermRetentionPolicy or ClientRawResponse + if raw=true + :rtype: ~azure.mgmt.sql.models.ManagedInstanceLongTermRetentionPolicy + 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'), + 'policyName': self._serialize.url("self.policy_name", self.policy_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('ManagedInstanceLongTermRetentionPolicy', 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}/backupLongTermRetentionPolicies/{policyName}'} + + + def _create_or_update_initial( + self, resource_group_name, managed_instance_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_or_update.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'), + 'policyName': self._serialize.url("self.policy_name", self.policy_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' + 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, 'ManagedInstanceLongTermRetentionPolicy') + + # Construct and send request + request = self._client.put(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 + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ManagedInstanceLongTermRetentionPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, managed_instance_name, database_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Sets a managed database's long term retention policy. + + :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 parameters: The long term retention policy info. + :type parameters: + ~azure.mgmt.sql.models.ManagedInstanceLongTermRetentionPolicy + :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 + ManagedInstanceLongTermRetentionPolicy or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ManagedInstanceLongTermRetentionPolicy] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.sql.models.ManagedInstanceLongTermRetentionPolicy]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + database_name=database_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ManagedInstanceLongTermRetentionPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + 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) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}'} + + def list_by_database( + self, resource_group_name, managed_instance_name, database_name, custom_headers=None, raw=False, **operation_config): + """Gets a database's long term retention policy. + + :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: An iterator like instance of + ManagedInstanceLongTermRetentionPolicy + :rtype: + ~azure.mgmt.sql.models.ManagedInstanceLongTermRetentionPolicyPaged[~azure.mgmt.sql.models.ManagedInstanceLongTermRetentionPolicy] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_database.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') + + else: + url = next_link + query_parameters = {} + + # 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) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + 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 + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ManagedInstanceLongTermRetentionPolicyPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupLongTermRetentionPolicies'} diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_azure_ad_administrators_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_azure_ad_administrators_operations.py index 26bc6441d307..2bfa200b74fe 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_azure_ad_administrators_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_azure_ad_administrators_operations.py @@ -27,7 +27,7 @@ class ServerAzureADAdministratorsOperations(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: "2018-06-01-preview". + :ivar api_version: The API version to use for the request. Constant value: "2019-06-01-preview". :ivar administrator_name: The name of server active directory administrator. Constant value: "ActiveDirectory". """ @@ -38,14 +38,14 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-06-01-preview" + self.api_version = "2019-06-01-preview" self.administrator_name = "ActiveDirectory" self.config = config def get( self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): - """Gets a server Administrator. + """Gets a Azure Active Directory administrator. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -162,8 +162,7 @@ def _create_or_update_initial( def create_or_update( self, resource_group_name, server_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): - """Creates a new Server Active Directory Administrator or updates an - existing server Active Directory Administrator. + """Creates or updates an existing Azure Active Directory administrator. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -256,7 +255,7 @@ def _delete_initial( def delete( self, resource_group_name, server_name, custom_headers=None, raw=False, polling=True, **operation_config): - """Deletes an existing server Active Directory Administrator. + """Deletes the Azure Active Directory administrator with the given name. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -299,7 +298,7 @@ def get_long_running_output(response): def list_by_server( self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): - """Gets a list of server Administrators. + """Gets a list of Azure Active Directory administrators in a server. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -370,3 +369,99 @@ def internal_paging(next_link=None): return deserialized list_by_server.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators'} + + + def _disable_azure_ad_only_authentication_initial( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.disable_azure_ad_only_authentication.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, '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.post(url, query_parameters, header_parameters) + 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 + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ServerAzureADAdministrator', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def disable_azure_ad_only_authentication( + self, resource_group_name, server_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Disables Azure Active Directory only authentication on logical Server. + + :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 server_name: The name of the server. + :type server_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 + ServerAzureADAdministrator or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ServerAzureADAdministrator] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.sql.models.ServerAzureADAdministrator]] + :raises: :class:`CloudError` + """ + raw_result = self._disable_azure_ad_only_authentication_initial( + resource_group_name=resource_group_name, + server_name=server_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ServerAzureADAdministrator', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + 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) + disable_azure_ad_only_authentication.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/disableAzureADOnlyAuthentication'} diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_servers_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_servers_operations.py index 16fd05d12be8..7abf430deda2 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_servers_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_servers_operations.py @@ -27,6 +27,7 @@ class ServersOperations(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: "2019-06-01-preview". """ models = models @@ -36,143 +37,10 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer + self.api_version = "2019-06-01-preview" self.config = config - def check_name_availability( - self, name, custom_headers=None, raw=False, **operation_config): - """Determines whether a resource can be created with the specified name. - - :param name: The name whose availability is to be checked. - :type 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: CheckNameAvailabilityResponse or ClientRawResponse if - raw=true - :rtype: ~azure.mgmt.sql.models.CheckNameAvailabilityResponse or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - parameters = models.CheckNameAvailabilityRequest(name=name) - - api_version = "2014-04-01" - - # Construct URL - url = self.check_name_availability.metadata['url'] - path_format_arguments = { - '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("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - 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, 'CheckNameAvailabilityRequest') - - # 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]: - 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('CheckNameAvailabilityResponse', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability'} - - def list( - self, custom_headers=None, raw=False, **operation_config): - """Gets a list of all servers in the subscription. - - :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: An iterator like instance of Server - :rtype: - ~azure.mgmt.sql.models.ServerPaged[~azure.mgmt.sql.models.Server] - :raises: :class:`CloudError` - """ - api_version = "2015-05-01-preview" - - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - '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("api_version", api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # 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) - return request - - def internal_paging(next_link=None): - request = prepare_request(next_link) - - 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 - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ServerPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers'} - def list_by_resource_group( self, resource_group_name, custom_headers=None, raw=False, **operation_config): """Gets a list of servers in a resource groups. @@ -191,8 +59,6 @@ def list_by_resource_group( ~azure.mgmt.sql.models.ServerPaged[~azure.mgmt.sql.models.Server] :raises: :class:`CloudError` """ - api_version = "2015-05-01-preview" - def prepare_request(next_link=None): if not next_link: # Construct URL @@ -205,7 +71,7 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link @@ -266,8 +132,6 @@ def get( ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ - api_version = "2015-05-01-preview" - # Construct URL url = self.get.metadata['url'] path_format_arguments = { @@ -279,7 +143,7 @@ def get( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers header_parameters = {} @@ -314,8 +178,6 @@ def get( def _create_or_update_initial( self, resource_group_name, server_name, parameters, custom_headers=None, raw=False, **operation_config): - api_version = "2015-05-01-preview" - # Construct URL url = self.create_or_update.metadata['url'] path_format_arguments = { @@ -327,7 +189,7 @@ def _create_or_update_initial( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers header_parameters = {} @@ -420,8 +282,6 @@ def get_long_running_output(response): def _delete_initial( self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): - api_version = "2015-05-01-preview" - # Construct URL url = self.delete.metadata['url'] path_format_arguments = { @@ -433,7 +293,7 @@ def _delete_initial( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers header_parameters = {} @@ -503,8 +363,6 @@ def get_long_running_output(response): def _update_initial( self, resource_group_name, server_name, parameters, custom_headers=None, raw=False, **operation_config): - api_version = "2015-05-01-preview" - # Construct URL url = self.update.metadata['url'] path_format_arguments = { @@ -516,7 +374,7 @@ def _update_initial( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers header_parameters = {} @@ -603,3 +461,133 @@ 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/servers/{serverName}'} + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Gets a list of all servers in the subscription. + + :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: An iterator like instance of Server + :rtype: + ~azure.mgmt.sql.models.ServerPaged[~azure.mgmt.sql.models.Server] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + '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') + + else: + url = next_link + query_parameters = {} + + # 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) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + 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 + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ServerPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers'} + + def check_name_availability( + self, name, custom_headers=None, raw=False, **operation_config): + """Determines whether a resource can be created with the specified name. + + :param name: + :type 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: CheckNameAvailabilityResponse or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.sql.models.CheckNameAvailabilityResponse or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + parameters = models.CheckNameAvailabilityRequest(name=name) + + # Construct URL + url = self.check_name_availability.metadata['url'] + path_format_arguments = { + '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' + 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, 'CheckNameAvailabilityRequest') + + # 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]: + 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('CheckNameAvailabilityResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability'}