From d0789c03086ff30c5a157129fc7c444a9db1df2d Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 28 Jun 2018 16:54:34 -0700 Subject: [PATCH 1/4] [AutoPR advisor/resource-manager] Swaggerfix (#2721) * Generated from 8f325f540f597ae184379bed0676e8cdfd42039f Add C# settings * Generated from a3db9ba57ede1858830cee525cf8f2bb9124e143 Remove wrong tag --- .../mgmt/advisor/advisor_management_client.py | 6 +- .../azure/mgmt/advisor/models/__init__.py | 29 ++++-- .../models/advisor_management_client_enums.py | 6 +- .../advisor/models/arm_error_response_body.py | 8 +- .../models/arm_error_response_body_py3.py | 34 +++++++ .../azure/mgmt/advisor/models/config_data.py | 12 +-- .../advisor/models/config_data_properties.py | 10 +- .../models/config_data_properties_py3.py | 40 ++++++++ .../mgmt/advisor/models/config_data_py3.py | 40 ++++++++ .../advisor/models/operation_display_info.py | 12 +-- .../models/operation_display_info_py3.py | 41 ++++++++ .../mgmt/advisor/models/operation_entity.py | 8 +- .../advisor/models/operation_entity_py3.py | 32 +++++++ .../azure/mgmt/advisor/models/resource.py | 4 +- .../azure/mgmt/advisor/models/resource_py3.py | 45 +++++++++ .../models/resource_recommendation_base.py | 24 ++--- .../resource_recommendation_base_py3.py | 87 +++++++++++++++++ .../mgmt/advisor/models/short_description.py | 8 +- .../advisor/models/short_description_py3.py | 32 +++++++ .../advisor/models/suppression_contract.py | 8 +- .../models/suppression_contract_py3.py | 51 ++++++++++ .../operations/configurations_operations.py | 14 ++- .../mgmt/advisor/operations/operations.py | 5 +- .../operations/recommendations_operations.py | 96 ++++++------------- .../operations/suppressions_operations.py | 14 ++- 25 files changed, 523 insertions(+), 143 deletions(-) create mode 100644 azure-mgmt-advisor/azure/mgmt/advisor/models/arm_error_response_body_py3.py create mode 100644 azure-mgmt-advisor/azure/mgmt/advisor/models/config_data_properties_py3.py create mode 100644 azure-mgmt-advisor/azure/mgmt/advisor/models/config_data_py3.py create mode 100644 azure-mgmt-advisor/azure/mgmt/advisor/models/operation_display_info_py3.py create mode 100644 azure-mgmt-advisor/azure/mgmt/advisor/models/operation_entity_py3.py create mode 100644 azure-mgmt-advisor/azure/mgmt/advisor/models/resource_py3.py create mode 100644 azure-mgmt-advisor/azure/mgmt/advisor/models/resource_recommendation_base_py3.py create mode 100644 azure-mgmt-advisor/azure/mgmt/advisor/models/short_description_py3.py create mode 100644 azure-mgmt-advisor/azure/mgmt/advisor/models/suppression_contract_py3.py diff --git a/azure-mgmt-advisor/azure/mgmt/advisor/advisor_management_client.py b/azure-mgmt-advisor/azure/mgmt/advisor/advisor_management_client.py index 0b48d2c719d5..0b162d69bd1b 100644 --- a/azure-mgmt-advisor/azure/mgmt/advisor/advisor_management_client.py +++ b/azure-mgmt-advisor/azure/mgmt/advisor/advisor_management_client.py @@ -9,7 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.service_client import ServiceClient +from msrest.service_client import SDKClient from msrest import Serializer, Deserializer from msrestazure import AzureConfiguration from .version import VERSION @@ -52,7 +52,7 @@ def __init__( self.subscription_id = subscription_id -class AdvisorManagementClient(object): +class AdvisorManagementClient(SDKClient): """REST APIs for Azure Advisor :ivar config: Configuration for client. @@ -79,7 +79,7 @@ def __init__( self, credentials, subscription_id, base_url=None): self.config = AdvisorManagementClientConfiguration(credentials, subscription_id, base_url) - self._client = ServiceClient(self.config.credentials, self.config) + 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' diff --git a/azure-mgmt-advisor/azure/mgmt/advisor/models/__init__.py b/azure-mgmt-advisor/azure/mgmt/advisor/models/__init__.py index 63972056a984..45155f314ad3 100644 --- a/azure-mgmt-advisor/azure/mgmt/advisor/models/__init__.py +++ b/azure-mgmt-advisor/azure/mgmt/advisor/models/__init__.py @@ -9,15 +9,26 @@ # regenerated. # -------------------------------------------------------------------------- -from .config_data_properties import ConfigDataProperties -from .config_data import ConfigData -from .arm_error_response_body import ARMErrorResponseBody -from .short_description import ShortDescription -from .resource_recommendation_base import ResourceRecommendationBase -from .resource import Resource -from .operation_display_info import OperationDisplayInfo -from .operation_entity import OperationEntity -from .suppression_contract import SuppressionContract +try: + from .config_data_properties_py3 import ConfigDataProperties + from .config_data_py3 import ConfigData + from .arm_error_response_body_py3 import ARMErrorResponseBody + from .short_description_py3 import ShortDescription + from .resource_recommendation_base_py3 import ResourceRecommendationBase + from .resource_py3 import Resource + from .operation_display_info_py3 import OperationDisplayInfo + from .operation_entity_py3 import OperationEntity + from .suppression_contract_py3 import SuppressionContract +except (SyntaxError, ImportError): + from .config_data_properties import ConfigDataProperties + from .config_data import ConfigData + from .arm_error_response_body import ARMErrorResponseBody + from .short_description import ShortDescription + from .resource_recommendation_base import ResourceRecommendationBase + from .resource import Resource + from .operation_display_info import OperationDisplayInfo + from .operation_entity import OperationEntity + from .suppression_contract import SuppressionContract from .config_data_paged import ConfigDataPaged from .resource_recommendation_base_paged import ResourceRecommendationBasePaged from .operation_entity_paged import OperationEntityPaged diff --git a/azure-mgmt-advisor/azure/mgmt/advisor/models/advisor_management_client_enums.py b/azure-mgmt-advisor/azure/mgmt/advisor/models/advisor_management_client_enums.py index 835a92ce544d..477dbe954da5 100644 --- a/azure-mgmt-advisor/azure/mgmt/advisor/models/advisor_management_client_enums.py +++ b/azure-mgmt-advisor/azure/mgmt/advisor/models/advisor_management_client_enums.py @@ -12,7 +12,7 @@ from enum import Enum -class Category(Enum): +class Category(str, Enum): high_availability = "HighAvailability" security = "Security" @@ -20,14 +20,14 @@ class Category(Enum): cost = "Cost" -class Impact(Enum): +class Impact(str, Enum): high = "High" medium = "Medium" low = "Low" -class Risk(Enum): +class Risk(str, Enum): error = "Error" warning = "Warning" diff --git a/azure-mgmt-advisor/azure/mgmt/advisor/models/arm_error_response_body.py b/azure-mgmt-advisor/azure/mgmt/advisor/models/arm_error_response_body.py index 5bf889bbbd27..ae0fff677a8f 100644 --- a/azure-mgmt-advisor/azure/mgmt/advisor/models/arm_error_response_body.py +++ b/azure-mgmt-advisor/azure/mgmt/advisor/models/arm_error_response_body.py @@ -28,7 +28,7 @@ class ARMErrorResponseBody(Model): 'code': {'key': 'code', 'type': 'str'}, } - def __init__(self, message=None, code=None): - super(ARMErrorResponseBody, self).__init__() - self.message = message - self.code = code + def __init__(self, **kwargs): + super(ARMErrorResponseBody, self).__init__(**kwargs) + self.message = kwargs.get('message', None) + self.code = kwargs.get('code', None) diff --git a/azure-mgmt-advisor/azure/mgmt/advisor/models/arm_error_response_body_py3.py b/azure-mgmt-advisor/azure/mgmt/advisor/models/arm_error_response_body_py3.py new file mode 100644 index 000000000000..1a79f9387110 --- /dev/null +++ b/azure-mgmt-advisor/azure/mgmt/advisor/models/arm_error_response_body_py3.py @@ -0,0 +1,34 @@ +# 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 ARMErrorResponseBody(Model): + """ARM error response body. + + :param message: Gets or sets the string that describes the error in detail + and provides debugging information. + :type message: str + :param code: Gets or sets the string that can be used to programmatically + identify the error. + :type code: str + """ + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + } + + def __init__(self, *, message: str=None, code: str=None, **kwargs) -> None: + super(ARMErrorResponseBody, self).__init__(**kwargs) + self.message = message + self.code = code diff --git a/azure-mgmt-advisor/azure/mgmt/advisor/models/config_data.py b/azure-mgmt-advisor/azure/mgmt/advisor/models/config_data.py index 3d4039cf76d6..534a0e11eb79 100644 --- a/azure-mgmt-advisor/azure/mgmt/advisor/models/config_data.py +++ b/azure-mgmt-advisor/azure/mgmt/advisor/models/config_data.py @@ -32,9 +32,9 @@ class ConfigData(Model): 'properties': {'key': 'properties', 'type': 'ConfigDataProperties'}, } - def __init__(self, id=None, type=None, name=None, properties=None): - super(ConfigData, self).__init__() - self.id = id - self.type = type - self.name = name - self.properties = properties + 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) diff --git a/azure-mgmt-advisor/azure/mgmt/advisor/models/config_data_properties.py b/azure-mgmt-advisor/azure/mgmt/advisor/models/config_data_properties.py index 9e5d1e0217f8..cc0303d1c606 100644 --- a/azure-mgmt-advisor/azure/mgmt/advisor/models/config_data_properties.py +++ b/azure-mgmt-advisor/azure/mgmt/advisor/models/config_data_properties.py @@ -33,8 +33,8 @@ class ConfigDataProperties(Model): 'low_cpu_threshold': {'key': 'low_cpu_threshold', 'type': 'str'}, } - def __init__(self, additional_properties=None, exclude=None, low_cpu_threshold=None): - super(ConfigDataProperties, self).__init__() - self.additional_properties = additional_properties - self.exclude = exclude - self.low_cpu_threshold = low_cpu_threshold + def __init__(self, **kwargs): + super(ConfigDataProperties, self).__init__(**kwargs) + self.additional_properties = kwargs.get('additional_properties', None) + self.exclude = kwargs.get('exclude', None) + self.low_cpu_threshold = kwargs.get('low_cpu_threshold', None) diff --git a/azure-mgmt-advisor/azure/mgmt/advisor/models/config_data_properties_py3.py b/azure-mgmt-advisor/azure/mgmt/advisor/models/config_data_properties_py3.py new file mode 100644 index 000000000000..f52c01d6dafe --- /dev/null +++ b/azure-mgmt-advisor/azure/mgmt/advisor/models/config_data_properties_py3.py @@ -0,0 +1,40 @@ +# 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 ConfigDataProperties(Model): + """The list of property name/value pairs. + + :param additional_properties: Unmatched properties from the message are + deserialized this collection + :type additional_properties: dict[str, object] + :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 + """ + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'exclude': {'key': 'exclude', 'type': 'bool'}, + 'low_cpu_threshold': {'key': 'low_cpu_threshold', 'type': 'str'}, + } + + 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 + self.exclude = exclude + self.low_cpu_threshold = low_cpu_threshold diff --git a/azure-mgmt-advisor/azure/mgmt/advisor/models/config_data_py3.py b/azure-mgmt-advisor/azure/mgmt/advisor/models/config_data_py3.py new file mode 100644 index 000000000000..c8e7c45215c4 --- /dev/null +++ b/azure-mgmt-advisor/azure/mgmt/advisor/models/config_data_py3.py @@ -0,0 +1,40 @@ +# 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 ConfigData(Model): + """The Advisor configuration data structure. + + :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 + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ConfigDataProperties'}, + } + + 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 diff --git a/azure-mgmt-advisor/azure/mgmt/advisor/models/operation_display_info.py b/azure-mgmt-advisor/azure/mgmt/advisor/models/operation_display_info.py index b338bd668c8e..d4f103558727 100644 --- a/azure-mgmt-advisor/azure/mgmt/advisor/models/operation_display_info.py +++ b/azure-mgmt-advisor/azure/mgmt/advisor/models/operation_display_info.py @@ -33,9 +33,9 @@ class OperationDisplayInfo(Model): 'resource': {'key': 'resource', 'type': 'str'}, } - def __init__(self, description=None, operation=None, provider=None, resource=None): - super(OperationDisplayInfo, self).__init__() - self.description = description - self.operation = operation - self.provider = provider - self.resource = resource + def __init__(self, **kwargs): + super(OperationDisplayInfo, self).__init__(**kwargs) + self.description = kwargs.get('description', None) + self.operation = kwargs.get('operation', None) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) diff --git a/azure-mgmt-advisor/azure/mgmt/advisor/models/operation_display_info_py3.py b/azure-mgmt-advisor/azure/mgmt/advisor/models/operation_display_info_py3.py new file mode 100644 index 000000000000..24ca7bb48ec2 --- /dev/null +++ b/azure-mgmt-advisor/azure/mgmt/advisor/models/operation_display_info_py3.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 OperationDisplayInfo(Model): + """The operation supported by Advisor. + + :param description: The description of the operation. + :type description: str + :param operation: The action that users can perform, based on their + permission level. + :type operation: str + :param provider: Service provider: Microsoft Advisor. + :type provider: str + :param resource: Resource on which the operation is performed. + :type resource: str + """ + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + } + + def __init__(self, *, description: str=None, operation: str=None, provider: str=None, resource: str=None, **kwargs) -> None: + super(OperationDisplayInfo, self).__init__(**kwargs) + self.description = description + self.operation = operation + self.provider = provider + self.resource = resource diff --git a/azure-mgmt-advisor/azure/mgmt/advisor/models/operation_entity.py b/azure-mgmt-advisor/azure/mgmt/advisor/models/operation_entity.py index 974966de9aa6..9872949cbe52 100644 --- a/azure-mgmt-advisor/azure/mgmt/advisor/models/operation_entity.py +++ b/azure-mgmt-advisor/azure/mgmt/advisor/models/operation_entity.py @@ -26,7 +26,7 @@ class OperationEntity(Model): 'display': {'key': 'display', 'type': 'OperationDisplayInfo'}, } - def __init__(self, name=None, display=None): - super(OperationEntity, self).__init__() - self.name = name - self.display = display + def __init__(self, **kwargs): + super(OperationEntity, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', None) diff --git a/azure-mgmt-advisor/azure/mgmt/advisor/models/operation_entity_py3.py b/azure-mgmt-advisor/azure/mgmt/advisor/models/operation_entity_py3.py new file mode 100644 index 000000000000..24c1b1b6eb82 --- /dev/null +++ b/azure-mgmt-advisor/azure/mgmt/advisor/models/operation_entity_py3.py @@ -0,0 +1,32 @@ +# 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 OperationEntity(Model): + """The operation supported by Advisor. + + :param name: Operation name: {provider}/{resource}/{operation}. + :type name: str + :param display: The operation supported by Advisor. + :type display: ~azure.mgmt.advisor.models.OperationDisplayInfo + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplayInfo'}, + } + + def __init__(self, *, name: str=None, display=None, **kwargs) -> None: + super(OperationEntity, self).__init__(**kwargs) + self.name = name + self.display = display diff --git a/azure-mgmt-advisor/azure/mgmt/advisor/models/resource.py b/azure-mgmt-advisor/azure/mgmt/advisor/models/resource.py index 92c78390e734..f43f76f15a74 100644 --- a/azure-mgmt-advisor/azure/mgmt/advisor/models/resource.py +++ b/azure-mgmt-advisor/azure/mgmt/advisor/models/resource.py @@ -38,8 +38,8 @@ class Resource(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self): - super(Resource, self).__init__() + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) self.id = None self.name = None self.type = None diff --git a/azure-mgmt-advisor/azure/mgmt/advisor/models/resource_py3.py b/azure-mgmt-advisor/azure/mgmt/advisor/models/resource_py3.py new file mode 100644 index 000000000000..33023c8d186f --- /dev/null +++ b/azure-mgmt-advisor/azure/mgmt/advisor/models/resource_py3.py @@ -0,0 +1,45 @@ +# 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 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 diff --git a/azure-mgmt-advisor/azure/mgmt/advisor/models/resource_recommendation_base.py b/azure-mgmt-advisor/azure/mgmt/advisor/models/resource_recommendation_base.py index d00353cb69c6..b10979180171 100644 --- a/azure-mgmt-advisor/azure/mgmt/advisor/models/resource_recommendation_base.py +++ b/azure-mgmt-advisor/azure/mgmt/advisor/models/resource_recommendation_base.py @@ -73,15 +73,15 @@ class ResourceRecommendationBase(Resource): 'suppression_ids': {'key': 'properties.suppressionIds', 'type': '[str]'}, } - def __init__(self, category=None, impact=None, impacted_field=None, impacted_value=None, last_updated=None, metadata=None, recommendation_type_id=None, risk=None, short_description=None, suppression_ids=None): - super(ResourceRecommendationBase, self).__init__() - self.category = category - self.impact = impact - self.impacted_field = impacted_field - self.impacted_value = impacted_value - self.last_updated = last_updated - self.metadata = metadata - self.recommendation_type_id = recommendation_type_id - self.risk = risk - self.short_description = short_description - self.suppression_ids = suppression_ids + def __init__(self, **kwargs): + super(ResourceRecommendationBase, self).__init__(**kwargs) + self.category = kwargs.get('category', None) + self.impact = kwargs.get('impact', None) + self.impacted_field = kwargs.get('impacted_field', None) + self.impacted_value = kwargs.get('impacted_value', None) + self.last_updated = kwargs.get('last_updated', None) + self.metadata = kwargs.get('metadata', None) + self.recommendation_type_id = kwargs.get('recommendation_type_id', None) + self.risk = kwargs.get('risk', None) + self.short_description = kwargs.get('short_description', None) + self.suppression_ids = kwargs.get('suppression_ids', None) diff --git a/azure-mgmt-advisor/azure/mgmt/advisor/models/resource_recommendation_base_py3.py b/azure-mgmt-advisor/azure/mgmt/advisor/models/resource_recommendation_base_py3.py new file mode 100644 index 000000000000..bb42375553e8 --- /dev/null +++ b/azure-mgmt-advisor/azure/mgmt/advisor/models/resource_recommendation_base_py3.py @@ -0,0 +1,87 @@ +# 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 .resource_py3 import Resource + + +class ResourceRecommendationBase(Resource): + """Advisor Recommendation. + + 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 category: The category of the recommendation. Possible values + include: 'HighAvailability', 'Security', 'Performance', 'Cost' + :type category: str or ~azure.mgmt.advisor.models.Category + :param impact: The business impact of the recommendation. Possible values + include: 'High', 'Medium', 'Low' + :type impact: str or ~azure.mgmt.advisor.models.Impact + :param impacted_field: The resource type identified by Advisor. + :type impacted_field: str + :param impacted_value: The resource identified by Advisor. + :type impacted_value: str + :param last_updated: The most recent time that Advisor checked the + validity of the recommendation. + :type last_updated: datetime + :param metadata: The recommendation metadata. + :type metadata: dict[str, object] + :param recommendation_type_id: The recommendation-type GUID. + :type recommendation_type_id: str + :param risk: The potential risk of not implementing the recommendation. + Possible values include: 'Error', 'Warning', 'None' + :type risk: str or ~azure.mgmt.advisor.models.Risk + :param short_description: A summary of the recommendation. + :type short_description: ~azure.mgmt.advisor.models.ShortDescription + :param suppression_ids: The list of snoozed and dismissed rules for the + recommendation. + :type suppression_ids: list[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'}, + 'category': {'key': 'properties.category', 'type': 'str'}, + 'impact': {'key': 'properties.impact', 'type': 'str'}, + 'impacted_field': {'key': 'properties.impactedField', 'type': 'str'}, + 'impacted_value': {'key': 'properties.impactedValue', 'type': 'str'}, + 'last_updated': {'key': 'properties.lastUpdated', 'type': 'iso-8601'}, + 'metadata': {'key': 'properties.metadata', 'type': '{object}'}, + 'recommendation_type_id': {'key': 'properties.recommendationTypeId', 'type': 'str'}, + 'risk': {'key': 'properties.risk', 'type': 'str'}, + 'short_description': {'key': 'properties.shortDescription', 'type': 'ShortDescription'}, + 'suppression_ids': {'key': 'properties.suppressionIds', 'type': '[str]'}, + } + + def __init__(self, *, category=None, impact=None, impacted_field: str=None, impacted_value: str=None, last_updated=None, metadata=None, recommendation_type_id: str=None, risk=None, short_description=None, suppression_ids=None, **kwargs) -> None: + super(ResourceRecommendationBase, self).__init__(**kwargs) + self.category = category + self.impact = impact + self.impacted_field = impacted_field + self.impacted_value = impacted_value + self.last_updated = last_updated + self.metadata = metadata + self.recommendation_type_id = recommendation_type_id + self.risk = risk + self.short_description = short_description + self.suppression_ids = suppression_ids diff --git a/azure-mgmt-advisor/azure/mgmt/advisor/models/short_description.py b/azure-mgmt-advisor/azure/mgmt/advisor/models/short_description.py index ba93541a0671..f2c722033a30 100644 --- a/azure-mgmt-advisor/azure/mgmt/advisor/models/short_description.py +++ b/azure-mgmt-advisor/azure/mgmt/advisor/models/short_description.py @@ -26,7 +26,7 @@ class ShortDescription(Model): 'solution': {'key': 'solution', 'type': 'str'}, } - def __init__(self, problem=None, solution=None): - super(ShortDescription, self).__init__() - self.problem = problem - self.solution = solution + def __init__(self, **kwargs): + super(ShortDescription, self).__init__(**kwargs) + self.problem = kwargs.get('problem', None) + self.solution = kwargs.get('solution', None) diff --git a/azure-mgmt-advisor/azure/mgmt/advisor/models/short_description_py3.py b/azure-mgmt-advisor/azure/mgmt/advisor/models/short_description_py3.py new file mode 100644 index 000000000000..ed3b7bd29aa2 --- /dev/null +++ b/azure-mgmt-advisor/azure/mgmt/advisor/models/short_description_py3.py @@ -0,0 +1,32 @@ +# 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 ShortDescription(Model): + """A summary of the recommendation. + + :param problem: The issue or opportunity identified by the recommendation. + :type problem: str + :param solution: The remediation action suggested by the recommendation. + :type solution: str + """ + + _attribute_map = { + 'problem': {'key': 'problem', 'type': 'str'}, + 'solution': {'key': 'solution', 'type': 'str'}, + } + + def __init__(self, *, problem: str=None, solution: str=None, **kwargs) -> None: + super(ShortDescription, self).__init__(**kwargs) + self.problem = problem + self.solution = solution diff --git a/azure-mgmt-advisor/azure/mgmt/advisor/models/suppression_contract.py b/azure-mgmt-advisor/azure/mgmt/advisor/models/suppression_contract.py index 358d6c239e36..ff9cc1012dbd 100644 --- a/azure-mgmt-advisor/azure/mgmt/advisor/models/suppression_contract.py +++ b/azure-mgmt-advisor/azure/mgmt/advisor/models/suppression_contract.py @@ -45,7 +45,7 @@ class SuppressionContract(Resource): 'ttl': {'key': 'properties.ttl', 'type': 'str'}, } - def __init__(self, suppression_id=None, ttl=None): - super(SuppressionContract, self).__init__() - self.suppression_id = suppression_id - self.ttl = ttl + def __init__(self, **kwargs): + super(SuppressionContract, self).__init__(**kwargs) + self.suppression_id = kwargs.get('suppression_id', None) + self.ttl = kwargs.get('ttl', None) diff --git a/azure-mgmt-advisor/azure/mgmt/advisor/models/suppression_contract_py3.py b/azure-mgmt-advisor/azure/mgmt/advisor/models/suppression_contract_py3.py new file mode 100644 index 000000000000..de2985eea108 --- /dev/null +++ b/azure-mgmt-advisor/azure/mgmt/advisor/models/suppression_contract_py3.py @@ -0,0 +1,51 @@ +# 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 .resource_py3 import Resource + + +class SuppressionContract(Resource): + """The details of the snoozed or dismissed rule; for example, the duration, + name, and GUID associated with the rule. + + 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 suppression_id: The GUID of the suppression. + :type suppression_id: str + :param ttl: The duration for which the suppression is valid. + :type ttl: 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'}, + 'suppression_id': {'key': 'properties.suppressionId', 'type': 'str'}, + 'ttl': {'key': 'properties.ttl', 'type': 'str'}, + } + + def __init__(self, *, suppression_id: str=None, ttl: str=None, **kwargs) -> None: + super(SuppressionContract, self).__init__(**kwargs) + self.suppression_id = suppression_id + self.ttl = ttl diff --git a/azure-mgmt-advisor/azure/mgmt/advisor/operations/configurations_operations.py b/azure-mgmt-advisor/azure/mgmt/advisor/operations/configurations_operations.py index 9a03137ea165..04586c6d5864 100644 --- a/azure-mgmt-advisor/azure/mgmt/advisor/operations/configurations_operations.py +++ b/azure-mgmt-advisor/azure/mgmt/advisor/operations/configurations_operations.py @@ -22,7 +22,7 @@ class ConfigurationsOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :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". """ @@ -58,7 +58,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations' + url = self.list_by_subscription.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } @@ -103,6 +103,7 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations'} def create_in_subscription( self, config_contract, custom_headers=None, raw=False, **operation_config): @@ -125,7 +126,7 @@ def create_in_subscription( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations' + url = self.create_in_subscription.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } @@ -168,6 +169,7 @@ def create_in_subscription( return client_raw_response return deserialized + create_in_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations'} def list_by_resource_group( self, resource_group, custom_headers=None, raw=False, **operation_config): @@ -189,7 +191,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations' + url = self.list_by_resource_group.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str') @@ -235,6 +237,7 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations'} def create_in_resource_group( self, config_contract, resource_group, custom_headers=None, raw=False, **operation_config): @@ -256,7 +259,7 @@ def create_in_resource_group( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations' + url = self.create_in_resource_group.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str') @@ -300,3 +303,4 @@ def create_in_resource_group( return client_raw_response return deserialized + create_in_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations'} diff --git a/azure-mgmt-advisor/azure/mgmt/advisor/operations/operations.py b/azure-mgmt-advisor/azure/mgmt/advisor/operations/operations.py index b1c46006013e..d21c47368ac2 100644 --- a/azure-mgmt-advisor/azure/mgmt/advisor/operations/operations.py +++ b/azure-mgmt-advisor/azure/mgmt/advisor/operations/operations.py @@ -22,7 +22,7 @@ class Operations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :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". """ @@ -55,7 +55,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/providers/Microsoft.Advisor/operations' + url = self.list.metadata['url'] # Construct parameters query_parameters = {} @@ -96,3 +96,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list.metadata = {'url': '/providers/Microsoft.Advisor/operations'} diff --git a/azure-mgmt-advisor/azure/mgmt/advisor/operations/recommendations_operations.py b/azure-mgmt-advisor/azure/mgmt/advisor/operations/recommendations_operations.py index fc25a7a6ef45..a518234151a2 100644 --- a/azure-mgmt-advisor/azure/mgmt/advisor/operations/recommendations_operations.py +++ b/azure-mgmt-advisor/azure/mgmt/advisor/operations/recommendations_operations.py @@ -12,8 +12,6 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError -from msrest.exceptions import DeserializationError -from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -24,7 +22,7 @@ class RecommendationsOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :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". """ @@ -55,7 +53,7 @@ def generate( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations' + url = self.generate.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } @@ -91,12 +89,29 @@ def generate( 'Retry-After': 'str', }) return client_raw_response + generate.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations'} - - def _get_generate_status_initial( + def get_generate_status( self, operation_id, custom_headers=None, raw=False, **operation_config): + """Retrieves the status of the recommendation computation or generation + process. Invoke this API after calling the generation recommendation. + The URI of this API is returned in the Location field of the response + header. + + :param operation_id: The operation ID, which can be found from the + Location field in the generate recommendation response header. + :type operation_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ # Construct URL - url = '/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations/{operationId}' + url = self.get_generate_status.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'operationId': self._serialize.url("operation_id", operation_id, 'str') @@ -129,66 +144,7 @@ def _get_generate_status_initial( if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response - - def get_generate_status( - self, operation_id, custom_headers=None, raw=False, **operation_config): - """Retrieves the status of the recommendation computation or generation - process. Invoke this API after calling the generation recommendation. - The URI of this API is returned in the Location field of the response - header. - - :param operation_id: The operation ID, which can be found from the - Location field in the generate recommendation response header. - :type operation_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - raw_result = self._get_generate_status_initial( - operation_id=operation_id, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - if raw: - return raw_result - - # Construct and send request - def long_running_send(): - return raw_result.response - - def get_long_running_status(status_link, headers=None): - - request = self._client.get(status_link) - if headers: - request.headers.update(headers) - header_parameters = {} - header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] - return self._client.send( - request, header_parameters, stream=False, **operation_config) - - def get_long_running_output(response): - - if response.status_code not in [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 - - long_running_operation_timeout = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - return AzureOperationPoller( - long_running_send, get_long_running_output, - get_long_running_status, long_running_operation_timeout) + get_generate_status.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations/{operationId}'} def list( self, filter=None, top=None, skip_token=None, custom_headers=None, raw=False, **operation_config): @@ -217,7 +173,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/recommendations' + url = self.list.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } @@ -268,6 +224,7 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/recommendations'} def get( self, resource_uri, recommendation_id, custom_headers=None, raw=False, **operation_config): @@ -289,7 +246,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}' + url = self.get.metadata['url'] path_format_arguments = { 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str'), 'recommendationId': self._serialize.url("recommendation_id", recommendation_id, 'str') @@ -329,3 +286,4 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}'} diff --git a/azure-mgmt-advisor/azure/mgmt/advisor/operations/suppressions_operations.py b/azure-mgmt-advisor/azure/mgmt/advisor/operations/suppressions_operations.py index 6c7806bc57e9..d3a9e85d47c8 100644 --- a/azure-mgmt-advisor/azure/mgmt/advisor/operations/suppressions_operations.py +++ b/azure-mgmt-advisor/azure/mgmt/advisor/operations/suppressions_operations.py @@ -22,7 +22,7 @@ class SuppressionsOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :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". """ @@ -59,7 +59,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}' + url = self.get.metadata['url'] path_format_arguments = { 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str'), 'recommendationId': self._serialize.url("recommendation_id", recommendation_id, 'str'), @@ -100,6 +100,7 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}'} def create( self, resource_uri, recommendation_id, name, suppression_id=None, ttl=None, custom_headers=None, raw=False, **operation_config): @@ -132,7 +133,7 @@ def create( suppression_contract = models.SuppressionContract(suppression_id=suppression_id, ttl=ttl) # Construct URL - url = '/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}' + url = self.create.metadata['url'] path_format_arguments = { 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str'), 'recommendationId': self._serialize.url("recommendation_id", recommendation_id, 'str'), @@ -177,6 +178,7 @@ def create( return client_raw_response return deserialized + create.metadata = {'url': '/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}'} def delete( self, resource_uri, recommendation_id, name, custom_headers=None, raw=False, **operation_config): @@ -201,7 +203,7 @@ def delete( :raises: :class:`CloudError` """ # Construct URL - url = '/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}' + url = self.delete.metadata['url'] path_format_arguments = { 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str'), 'recommendationId': self._serialize.url("recommendation_id", recommendation_id, 'str'), @@ -235,6 +237,7 @@ def delete( if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response + delete.metadata = {'url': '/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}'} def list( self, top=None, skip_token=None, custom_headers=None, raw=False, **operation_config): @@ -262,7 +265,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/suppressions' + url = self.list.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } @@ -311,3 +314,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/suppressions'} From f79611200ae0053d05ed724e3864dc5b8ce39510 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 6 Aug 2018 10:19:54 -0700 Subject: [PATCH 2/4] [AutoPR advisor/resource-manager] Add extended properties to recommendation model (#3015) * Generated from 2be7ef7e6f683c16e394595b2570e3e9d131e676 Add extended properties to recommendation model * Generated from 2be7ef7e6f683c16e394595b2570e3e9d131e676 Add extended properties to recommendation model --- .../models/resource_recommendation_base.py | 4 +++ .../resource_recommendation_base_py3.py | 6 ++++- .../operations/configurations_operations.py | 26 +++++++++---------- .../mgmt/advisor/operations/operations.py | 7 +++-- .../operations/recommendations_operations.py | 23 +++++++--------- .../operations/suppressions_operations.py | 24 ++++++++--------- 6 files changed, 45 insertions(+), 45 deletions(-) diff --git a/azure-mgmt-advisor/azure/mgmt/advisor/models/resource_recommendation_base.py b/azure-mgmt-advisor/azure/mgmt/advisor/models/resource_recommendation_base.py index b10979180171..39a93d0b2764 100644 --- a/azure-mgmt-advisor/azure/mgmt/advisor/models/resource_recommendation_base.py +++ b/azure-mgmt-advisor/azure/mgmt/advisor/models/resource_recommendation_base.py @@ -49,6 +49,8 @@ class ResourceRecommendationBase(Resource): :param suppression_ids: The list of snoozed and dismissed rules for the recommendation. :type suppression_ids: list[str] + :param extended_properties: Extended properties + :type extended_properties: dict[str, str] """ _validation = { @@ -71,6 +73,7 @@ class ResourceRecommendationBase(Resource): 'risk': {'key': 'properties.risk', 'type': 'str'}, 'short_description': {'key': 'properties.shortDescription', 'type': 'ShortDescription'}, 'suppression_ids': {'key': 'properties.suppressionIds', 'type': '[str]'}, + 'extended_properties': {'key': 'properties.extendedProperties', 'type': '{str}'}, } def __init__(self, **kwargs): @@ -85,3 +88,4 @@ def __init__(self, **kwargs): self.risk = kwargs.get('risk', None) self.short_description = kwargs.get('short_description', None) self.suppression_ids = kwargs.get('suppression_ids', None) + self.extended_properties = kwargs.get('extended_properties', None) diff --git a/azure-mgmt-advisor/azure/mgmt/advisor/models/resource_recommendation_base_py3.py b/azure-mgmt-advisor/azure/mgmt/advisor/models/resource_recommendation_base_py3.py index bb42375553e8..39bfd16bafef 100644 --- a/azure-mgmt-advisor/azure/mgmt/advisor/models/resource_recommendation_base_py3.py +++ b/azure-mgmt-advisor/azure/mgmt/advisor/models/resource_recommendation_base_py3.py @@ -49,6 +49,8 @@ class ResourceRecommendationBase(Resource): :param suppression_ids: The list of snoozed and dismissed rules for the recommendation. :type suppression_ids: list[str] + :param extended_properties: Extended properties + :type extended_properties: dict[str, str] """ _validation = { @@ -71,9 +73,10 @@ class ResourceRecommendationBase(Resource): 'risk': {'key': 'properties.risk', 'type': 'str'}, 'short_description': {'key': 'properties.shortDescription', 'type': 'ShortDescription'}, 'suppression_ids': {'key': 'properties.suppressionIds', 'type': '[str]'}, + 'extended_properties': {'key': 'properties.extendedProperties', 'type': '{str}'}, } - def __init__(self, *, category=None, impact=None, impacted_field: str=None, impacted_value: str=None, last_updated=None, metadata=None, recommendation_type_id: str=None, risk=None, short_description=None, suppression_ids=None, **kwargs) -> None: + def __init__(self, *, category=None, impact=None, impacted_field: str=None, impacted_value: str=None, last_updated=None, metadata=None, recommendation_type_id: str=None, risk=None, short_description=None, suppression_ids=None, extended_properties=None, **kwargs) -> None: super(ResourceRecommendationBase, self).__init__(**kwargs) self.category = category self.impact = impact @@ -85,3 +88,4 @@ def __init__(self, *, category=None, impact=None, impacted_field: str=None, impa self.risk = risk self.short_description = short_description self.suppression_ids = suppression_ids + self.extended_properties = extended_properties diff --git a/azure-mgmt-advisor/azure/mgmt/advisor/operations/configurations_operations.py b/azure-mgmt-advisor/azure/mgmt/advisor/operations/configurations_operations.py index 04586c6d5864..93978f2d8cbe 100644 --- a/azure-mgmt-advisor/azure/mgmt/advisor/operations/configurations_operations.py +++ b/azure-mgmt-advisor/azure/mgmt/advisor/operations/configurations_operations.py @@ -74,7 +74,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -83,9 +83,8 @@ def internal_paging(next_link=None, raw=False): 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, stream=False, **operation_config) + 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) @@ -138,6 +137,7 @@ def create_in_subscription( # 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()) @@ -150,9 +150,8 @@ def create_in_subscription( body_content = self._serialize.body(config_contract, 'ConfigData') # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + 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) @@ -208,7 +207,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -217,9 +216,8 @@ def internal_paging(next_link=None, raw=False): 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, stream=False, **operation_config) + 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) @@ -272,6 +270,7 @@ def create_in_resource_group( # 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()) @@ -284,9 +283,8 @@ def create_in_resource_group( body_content = self._serialize.body(config_contract, 'ConfigData') # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + 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) diff --git a/azure-mgmt-advisor/azure/mgmt/advisor/operations/operations.py b/azure-mgmt-advisor/azure/mgmt/advisor/operations/operations.py index d21c47368ac2..25ba76f97f97 100644 --- a/azure-mgmt-advisor/azure/mgmt/advisor/operations/operations.py +++ b/azure-mgmt-advisor/azure/mgmt/advisor/operations/operations.py @@ -67,7 +67,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -76,9 +76,8 @@ def internal_paging(next_link=None, raw=False): 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, stream=False, **operation_config) + 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) diff --git a/azure-mgmt-advisor/azure/mgmt/advisor/operations/recommendations_operations.py b/azure-mgmt-advisor/azure/mgmt/advisor/operations/recommendations_operations.py index a518234151a2..7eb288b64270 100644 --- a/azure-mgmt-advisor/azure/mgmt/advisor/operations/recommendations_operations.py +++ b/azure-mgmt-advisor/azure/mgmt/advisor/operations/recommendations_operations.py @@ -65,7 +65,6 @@ def generate( # 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: @@ -74,8 +73,8 @@ def generate( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [202]: exp = CloudError(response) @@ -124,7 +123,6 @@ def get_generate_status( # 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: @@ -133,8 +131,8 @@ def get_generate_status( 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, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [202, 204]: exp = CloudError(response) @@ -195,7 +193,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -204,9 +202,8 @@ def internal_paging(next_link=None, raw=False): 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, stream=False, **operation_config) + 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) @@ -259,7 +256,7 @@ def get( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -268,8 +265,8 @@ def get( 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, stream=False, **operation_config) + 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) diff --git a/azure-mgmt-advisor/azure/mgmt/advisor/operations/suppressions_operations.py b/azure-mgmt-advisor/azure/mgmt/advisor/operations/suppressions_operations.py index d3a9e85d47c8..e9bdb9853ff6 100644 --- a/azure-mgmt-advisor/azure/mgmt/advisor/operations/suppressions_operations.py +++ b/azure-mgmt-advisor/azure/mgmt/advisor/operations/suppressions_operations.py @@ -73,7 +73,7 @@ def get( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -82,8 +82,8 @@ def get( 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, stream=False, **operation_config) + 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) @@ -147,6 +147,7 @@ def create( # 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()) @@ -159,9 +160,8 @@ def create( body_content = self._serialize.body(suppression_contract, 'SuppressionContract') # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + 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 [200]: exp = CloudError(response) @@ -217,7 +217,6 @@ def delete( # 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: @@ -226,8 +225,8 @@ def delete( 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) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [204]: exp = CloudError(response) @@ -285,7 +284,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -294,9 +293,8 @@ def internal_paging(next_link=None, raw=False): 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, stream=False, **operation_config) + 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) From 2e547ef1982bc58f46a683574ee1fd1e85a80bc1 Mon Sep 17 00:00:00 2001 From: Laurent Mazuel Date: Mon, 15 Oct 2018 10:44:06 -0700 Subject: [PATCH 3/4] Packaging --- azure-mgmt-advisor/HISTORY.rst | 38 +++++++++++++++++++ .../azure/mgmt/advisor/version.py | 2 +- azure-mgmt-advisor/sdk_packaging.toml | 2 +- 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/azure-mgmt-advisor/HISTORY.rst b/azure-mgmt-advisor/HISTORY.rst index 7034a2974528..0e10938bf0df 100644 --- a/azure-mgmt-advisor/HISTORY.rst +++ b/azure-mgmt-advisor/HISTORY.rst @@ -3,6 +3,44 @@ Release History =============== +2.0.0 (2018-10-15) +++++++++++++++++++ + +**Features** + +- Model ResourceRecommendationBase has a new parameter extended_properties +- Client class can be used as a context manager to keep the underlying HTTP session open for performance + +**General Breaking changes** + +This version uses a next-generation code generator that *might* introduce breaking changes. + +- Model signatures now use only keyword-argument syntax. All positional arguments must be re-written as keyword-arguments. + To keep auto-completion in most cases, models are now generated for Python 2 and Python 3. Python 3 uses the "*" syntax for keyword-only arguments. +- Enum types now use the "str" mixin (class AzureEnum(str, Enum)) to improve the behavior when unrecognized enum values are encountered. + While this is not a breaking change, the distinctions are important, and are documented here: + https://docs.python.org/3/library/enum.html#others + At a glance: + + - "is" should not be used at all. + - "format" will return the string value, where "%s" string formatting will return `NameOfEnum.stringvalue`. Format syntax should be prefered. + +- New Long Running Operation: + + - Return type changes from `msrestazure.azure_operation.AzureOperationPoller` to `msrest.polling.LROPoller`. External API is the same. + - Return type is now **always** a `msrest.polling.LROPoller`, regardless of the optional parameters used. + - The behavior has changed when using `raw=True`. Instead of returning the initial call result as `ClientRawResponse`, + without polling, now this returns an LROPoller. After polling, the final resource will be returned as a `ClientRawResponse`. + - New `polling` parameter. The default behavior is `Polling=True` which will poll using ARM algorithm. When `Polling=False`, + the response of the initial call will be returned without polling. + - `polling` parameter accepts instances of subclasses of `msrest.polling.PollingMethod`. + - `add_done_callback` will no longer raise if called after polling is finished, but will instead execute the callback right away. + +**Note** + +- azure-mgmt-nspkg is not installed anymore on Python 3 (PEP420-based namespace package) + + 1.0.1 (2018-02-13) ++++++++++++++++++ diff --git a/azure-mgmt-advisor/azure/mgmt/advisor/version.py b/azure-mgmt-advisor/azure/mgmt/advisor/version.py index 44e69c49c178..53c4c7ea05e8 100644 --- a/azure-mgmt-advisor/azure/mgmt/advisor/version.py +++ b/azure-mgmt-advisor/azure/mgmt/advisor/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.1" +VERSION = "2.0.0" diff --git a/azure-mgmt-advisor/sdk_packaging.toml b/azure-mgmt-advisor/sdk_packaging.toml index 861b42f1ee21..443082b5d776 100644 --- a/azure-mgmt-advisor/sdk_packaging.toml +++ b/azure-mgmt-advisor/sdk_packaging.toml @@ -3,5 +3,5 @@ package_name = "azure-mgmt-advisor" package_nspkg = "azure-mgmt-nspkg" package_pprint_name = "Advisor" package_doc_id = "advisor" -is_stable = false +is_stable = true is_arm = true From dddd766e0738a9d44f50500de60f33cc87d50a6f Mon Sep 17 00:00:00 2001 From: azuresdkci Date: Mon, 15 Oct 2018 17:48:48 +0000 Subject: [PATCH 4/4] Packaging update of azure-mgmt-advisor --- azure-mgmt-advisor/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-mgmt-advisor/setup.py b/azure-mgmt-advisor/setup.py index 0a41844d4184..b762f21eae88 100644 --- a/azure-mgmt-advisor/setup.py +++ b/azure-mgmt-advisor/setup.py @@ -58,7 +58,7 @@ author_email='azpysdkhelp@microsoft.com', url='https://github.com/Azure/azure-sdk-for-python', classifiers=[ - 'Development Status :: 4 - Beta', + 'Development Status :: 5 - Production/Stable', 'Programming Language :: Python', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7',