From 62b84bf2d15ebf3234a06636d1fc9916eac07231 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Thu, 27 Aug 2020 04:55:28 +0000 Subject: [PATCH] Generated from f81dd1631ac7d6ae7f0a98d2cf0fbc859a762c3d Merge branch 'master' into addNewIeApiSwagger --- .../azure/mgmt/sql/_sql_management_client.py | 5 + .../azure/mgmt/sql/models/__init__.py | 42 +- .../azure/mgmt/sql/models/_models.py | 381 ++++++++------- .../azure/mgmt/sql/models/_models_py3.py | 383 ++++++++------- .../models/_sql_management_client_enums.py | 174 +++---- .../azure/mgmt/sql/operations/__init__.py | 2 + .../sql/operations/_databases_operations.py | 435 +++++------------- .../operations/_import_export_operations.py | 150 ++++++ .../sql/operations/_servers_operations.py | 135 +++++- 9 files changed, 908 insertions(+), 799 deletions(-) create mode 100644 sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_import_export_operations.py diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/_sql_management_client.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/_sql_management_client.py index 197c781f2d5c..f44654f61c0d 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 @@ -105,6 +105,7 @@ from .operations import ManagedDatabaseRestoreDetailsOperations from .operations import ManagedDatabasesOperations from .operations import ServerAzureADOnlyAuthenticationsOperations +from .operations import ImportExportOperations from . import models @@ -298,6 +299,8 @@ class SqlManagementClient(SDKClient): :vartype managed_databases: azure.mgmt.sql.operations.ManagedDatabasesOperations :ivar server_azure_ad_only_authentications: ServerAzureADOnlyAuthentications operations :vartype server_azure_ad_only_authentications: azure.mgmt.sql.operations.ServerAzureADOnlyAuthenticationsOperations + :ivar import_export: ImportExport operations + :vartype import_export: azure.mgmt.sql.operations.ImportExportOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -502,3 +505,5 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.server_azure_ad_only_authentications = ServerAzureADOnlyAuthenticationsOperations( self._client, self.config, self._serialize, self._deserialize) + self.import_export = ImportExportOperations( + 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 8e5cad538fb2..31a29be00ef2 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 @@ -44,7 +44,7 @@ from ._models_py3 import ElasticPoolPerformanceLevelCapability from ._models_py3 import ElasticPoolUpdate from ._models_py3 import EncryptionProtector - from ._models_py3 import ExportRequest + from ._models_py3 import ExportDatabaseDefinition from ._models_py3 import ExtendedDatabaseBlobAuditingPolicy from ._models_py3 import ExtendedServerBlobAuditingPolicy from ._models_py3 import FailoverGroup @@ -53,9 +53,9 @@ from ._models_py3 import FailoverGroupUpdate from ._models_py3 import FirewallRule from ._models_py3 import GeoBackupPolicy - from ._models_py3 import ImportExportResponse - from ._models_py3 import ImportExtensionRequest - from ._models_py3 import ImportRequest + from ._models_py3 import ImportExistingDatabaseDefinition + from ._models_py3 import ImportExportOperationResult + from ._models_py3 import ImportNewDatabaseDefinition from ._models_py3 import InstanceFailoverGroup from ._models_py3 import InstanceFailoverGroupReadOnlyEndpoint from ._models_py3 import InstanceFailoverGroupReadWriteEndpoint @@ -114,6 +114,7 @@ from ._models_py3 import MetricValue from ._models_py3 import MinCapacityCapability from ._models_py3 import Name + from ._models_py3 import NetworkIsolationSettings from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import OperationImpact @@ -122,6 +123,7 @@ from ._models_py3 import PerformanceLevelCapability from ._models_py3 import PrivateEndpointConnection from ._models_py3 import PrivateEndpointConnectionProperties + from ._models_py3 import PrivateEndpointConnectionRequestStatus from ._models_py3 import PrivateEndpointProperty from ._models_py3 import PrivateLinkResource from ._models_py3 import PrivateLinkResourceProperties @@ -228,7 +230,7 @@ from ._models import ElasticPoolPerformanceLevelCapability from ._models import ElasticPoolUpdate from ._models import EncryptionProtector - from ._models import ExportRequest + from ._models import ExportDatabaseDefinition from ._models import ExtendedDatabaseBlobAuditingPolicy from ._models import ExtendedServerBlobAuditingPolicy from ._models import FailoverGroup @@ -237,9 +239,9 @@ from ._models import FailoverGroupUpdate from ._models import FirewallRule from ._models import GeoBackupPolicy - from ._models import ImportExportResponse - from ._models import ImportExtensionRequest - from ._models import ImportRequest + from ._models import ImportExistingDatabaseDefinition + from ._models import ImportExportOperationResult + from ._models import ImportNewDatabaseDefinition from ._models import InstanceFailoverGroup from ._models import InstanceFailoverGroupReadOnlyEndpoint from ._models import InstanceFailoverGroupReadWriteEndpoint @@ -298,6 +300,7 @@ from ._models import MetricValue from ._models import MinCapacityCapability from ._models import Name + from ._models import NetworkIsolationSettings from ._models import Operation from ._models import OperationDisplay from ._models import OperationImpact @@ -306,6 +309,7 @@ from ._models import PerformanceLevelCapability from ._models import PrivateEndpointConnection from ._models import PrivateEndpointConnectionProperties + from ._models import PrivateEndpointConnectionRequestStatus from ._models import PrivateEndpointProperty from ._models import PrivateLinkResource from ._models import PrivateLinkResourceProperties @@ -466,10 +470,6 @@ DataMaskingRuleState, DataMaskingFunction, GeoBackupPolicyState, - DatabaseEdition, - ServiceObjectiveName, - StorageKeyType, - AuthenticationType, UnitType, PrimaryAggregationType, UnitDefinitionType, @@ -480,6 +480,7 @@ RecommendedIndexState, RecommendedIndexType, TransparentDataEncryptionStatus, + ServiceObjectiveName, TransparentDataEncryptionActivityStatus, AutomaticTuningMode, AutomaticTuningOptionModeDesired, @@ -542,6 +543,7 @@ ManagedInstanceLicenseType, ManagedInstanceProxyOverride, StorageAccountType, + StorageKeyType, LongTermRetentionDatabaseState, VulnerabilityAssessmentPolicyBaselineName, SensitivityLabelSource, @@ -590,7 +592,7 @@ 'ElasticPoolPerformanceLevelCapability', 'ElasticPoolUpdate', 'EncryptionProtector', - 'ExportRequest', + 'ExportDatabaseDefinition', 'ExtendedDatabaseBlobAuditingPolicy', 'ExtendedServerBlobAuditingPolicy', 'FailoverGroup', @@ -599,9 +601,9 @@ 'FailoverGroupUpdate', 'FirewallRule', 'GeoBackupPolicy', - 'ImportExportResponse', - 'ImportExtensionRequest', - 'ImportRequest', + 'ImportExistingDatabaseDefinition', + 'ImportExportOperationResult', + 'ImportNewDatabaseDefinition', 'InstanceFailoverGroup', 'InstanceFailoverGroupReadOnlyEndpoint', 'InstanceFailoverGroupReadWriteEndpoint', @@ -660,6 +662,7 @@ 'MetricValue', 'MinCapacityCapability', 'Name', + 'NetworkIsolationSettings', 'Operation', 'OperationDisplay', 'OperationImpact', @@ -668,6 +671,7 @@ 'PerformanceLevelCapability', 'PrivateEndpointConnection', 'PrivateEndpointConnectionProperties', + 'PrivateEndpointConnectionRequestStatus', 'PrivateEndpointProperty', 'PrivateLinkResource', 'PrivateLinkResourceProperties', @@ -827,10 +831,6 @@ 'DataMaskingRuleState', 'DataMaskingFunction', 'GeoBackupPolicyState', - 'DatabaseEdition', - 'ServiceObjectiveName', - 'StorageKeyType', - 'AuthenticationType', 'UnitType', 'PrimaryAggregationType', 'UnitDefinitionType', @@ -841,6 +841,7 @@ 'RecommendedIndexState', 'RecommendedIndexType', 'TransparentDataEncryptionStatus', + 'ServiceObjectiveName', 'TransparentDataEncryptionActivityStatus', 'AutomaticTuningMode', 'AutomaticTuningOptionModeDesired', @@ -903,6 +904,7 @@ 'ManagedInstanceLicenseType', 'ManagedInstanceProxyOverride', 'StorageAccountType', + 'StorageKeyType', 'LongTermRetentionDatabaseState', 'VulnerabilityAssessmentPolicyBaselineName', 'SensitivityLabelSource', diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_models.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_models.py index 084c636cb28e..afb4b8a4dd46 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 @@ -2614,28 +2614,28 @@ def __init__(self, **kwargs): self.thumbprint = None -class ExportRequest(Model): - """Export database parameters. +class ExportDatabaseDefinition(Model): + """Contains the information necessary to perform export database operation. All required parameters must be populated in order to send to Azure. - :param storage_key_type: Required. The type of the storage key to use. - Possible values include: 'StorageAccessKey', 'SharedAccessKey' + :param storage_key_type: Required. Storage key type. Possible values + include: 'SharedAccessKey', 'StorageAccessKey' :type storage_key_type: str or ~azure.mgmt.sql.models.StorageKeyType - :param storage_key: Required. The storage key to use. If storage key type - is SharedAccessKey, it must be preceded with a "?." + :param storage_key: Required. Storage key. :type storage_key: str - :param storage_uri: Required. The storage uri to use. + :param storage_uri: Required. Storage Uri. :type storage_uri: str - :param administrator_login: Required. The name of the SQL administrator. + :param administrator_login: Required. Administrator login name. :type administrator_login: str - :param administrator_login_password: Required. The password of the SQL - administrator. + :param administrator_login_password: Required. Administrator login + password. :type administrator_login_password: str - :param authentication_type: The authentication type. Possible values - include: 'SQL', 'ADPassword'. Default value: "SQL" . - :type authentication_type: str or - ~azure.mgmt.sql.models.AuthenticationType + :param authentication_type: Authentication type. + :type authentication_type: str + :param network_isolation: Optional resource information to enable network + isolation for request. + :type network_isolation: ~azure.mgmt.sql.models.NetworkIsolationSettings """ _validation = { @@ -2647,22 +2647,24 @@ class ExportRequest(Model): } _attribute_map = { - 'storage_key_type': {'key': 'storageKeyType', 'type': 'StorageKeyType'}, + 'storage_key_type': {'key': 'storageKeyType', 'type': 'str'}, 'storage_key': {'key': 'storageKey', 'type': 'str'}, 'storage_uri': {'key': 'storageUri', 'type': 'str'}, 'administrator_login': {'key': 'administratorLogin', 'type': 'str'}, 'administrator_login_password': {'key': 'administratorLoginPassword', 'type': 'str'}, - 'authentication_type': {'key': 'authenticationType', 'type': 'AuthenticationType'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'network_isolation': {'key': 'networkIsolation', 'type': 'NetworkIsolationSettings'}, } def __init__(self, **kwargs): - super(ExportRequest, self).__init__(**kwargs) + super(ExportDatabaseDefinition, self).__init__(**kwargs) self.storage_key_type = kwargs.get('storage_key_type', None) self.storage_key = kwargs.get('storage_key', None) self.storage_uri = kwargs.get('storage_uri', None) self.administrator_login = kwargs.get('administrator_login', None) self.administrator_login_password = kwargs.get('administrator_login_password', None) - self.authentication_type = kwargs.get('authentication_type', "SQL") + self.authentication_type = kwargs.get('authentication_type', None) + self.network_isolation = kwargs.get('network_isolation', None) class ExtendedDatabaseBlobAuditingPolicy(ProxyResource): @@ -3272,8 +3274,62 @@ def __init__(self, **kwargs): self.location = None -class ImportExportResponse(ProxyResource): - """Response for Import/Export Get operation. +class ImportExistingDatabaseDefinition(Model): + """Contains the information necessary to perform import operation for existing + database. + + All required parameters must be populated in order to send to Azure. + + :param storage_key_type: Required. Storage key type. Possible values + include: 'SharedAccessKey', 'StorageAccessKey' + :type storage_key_type: str or ~azure.mgmt.sql.models.StorageKeyType + :param storage_key: Required. Storage key. + :type storage_key: str + :param storage_uri: Required. Storage Uri. + :type storage_uri: str + :param administrator_login: Required. Administrator login name. + :type administrator_login: str + :param administrator_login_password: Required. Administrator login + password. + :type administrator_login_password: str + :param authentication_type: Authentication type. + :type authentication_type: str + :param network_isolation: Optional resource information to enable network + isolation for request. + :type network_isolation: ~azure.mgmt.sql.models.NetworkIsolationSettings + """ + + _validation = { + 'storage_key_type': {'required': True}, + 'storage_key': {'required': True}, + 'storage_uri': {'required': True}, + 'administrator_login': {'required': True}, + 'administrator_login_password': {'required': True}, + } + + _attribute_map = { + 'storage_key_type': {'key': 'storageKeyType', 'type': 'str'}, + 'storage_key': {'key': 'storageKey', 'type': 'str'}, + 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + 'administrator_login': {'key': 'administratorLogin', 'type': 'str'}, + 'administrator_login_password': {'key': 'administratorLoginPassword', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'network_isolation': {'key': 'networkIsolation', 'type': 'NetworkIsolationSettings'}, + } + + def __init__(self, **kwargs): + super(ImportExistingDatabaseDefinition, self).__init__(**kwargs) + self.storage_key_type = kwargs.get('storage_key_type', None) + self.storage_key = kwargs.get('storage_key', None) + self.storage_uri = kwargs.get('storage_uri', None) + self.administrator_login = kwargs.get('administrator_login', None) + self.administrator_login_password = kwargs.get('administrator_login_password', None) + self.authentication_type = kwargs.get('authentication_type', None) + self.network_isolation = kwargs.get('network_isolation', None) + + +class ImportExportOperationResult(ProxyResource): + """An ImportExport operation result resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -3284,192 +3340,108 @@ class ImportExportResponse(ProxyResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar request_type: The request type of the operation. - :vartype request_type: str - :ivar request_id: The request type of the operation. + :ivar request_id: Request Id. :vartype request_id: str - :ivar server_name: The name of the server. + :ivar request_type: Request type. + :vartype request_type: str + :ivar queued_time: Queued time. + :vartype queued_time: str + :ivar last_modified_time: Last modified time. + :vartype last_modified_time: str + :ivar blob_uri: Blob Uri. + :vartype blob_uri: str + :ivar server_name: Server name. :vartype server_name: str - :ivar database_name: The name of the database. + :ivar database_name: Database name. :vartype database_name: str - :ivar status: The status message returned from the server. + :ivar status: Operation status. :vartype status: str - :ivar last_modified_time: The operation status last modified time. - :vartype last_modified_time: str - :ivar queued_time: The operation queued time. - :vartype queued_time: str - :ivar blob_uri: The blob uri. - :vartype blob_uri: str - :ivar error_message: The error message returned from the server. + :ivar error_message: Error message. :vartype error_message: str + :ivar private_endpoint_connections: Gets the status of private endpoints + associated with this request. + :vartype private_endpoint_connections: + list[~azure.mgmt.sql.models.PrivateEndpointConnectionRequestStatus] """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'request_type': {'readonly': True}, 'request_id': {'readonly': True}, + 'request_type': {'readonly': True}, + 'queued_time': {'readonly': True}, + 'last_modified_time': {'readonly': True}, + 'blob_uri': {'readonly': True}, 'server_name': {'readonly': True}, 'database_name': {'readonly': True}, 'status': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'queued_time': {'readonly': True}, - 'blob_uri': {'readonly': True}, 'error_message': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'request_type': {'key': 'properties.requestType', 'type': 'str'}, 'request_id': {'key': 'properties.requestId', 'type': 'str'}, + 'request_type': {'key': 'properties.requestType', 'type': 'str'}, + 'queued_time': {'key': 'properties.queuedTime', 'type': 'str'}, + 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'str'}, + 'blob_uri': {'key': 'properties.blobUri', 'type': 'str'}, 'server_name': {'key': 'properties.serverName', 'type': 'str'}, 'database_name': {'key': 'properties.databaseName', 'type': 'str'}, 'status': {'key': 'properties.status', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'str'}, - 'queued_time': {'key': 'properties.queuedTime', 'type': 'str'}, - 'blob_uri': {'key': 'properties.blobUri', 'type': 'str'}, 'error_message': {'key': 'properties.errorMessage', 'type': 'str'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnectionRequestStatus]'}, } def __init__(self, **kwargs): - super(ImportExportResponse, self).__init__(**kwargs) - self.request_type = None + super(ImportExportOperationResult, self).__init__(**kwargs) self.request_id = None + self.request_type = None + self.queued_time = None + self.last_modified_time = None + self.blob_uri = None self.server_name = None self.database_name = None self.status = None - self.last_modified_time = None - self.queued_time = None - self.blob_uri = None self.error_message = None + self.private_endpoint_connections = None -class ImportExtensionRequest(Model): - """Import database parameters. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: The name of the extension. - :type name: str - :param type: The type of the extension. - :type type: str - :param storage_key_type: Required. The type of the storage key to use. - Possible values include: 'StorageAccessKey', 'SharedAccessKey' - :type storage_key_type: str or ~azure.mgmt.sql.models.StorageKeyType - :param storage_key: Required. The storage key to use. If storage key type - is SharedAccessKey, it must be preceded with a "?." - :type storage_key: str - :param storage_uri: Required. The storage uri to use. - :type storage_uri: str - :param administrator_login: Required. The name of the SQL administrator. - :type administrator_login: str - :param administrator_login_password: Required. The password of the SQL - administrator. - :type administrator_login_password: str - :param authentication_type: The authentication type. Possible values - include: 'SQL', 'ADPassword'. Default value: "SQL" . - :type authentication_type: str or - ~azure.mgmt.sql.models.AuthenticationType - :ivar operation_mode: Required. The type of import operation being - performed. This is always Import. Default value: "Import" . - :vartype operation_mode: str - """ - - _validation = { - 'storage_key_type': {'required': True}, - 'storage_key': {'required': True}, - 'storage_uri': {'required': True}, - 'administrator_login': {'required': True}, - 'administrator_login_password': {'required': True}, - 'operation_mode': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'storage_key_type': {'key': 'properties.storageKeyType', 'type': 'StorageKeyType'}, - 'storage_key': {'key': 'properties.storageKey', 'type': 'str'}, - 'storage_uri': {'key': 'properties.storageUri', 'type': 'str'}, - 'administrator_login': {'key': 'properties.administratorLogin', 'type': 'str'}, - 'administrator_login_password': {'key': 'properties.administratorLoginPassword', 'type': 'str'}, - 'authentication_type': {'key': 'properties.authenticationType', 'type': 'AuthenticationType'}, - 'operation_mode': {'key': 'properties.operationMode', 'type': 'str'}, - } - - operation_mode = "Import" - - def __init__(self, **kwargs): - super(ImportExtensionRequest, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.type = kwargs.get('type', None) - self.storage_key_type = kwargs.get('storage_key_type', None) - self.storage_key = kwargs.get('storage_key', None) - self.storage_uri = kwargs.get('storage_uri', None) - self.administrator_login = kwargs.get('administrator_login', None) - self.administrator_login_password = kwargs.get('administrator_login_password', None) - self.authentication_type = kwargs.get('authentication_type', "SQL") - - -class ImportRequest(ExportRequest): - """Import database parameters. +class ImportNewDatabaseDefinition(Model): + """Contains the information necessary to perform import operation for new + database. All required parameters must be populated in order to send to Azure. - :param storage_key_type: Required. The type of the storage key to use. - Possible values include: 'StorageAccessKey', 'SharedAccessKey' + :param database_name: Name of the import database. + :type database_name: str + :param edition: Edition of the import database. + :type edition: str + :param service_objective_name: Service level objective name of the import + database. + :type service_objective_name: str + :param max_size_bytes: Max size in bytes for the import database. + :type max_size_bytes: str + :param storage_key_type: Required. Storage key type. Possible values + include: 'SharedAccessKey', 'StorageAccessKey' :type storage_key_type: str or ~azure.mgmt.sql.models.StorageKeyType - :param storage_key: Required. The storage key to use. If storage key type - is SharedAccessKey, it must be preceded with a "?." + :param storage_key: Required. Storage key. :type storage_key: str - :param storage_uri: Required. The storage uri to use. + :param storage_uri: Required. Storage Uri. :type storage_uri: str - :param administrator_login: Required. The name of the SQL administrator. + :param administrator_login: Required. Administrator login name. :type administrator_login: str - :param administrator_login_password: Required. The password of the SQL - administrator. + :param administrator_login_password: Required. Administrator login + password. :type administrator_login_password: str - :param authentication_type: The authentication type. Possible values - include: 'SQL', 'ADPassword'. Default value: "SQL" . - :type authentication_type: str or - ~azure.mgmt.sql.models.AuthenticationType - :param database_name: Required. The name of the database to import. - :type database_name: str - :param edition: Required. The edition for the database being created. - The list of SKUs may vary by region and support offer. To determine the - SKUs (including the SKU name, tier/edition, family, and capacity) that are - available to your subscription in an Azure region, use the - `Capabilities_ListByLocation` REST API or one of the following commands: - ```azurecli - az sql db list-editions -l -o table - ```` - ```powershell - Get-AzSqlServerServiceObjective -Location - ```` - . Possible values include: 'Web', 'Business', 'Basic', 'Standard', - 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', - 'System2', 'GeneralPurpose', 'BusinessCritical', 'Hyperscale' - :type edition: str or ~azure.mgmt.sql.models.DatabaseEdition - :param service_objective_name: Required. The name of the service objective - to assign to the database. Possible values include: 'System', 'System0', - 'System1', 'System2', 'System3', 'System4', 'System2L', 'System3L', - 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', - 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', 'PRS2', - 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', 'DW600', - 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', - 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', - 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', - 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool' - :type service_objective_name: str or - ~azure.mgmt.sql.models.ServiceObjectiveName - :param max_size_bytes: Required. The maximum size for the newly imported - database. - :type max_size_bytes: str + :param authentication_type: Authentication type. + :type authentication_type: str + :param network_isolation: Optional resource information to enable network + isolation for request. + :type network_isolation: ~azure.mgmt.sql.models.NetworkIsolationSettings """ _validation = { @@ -3478,31 +3450,35 @@ class ImportRequest(ExportRequest): 'storage_uri': {'required': True}, 'administrator_login': {'required': True}, 'administrator_login_password': {'required': True}, - 'database_name': {'required': True}, - 'edition': {'required': True}, - 'service_objective_name': {'required': True}, - 'max_size_bytes': {'required': True}, } _attribute_map = { - 'storage_key_type': {'key': 'storageKeyType', 'type': 'StorageKeyType'}, - 'storage_key': {'key': 'storageKey', 'type': 'str'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, - 'administrator_login': {'key': 'administratorLogin', 'type': 'str'}, - 'administrator_login_password': {'key': 'administratorLoginPassword', 'type': 'str'}, - 'authentication_type': {'key': 'authenticationType', 'type': 'AuthenticationType'}, 'database_name': {'key': 'databaseName', 'type': 'str'}, 'edition': {'key': 'edition', 'type': 'str'}, 'service_objective_name': {'key': 'serviceObjectiveName', 'type': 'str'}, 'max_size_bytes': {'key': 'maxSizeBytes', 'type': 'str'}, + 'storage_key_type': {'key': 'storageKeyType', 'type': 'str'}, + 'storage_key': {'key': 'storageKey', 'type': 'str'}, + 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + 'administrator_login': {'key': 'administratorLogin', 'type': 'str'}, + 'administrator_login_password': {'key': 'administratorLoginPassword', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'network_isolation': {'key': 'networkIsolation', 'type': 'NetworkIsolationSettings'}, } def __init__(self, **kwargs): - super(ImportRequest, self).__init__(**kwargs) + super(ImportNewDatabaseDefinition, self).__init__(**kwargs) self.database_name = kwargs.get('database_name', None) self.edition = kwargs.get('edition', None) self.service_objective_name = kwargs.get('service_objective_name', None) self.max_size_bytes = kwargs.get('max_size_bytes', None) + self.storage_key_type = kwargs.get('storage_key_type', None) + self.storage_key = kwargs.get('storage_key', None) + self.storage_uri = kwargs.get('storage_uri', None) + self.administrator_login = kwargs.get('administrator_login', None) + self.administrator_login_password = kwargs.get('administrator_login_password', None) + self.authentication_type = kwargs.get('authentication_type', None) + self.network_isolation = kwargs.get('network_isolation', None) class InstanceFailoverGroup(ProxyResource): @@ -6615,6 +6591,32 @@ def __init__(self, **kwargs): self.localized_value = kwargs.get('localized_value', None) +class NetworkIsolationSettings(Model): + """Contains the ARM resources for which to create private endpoint connection. + + :param storage_account_resource_id: The resource id for the storage + account used to store BACPAC file. If set, private endpoint connection + will be created for the storage account. Must match storage account used + for StorageUri parameter. + :type storage_account_resource_id: str + :param sql_server_resource_id: The resource id for the SQL server which is + the target of this request. If set, private endpoint connection will be + created for the SQL server. Must match server which is target of the + operation. + :type sql_server_resource_id: str + """ + + _attribute_map = { + 'storage_account_resource_id': {'key': 'storageAccountResourceId', 'type': 'str'}, + 'sql_server_resource_id': {'key': 'sqlServerResourceId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(NetworkIsolationSettings, self).__init__(**kwargs) + self.storage_account_resource_id = kwargs.get('storage_account_resource_id', None) + self.sql_server_resource_id = kwargs.get('sql_server_resource_id', None) + + class Operation(Model): """SQL REST API operation definition. @@ -6913,6 +6915,41 @@ def __init__(self, **kwargs): self.provisioning_state = None +class PrivateEndpointConnectionRequestStatus(Model): + """Contains the private endpoint connection requests status. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar private_link_service_id: Resource id for which the private endpoint + is created. + :vartype private_link_service_id: str + :ivar private_endpoint_connection_name: The connection name for the + private endpoint. + :vartype private_endpoint_connection_name: str + :ivar status: Status of this private endpoint connection. + :vartype status: str + """ + + _validation = { + 'private_link_service_id': {'readonly': True}, + 'private_endpoint_connection_name': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'private_link_service_id': {'key': 'privateLinkServiceId', 'type': 'str'}, + 'private_endpoint_connection_name': {'key': 'privateEndpointConnectionName', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PrivateEndpointConnectionRequestStatus, self).__init__(**kwargs) + self.private_link_service_id = None + self.private_endpoint_connection_name = None + self.status = None + + class PrivateEndpointProperty(Model): """PrivateEndpointProperty. 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 615544e36d25..168aa32b7876 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 @@ -2614,28 +2614,28 @@ def __init__(self, *, server_key_type, server_key_name: str=None, **kwargs) -> N self.thumbprint = None -class ExportRequest(Model): - """Export database parameters. +class ExportDatabaseDefinition(Model): + """Contains the information necessary to perform export database operation. All required parameters must be populated in order to send to Azure. - :param storage_key_type: Required. The type of the storage key to use. - Possible values include: 'StorageAccessKey', 'SharedAccessKey' + :param storage_key_type: Required. Storage key type. Possible values + include: 'SharedAccessKey', 'StorageAccessKey' :type storage_key_type: str or ~azure.mgmt.sql.models.StorageKeyType - :param storage_key: Required. The storage key to use. If storage key type - is SharedAccessKey, it must be preceded with a "?." + :param storage_key: Required. Storage key. :type storage_key: str - :param storage_uri: Required. The storage uri to use. + :param storage_uri: Required. Storage Uri. :type storage_uri: str - :param administrator_login: Required. The name of the SQL administrator. + :param administrator_login: Required. Administrator login name. :type administrator_login: str - :param administrator_login_password: Required. The password of the SQL - administrator. + :param administrator_login_password: Required. Administrator login + password. :type administrator_login_password: str - :param authentication_type: The authentication type. Possible values - include: 'SQL', 'ADPassword'. Default value: "SQL" . - :type authentication_type: str or - ~azure.mgmt.sql.models.AuthenticationType + :param authentication_type: Authentication type. + :type authentication_type: str + :param network_isolation: Optional resource information to enable network + isolation for request. + :type network_isolation: ~azure.mgmt.sql.models.NetworkIsolationSettings """ _validation = { @@ -2647,22 +2647,24 @@ class ExportRequest(Model): } _attribute_map = { - 'storage_key_type': {'key': 'storageKeyType', 'type': 'StorageKeyType'}, + 'storage_key_type': {'key': 'storageKeyType', 'type': 'str'}, 'storage_key': {'key': 'storageKey', 'type': 'str'}, 'storage_uri': {'key': 'storageUri', 'type': 'str'}, 'administrator_login': {'key': 'administratorLogin', 'type': 'str'}, 'administrator_login_password': {'key': 'administratorLoginPassword', 'type': 'str'}, - 'authentication_type': {'key': 'authenticationType', 'type': 'AuthenticationType'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'network_isolation': {'key': 'networkIsolation', 'type': 'NetworkIsolationSettings'}, } - def __init__(self, *, storage_key_type, storage_key: str, storage_uri: str, administrator_login: str, administrator_login_password: str, authentication_type="SQL", **kwargs) -> None: - super(ExportRequest, self).__init__(**kwargs) + def __init__(self, *, storage_key_type, storage_key: str, storage_uri: str, administrator_login: str, administrator_login_password: str, authentication_type: str=None, network_isolation=None, **kwargs) -> None: + super(ExportDatabaseDefinition, self).__init__(**kwargs) self.storage_key_type = storage_key_type self.storage_key = storage_key self.storage_uri = storage_uri self.administrator_login = administrator_login self.administrator_login_password = administrator_login_password self.authentication_type = authentication_type + self.network_isolation = network_isolation class ExtendedDatabaseBlobAuditingPolicy(ProxyResource): @@ -3272,8 +3274,62 @@ def __init__(self, *, state, **kwargs) -> None: self.location = None -class ImportExportResponse(ProxyResource): - """Response for Import/Export Get operation. +class ImportExistingDatabaseDefinition(Model): + """Contains the information necessary to perform import operation for existing + database. + + All required parameters must be populated in order to send to Azure. + + :param storage_key_type: Required. Storage key type. Possible values + include: 'SharedAccessKey', 'StorageAccessKey' + :type storage_key_type: str or ~azure.mgmt.sql.models.StorageKeyType + :param storage_key: Required. Storage key. + :type storage_key: str + :param storage_uri: Required. Storage Uri. + :type storage_uri: str + :param administrator_login: Required. Administrator login name. + :type administrator_login: str + :param administrator_login_password: Required. Administrator login + password. + :type administrator_login_password: str + :param authentication_type: Authentication type. + :type authentication_type: str + :param network_isolation: Optional resource information to enable network + isolation for request. + :type network_isolation: ~azure.mgmt.sql.models.NetworkIsolationSettings + """ + + _validation = { + 'storage_key_type': {'required': True}, + 'storage_key': {'required': True}, + 'storage_uri': {'required': True}, + 'administrator_login': {'required': True}, + 'administrator_login_password': {'required': True}, + } + + _attribute_map = { + 'storage_key_type': {'key': 'storageKeyType', 'type': 'str'}, + 'storage_key': {'key': 'storageKey', 'type': 'str'}, + 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + 'administrator_login': {'key': 'administratorLogin', 'type': 'str'}, + 'administrator_login_password': {'key': 'administratorLoginPassword', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'network_isolation': {'key': 'networkIsolation', 'type': 'NetworkIsolationSettings'}, + } + + def __init__(self, *, storage_key_type, storage_key: str, storage_uri: str, administrator_login: str, administrator_login_password: str, authentication_type: str=None, network_isolation=None, **kwargs) -> None: + super(ImportExistingDatabaseDefinition, self).__init__(**kwargs) + self.storage_key_type = storage_key_type + self.storage_key = storage_key + self.storage_uri = storage_uri + self.administrator_login = administrator_login + self.administrator_login_password = administrator_login_password + self.authentication_type = authentication_type + self.network_isolation = network_isolation + + +class ImportExportOperationResult(ProxyResource): + """An ImportExport operation result resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -3284,192 +3340,108 @@ class ImportExportResponse(ProxyResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar request_type: The request type of the operation. - :vartype request_type: str - :ivar request_id: The request type of the operation. + :ivar request_id: Request Id. :vartype request_id: str - :ivar server_name: The name of the server. + :ivar request_type: Request type. + :vartype request_type: str + :ivar queued_time: Queued time. + :vartype queued_time: str + :ivar last_modified_time: Last modified time. + :vartype last_modified_time: str + :ivar blob_uri: Blob Uri. + :vartype blob_uri: str + :ivar server_name: Server name. :vartype server_name: str - :ivar database_name: The name of the database. + :ivar database_name: Database name. :vartype database_name: str - :ivar status: The status message returned from the server. + :ivar status: Operation status. :vartype status: str - :ivar last_modified_time: The operation status last modified time. - :vartype last_modified_time: str - :ivar queued_time: The operation queued time. - :vartype queued_time: str - :ivar blob_uri: The blob uri. - :vartype blob_uri: str - :ivar error_message: The error message returned from the server. + :ivar error_message: Error message. :vartype error_message: str + :ivar private_endpoint_connections: Gets the status of private endpoints + associated with this request. + :vartype private_endpoint_connections: + list[~azure.mgmt.sql.models.PrivateEndpointConnectionRequestStatus] """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'request_type': {'readonly': True}, 'request_id': {'readonly': True}, + 'request_type': {'readonly': True}, + 'queued_time': {'readonly': True}, + 'last_modified_time': {'readonly': True}, + 'blob_uri': {'readonly': True}, 'server_name': {'readonly': True}, 'database_name': {'readonly': True}, 'status': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'queued_time': {'readonly': True}, - 'blob_uri': {'readonly': True}, 'error_message': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'request_type': {'key': 'properties.requestType', 'type': 'str'}, 'request_id': {'key': 'properties.requestId', 'type': 'str'}, + 'request_type': {'key': 'properties.requestType', 'type': 'str'}, + 'queued_time': {'key': 'properties.queuedTime', 'type': 'str'}, + 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'str'}, + 'blob_uri': {'key': 'properties.blobUri', 'type': 'str'}, 'server_name': {'key': 'properties.serverName', 'type': 'str'}, 'database_name': {'key': 'properties.databaseName', 'type': 'str'}, 'status': {'key': 'properties.status', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'str'}, - 'queued_time': {'key': 'properties.queuedTime', 'type': 'str'}, - 'blob_uri': {'key': 'properties.blobUri', 'type': 'str'}, 'error_message': {'key': 'properties.errorMessage', 'type': 'str'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnectionRequestStatus]'}, } def __init__(self, **kwargs) -> None: - super(ImportExportResponse, self).__init__(**kwargs) - self.request_type = None + super(ImportExportOperationResult, self).__init__(**kwargs) self.request_id = None + self.request_type = None + self.queued_time = None + self.last_modified_time = None + self.blob_uri = None self.server_name = None self.database_name = None self.status = None - self.last_modified_time = None - self.queued_time = None - self.blob_uri = None self.error_message = None + self.private_endpoint_connections = None -class ImportExtensionRequest(Model): - """Import database parameters. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: The name of the extension. - :type name: str - :param type: The type of the extension. - :type type: str - :param storage_key_type: Required. The type of the storage key to use. - Possible values include: 'StorageAccessKey', 'SharedAccessKey' - :type storage_key_type: str or ~azure.mgmt.sql.models.StorageKeyType - :param storage_key: Required. The storage key to use. If storage key type - is SharedAccessKey, it must be preceded with a "?." - :type storage_key: str - :param storage_uri: Required. The storage uri to use. - :type storage_uri: str - :param administrator_login: Required. The name of the SQL administrator. - :type administrator_login: str - :param administrator_login_password: Required. The password of the SQL - administrator. - :type administrator_login_password: str - :param authentication_type: The authentication type. Possible values - include: 'SQL', 'ADPassword'. Default value: "SQL" . - :type authentication_type: str or - ~azure.mgmt.sql.models.AuthenticationType - :ivar operation_mode: Required. The type of import operation being - performed. This is always Import. Default value: "Import" . - :vartype operation_mode: str - """ - - _validation = { - 'storage_key_type': {'required': True}, - 'storage_key': {'required': True}, - 'storage_uri': {'required': True}, - 'administrator_login': {'required': True}, - 'administrator_login_password': {'required': True}, - 'operation_mode': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'storage_key_type': {'key': 'properties.storageKeyType', 'type': 'StorageKeyType'}, - 'storage_key': {'key': 'properties.storageKey', 'type': 'str'}, - 'storage_uri': {'key': 'properties.storageUri', 'type': 'str'}, - 'administrator_login': {'key': 'properties.administratorLogin', 'type': 'str'}, - 'administrator_login_password': {'key': 'properties.administratorLoginPassword', 'type': 'str'}, - 'authentication_type': {'key': 'properties.authenticationType', 'type': 'AuthenticationType'}, - 'operation_mode': {'key': 'properties.operationMode', 'type': 'str'}, - } - - operation_mode = "Import" - - def __init__(self, *, storage_key_type, storage_key: str, storage_uri: str, administrator_login: str, administrator_login_password: str, name: str=None, type: str=None, authentication_type="SQL", **kwargs) -> None: - super(ImportExtensionRequest, self).__init__(**kwargs) - self.name = name - self.type = type - self.storage_key_type = storage_key_type - self.storage_key = storage_key - self.storage_uri = storage_uri - self.administrator_login = administrator_login - self.administrator_login_password = administrator_login_password - self.authentication_type = authentication_type - - -class ImportRequest(ExportRequest): - """Import database parameters. +class ImportNewDatabaseDefinition(Model): + """Contains the information necessary to perform import operation for new + database. All required parameters must be populated in order to send to Azure. - :param storage_key_type: Required. The type of the storage key to use. - Possible values include: 'StorageAccessKey', 'SharedAccessKey' + :param database_name: Name of the import database. + :type database_name: str + :param edition: Edition of the import database. + :type edition: str + :param service_objective_name: Service level objective name of the import + database. + :type service_objective_name: str + :param max_size_bytes: Max size in bytes for the import database. + :type max_size_bytes: str + :param storage_key_type: Required. Storage key type. Possible values + include: 'SharedAccessKey', 'StorageAccessKey' :type storage_key_type: str or ~azure.mgmt.sql.models.StorageKeyType - :param storage_key: Required. The storage key to use. If storage key type - is SharedAccessKey, it must be preceded with a "?." + :param storage_key: Required. Storage key. :type storage_key: str - :param storage_uri: Required. The storage uri to use. + :param storage_uri: Required. Storage Uri. :type storage_uri: str - :param administrator_login: Required. The name of the SQL administrator. + :param administrator_login: Required. Administrator login name. :type administrator_login: str - :param administrator_login_password: Required. The password of the SQL - administrator. + :param administrator_login_password: Required. Administrator login + password. :type administrator_login_password: str - :param authentication_type: The authentication type. Possible values - include: 'SQL', 'ADPassword'. Default value: "SQL" . - :type authentication_type: str or - ~azure.mgmt.sql.models.AuthenticationType - :param database_name: Required. The name of the database to import. - :type database_name: str - :param edition: Required. The edition for the database being created. - The list of SKUs may vary by region and support offer. To determine the - SKUs (including the SKU name, tier/edition, family, and capacity) that are - available to your subscription in an Azure region, use the - `Capabilities_ListByLocation` REST API or one of the following commands: - ```azurecli - az sql db list-editions -l -o table - ```` - ```powershell - Get-AzSqlServerServiceObjective -Location - ```` - . Possible values include: 'Web', 'Business', 'Basic', 'Standard', - 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', - 'System2', 'GeneralPurpose', 'BusinessCritical', 'Hyperscale' - :type edition: str or ~azure.mgmt.sql.models.DatabaseEdition - :param service_objective_name: Required. The name of the service objective - to assign to the database. Possible values include: 'System', 'System0', - 'System1', 'System2', 'System3', 'System4', 'System2L', 'System3L', - 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', - 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', 'PRS2', - 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', 'DW600', - 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', - 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', - 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', - 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool' - :type service_objective_name: str or - ~azure.mgmt.sql.models.ServiceObjectiveName - :param max_size_bytes: Required. The maximum size for the newly imported - database. - :type max_size_bytes: str + :param authentication_type: Authentication type. + :type authentication_type: str + :param network_isolation: Optional resource information to enable network + isolation for request. + :type network_isolation: ~azure.mgmt.sql.models.NetworkIsolationSettings """ _validation = { @@ -3478,31 +3450,35 @@ class ImportRequest(ExportRequest): 'storage_uri': {'required': True}, 'administrator_login': {'required': True}, 'administrator_login_password': {'required': True}, - 'database_name': {'required': True}, - 'edition': {'required': True}, - 'service_objective_name': {'required': True}, - 'max_size_bytes': {'required': True}, } _attribute_map = { - 'storage_key_type': {'key': 'storageKeyType', 'type': 'StorageKeyType'}, - 'storage_key': {'key': 'storageKey', 'type': 'str'}, - 'storage_uri': {'key': 'storageUri', 'type': 'str'}, - 'administrator_login': {'key': 'administratorLogin', 'type': 'str'}, - 'administrator_login_password': {'key': 'administratorLoginPassword', 'type': 'str'}, - 'authentication_type': {'key': 'authenticationType', 'type': 'AuthenticationType'}, 'database_name': {'key': 'databaseName', 'type': 'str'}, 'edition': {'key': 'edition', 'type': 'str'}, 'service_objective_name': {'key': 'serviceObjectiveName', 'type': 'str'}, 'max_size_bytes': {'key': 'maxSizeBytes', 'type': 'str'}, + 'storage_key_type': {'key': 'storageKeyType', 'type': 'str'}, + 'storage_key': {'key': 'storageKey', 'type': 'str'}, + 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + 'administrator_login': {'key': 'administratorLogin', 'type': 'str'}, + 'administrator_login_password': {'key': 'administratorLoginPassword', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'network_isolation': {'key': 'networkIsolation', 'type': 'NetworkIsolationSettings'}, } - def __init__(self, *, storage_key_type, storage_key: str, storage_uri: str, administrator_login: str, administrator_login_password: str, database_name: str, edition, service_objective_name, max_size_bytes: str, authentication_type="SQL", **kwargs) -> None: - super(ImportRequest, self).__init__(storage_key_type=storage_key_type, storage_key=storage_key, storage_uri=storage_uri, administrator_login=administrator_login, administrator_login_password=administrator_login_password, authentication_type=authentication_type, **kwargs) + def __init__(self, *, storage_key_type, storage_key: str, storage_uri: str, administrator_login: str, administrator_login_password: str, database_name: str=None, edition: str=None, service_objective_name: str=None, max_size_bytes: str=None, authentication_type: str=None, network_isolation=None, **kwargs) -> None: + super(ImportNewDatabaseDefinition, self).__init__(**kwargs) self.database_name = database_name self.edition = edition self.service_objective_name = service_objective_name self.max_size_bytes = max_size_bytes + self.storage_key_type = storage_key_type + self.storage_key = storage_key + self.storage_uri = storage_uri + self.administrator_login = administrator_login + self.administrator_login_password = administrator_login_password + self.authentication_type = authentication_type + self.network_isolation = network_isolation class InstanceFailoverGroup(ProxyResource): @@ -6615,6 +6591,32 @@ def __init__(self, *, value: str=None, localized_value: str=None, **kwargs) -> N self.localized_value = localized_value +class NetworkIsolationSettings(Model): + """Contains the ARM resources for which to create private endpoint connection. + + :param storage_account_resource_id: The resource id for the storage + account used to store BACPAC file. If set, private endpoint connection + will be created for the storage account. Must match storage account used + for StorageUri parameter. + :type storage_account_resource_id: str + :param sql_server_resource_id: The resource id for the SQL server which is + the target of this request. If set, private endpoint connection will be + created for the SQL server. Must match server which is target of the + operation. + :type sql_server_resource_id: str + """ + + _attribute_map = { + 'storage_account_resource_id': {'key': 'storageAccountResourceId', 'type': 'str'}, + 'sql_server_resource_id': {'key': 'sqlServerResourceId', 'type': 'str'}, + } + + def __init__(self, *, storage_account_resource_id: str=None, sql_server_resource_id: str=None, **kwargs) -> None: + super(NetworkIsolationSettings, self).__init__(**kwargs) + self.storage_account_resource_id = storage_account_resource_id + self.sql_server_resource_id = sql_server_resource_id + + class Operation(Model): """SQL REST API operation definition. @@ -6913,6 +6915,41 @@ def __init__(self, *, private_endpoint=None, private_link_service_connection_sta self.provisioning_state = None +class PrivateEndpointConnectionRequestStatus(Model): + """Contains the private endpoint connection requests status. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar private_link_service_id: Resource id for which the private endpoint + is created. + :vartype private_link_service_id: str + :ivar private_endpoint_connection_name: The connection name for the + private endpoint. + :vartype private_endpoint_connection_name: str + :ivar status: Status of this private endpoint connection. + :vartype status: str + """ + + _validation = { + 'private_link_service_id': {'readonly': True}, + 'private_endpoint_connection_name': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'private_link_service_id': {'key': 'privateLinkServiceId', 'type': 'str'}, + 'private_endpoint_connection_name': {'key': 'privateEndpointConnectionName', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(PrivateEndpointConnectionRequestStatus, self).__init__(**kwargs) + self.private_link_service_id = None + self.private_endpoint_connection_name = None + self.status = None + + class PrivateEndpointProperty(Model): """PrivateEndpointProperty. 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 435472f2e376..f88a28c8bad0 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 @@ -66,105 +66,6 @@ class GeoBackupPolicyState(str, Enum): enabled = "Enabled" -class DatabaseEdition(str, Enum): - - web = "Web" - business = "Business" - basic = "Basic" - standard = "Standard" - premium = "Premium" - premium_rs = "PremiumRS" - free = "Free" - stretch = "Stretch" - data_warehouse = "DataWarehouse" - system = "System" - system2 = "System2" - general_purpose = "GeneralPurpose" - business_critical = "BusinessCritical" - hyperscale = "Hyperscale" - - -class ServiceObjectiveName(str, Enum): - - system = "System" - system0 = "System0" - system1 = "System1" - system2 = "System2" - system3 = "System3" - system4 = "System4" - system2_l = "System2L" - system3_l = "System3L" - system4_l = "System4L" - free = "Free" - basic = "Basic" - s0 = "S0" - s1 = "S1" - s2 = "S2" - s3 = "S3" - s4 = "S4" - s6 = "S6" - s7 = "S7" - s9 = "S9" - s12 = "S12" - p1 = "P1" - p2 = "P2" - p3 = "P3" - p4 = "P4" - p6 = "P6" - p11 = "P11" - p15 = "P15" - prs1 = "PRS1" - prs2 = "PRS2" - prs4 = "PRS4" - prs6 = "PRS6" - dw100 = "DW100" - dw200 = "DW200" - dw300 = "DW300" - dw400 = "DW400" - dw500 = "DW500" - dw600 = "DW600" - dw1000 = "DW1000" - dw1200 = "DW1200" - dw1000c = "DW1000c" - dw1500 = "DW1500" - dw1500c = "DW1500c" - dw2000 = "DW2000" - dw2000c = "DW2000c" - dw3000 = "DW3000" - dw2500c = "DW2500c" - dw3000c = "DW3000c" - dw6000 = "DW6000" - dw5000c = "DW5000c" - dw6000c = "DW6000c" - dw7500c = "DW7500c" - dw10000c = "DW10000c" - dw15000c = "DW15000c" - dw30000c = "DW30000c" - ds100 = "DS100" - ds200 = "DS200" - ds300 = "DS300" - ds400 = "DS400" - ds500 = "DS500" - ds600 = "DS600" - ds1000 = "DS1000" - ds1200 = "DS1200" - ds1500 = "DS1500" - ds2000 = "DS2000" - elastic_pool = "ElasticPool" - - -class StorageKeyType(str, Enum): - - storage_access_key = "StorageAccessKey" - shared_access_key = "SharedAccessKey" - - -class AuthenticationType(str, Enum): - - sql = "SQL" - ad_password = "ADPassword" - - class UnitType(str, Enum): count = "count" @@ -257,6 +158,75 @@ class TransparentDataEncryptionStatus(str, Enum): disabled = "Disabled" +class ServiceObjectiveName(str, Enum): + + system = "System" + system0 = "System0" + system1 = "System1" + system2 = "System2" + system3 = "System3" + system4 = "System4" + system2_l = "System2L" + system3_l = "System3L" + system4_l = "System4L" + free = "Free" + basic = "Basic" + s0 = "S0" + s1 = "S1" + s2 = "S2" + s3 = "S3" + s4 = "S4" + s6 = "S6" + s7 = "S7" + s9 = "S9" + s12 = "S12" + p1 = "P1" + p2 = "P2" + p3 = "P3" + p4 = "P4" + p6 = "P6" + p11 = "P11" + p15 = "P15" + prs1 = "PRS1" + prs2 = "PRS2" + prs4 = "PRS4" + prs6 = "PRS6" + dw100 = "DW100" + dw200 = "DW200" + dw300 = "DW300" + dw400 = "DW400" + dw500 = "DW500" + dw600 = "DW600" + dw1000 = "DW1000" + dw1200 = "DW1200" + dw1000c = "DW1000c" + dw1500 = "DW1500" + dw1500c = "DW1500c" + dw2000 = "DW2000" + dw2000c = "DW2000c" + dw3000 = "DW3000" + dw2500c = "DW2500c" + dw3000c = "DW3000c" + dw6000 = "DW6000" + dw5000c = "DW5000c" + dw6000c = "DW6000c" + dw7500c = "DW7500c" + dw10000c = "DW10000c" + dw15000c = "DW15000c" + dw30000c = "DW30000c" + ds100 = "DS100" + ds200 = "DS200" + ds300 = "DS300" + ds400 = "DS400" + ds500 = "DS500" + ds600 = "DS600" + ds1000 = "DS1000" + ds1200 = "DS1200" + ds1500 = "DS1500" + ds2000 = "DS2000" + elastic_pool = "ElasticPool" + + class TransparentDataEncryptionActivityStatus(str, Enum): encrypting = "Encrypting" @@ -736,6 +706,12 @@ class StorageAccountType(str, Enum): zrs = "ZRS" +class StorageKeyType(str, Enum): + + shared_access_key = "SharedAccessKey" + storage_access_key = "StorageAccessKey" + + class LongTermRetentionDatabaseState(str, Enum): all = "All" diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py index 8643d9ba96da..111e0b8248c5 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 @@ -101,6 +101,7 @@ from ._managed_database_restore_details_operations import ManagedDatabaseRestoreDetailsOperations from ._managed_databases_operations import ManagedDatabasesOperations from ._server_azure_ad_only_authentications_operations import ServerAzureADOnlyAuthenticationsOperations +from ._import_export_operations import ImportExportOperations __all__ = [ 'RecoverableDatabasesOperations', @@ -195,4 +196,5 @@ 'ManagedDatabaseRestoreDetailsOperations', 'ManagedDatabasesOperations', 'ServerAzureADOnlyAuthenticationsOperations', + 'ImportExportOperations', ] diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_databases_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_databases_operations.py index e0aa41fadadd..61f20dbe5897 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_databases_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_databases_operations.py @@ -27,7 +27,6 @@ class DatabasesOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar extension_name: The name of the operation to perform. Constant value: "import". """ models = models @@ -37,334 +36,9 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.extension_name = "import" self.config = config - - def _import_method_initial( - self, resource_group_name, server_name, parameters, custom_headers=None, raw=False, **operation_config): - api_version = "2014-04-01" - - # Construct URL - url = self.import_method.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("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, 'ImportRequest') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ImportExportResponse', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def import_method( - self, resource_group_name, server_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): - """Imports a bacpac into a new 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 server_name: The name of the server. - :type server_name: str - :param parameters: The required parameters for importing a Bacpac into - a database. - :type parameters: ~azure.mgmt.sql.models.ImportRequest - :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 ImportExportResponse or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ImportExportResponse] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.sql.models.ImportExportResponse]] - :raises: :class:`CloudError` - """ - raw_result = self._import_method_initial( - resource_group_name=resource_group_name, - server_name=server_name, - parameters=parameters, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - deserialized = self._deserialize('ImportExportResponse', 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) - import_method.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/import'} - - - def _create_import_operation_initial( - self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): - api_version = "2014-04-01" - - # Construct URL - url = self.create_import_operation.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'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'extensionName': self._serialize.url("self.extension_name", self.extension_name, '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, 'ImportExtensionRequest') - - # 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 [201, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 201: - deserialized = self._deserialize('ImportExportResponse', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def create_import_operation( - self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): - """Creates an import operation that imports a bacpac into an existing - database. The existing database must be empty. - - :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 database_name: The name of the database to import into - :type database_name: str - :param parameters: The required parameters for importing a Bacpac into - a database. - :type parameters: ~azure.mgmt.sql.models.ImportExtensionRequest - :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 ImportExportResponse or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ImportExportResponse] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.sql.models.ImportExportResponse]] - :raises: :class:`CloudError` - """ - raw_result = self._create_import_operation_initial( - resource_group_name=resource_group_name, - server_name=server_name, - database_name=database_name, - parameters=parameters, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - deserialized = self._deserialize('ImportExportResponse', 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_import_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions/{extensionName}'} - - - def _export_initial( - self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): - api_version = "2014-04-01" - - # Construct URL - url = self.export.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'), - 'databaseName': self._serialize.url("database_name", database_name, '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, 'ExportRequest') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('ImportExportResponse', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def export( - self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): - """Exports a database to a bacpac. - - :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 database_name: The name of the database to be exported. - :type database_name: str - :param parameters: The required parameters for exporting a database. - :type parameters: ~azure.mgmt.sql.models.ExportRequest - :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 ImportExportResponse or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ImportExportResponse] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.sql.models.ImportExportResponse]] - :raises: :class:`CloudError` - """ - raw_result = self._export_initial( - resource_group_name=resource_group_name, - server_name=server_name, - database_name=database_name, - parameters=parameters, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - deserialized = self._deserialize('ImportExportResponse', 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) - export.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/export'} - def list_metrics( self, resource_group_name, server_name, database_name, filter, custom_headers=None, raw=False, **operation_config): """Returns database metrics. @@ -1504,3 +1178,112 @@ def get_long_running_output(response): else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/failover'} + + + def _export_initial( + self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): + api_version = "2020-02-02-preview" + + # Construct URL + url = self.export.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_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("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, 'ExportDatabaseDefinition') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ImportExportOperationResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def export( + self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Exports a 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 server_name: The name of the server. + :type server_name: str + :param database_name: The name of the database. + :type database_name: str + :param parameters: The database export request parameters. + :type parameters: ~azure.mgmt.sql.models.ExportDatabaseDefinition + :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 + ImportExportOperationResult or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ImportExportOperationResult] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.sql.models.ImportExportOperationResult]] + :raises: :class:`CloudError` + """ + raw_result = self._export_initial( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ImportExportOperationResult', 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) + export.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/export'} diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_import_export_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_import_export_operations.py new file mode 100644 index 000000000000..ce62b16c135a --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_import_export_operations.py @@ -0,0 +1,150 @@ +# 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 ImportExportOperations(object): + """ImportExportOperations 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: "2020-02-02-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-02-02-preview" + + self.config = config + + + def _import_method_initial( + self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.import_method.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['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, 'ImportExistingDatabaseDefinition') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ImportExportOperationResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def import_method( + self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Imports a bacpac into a new 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 server_name: The name of the server. + :type server_name: str + :param database_name: The name of the database. + :type database_name: str + :param parameters: The database import request parameters. + :type parameters: + ~azure.mgmt.sql.models.ImportExistingDatabaseDefinition + :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 + ImportExportOperationResult or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ImportExportOperationResult] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.sql.models.ImportExportOperationResult]] + :raises: :class:`CloudError` + """ + raw_result = self._import_method_initial( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ImportExportOperationResult', 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) + import_method.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/import'} 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 7abf430deda2..ebba98c1f7bf 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,7 +27,6 @@ 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 @@ -37,7 +36,6 @@ 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 @@ -59,6 +57,8 @@ def list_by_resource_group( ~azure.mgmt.sql.models.ServerPaged[~azure.mgmt.sql.models.Server] :raises: :class:`CloudError` """ + api_version = "2019-06-01-preview" + def prepare_request(next_link=None): if not next_link: # Construct URL @@ -71,7 +71,7 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') else: url = next_link @@ -132,6 +132,8 @@ def get( ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ + api_version = "2019-06-01-preview" + # Construct URL url = self.get.metadata['url'] path_format_arguments = { @@ -143,7 +145,7 @@ def get( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} @@ -178,6 +180,8 @@ def get( def _create_or_update_initial( self, resource_group_name, server_name, parameters, custom_headers=None, raw=False, **operation_config): + api_version = "2019-06-01-preview" + # Construct URL url = self.create_or_update.metadata['url'] path_format_arguments = { @@ -189,7 +193,7 @@ def _create_or_update_initial( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} @@ -282,6 +286,8 @@ def get_long_running_output(response): def _delete_initial( self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + api_version = "2019-06-01-preview" + # Construct URL url = self.delete.metadata['url'] path_format_arguments = { @@ -293,7 +299,7 @@ def _delete_initial( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} @@ -363,6 +369,8 @@ 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 = "2019-06-01-preview" + # Construct URL url = self.update.metadata['url'] path_format_arguments = { @@ -374,7 +382,7 @@ def _update_initial( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} @@ -476,6 +484,8 @@ def list( ~azure.mgmt.sql.models.ServerPaged[~azure.mgmt.sql.models.Server] :raises: :class:`CloudError` """ + api_version = "2019-06-01-preview" + def prepare_request(next_link=None): if not next_link: # Construct URL @@ -487,7 +497,7 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') else: url = next_link @@ -547,6 +557,8 @@ def check_name_availability( """ parameters = models.CheckNameAvailabilityRequest(name=name) + api_version = "2019-06-01-preview" + # Construct URL url = self.check_name_availability.metadata['url'] path_format_arguments = { @@ -556,7 +568,7 @@ def check_name_availability( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} @@ -591,3 +603,108 @@ def check_name_availability( return deserialized check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability'} + + + def _import_database_initial( + self, resource_group_name, server_name, parameters, custom_headers=None, raw=False, **operation_config): + api_version = "2020-02-02-preview" + + # Construct URL + url = self.import_database.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_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("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, 'ImportNewDatabaseDefinition') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ImportExportOperationResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def import_database( + self, resource_group_name, server_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Imports a bacpac into a new 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 server_name: The name of the server. + :type server_name: str + :param parameters: The database import request parameters. + :type parameters: ~azure.mgmt.sql.models.ImportNewDatabaseDefinition + :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 + ImportExportOperationResult or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ImportExportOperationResult] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.sql.models.ImportExportOperationResult]] + :raises: :class:`CloudError` + """ + raw_result = self._import_database_initial( + resource_group_name=resource_group_name, + server_name=server_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ImportExportOperationResult', 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) + import_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/import'}