Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,30 @@
# --------------------------------------------------------------------------

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
from ._models_py3 import OperationEntity
from ._models_py3 import Resource
from ._models_py3 import ResourceMetadata
from ._models_py3 import ResourceRecommendationBase
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
from ._models import OperationEntity
from ._models import Resource
from ._models import ResourceMetadata
from ._models import ResourceRecommendationBase
from ._models import ShortDescription
from ._models import SuppressionContract
Expand All @@ -40,20 +44,24 @@
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',
'OperationEntity',
'Resource',
'ResourceMetadata',
'ResourceRecommendationBase',
'ShortDescription',
'SuppressionContract',
Expand All @@ -63,7 +71,9 @@
'OperationEntityPaged',
'SuppressionContractPaged',
'Scenario',
'CpuThreshold',
'Category',
'DigestConfigState',
'Impact',
'Risk',
]
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
190 changes: 137 additions & 53 deletions sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/models/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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 ConfigData(Resource):
"""The Advisor configuration data structure.

class ConfigDataProperties(Model):
"""The list of property name/value pairs.
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):
Expand Down Expand Up @@ -210,37 +303,24 @@ def __init__(self, **kwargs):
self.display = kwargs.get('display', None)


class Resource(Model):
"""An Azure resource.
class ResourceMetadata(Model):
"""Recommendation resource metadata.

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 resource_id: Azure resource Id of the assessed resource
:type resource_id: str
:param source: Source from which recommendation is generated
:type source: 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'},
'resource_id': {'key': 'resourceId', 'type': 'str'},
'source': {'key': 'source', 'type': 'str'},
}

def __init__(self, **kwargs):
super(Resource, self).__init__(**kwargs)
self.id = None
self.name = None
self.type = None
super(ResourceMetadata, self).__init__(**kwargs)
self.resource_id = kwargs.get('resource_id', None)
self.source = kwargs.get('source', None)


class ResourceRecommendationBase(Resource):
Expand Down Expand Up @@ -283,6 +363,8 @@ class ResourceRecommendationBase(Resource):
:type suppression_ids: list[str]
:param extended_properties: Extended properties
:type extended_properties: dict[str, str]
:param resource_metadata: Metadata of resource that was assessed
:type resource_metadata: ~azure.mgmt.advisor.models.ResourceMetadata
"""

_validation = {
Expand All @@ -306,6 +388,7 @@ class ResourceRecommendationBase(Resource):
'short_description': {'key': 'properties.shortDescription', 'type': 'ShortDescription'},
'suppression_ids': {'key': 'properties.suppressionIds', 'type': '[str]'},
'extended_properties': {'key': 'properties.extendedProperties', 'type': '{str}'},
'resource_metadata': {'key': 'properties.resourceMetadata', 'type': 'ResourceMetadata'},
}

def __init__(self, **kwargs):
Expand All @@ -321,6 +404,7 @@ def __init__(self, **kwargs):
self.short_description = kwargs.get('short_description', None)
self.suppression_ids = kwargs.get('suppression_ids', None)
self.extended_properties = kwargs.get('extended_properties', None)
self.resource_metadata = kwargs.get('resource_metadata', None)


class ShortDescription(Model):
Expand Down
Loading