From aeae8d27c1f858d6c60304a949dc6c643a232db8 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 26 Feb 2019 16:22:41 +0000 Subject: [PATCH] Generated from a03ebb5e6ea5c7aa1585f40be78db1703c328084 Adding virtualclusters.json to readme.md --- .../azure/mgmt/sql/models/__init__.py | 8 + .../azure/mgmt/sql/models/virtual_cluster.py | 66 +++ .../mgmt/sql/models/virtual_cluster_paged.py | 27 ++ .../mgmt/sql/models/virtual_cluster_py3.py | 66 +++ .../mgmt/sql/models/virtual_cluster_update.py | 49 ++ .../sql/models/virtual_cluster_update_py3.py | 49 ++ .../azure/mgmt/sql/operations/__init__.py | 2 + .../operations/virtual_clusters_operations.py | 426 ++++++++++++++++++ .../azure/mgmt/sql/sql_management_client.py | 5 + 9 files changed, 698 insertions(+) create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster_paged.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster_py3.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster_update.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster_update_py3.py create mode 100644 azure-mgmt-sql/azure/mgmt/sql/operations/virtual_clusters_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 320d5636704c..fc7e6c8e70b2 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py @@ -79,6 +79,8 @@ from .sync_group_py3 import SyncGroup from .sync_member_py3 import SyncMember from .subscription_usage_py3 import SubscriptionUsage + from .virtual_cluster_py3 import VirtualCluster + from .virtual_cluster_update_py3 import VirtualClusterUpdate from .virtual_network_rule_py3 import VirtualNetworkRule from .extended_database_blob_auditing_policy_py3 import ExtendedDatabaseBlobAuditingPolicy from .extended_server_blob_auditing_policy_py3 import ExtendedServerBlobAuditingPolicy @@ -229,6 +231,8 @@ from .sync_group import SyncGroup from .sync_member import SyncMember from .subscription_usage import SubscriptionUsage + from .virtual_cluster import VirtualCluster + from .virtual_cluster_update import VirtualClusterUpdate from .virtual_network_rule import VirtualNetworkRule from .extended_database_blob_auditing_policy import ExtendedDatabaseBlobAuditingPolicy from .extended_server_blob_auditing_policy import ExtendedServerBlobAuditingPolicy @@ -344,6 +348,7 @@ from .sync_group_paged import SyncGroupPaged from .sync_member_paged import SyncMemberPaged from .subscription_usage_paged import SubscriptionUsagePaged +from .virtual_cluster_paged import VirtualClusterPaged from .virtual_network_rule_paged import VirtualNetworkRulePaged from .database_vulnerability_assessment_paged import DatabaseVulnerabilityAssessmentPaged from .job_agent_paged import JobAgentPaged @@ -521,6 +526,8 @@ 'SyncGroup', 'SyncMember', 'SubscriptionUsage', + 'VirtualCluster', + 'VirtualClusterUpdate', 'VirtualNetworkRule', 'ExtendedDatabaseBlobAuditingPolicy', 'ExtendedServerBlobAuditingPolicy', @@ -636,6 +643,7 @@ 'SyncGroupPaged', 'SyncMemberPaged', 'SubscriptionUsagePaged', + 'VirtualClusterPaged', 'VirtualNetworkRulePaged', 'DatabaseVulnerabilityAssessmentPaged', 'JobAgentPaged', diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster.py b/azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster.py new file mode 100644 index 000000000000..a3c9dd04abca --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster.py @@ -0,0 +1,66 @@ +# 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 .tracked_resource import TrackedResource + + +class VirtualCluster(TrackedResource): + """An Azure SQL virtual cluster. + + 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. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + :ivar subnet_id: Subnet resource ID for the virtual cluster. + :vartype subnet_id: str + :param family: If the service has different generations of hardware, for + the same SKU, then that can be captured here. + :type family: str + :ivar child_resources: List of resources in this virtual cluster. + :vartype child_resources: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'subnet_id': {'readonly': True}, + 'child_resources': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'subnet_id': {'key': 'properties.subnetId', 'type': 'str'}, + 'family': {'key': 'properties.family', 'type': 'str'}, + 'child_resources': {'key': 'properties.childResources', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(VirtualCluster, self).__init__(**kwargs) + self.subnet_id = None + self.family = kwargs.get('family', None) + self.child_resources = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster_paged.py b/azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster_paged.py new file mode 100644 index 000000000000..865bbd5e9f86 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster_paged.py @@ -0,0 +1,27 @@ +# 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.paging import Paged + + +class VirtualClusterPaged(Paged): + """ + A paging container for iterating over a list of :class:`VirtualCluster ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[VirtualCluster]'} + } + + def __init__(self, *args, **kwargs): + + super(VirtualClusterPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster_py3.py new file mode 100644 index 000000000000..e11fb730e2be --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster_py3.py @@ -0,0 +1,66 @@ +# 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 .tracked_resource_py3 import TrackedResource + + +class VirtualCluster(TrackedResource): + """An Azure SQL virtual cluster. + + 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. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + :ivar subnet_id: Subnet resource ID for the virtual cluster. + :vartype subnet_id: str + :param family: If the service has different generations of hardware, for + the same SKU, then that can be captured here. + :type family: str + :ivar child_resources: List of resources in this virtual cluster. + :vartype child_resources: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'subnet_id': {'readonly': True}, + 'child_resources': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'subnet_id': {'key': 'properties.subnetId', 'type': 'str'}, + 'family': {'key': 'properties.family', 'type': 'str'}, + 'child_resources': {'key': 'properties.childResources', 'type': '[str]'}, + } + + def __init__(self, *, location: str, tags=None, family: str=None, **kwargs) -> None: + super(VirtualCluster, self).__init__(location=location, tags=tags, **kwargs) + self.subnet_id = None + self.family = family + self.child_resources = None diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster_update.py b/azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster_update.py new file mode 100644 index 000000000000..c6604df3568a --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster_update.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 VirtualClusterUpdate(Model): + """An update request for an Azure SQL Database virtual cluster. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar subnet_id: Subnet resource ID for the virtual cluster. + :vartype subnet_id: str + :param family: If the service has different generations of hardware, for + the same SKU, then that can be captured here. + :type family: str + :ivar child_resources: List of resources in this virtual cluster. + :vartype child_resources: list[str] + :param tags: Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'subnet_id': {'readonly': True}, + 'child_resources': {'readonly': True}, + } + + _attribute_map = { + 'subnet_id': {'key': 'properties.subnetId', 'type': 'str'}, + 'family': {'key': 'properties.family', 'type': 'str'}, + 'child_resources': {'key': 'properties.childResources', 'type': '[str]'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(VirtualClusterUpdate, self).__init__(**kwargs) + self.subnet_id = None + self.family = kwargs.get('family', None) + self.child_resources = None + self.tags = kwargs.get('tags', None) diff --git a/azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster_update_py3.py b/azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster_update_py3.py new file mode 100644 index 000000000000..ec26101b089a --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/models/virtual_cluster_update_py3.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 VirtualClusterUpdate(Model): + """An update request for an Azure SQL Database virtual cluster. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar subnet_id: Subnet resource ID for the virtual cluster. + :vartype subnet_id: str + :param family: If the service has different generations of hardware, for + the same SKU, then that can be captured here. + :type family: str + :ivar child_resources: List of resources in this virtual cluster. + :vartype child_resources: list[str] + :param tags: Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'subnet_id': {'readonly': True}, + 'child_resources': {'readonly': True}, + } + + _attribute_map = { + 'subnet_id': {'key': 'properties.subnetId', 'type': 'str'}, + 'family': {'key': 'properties.family', 'type': 'str'}, + 'child_resources': {'key': 'properties.childResources', 'type': '[str]'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, family: str=None, tags=None, **kwargs) -> None: + super(VirtualClusterUpdate, self).__init__(**kwargs) + self.subnet_id = None + self.family = family + self.child_resources = None + self.tags = tags diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py index 210190b18201..3db410ac9cd7 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py @@ -42,6 +42,7 @@ from .sync_groups_operations import SyncGroupsOperations from .sync_members_operations import SyncMembersOperations from .subscription_usages_operations import SubscriptionUsagesOperations +from .virtual_clusters_operations import VirtualClustersOperations from .virtual_network_rules_operations import VirtualNetworkRulesOperations from .extended_database_blob_auditing_policies_operations import ExtendedDatabaseBlobAuditingPoliciesOperations from .extended_server_blob_auditing_policies_operations import ExtendedServerBlobAuditingPoliciesOperations @@ -123,6 +124,7 @@ 'SyncGroupsOperations', 'SyncMembersOperations', 'SubscriptionUsagesOperations', + 'VirtualClustersOperations', 'VirtualNetworkRulesOperations', 'ExtendedDatabaseBlobAuditingPoliciesOperations', 'ExtendedServerBlobAuditingPoliciesOperations', diff --git a/azure-mgmt-sql/azure/mgmt/sql/operations/virtual_clusters_operations.py b/azure-mgmt-sql/azure/mgmt/sql/operations/virtual_clusters_operations.py new file mode 100644 index 000000000000..90a685e001a5 --- /dev/null +++ b/azure-mgmt-sql/azure/mgmt/sql/operations/virtual_clusters_operations.py @@ -0,0 +1,426 @@ +# 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 VirtualClustersOperations(object): + """VirtualClustersOperations operations. + + :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: "2015-05-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2015-05-01-preview" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Gets a list of all virtualClusters in the subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of VirtualCluster + :rtype: + ~azure.mgmt.sql.models.VirtualClusterPaged[~azure.mgmt.sql.models.VirtualCluster] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.VirtualClusterPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.VirtualClusterPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Gets a list of virtual clusters in a resource group. + + :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 dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of VirtualCluster + :rtype: + ~azure.mgmt.sql.models.VirtualClusterPaged[~azure.mgmt.sql.models.VirtualCluster] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.VirtualClusterPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.VirtualClusterPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters'} + + def get( + self, resource_group_name, virtual_cluster_name, custom_headers=None, raw=False, **operation_config): + """Gets a virtual cluster. + + :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 virtual_cluster_name: The name of the virtual cluster. + :type virtual_cluster_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: VirtualCluster or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.sql.models.VirtualCluster or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualClusterName': self._serialize.url("virtual_cluster_name", virtual_cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VirtualCluster', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters/{virtualClusterName}'} + + + def _delete_initial( + self, resource_group_name, virtual_cluster_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualClusterName': self._serialize.url("virtual_cluster_name", virtual_cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, virtual_cluster_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes a virtual cluster. + + :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 virtual_cluster_name: The name of the virtual cluster. + :type virtual_cluster_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + virtual_cluster_name=virtual_cluster_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters/{virtualClusterName}'} + + + def _update_initial( + self, resource_group_name, virtual_cluster_name, family=None, tags=None, custom_headers=None, raw=False, **operation_config): + parameters = models.VirtualClusterUpdate(family=family, tags=tags) + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualClusterName': self._serialize.url("virtual_cluster_name", virtual_cluster_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, 'VirtualClusterUpdate') + + # Construct and send request + request = self._client.patch(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('VirtualCluster', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, virtual_cluster_name, family=None, tags=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Updates a virtual cluster. + + :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 virtual_cluster_name: The name of the virtual cluster. + :type virtual_cluster_name: str + :param family: If the service has different generations of hardware, + for the same SKU, then that can be captured here. + :type family: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns VirtualCluster or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.VirtualCluster] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.sql.models.VirtualCluster]] + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + virtual_cluster_name=virtual_cluster_name, + family=family, + tags=tags, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('VirtualCluster', 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) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters/{virtualClusterName}'} 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 17a98aa1de4b..aae1ce917e14 100644 --- a/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py +++ b/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py @@ -46,6 +46,7 @@ from .operations.sync_groups_operations import SyncGroupsOperations from .operations.sync_members_operations import SyncMembersOperations from .operations.subscription_usages_operations import SubscriptionUsagesOperations +from .operations.virtual_clusters_operations import VirtualClustersOperations from .operations.virtual_network_rules_operations import VirtualNetworkRulesOperations from .operations.extended_database_blob_auditing_policies_operations import ExtendedDatabaseBlobAuditingPoliciesOperations from .operations.extended_server_blob_auditing_policies_operations import ExtendedServerBlobAuditingPoliciesOperations @@ -200,6 +201,8 @@ class SqlManagementClient(SDKClient): :vartype sync_members: azure.mgmt.sql.operations.SyncMembersOperations :ivar subscription_usages: SubscriptionUsages operations :vartype subscription_usages: azure.mgmt.sql.operations.SubscriptionUsagesOperations + :ivar virtual_clusters: VirtualClusters operations + :vartype virtual_clusters: azure.mgmt.sql.operations.VirtualClustersOperations :ivar virtual_network_rules: VirtualNetworkRules operations :vartype virtual_network_rules: azure.mgmt.sql.operations.VirtualNetworkRulesOperations :ivar extended_database_blob_auditing_policies: ExtendedDatabaseBlobAuditingPolicies operations @@ -378,6 +381,8 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.subscription_usages = SubscriptionUsagesOperations( self._client, self.config, self._serialize, self._deserialize) + self.virtual_clusters = VirtualClustersOperations( + self._client, self.config, self._serialize, self._deserialize) self.virtual_network_rules = VirtualNetworkRulesOperations( self._client, self.config, self._serialize, self._deserialize) self.extended_database_blob_auditing_policies = ExtendedDatabaseBlobAuditingPoliciesOperations(