Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR] advisor/resource-manager #2843

Merged
merged 5 commits into from
Oct 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions azure-mgmt-advisor/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
++++++++++++++++++

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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'
Expand Down
29 changes: 20 additions & 9 deletions azure-mgmt-advisor/azure/mgmt/advisor/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@
from enum import Enum


class Category(Enum):
class Category(str, Enum):

high_availability = "HighAvailability"
security = "Security"
performance = "Performance"
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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
@@ -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
12 changes: 6 additions & 6 deletions azure-mgmt-advisor/azure/mgmt/advisor/models/config_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
@@ -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
40 changes: 40 additions & 0 deletions azure-mgmt-advisor/azure/mgmt/advisor/models/config_data_py3.py
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
@@ -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
Loading