diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py index 42c6198cb65c..27d0fef14c17 100755 --- a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py @@ -9,6 +9,11 @@ # regenerated. # -------------------------------------------------------------------------- +from .max_size_capability import MaxSizeCapability +from .service_objective_capability import ServiceObjectiveCapability +from .edition_capability import EditionCapability +from .server_version_capability import ServerVersionCapability +from .location_capabilities import LocationCapabilities from .server_firewall_rule import ServerFirewallRule from .sql_sub_resource import SqlSubResource from .import_extension_request_parameters import ImportExtensionRequestParameters @@ -63,6 +68,9 @@ from .recommended_elastic_pool_paged import RecommendedElasticPoolPaged from .recommended_elastic_pool_metric_paged import RecommendedElasticPoolMetricPaged from .sql_management_client_enums import ( + CapabilityStatus, + MaxSizeUnits, + PerformanceLevelUnit, StorageKeyType, AuthenticationType, ReplicationRole, @@ -92,6 +100,11 @@ ) __all__ = [ + 'MaxSizeCapability', + 'ServiceObjectiveCapability', + 'EditionCapability', + 'ServerVersionCapability', + 'LocationCapabilities', 'ServerFirewallRule', 'SqlSubResource', 'ImportExtensionRequestParameters', @@ -145,6 +158,9 @@ 'ElasticPoolDatabaseActivityPaged', 'RecommendedElasticPoolPaged', 'RecommendedElasticPoolMetricPaged', + 'CapabilityStatus', + 'MaxSizeUnits', + 'PerformanceLevelUnit', 'StorageKeyType', 'AuthenticationType', 'ReplicationRole', diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/database.py b/azure-mgmt-sql/azure/mgmt/sql/models/database.py index 943c07f8494e..d7db6468ab33 100755 --- a/azure-mgmt-sql/azure/mgmt/sql/models/database.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/database.py @@ -103,16 +103,19 @@ class Database(Resource): :type recovery_services_recovery_point_resource_id: datetime :param edition: The edition of the database. The DatabaseEditions enumeration contains all the valid editions. If createMode is - NonReadableSecondary or OnlineSecondary, this value is ignored. Possible - values include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'Free', - 'Stretch', 'DataWarehouse', 'System' + NonReadableSecondary or OnlineSecondary, this value is ignored. To see + possible values, query the capabilities API + (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) + referred to by operationId: "Capabilities_List.". Possible values include: + 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'Free', 'Stretch', + 'DataWarehouse', 'System' :type edition: str or :class:`DatabaseEditions ` :param max_size_bytes: The max size of the database expressed in bytes. If - createMode is not Default, this value is ignored. Note: Only the following - sizes are supported (in addition to limitations being placed on each - edition): { 100 MB | 500 MB |1 GB | 5 GB | 10 GB | 20 GB | 30 GB … 150 GB - | 200 GB … 500 GB } + createMode is not Default, this value is ignored. To see possible values, + query the capabilities API + (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) + referred to by operationId: "Capabilities_List." :type max_size_bytes: str :param requested_service_objective_id: The configured service level objective ID of the database. This is the service level objective that is @@ -120,14 +123,20 @@ class Database(Resource): updated, it will match the value of currentServiceObjectiveId property. If requestedServiceObjectiveId and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveId overrides the value of - requestedServiceObjectiveName. + requestedServiceObjectiveName. To see possible values, query the + capabilities API + (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) + referred to by operationId: "Capabilities_List." :type requested_service_objective_id: str :param requested_service_objective_name: The name of the configured service level objective of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of serviceLevelObjective - property. Possible values include: 'Basic', 'S0', 'S1', 'S2', 'S3', 'P1', - 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'System', 'ElasticPool' + property. To see possible values, query the capabilities API + (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) + referred to by operationId: "Capabilities_List.". Possible values include: + 'Basic', 'S0', 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', + 'P15', 'System', 'ElasticPool' :type requested_service_objective_name: str or :class:`ServiceObjectiveName ` :ivar service_level_objective: The current service level objective of the diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/edition_capability.py b/azure-mgmt-sql/azure/mgmt/sql/models/edition_capability.py new file mode 100755 index 000000000000..6c729a32b82b --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/edition_capability.py @@ -0,0 +1,49 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class EditionCapability(Model): + """The server edition capabilities. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: The edition name. + :vartype name: str + :ivar status: The status of the server edition. Possible values include: + 'Visible', 'Available', 'Default', 'Disabled' + :vartype status: str or :class:`CapabilityStatus + ` + :ivar supported_service_level_objectives: The list of supported service + objectives for the edition. + :vartype supported_service_level_objectives: list of + :class:`ServiceObjectiveCapability + ` + """ + + _validation = { + 'name': {'readonly': True}, + 'status': {'readonly': True}, + 'supported_service_level_objectives': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'CapabilityStatus'}, + 'supported_service_level_objectives': {'key': 'supportedServiceLevelObjectives', 'type': '[ServiceObjectiveCapability]'}, + } + + def __init__(self): + self.name = None + self.status = None + self.supported_service_level_objectives = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/location_capabilities.py b/azure-mgmt-sql/azure/mgmt/sql/models/location_capabilities.py new file mode 100755 index 000000000000..782fefc6a8ec --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/location_capabilities.py @@ -0,0 +1,48 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class LocationCapabilities(Model): + """The capabilities for a location. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: The location name. + :vartype name: str + :ivar status: Azure SQL Database's status for the location. Possible + values include: 'Visible', 'Available', 'Default', 'Disabled' + :vartype status: str or :class:`CapabilityStatus + ` + :ivar supported_server_versions: The list of supported server versions. + :vartype supported_server_versions: list of + :class:`ServerVersionCapability + ` + """ + + _validation = { + 'name': {'readonly': True}, + 'status': {'readonly': True}, + 'supported_server_versions': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'CapabilityStatus'}, + 'supported_server_versions': {'key': 'supportedServerVersions', 'type': '[ServerVersionCapability]'}, + } + + def __init__(self): + self.name = None + self.status = None + self.supported_server_versions = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/max_size_capability.py b/azure-mgmt-sql/azure/mgmt/sql/models/max_size_capability.py new file mode 100755 index 000000000000..54388da0235d --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/max_size_capability.py @@ -0,0 +1,48 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class MaxSizeCapability(Model): + """The maximum size limits for a database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar limit: The maximum size of the database (see 'unit' for the units). + :vartype limit: long + :ivar unit: The units that the limit is expressed in. Possible values + include: 'Megabytes', 'Gigabytes', 'Terabytes', 'Petabytes' + :vartype unit: str or :class:`MaxSizeUnits + ` + :ivar status: The status of the maximum size capability. Possible values + include: 'Visible', 'Available', 'Default', 'Disabled' + :vartype status: str or :class:`CapabilityStatus + ` + """ + + _validation = { + 'limit': {'readonly': True}, + 'unit': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'limit': {'key': 'limit', 'type': 'long'}, + 'unit': {'key': 'unit', 'type': 'MaxSizeUnits'}, + 'status': {'key': 'status', 'type': 'CapabilityStatus'}, + } + + def __init__(self): + self.limit = None + self.unit = None + self.status = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/server_version_capability.py b/azure-mgmt-sql/azure/mgmt/sql/models/server_version_capability.py new file mode 100755 index 000000000000..e0f5e9029bc2 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/server_version_capability.py @@ -0,0 +1,47 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ServerVersionCapability(Model): + """The server capabilities. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: The server version name. + :vartype name: str + :ivar status: The status of the server version. Possible values include: + 'Visible', 'Available', 'Default', 'Disabled' + :vartype status: str or :class:`CapabilityStatus + ` + :ivar supported_editions: The list of supported server editions. + :vartype supported_editions: list of :class:`EditionCapability + ` + """ + + _validation = { + 'name': {'readonly': True}, + 'status': {'readonly': True}, + 'supported_editions': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'CapabilityStatus'}, + 'supported_editions': {'key': 'supportedEditions', 'type': '[EditionCapability]'}, + } + + def __init__(self): + self.name = None + self.status = None + self.supported_editions = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/service_objective_capability.py b/azure-mgmt-sql/azure/mgmt/sql/models/service_objective_capability.py new file mode 100755 index 000000000000..e8c6bfb8dd35 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/service_objective_capability.py @@ -0,0 +1,65 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ServiceObjectiveCapability(Model): + """The service objectives capabilities. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: The service objective name. + :vartype name: str + :ivar status: The status of the service objective. Possible values + include: 'Visible', 'Available', 'Default', 'Disabled' + :vartype status: str or :class:`CapabilityStatus + ` + :ivar unit: Unit type used to measure service objective performance level. + Possible values include: 'DTU' + :vartype unit: str or :class:`PerformanceLevelUnit + ` + :ivar value: Performance level value. + :vartype value: int + :ivar id: The unique ID of the service objective. + :vartype id: str + :ivar supported_max_sizes: The list of supported maximum database sizes + for this service objective. + :vartype supported_max_sizes: list of :class:`MaxSizeCapability + ` + """ + + _validation = { + 'name': {'readonly': True}, + 'status': {'readonly': True}, + 'unit': {'readonly': True}, + 'value': {'readonly': True}, + 'id': {'readonly': True}, + 'supported_max_sizes': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'CapabilityStatus'}, + 'unit': {'key': 'performanceLevel.unit', 'type': 'PerformanceLevelUnit'}, + 'value': {'key': 'performanceLevel.value', 'type': 'int'}, + 'id': {'key': 'id', 'type': 'str'}, + 'supported_max_sizes': {'key': 'supportedMaxSizes', 'type': '[MaxSizeCapability]'}, + } + + def __init__(self): + self.name = None + self.status = None + self.unit = None + self.value = None + self.id = None + self.supported_max_sizes = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py b/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py index 34b101d72b13..55de54853a32 100755 --- a/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py @@ -12,6 +12,27 @@ from enum import Enum +class CapabilityStatus(Enum): + + visible = "Visible" + available = "Available" + default = "Default" + disabled = "Disabled" + + +class MaxSizeUnits(Enum): + + megabytes = "Megabytes" + gigabytes = "Gigabytes" + terabytes = "Terabytes" + petabytes = "Petabytes" + + +class PerformanceLevelUnit(Enum): + + dtu = "DTU" + + class StorageKeyType(Enum): storage_access_key = "StorageAccessKey" diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py index 88c1012329b8..ecb1bc93b514 100755 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py @@ -9,6 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- +from .capabilities_operations import CapabilitiesOperations from .servers_operations import ServersOperations from .databases_operations import DatabasesOperations from .import_export_operations import ImportExportOperations @@ -18,6 +19,7 @@ from .database_blob_auditing_policies_operations import DatabaseBlobAuditingPoliciesOperations __all__ = [ + 'CapabilitiesOperations', 'ServersOperations', 'DatabasesOperations', 'ImportExportOperations', diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/capabilities_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/capabilities_operations.py new file mode 100755 index 000000000000..f6c328a6da9b --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/capabilities_operations.py @@ -0,0 +1,95 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +import uuid + +from .. import models + + +class CapabilitiesOperations(object): + """CapabilitiesOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2014-04-01". + """ + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2014-04-01" + + self.config = config + + def list_by_location( + self, location_id, custom_headers=None, raw=False, **operation_config): + """Gets the capabilities available for the specified location. + + :param location_id: The location id whose capabilities are retrieved. + :type location_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :rtype: :class:`LocationCapabilities + ` + :rtype: :class:`ClientRawResponse` + if raw=true + :raises: :class:`CloudError` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationId}/capabilities' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'locationId': self._serialize.url("location_id", location_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LocationCapabilities', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized diff --git a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py index 80ae7727e049..bdad0e2267b0 100755 --- a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py +++ b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py @@ -17,6 +17,7 @@ from msrestazure.azure_exceptions import CloudError from msrestazure.azure_operation import AzureOperationPoller import uuid +from .operations.capabilities_operations import CapabilitiesOperations from .operations.servers_operations import ServersOperations from .operations.databases_operations import DatabasesOperations from .operations.import_export_operations import ImportExportOperations @@ -68,6 +69,8 @@ class SqlManagementClient(object): :ivar config: Configuration for client. :vartype config: SqlManagementClientConfiguration + :ivar capabilities: Capabilities operations + :vartype capabilities: .operations.CapabilitiesOperations :ivar servers: Servers operations :vartype servers: .operations.ServersOperations :ivar databases: Databases operations @@ -102,6 +105,8 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) + self.capabilities = CapabilitiesOperations( + self._client, self.config, self._serialize, self._deserialize) self.servers = ServersOperations( self._client, self.config, self._serialize, self._deserialize) self.databases = DatabasesOperations(