From 182c77dbf8066e6fa23233abcda6b7c8cff05498 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Mon, 24 Feb 2020 20:31:29 +0000 Subject: [PATCH] Generated from 497f37d011e45d90e7a5f190b1326ec89e2719c8 Merge pull request #6 from Khushboo-Baheti/master merge --- .../advisor/_advisor_management_client.py | 2 +- .../azure/mgmt/advisor/models/__init__.py | 13 +- .../_advisor_management_client_enums.py | 14 ++ .../azure/mgmt/advisor/models/_models.py | 184 +++++++++++------ .../azure/mgmt/advisor/models/_models_py3.py | 188 ++++++++++++------ .../operations/_configurations_operations.py | 63 +++--- .../mgmt/advisor/operations/_operations.py | 4 +- .../_recommendation_metadata_operations.py | 4 +- .../operations/_recommendations_operations.py | 4 +- .../operations/_suppressions_operations.py | 4 +- 10 files changed, 310 insertions(+), 170 deletions(-) diff --git a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/_advisor_management_client.py b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/_advisor_management_client.py index ad34fa86ea9e..bb051ab728c8 100644 --- a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/_advisor_management_client.py +++ b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/_advisor_management_client.py @@ -53,7 +53,7 @@ def __init__( super(AdvisorManagementClient, self).__init__(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '2017-04-19' + self.api_version = '2020-01-01' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) diff --git a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/models/__init__.py b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/models/__init__.py index d12d43fe96aa..9621eaa6d438 100644 --- a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/models/__init__.py +++ b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/models/__init__.py @@ -10,9 +10,10 @@ # -------------------------------------------------------------------------- try: + from ._models_py3 import ArmErrorResponse, ArmErrorResponseException from ._models_py3 import ARMErrorResponseBody from ._models_py3 import ConfigData - from ._models_py3 import ConfigDataProperties + from ._models_py3 import DigestConfig from ._models_py3 import MetadataEntity from ._models_py3 import MetadataSupportedValueDetail from ._models_py3 import OperationDisplayInfo @@ -22,9 +23,10 @@ from ._models_py3 import ShortDescription from ._models_py3 import SuppressionContract except (SyntaxError, ImportError): + from ._models import ArmErrorResponse, ArmErrorResponseException from ._models import ARMErrorResponseBody from ._models import ConfigData - from ._models import ConfigDataProperties + from ._models import DigestConfig from ._models import MetadataEntity from ._models import MetadataSupportedValueDetail from ._models import OperationDisplayInfo @@ -40,15 +42,18 @@ from ._paged_models import SuppressionContractPaged from ._advisor_management_client_enums import ( Scenario, + CpuThreshold, Category, + DigestConfigState, Impact, Risk, ) __all__ = [ + 'ArmErrorResponse', 'ArmErrorResponseException', 'ARMErrorResponseBody', 'ConfigData', - 'ConfigDataProperties', + 'DigestConfig', 'MetadataEntity', 'MetadataSupportedValueDetail', 'OperationDisplayInfo', @@ -63,7 +68,9 @@ 'OperationEntityPaged', 'SuppressionContractPaged', 'Scenario', + 'CpuThreshold', 'Category', + 'DigestConfigState', 'Impact', 'Risk', ] diff --git a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/models/_advisor_management_client_enums.py b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/models/_advisor_management_client_enums.py index d925fb682389..40a05786162e 100644 --- a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/models/_advisor_management_client_enums.py +++ b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/models/_advisor_management_client_enums.py @@ -17,6 +17,14 @@ class Scenario(str, Enum): alerts = "Alerts" +class CpuThreshold(str, Enum): + + five = "5" + one_zero = "10" + one_five = "15" + two_zero = "20" + + class Category(str, Enum): high_availability = "HighAvailability" @@ -26,6 +34,12 @@ class Category(str, Enum): operational_excellence = "OperationalExcellence" +class DigestConfigState(str, Enum): + + active = "Active" + disabled = "Disabled" + + class Impact(str, Enum): high = "High" diff --git a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/models/_models.py b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/models/_models.py index c1a8ad5fb1f4..bd73ade7bb2e 100644 --- a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/models/_models.py +++ b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/models/_models.py @@ -10,6 +10,35 @@ # -------------------------------------------------------------------------- from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ArmErrorResponse(Model): + """ArmErrorResponse. + + :param error: + :type error: ~azure.mgmt.advisor.models.ARMErrorResponseBody + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ARMErrorResponseBody'}, + } + + def __init__(self, **kwargs): + super(ArmErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ArmErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ArmErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ArmErrorResponseException, self).__init__(deserialize, response, 'ArmErrorResponse', *args) class ARMErrorResponseBody(Model): @@ -42,60 +71,124 @@ class CloudError(Model): } -class ConfigData(Model): - """The Advisor configuration data structure. +class Resource(Model): + """An Azure resource. - :param id: The resource Id of the configuration resource. - :type id: str - :param type: The type of the configuration resource. - :type type: str - :param name: The name of the configuration resource. - :type name: str - :param properties: The list of property name/value pairs. - :type properties: ~azure.mgmt.advisor.models.ConfigDataProperties + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'ConfigDataProperties'}, + 'type': {'key': 'type', 'type': 'str'}, } def __init__(self, **kwargs): - super(ConfigData, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.type = kwargs.get('type', None) - self.name = kwargs.get('name', None) - self.properties = kwargs.get('properties', None) + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None -class ConfigDataProperties(Model): - """The list of property name/value pairs. +class ConfigData(Resource): + """The Advisor configuration data structure. + + Variables are only populated by the server, and will be ignored when + sending a request. - :param additional_properties: Unmatched properties from the message are - deserialized this collection - :type additional_properties: dict[str, object] + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str :param exclude: Exclude the resource from Advisor evaluations. Valid values: False (default) or True. :type exclude: bool :param low_cpu_threshold: Minimum percentage threshold for Advisor low CPU utilization evaluation. Valid only for subscriptions. Valid values: 5 - (default), 10, 15 or 20. - :type low_cpu_threshold: str + (default), 10, 15 or 20. Possible values include: '5', '10', '15', '20' + :type low_cpu_threshold: str or ~azure.mgmt.advisor.models.CpuThreshold + :param digests: Advisor digest configuration. Valid only for subscriptions + :type digests: list[~azure.mgmt.advisor.models.DigestConfig] """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'exclude': {'key': 'exclude', 'type': 'bool'}, - 'low_cpu_threshold': {'key': 'low_cpu_threshold', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'exclude': {'key': 'properties.exclude', 'type': 'bool'}, + 'low_cpu_threshold': {'key': 'properties.lowCpuThreshold', 'type': 'str'}, + 'digests': {'key': 'properties.digests', 'type': '[DigestConfig]'}, } def __init__(self, **kwargs): - super(ConfigDataProperties, self).__init__(**kwargs) - self.additional_properties = kwargs.get('additional_properties', None) + super(ConfigData, self).__init__(**kwargs) self.exclude = kwargs.get('exclude', None) self.low_cpu_threshold = kwargs.get('low_cpu_threshold', None) + self.digests = kwargs.get('digests', None) + + +class DigestConfig(Model): + """Advisor Digest configuration entity. + + :param name: Name of digest configuration. Value is case-insensitive and + must be unique within a subscription. + :type name: str + :param action_group_resource_id: Action group resource id used by digest. + :type action_group_resource_id: str + :param frequency: Frequency that digest will be triggered, in days. Value + must be between 7 and 30 days inclusive. + :type frequency: int + :param categories: Categories to send digest for. If categories are not + provided, then digest will be sent for all categories. + :type categories: list[str or ~azure.mgmt.advisor.models.Category] + :param language: Language for digest content body. Value must be ISO 639-1 + code for one of Azure portal supported languages. Otherwise, it will be + converted into one. Default value is English (en). + :type language: str + :param state: State of digest configuration. Possible values include: + 'Active', 'Disabled' + :type state: str or ~azure.mgmt.advisor.models.DigestConfigState + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'action_group_resource_id': {'key': 'actionGroupResourceId', 'type': 'str'}, + 'frequency': {'key': 'frequency', 'type': 'int'}, + 'categories': {'key': 'categories', 'type': '[str]'}, + 'language': {'key': 'language', 'type': 'str'}, + 'state': {'key': 'state', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DigestConfig, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.action_group_resource_id = kwargs.get('action_group_resource_id', None) + self.frequency = kwargs.get('frequency', None) + self.categories = kwargs.get('categories', None) + self.language = kwargs.get('language', None) + self.state = kwargs.get('state', None) class MetadataEntity(Model): @@ -210,39 +303,6 @@ def __init__(self, **kwargs): self.display = kwargs.get('display', None) -class Resource(Model): - """An Azure resource. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - class ResourceRecommendationBase(Resource): """Advisor Recommendation. diff --git a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/models/_models_py3.py b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/models/_models_py3.py index 59b4752e6036..2c790ec0d838 100644 --- a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/models/_models_py3.py +++ b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/models/_models_py3.py @@ -10,6 +10,35 @@ # -------------------------------------------------------------------------- from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ArmErrorResponse(Model): + """ArmErrorResponse. + + :param error: + :type error: ~azure.mgmt.advisor.models.ARMErrorResponseBody + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ARMErrorResponseBody'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(ArmErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ArmErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ArmErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ArmErrorResponseException, self).__init__(deserialize, response, 'ArmErrorResponse', *args) class ARMErrorResponseBody(Model): @@ -42,60 +71,124 @@ class CloudError(Model): } -class ConfigData(Model): - """The Advisor configuration data structure. +class Resource(Model): + """An Azure resource. - :param id: The resource Id of the configuration resource. - :type id: str - :param type: The type of the configuration resource. - :type type: str - :param name: The name of the configuration resource. - :type name: str - :param properties: The list of property name/value pairs. - :type properties: ~azure.mgmt.advisor.models.ConfigDataProperties + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'ConfigDataProperties'}, + 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, *, id: str=None, type: str=None, name: str=None, properties=None, **kwargs) -> None: - super(ConfigData, self).__init__(**kwargs) - self.id = id - self.type = type - self.name = name - self.properties = properties + def __init__(self, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None -class ConfigDataProperties(Model): - """The list of property name/value pairs. +class ConfigData(Resource): + """The Advisor configuration data structure. - :param additional_properties: Unmatched properties from the message are - deserialized this collection - :type additional_properties: dict[str, object] + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The resource ID. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str :param exclude: Exclude the resource from Advisor evaluations. Valid values: False (default) or True. :type exclude: bool :param low_cpu_threshold: Minimum percentage threshold for Advisor low CPU utilization evaluation. Valid only for subscriptions. Valid values: 5 - (default), 10, 15 or 20. - :type low_cpu_threshold: str + (default), 10, 15 or 20. Possible values include: '5', '10', '15', '20' + :type low_cpu_threshold: str or ~azure.mgmt.advisor.models.CpuThreshold + :param digests: Advisor digest configuration. Valid only for subscriptions + :type digests: list[~azure.mgmt.advisor.models.DigestConfig] """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'exclude': {'key': 'exclude', 'type': 'bool'}, - 'low_cpu_threshold': {'key': 'low_cpu_threshold', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'exclude': {'key': 'properties.exclude', 'type': 'bool'}, + 'low_cpu_threshold': {'key': 'properties.lowCpuThreshold', 'type': 'str'}, + 'digests': {'key': 'properties.digests', 'type': '[DigestConfig]'}, } - def __init__(self, *, additional_properties=None, exclude: bool=None, low_cpu_threshold: str=None, **kwargs) -> None: - super(ConfigDataProperties, self).__init__(**kwargs) - self.additional_properties = additional_properties + def __init__(self, *, exclude: bool=None, low_cpu_threshold=None, digests=None, **kwargs) -> None: + super(ConfigData, self).__init__(**kwargs) self.exclude = exclude self.low_cpu_threshold = low_cpu_threshold + self.digests = digests + + +class DigestConfig(Model): + """Advisor Digest configuration entity. + + :param name: Name of digest configuration. Value is case-insensitive and + must be unique within a subscription. + :type name: str + :param action_group_resource_id: Action group resource id used by digest. + :type action_group_resource_id: str + :param frequency: Frequency that digest will be triggered, in days. Value + must be between 7 and 30 days inclusive. + :type frequency: int + :param categories: Categories to send digest for. If categories are not + provided, then digest will be sent for all categories. + :type categories: list[str or ~azure.mgmt.advisor.models.Category] + :param language: Language for digest content body. Value must be ISO 639-1 + code for one of Azure portal supported languages. Otherwise, it will be + converted into one. Default value is English (en). + :type language: str + :param state: State of digest configuration. Possible values include: + 'Active', 'Disabled' + :type state: str or ~azure.mgmt.advisor.models.DigestConfigState + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'action_group_resource_id': {'key': 'actionGroupResourceId', 'type': 'str'}, + 'frequency': {'key': 'frequency', 'type': 'int'}, + 'categories': {'key': 'categories', 'type': '[str]'}, + 'language': {'key': 'language', 'type': 'str'}, + 'state': {'key': 'state', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, action_group_resource_id: str=None, frequency: int=None, categories=None, language: str=None, state=None, **kwargs) -> None: + super(DigestConfig, self).__init__(**kwargs) + self.name = name + self.action_group_resource_id = action_group_resource_id + self.frequency = frequency + self.categories = categories + self.language = language + self.state = state class MetadataEntity(Model): @@ -210,39 +303,6 @@ def __init__(self, *, name: str=None, display=None, **kwargs) -> None: self.display = display -class Resource(Model): - """An Azure resource. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__(self, **kwargs) -> None: - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - class ResourceRecommendationBase(Resource): """Advisor Recommendation. diff --git a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_configurations_operations.py b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_configurations_operations.py index 128d558b5a7c..2c54c5cd7765 100644 --- a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_configurations_operations.py +++ b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_configurations_operations.py @@ -11,7 +11,6 @@ import uuid from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError from .. import models @@ -25,7 +24,8 @@ class ConfigurationsOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The version of the API to be used with the client request. Constant value: "2017-04-19". + :ivar api_version: The version of the API to be used with the client request. Constant value: "2020-01-01". + :ivar configuration_name: Advisor configuration name. Value must be 'default'. Constant value: "default". """ models = models @@ -35,7 +35,8 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2017-04-19" + self.api_version = "2020-01-01" + self.configuration_name = "default" self.config = config @@ -54,7 +55,8 @@ def list_by_subscription( :return: An iterator like instance of ConfigData :rtype: ~azure.mgmt.advisor.models.ConfigDataPaged[~azure.mgmt.advisor.models.ConfigData] - :raises: :class:`CloudError` + :raises: + :class:`ArmErrorResponseException` """ def prepare_request(next_link=None): if not next_link: @@ -93,9 +95,7 @@ def internal_paging(next_link=None): 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 + raise models.ArmErrorResponseException(self._deserialize, response) return response @@ -123,15 +123,17 @@ def create_in_subscription( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: ARMErrorResponseBody or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.advisor.models.ARMErrorResponseBody or + :return: ConfigData or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.advisor.models.ConfigData or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ArmErrorResponseException` """ # Construct URL url = self.create_in_subscription.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'configurationName': self._serialize.url("self.configuration_name", self.configuration_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -157,21 +159,19 @@ def create_in_subscription( request = self._client.put(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [204, 400]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + if response.status_code not in [200]: + raise models.ArmErrorResponseException(self._deserialize, response) deserialized = None - if response.status_code == 400: - deserialized = self._deserialize('ARMErrorResponseBody', response) + if response.status_code == 200: + deserialized = self._deserialize('ConfigData', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - create_in_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations'} + create_in_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations/{configurationName}'} def list_by_resource_group( self, resource_group, custom_headers=None, raw=False, **operation_config): @@ -187,7 +187,8 @@ def list_by_resource_group( :return: An iterator like instance of ConfigData :rtype: ~azure.mgmt.advisor.models.ConfigDataPaged[~azure.mgmt.advisor.models.ConfigData] - :raises: :class:`CloudError` + :raises: + :class:`ArmErrorResponseException` """ def prepare_request(next_link=None): if not next_link: @@ -227,9 +228,7 @@ def internal_paging(next_link=None): 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 + raise models.ArmErrorResponseException(self._deserialize, response) return response @@ -256,15 +255,17 @@ def create_in_resource_group( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: ARMErrorResponseBody or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.advisor.models.ARMErrorResponseBody or + :return: ConfigData or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.advisor.models.ConfigData or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ArmErrorResponseException` """ # Construct URL url = self.create_in_resource_group.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'configurationName': self._serialize.url("self.configuration_name", self.configuration_name, 'str'), 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -291,18 +292,16 @@ def create_in_resource_group( request = self._client.put(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [204, 400]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + if response.status_code not in [200]: + raise models.ArmErrorResponseException(self._deserialize, response) deserialized = None - if response.status_code == 400: - deserialized = self._deserialize('ARMErrorResponseBody', response) + if response.status_code == 200: + deserialized = self._deserialize('ConfigData', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - create_in_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations'} + create_in_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations/{configurationName}'} diff --git a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_operations.py b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_operations.py index cb591080f43f..29154f117dba 100644 --- a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_operations.py +++ b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_operations.py @@ -25,7 +25,7 @@ class Operations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The version of the API to be used with the client request. Constant value: "2017-04-19". + :ivar api_version: The version of the API to be used with the client request. Constant value: "2020-01-01". """ models = models @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2017-04-19" + self.api_version = "2020-01-01" self.config = config diff --git a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_recommendation_metadata_operations.py b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_recommendation_metadata_operations.py index cbc259216fdc..4697a37af304 100644 --- a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_recommendation_metadata_operations.py +++ b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_recommendation_metadata_operations.py @@ -25,7 +25,7 @@ class RecommendationMetadataOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The version of the API to be used with the client request. Constant value: "2017-04-19". + :ivar api_version: The version of the API to be used with the client request. Constant value: "2020-01-01". """ models = models @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2017-04-19" + self.api_version = "2020-01-01" self.config = config diff --git a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_recommendations_operations.py b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_recommendations_operations.py index 5f3bf5c6c6d6..600cd2c43ff7 100644 --- a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_recommendations_operations.py +++ b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_recommendations_operations.py @@ -25,7 +25,7 @@ class RecommendationsOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The version of the API to be used with the client request. Constant value: "2017-04-19". + :ivar api_version: The version of the API to be used with the client request. Constant value: "2020-01-01". """ models = models @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2017-04-19" + self.api_version = "2020-01-01" self.config = config diff --git a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_suppressions_operations.py b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_suppressions_operations.py index 6e2b52a75025..e8ee6264d4d6 100644 --- a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_suppressions_operations.py +++ b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_suppressions_operations.py @@ -25,7 +25,7 @@ class SuppressionsOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The version of the API to be used with the client request. Constant value: "2017-04-19". + :ivar api_version: The version of the API to be used with the client request. Constant value: "2020-01-01". """ models = models @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2017-04-19" + self.api_version = "2020-01-01" self.config = config