From 79d6c9fea3a3aa7e1b291ad349438177b5242c53 Mon Sep 17 00:00:00 2001 From: SwaggerToSDK Automation Date: Tue, 18 Apr 2017 21:34:05 +0000 Subject: [PATCH] Generated from af2c591b759dd7f00d1795f2539bf2383675c8e9 --- .../azure/mgmt/sql/models/__init__.py | 64 ++++--- .../mgmt/sql/models/edition_capability.py | 4 +- .../sql/models/elastic_pool_dtu_capability.py | 74 ++++++++ .../models/elastic_pool_edition_capability.py | 49 ++++++ ...ic_pool_per_database_max_dtu_capability.py | 49 ++++++ ...ic_pool_per_database_min_dtu_capability.py | 41 +++++ .../sql/models/server_version_capability.py | 10 +- .../models/service_objective_capability.py | 9 +- .../sql/models/sql_management_client_enums.py | 36 ++-- .../azure/mgmt/sql/operations/__init__.py | 6 +- .../sql/operations/databases_operations.py | 165 +++++++++--------- .../azure/mgmt/sql/operations/operations.py | 88 ++++++++++ .../azure/mgmt/sql/sql_management_client.py | 71 +------- azure-mgmt-sql/azure/mgmt/sql/version.py | 2 +- 14 files changed, 471 insertions(+), 197 deletions(-) create mode 100755 azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_dtu_capability.py create mode 100755 azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_edition_capability.py create mode 100755 azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_per_database_max_dtu_capability.py create mode 100755 azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_per_database_min_dtu_capability.py create mode 100755 azure-mgmt-sql/azure/mgmt/sql/operations/operations.py diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py index 57dcfd4982ed..16910dc2a694 100755 --- a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py @@ -9,21 +9,31 @@ # regenerated. # -------------------------------------------------------------------------- +from .resource import Resource +from .tracked_resource import TrackedResource +from .proxy_resource import ProxyResource +from .restore_point import RestorePoint from .max_size_capability import MaxSizeCapability from .service_objective_capability import ServiceObjectiveCapability from .edition_capability import EditionCapability +from .elastic_pool_per_database_min_dtu_capability import ElasticPoolPerDatabaseMinDtuCapability +from .elastic_pool_per_database_max_dtu_capability import ElasticPoolPerDatabaseMaxDtuCapability +from .elastic_pool_dtu_capability import ElasticPoolDtuCapability +from .elastic_pool_edition_capability import ElasticPoolEditionCapability from .server_version_capability import ServerVersionCapability from .location_capabilities import LocationCapabilities from .sub_resource import SubResource from .firewall_rule import FirewallRule -from .resource import Resource -from .tracked_resource import TrackedResource -from .proxy_resource import ProxyResource from .import_extension_request import ImportExtensionRequest from .import_export_response import ImportExportResponse from .import_request import ImportRequest from .export_request import ExportRequest +from .operation_display import OperationDisplay +from .operation import Operation +from .operation_list_result import OperationListResult from .replication_link import ReplicationLink +from .server import Server +from .server_metric import ServerMetric from .recommended_elastic_pool_metric import RecommendedElasticPoolMetric from .slo_usage_metric import SloUsageMetric from .service_tier_advisor import ServiceTierAdvisor @@ -35,24 +45,18 @@ from .elastic_pool import ElasticPool from .elastic_pool_activity import ElasticPoolActivity from .elastic_pool_database_activity import ElasticPoolDatabaseActivity -from .server import Server -from .restore_point import RestorePoint from .database_metric import DatabaseMetric -from .server_metric import ServerMetric from .service_objective import ServiceObjective from .transparent_data_encryption_activity import TransparentDataEncryptionActivity -from .operation_display import OperationDisplay -from .operation import Operation -from .operation_list_result import OperationListResult from .database_security_alert_policy import DatabaseSecurityAlertPolicy from .database_blob_auditing_policy import DatabaseBlobAuditingPolicy -from .firewall_rule_paged import FirewallRulePaged -from .replication_link_paged import ReplicationLinkPaged from .restore_point_paged import RestorePointPaged +from .replication_link_paged import ReplicationLinkPaged from .database_paged import DatabasePaged from .database_metric_paged import DatabaseMetricPaged from .service_tier_advisor_paged import ServiceTierAdvisorPaged from .transparent_data_encryption_activity_paged import TransparentDataEncryptionActivityPaged +from .firewall_rule_paged import FirewallRulePaged from .server_paged import ServerPaged from .server_metric_paged import ServerMetricPaged from .service_objective_paged import ServiceObjectivePaged @@ -62,6 +66,7 @@ from .recommended_elastic_pool_paged import RecommendedElasticPoolPaged from .recommended_elastic_pool_metric_paged import RecommendedElasticPoolMetricPaged from .sql_management_client_enums import ( + RestorePointTypes, CapabilityStatus, MaxSizeUnits, PerformanceLevelUnit, @@ -71,6 +76,8 @@ AuthenticationType, ReplicationRole, ReplicationState, + ServerVersion, + ServerState, ElasticPoolEdition, CreateMode, TransparentDataEncryptionStatus, @@ -80,9 +87,6 @@ ReadScale, SampleName, ElasticPoolState, - ServerVersion, - ServerState, - RestorePointTypes, TransparentDataEncryptionActivityStatus, SecurityAlertPolicyState, SecurityAlertPolicyEmailAccountAdmins, @@ -91,21 +95,31 @@ ) __all__ = [ + 'Resource', + 'TrackedResource', + 'ProxyResource', + 'RestorePoint', 'MaxSizeCapability', 'ServiceObjectiveCapability', 'EditionCapability', + 'ElasticPoolPerDatabaseMinDtuCapability', + 'ElasticPoolPerDatabaseMaxDtuCapability', + 'ElasticPoolDtuCapability', + 'ElasticPoolEditionCapability', 'ServerVersionCapability', 'LocationCapabilities', 'SubResource', 'FirewallRule', - 'Resource', - 'TrackedResource', - 'ProxyResource', 'ImportExtensionRequest', 'ImportExportResponse', 'ImportRequest', 'ExportRequest', + 'OperationDisplay', + 'Operation', + 'OperationListResult', 'ReplicationLink', + 'Server', + 'ServerMetric', 'RecommendedElasticPoolMetric', 'SloUsageMetric', 'ServiceTierAdvisor', @@ -117,24 +131,18 @@ 'ElasticPool', 'ElasticPoolActivity', 'ElasticPoolDatabaseActivity', - 'Server', - 'RestorePoint', 'DatabaseMetric', - 'ServerMetric', 'ServiceObjective', 'TransparentDataEncryptionActivity', - 'OperationDisplay', - 'Operation', - 'OperationListResult', 'DatabaseSecurityAlertPolicy', 'DatabaseBlobAuditingPolicy', - 'FirewallRulePaged', - 'ReplicationLinkPaged', 'RestorePointPaged', + 'ReplicationLinkPaged', 'DatabasePaged', 'DatabaseMetricPaged', 'ServiceTierAdvisorPaged', 'TransparentDataEncryptionActivityPaged', + 'FirewallRulePaged', 'ServerPaged', 'ServerMetricPaged', 'ServiceObjectivePaged', @@ -143,6 +151,7 @@ 'ElasticPoolDatabaseActivityPaged', 'RecommendedElasticPoolPaged', 'RecommendedElasticPoolMetricPaged', + 'RestorePointTypes', 'CapabilityStatus', 'MaxSizeUnits', 'PerformanceLevelUnit', @@ -152,6 +161,8 @@ 'AuthenticationType', 'ReplicationRole', 'ReplicationState', + 'ServerVersion', + 'ServerState', 'ElasticPoolEdition', 'CreateMode', 'TransparentDataEncryptionStatus', @@ -161,9 +172,6 @@ 'ReadScale', 'SampleName', 'ElasticPoolState', - 'ServerVersion', - 'ServerState', - 'RestorePointTypes', 'TransparentDataEncryptionActivityStatus', 'SecurityAlertPolicyState', 'SecurityAlertPolicyEmailAccountAdmins', diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/edition_capability.py b/azure-mgmt-sql/azure/mgmt/sql/models/edition_capability.py index 6c729a32b82b..8b4a9ef0dfa0 100755 --- a/azure-mgmt-sql/azure/mgmt/sql/models/edition_capability.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/edition_capability.py @@ -13,14 +13,14 @@ class EditionCapability(Model): - """The server edition capabilities. + """The database 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: + :ivar status: The status of the edition. Possible values include: 'Visible', 'Available', 'Default', 'Disabled' :vartype status: str or :class:`CapabilityStatus ` diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_dtu_capability.py b/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_dtu_capability.py new file mode 100755 index 000000000000..c6eef18c6574 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_dtu_capability.py @@ -0,0 +1,74 @@ +# 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 ElasticPoolDtuCapability(Model): + """The Elastic Pool DTU capability. + + 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 max_database_count: The maximum number of databases supported. + :vartype max_database_count: long + :ivar status: The status of the capability. Possible values include: + 'Visible', 'Available', 'Default', 'Disabled' + :vartype status: str or :class:`CapabilityStatus + ` + :ivar supported_max_sizes: The list of supported max sizes. + :vartype supported_max_sizes: list of :class:`MaxSizeCapability + ` + :ivar included_max_size: The included (free) max size for this service + level objective. + :vartype included_max_size: :class:`MaxSizeCapability + ` + :ivar supported_per_database_max_sizes: The list of supported max database + sizes. + :vartype supported_per_database_max_sizes: list of + :class:`MaxSizeCapability ` + :ivar supported_per_database_max_dtus: The list of supported max database + DTUs. + :vartype supported_per_database_max_dtus: list of + :class:`ElasticPoolPerDatabaseMaxDtuCapability + ` + """ + + _validation = { + 'limit': {'readonly': True}, + 'max_database_count': {'readonly': True}, + 'status': {'readonly': True}, + 'supported_max_sizes': {'readonly': True}, + 'included_max_size': {'readonly': True}, + 'supported_per_database_max_sizes': {'readonly': True}, + 'supported_per_database_max_dtus': {'readonly': True}, + } + + _attribute_map = { + 'limit': {'key': 'limit', 'type': 'long'}, + 'max_database_count': {'key': 'maxDatabaseCount', 'type': 'long'}, + 'status': {'key': 'status', 'type': 'CapabilityStatus'}, + 'supported_max_sizes': {'key': 'supportedMaxSizes', 'type': '[MaxSizeCapability]'}, + 'included_max_size': {'key': 'includedMaxSize', 'type': 'MaxSizeCapability'}, + 'supported_per_database_max_sizes': {'key': 'supportedPerDatabaseMaxSizes', 'type': '[MaxSizeCapability]'}, + 'supported_per_database_max_dtus': {'key': 'supportedPerDatabaseMaxDtus', 'type': '[ElasticPoolPerDatabaseMaxDtuCapability]'}, + } + + def __init__(self): + self.limit = None + self.max_database_count = None + self.status = None + self.supported_max_sizes = None + self.included_max_size = None + self.supported_per_database_max_sizes = None + self.supported_per_database_max_dtus = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_edition_capability.py b/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_edition_capability.py new file mode 100755 index 000000000000..f6bb2ae8c494 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_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 ElasticPoolEditionCapability(Model): + """The elastic pool edition capabilities. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: The elastic pool edition name. + :vartype name: str + :ivar status: The status of the elastic pool edition. Possible values + include: 'Visible', 'Available', 'Default', 'Disabled' + :vartype status: str or :class:`CapabilityStatus + ` + :ivar supported_elastic_pool_dtus: The list of supported elastic pool DTU + levels for the edition. + :vartype supported_elastic_pool_dtus: list of + :class:`ElasticPoolDtuCapability + ` + """ + + _validation = { + 'name': {'readonly': True}, + 'status': {'readonly': True}, + 'supported_elastic_pool_dtus': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'CapabilityStatus'}, + 'supported_elastic_pool_dtus': {'key': 'supportedElasticPoolDtus', 'type': '[ElasticPoolDtuCapability]'}, + } + + def __init__(self): + self.name = None + self.status = None + self.supported_elastic_pool_dtus = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_per_database_max_dtu_capability.py b/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_per_database_max_dtu_capability.py new file mode 100755 index 000000000000..a918fe7d361f --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_per_database_max_dtu_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 ElasticPoolPerDatabaseMaxDtuCapability(Model): + """The max per-database DTU capability. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar limit: The maximum DTUs per database. + :vartype limit: long + :ivar status: The status of the capability. Possible values include: + 'Visible', 'Available', 'Default', 'Disabled' + :vartype status: str or :class:`CapabilityStatus + ` + :ivar supported_per_database_min_dtus: The list of supported min database + DTUs. + :vartype supported_per_database_min_dtus: list of + :class:`ElasticPoolPerDatabaseMinDtuCapability + ` + """ + + _validation = { + 'limit': {'readonly': True}, + 'status': {'readonly': True}, + 'supported_per_database_min_dtus': {'readonly': True}, + } + + _attribute_map = { + 'limit': {'key': 'limit', 'type': 'long'}, + 'status': {'key': 'status', 'type': 'CapabilityStatus'}, + 'supported_per_database_min_dtus': {'key': 'supportedPerDatabaseMinDtus', 'type': '[ElasticPoolPerDatabaseMinDtuCapability]'}, + } + + def __init__(self): + self.limit = None + self.status = None + self.supported_per_database_min_dtus = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_per_database_min_dtu_capability.py b/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_per_database_min_dtu_capability.py new file mode 100755 index 000000000000..4e84c7de718a --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_per_database_min_dtu_capability.py @@ -0,0 +1,41 @@ +# 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 ElasticPoolPerDatabaseMinDtuCapability(Model): + """The minimum per-database DTU capability. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar limit: The maximum DTUs per database. + :vartype limit: long + :ivar status: The status of the capability. Possible values include: + 'Visible', 'Available', 'Default', 'Disabled' + :vartype status: str or :class:`CapabilityStatus + ` + """ + + _validation = { + 'limit': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'limit': {'key': 'limit', 'type': 'long'}, + 'status': {'key': 'status', 'type': 'CapabilityStatus'}, + } + + def __init__(self): + self.limit = 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 index e0f5e9029bc2..0c3199606670 100755 --- a/azure-mgmt-sql/azure/mgmt/sql/models/server_version_capability.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/server_version_capability.py @@ -24,24 +24,32 @@ class ServerVersionCapability(Model): 'Visible', 'Available', 'Default', 'Disabled' :vartype status: str or :class:`CapabilityStatus ` - :ivar supported_editions: The list of supported server editions. + :ivar supported_editions: The list of supported database editions. :vartype supported_editions: list of :class:`EditionCapability ` + :ivar supported_elastic_pool_editions: The list of supported elastic pool + editions. + :vartype supported_elastic_pool_editions: list of + :class:`ElasticPoolEditionCapability + ` """ _validation = { 'name': {'readonly': True}, 'status': {'readonly': True}, 'supported_editions': {'readonly': True}, + 'supported_elastic_pool_editions': {'readonly': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'status': {'key': 'status', 'type': 'CapabilityStatus'}, 'supported_editions': {'key': 'supportedEditions', 'type': '[EditionCapability]'}, + 'supported_elastic_pool_editions': {'key': 'supportedElasticPoolEditions', 'type': '[ElasticPoolEditionCapability]'}, } def __init__(self): self.name = None self.status = None self.supported_editions = None + self.supported_elastic_pool_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 index e8c6bfb8dd35..f12dd015ef80 100755 --- a/azure-mgmt-sql/azure/mgmt/sql/models/service_objective_capability.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/service_objective_capability.py @@ -13,7 +13,7 @@ class ServiceObjectiveCapability(Model): - """The service objectives capabilities. + """The service objectives capability. Variables are only populated by the server, and will be ignored when sending a request. @@ -36,6 +36,10 @@ class ServiceObjectiveCapability(Model): for this service objective. :vartype supported_max_sizes: list of :class:`MaxSizeCapability ` + :ivar included_max_size: The included (free) max size for this service + level objective. + :vartype included_max_size: :class:`MaxSizeCapability + ` """ _validation = { @@ -45,6 +49,7 @@ class ServiceObjectiveCapability(Model): 'value': {'readonly': True}, 'id': {'readonly': True}, 'supported_max_sizes': {'readonly': True}, + 'included_max_size': {'readonly': True}, } _attribute_map = { @@ -54,6 +59,7 @@ class ServiceObjectiveCapability(Model): 'value': {'key': 'performanceLevel.value', 'type': 'int'}, 'id': {'key': 'id', 'type': 'str'}, 'supported_max_sizes': {'key': 'supportedMaxSizes', 'type': '[MaxSizeCapability]'}, + 'included_max_size': {'key': 'includedMaxSize', 'type': 'MaxSizeCapability'}, } def __init__(self): @@ -63,3 +69,4 @@ def __init__(self): self.value = None self.id = None self.supported_max_sizes = None + self.included_max_size = 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 f061b747575d..3033853a654e 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,12 @@ from enum import Enum +class RestorePointTypes(Enum): + + discrete = "DISCRETE" + continuous = "CONTINUOUS" + + class CapabilityStatus(Enum): visible = "Visible" @@ -95,6 +101,18 @@ class ReplicationState(Enum): suspended = "SUSPENDED" +class ServerVersion(Enum): + + two_full_stop_zero = "2.0" + one_two_full_stop_zero = "12.0" + + +class ServerState(Enum): + + ready = "Ready" + disabled = "Disabled" + + class ElasticPoolEdition(Enum): basic = "Basic" @@ -168,24 +186,6 @@ class ElasticPoolState(Enum): disabled = "Disabled" -class ServerVersion(Enum): - - two_full_stop_zero = "2.0" - one_two_full_stop_zero = "12.0" - - -class ServerState(Enum): - - ready = "Ready" - disabled = "Disabled" - - -class RestorePointTypes(Enum): - - discrete = "DISCRETE" - continuous = "CONTINUOUS" - - class TransparentDataEncryptionActivityStatus(Enum): encrypting = "Encrypting" diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py index 7b9bb5e7e54f..a310f0741e1b 100755 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py @@ -9,17 +9,19 @@ # regenerated. # -------------------------------------------------------------------------- +from .databases_operations import DatabasesOperations from .capabilities_operations import CapabilitiesOperations from .firewall_rules_operations import FirewallRulesOperations -from .databases_operations import DatabasesOperations +from .operations import Operations from .servers_operations import ServersOperations from .elastic_pools_operations import ElasticPoolsOperations from .recommended_elastic_pools_operations import RecommendedElasticPoolsOperations __all__ = [ + 'DatabasesOperations', 'CapabilitiesOperations', 'FirewallRulesOperations', - 'DatabasesOperations', + 'Operations', 'ServersOperations', 'ElasticPoolsOperations', 'RecommendedElasticPoolsOperations', diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/databases_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/databases_operations.py index 41ce795a9264..8f588996eb70 100755 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/databases_operations.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/databases_operations.py @@ -34,6 +34,83 @@ def __init__(self, client, config, serializer, deserializer): self.config = config + def list_restore_points( + self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): + """Returns a list of database restore points. + + :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 from which to retrieve + available restore points. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :rtype: :class:`RestorePointPaged + ` + :raises: :class:`CloudError` + """ + api_version = "2014-04-01" + + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints' + 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') + + else: + url = next_link + query_parameters = {} + + # 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 + + return response + + # Deserialize response + deserialized = models.RestorePointPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.RestorePointPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + def import_method( self, resource_group_name, server_name, parameters, custom_headers=None, raw=False, **operation_config): """Imports a bacpac into a new database. . @@ -205,14 +282,14 @@ def get_long_running_status(status_link, headers=None): def get_long_running_output(response): - if response.status_code not in [200, 202]: + 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 == 200: + if response.status_code == 201: deserialized = self._deserialize('ImportExportResponse', response) if raw: @@ -470,7 +547,8 @@ def get_replication_link( def failover_replication_link( self, resource_group_name, server_name, database_name, link_id, custom_headers=None, raw=False, **operation_config): - """Failover the database replication link. + """Sets which replica database is primary by failing over from the current + primary replica database. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -558,8 +636,8 @@ def get_long_running_output(response): def failover_replication_link_allow_data_loss( self, resource_group_name, server_name, database_name, link_id, custom_headers=None, raw=False, **operation_config): - """Force failover the database replication link, which may result in data - loss. + """Sets which replica database is primary by failing over from the current + primary replica database. This operation might result in data loss. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -889,83 +967,6 @@ def get_long_running_output(response): long_running_send, get_long_running_output, get_long_running_status, long_running_operation_timeout) - def list_restore_points( - self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): - """Returns a list of database restore points. - - :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 from which to retrieve - available restore points. - :type database_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :rtype: :class:`RestorePointPaged - ` - :raises: :class:`CloudError` - """ - api_version = "2014-04-01" - - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints' - 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') - - else: - url = next_link - query_parameters = {} - - # 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 - - return response - - # Deserialize response - deserialized = models.RestorePointPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.RestorePointPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - def create_or_update( self, resource_group_name, server_name, database_name, parameters, custom_headers=None, raw=False, **operation_config): """Creates a new database or updates an existing database. Location is a diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/operations.py new file mode 100755 index 000000000000..e346b121624c --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/operations.py @@ -0,0 +1,88 @@ +# 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 Operations(object): + """Operations 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( + self, custom_headers=None, raw=False, **operation_config): + """Lists all of the available SQL Rest API operations. + + :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:`OperationListResult + ` + :rtype: :class:`ClientRawResponse` + if raw=true + :raises: :class:`CloudError` + """ + # Construct URL + url = '/providers/Microsoft.Sql/operations' + + # 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('OperationListResult', 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 b704c43e5758..ddea0bf519ce 100755 --- a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py +++ b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py @@ -13,13 +13,10 @@ from msrest import Serializer, Deserializer from msrestazure import AzureConfiguration from .version import VERSION -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrestazure.azure_operation import AzureOperationPoller -import uuid +from .operations.databases_operations import DatabasesOperations from .operations.capabilities_operations import CapabilitiesOperations from .operations.firewall_rules_operations import FirewallRulesOperations -from .operations.databases_operations import DatabasesOperations +from .operations.operations import Operations from .operations.servers_operations import ServersOperations from .operations.elastic_pools_operations import ElasticPoolsOperations from .operations.recommended_elastic_pools_operations import RecommendedElasticPoolsOperations @@ -67,12 +64,14 @@ class SqlManagementClient(object): :ivar config: Configuration for client. :vartype config: SqlManagementClientConfiguration + :ivar databases: Databases operations + :vartype databases: .operations.DatabasesOperations :ivar capabilities: Capabilities operations :vartype capabilities: .operations.CapabilitiesOperations :ivar firewall_rules: FirewallRules operations :vartype firewall_rules: .operations.FirewallRulesOperations - :ivar databases: Databases operations - :vartype databases: .operations.DatabasesOperations + :ivar operations: Operations operations + :vartype operations: .operations.Operations :ivar servers: Servers operations :vartype servers: .operations.ServersOperations :ivar elastic_pools: ElasticPools operations @@ -99,11 +98,13 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) + self.databases = DatabasesOperations( + self._client, self.config, self._serialize, self._deserialize) self.capabilities = CapabilitiesOperations( self._client, self.config, self._serialize, self._deserialize) self.firewall_rules = FirewallRulesOperations( self._client, self.config, self._serialize, self._deserialize) - self.databases = DatabasesOperations( + self.operations = Operations( self._client, self.config, self._serialize, self._deserialize) self.servers = ServersOperations( self._client, self.config, self._serialize, self._deserialize) @@ -111,57 +112,3 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.recommended_elastic_pools = RecommendedElasticPoolsOperations( self._client, self.config, self._serialize, self._deserialize) - - def list_operations( - self, custom_headers=None, raw=False, **operation_config): - """Lists all of the available SQL Rest API operations. - - :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:`OperationListResult - ` - :rtype: :class:`ClientRawResponse` - if raw=true - :raises: :class:`CloudError` - """ - api_version = "2014-04-01" - - # Construct URL - url = '/providers/Microsoft.Sql/operations' - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", 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('OperationListResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized diff --git a/azure-mgmt-sql/azure/mgmt/sql/version.py b/azure-mgmt-sql/azure/mgmt/sql/version.py index e9983c0d8c01..85da2c00c1a6 100755 --- a/azure-mgmt-sql/azure/mgmt/sql/version.py +++ b/azure-mgmt-sql/azure/mgmt/sql/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.4.1" +VERSION = "0.4.0"