Skip to content
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
8 changes: 8 additions & 0 deletions azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@
from .trigger_condition_py3 import TriggerCondition
from .az_ns_action_group_py3 import AzNsActionGroup
from .alerting_action_py3 import AlertingAction
from .metric_namespace_name_py3 import MetricNamespaceName
from .metric_namespace_py3 import MetricNamespace
except (SyntaxError, ImportError):
from .resource import Resource
from .scale_capacity import ScaleCapacity
Expand Down Expand Up @@ -203,6 +205,8 @@
from .trigger_condition import TriggerCondition
from .az_ns_action_group import AzNsActionGroup
from .alerting_action import AlertingAction
from .metric_namespace_name import MetricNamespaceName
from .metric_namespace import MetricNamespace
from .autoscale_setting_resource_paged import AutoscaleSettingResourcePaged
from .incident_paged import IncidentPaged
from .alert_rule_resource_paged import AlertRuleResourcePaged
Expand All @@ -214,6 +218,7 @@
from .metric_definition_paged import MetricDefinitionPaged
from .metric_alert_resource_paged import MetricAlertResourcePaged
from .log_search_rule_resource_paged import LogSearchRuleResourcePaged
from .metric_namespace_paged import MetricNamespacePaged
from .monitor_management_client_enums import (
MetricStatisticType,
TimeAggregationType,
Expand Down Expand Up @@ -335,6 +340,8 @@
'TriggerCondition',
'AzNsActionGroup',
'AlertingAction',
'MetricNamespaceName',
'MetricNamespace',
'AutoscaleSettingResourcePaged',
'IncidentPaged',
'AlertRuleResourcePaged',
Expand All @@ -346,6 +353,7 @@
'MetricDefinitionPaged',
'MetricAlertResourcePaged',
'LogSearchRuleResourcePaged',
'MetricNamespacePaged',
'MetricStatisticType',
'TimeAggregationType',
'ComparisonOperationType',
Expand Down
41 changes: 41 additions & 0 deletions azure-mgmt-monitor/azure/mgmt/monitor/models/metric_namespace.py
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 MetricNamespace(Model):
"""Metric namespace class specifies the metadata for a metric namespace.

:param id: The ID of the metricNamespace.
:type id: str
:param type: The type of the namespace.
:type type: str
:param name: The name of the namespace.
:type name: str
:param properties: Properties which include the fully qualified namespace
name.
:type properties: ~azure.mgmt.monitor.models.MetricNamespaceName
"""

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'properties': {'key': 'properties', 'type': 'MetricNamespaceName'},
}

def __init__(self, **kwargs):
super(MetricNamespace, 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
@@ -0,0 +1,28 @@
# 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 MetricNamespaceName(Model):
"""The fully qualified metric namespace name.

:param metric_namespace_name: The metric namespace name.
:type metric_namespace_name: str
"""

_attribute_map = {
'metric_namespace_name': {'key': 'metricNamespaceName', 'type': 'str'},
}

def __init__(self, **kwargs):
super(MetricNamespaceName, self).__init__(**kwargs)
self.metric_namespace_name = kwargs.get('metric_namespace_name', None)
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 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 MetricNamespaceName(Model):
"""The fully qualified metric namespace name.

:param metric_namespace_name: The metric namespace name.
:type metric_namespace_name: str
"""

_attribute_map = {
'metric_namespace_name': {'key': 'metricNamespaceName', 'type': 'str'},
}

def __init__(self, *, metric_namespace_name: str=None, **kwargs) -> None:
super(MetricNamespaceName, self).__init__(**kwargs)
self.metric_namespace_name = metric_namespace_name
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.paging import Paged


class MetricNamespacePaged(Paged):
"""
A paging container for iterating over a list of :class:`MetricNamespace <azure.mgmt.monitor.models.MetricNamespace>` object
"""

_attribute_map = {
'next_link': {'key': 'nextLink', 'type': 'str'},
'current_page': {'key': 'value', 'type': '[MetricNamespace]'}
}

def __init__(self, *args, **kwargs):

super(MetricNamespacePaged, self).__init__(*args, **kwargs)
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 MetricNamespace(Model):
"""Metric namespace class specifies the metadata for a metric namespace.

:param id: The ID of the metricNamespace.
:type id: str
:param type: The type of the namespace.
:type type: str
:param name: The name of the namespace.
:type name: str
:param properties: Properties which include the fully qualified namespace
name.
:type properties: ~azure.mgmt.monitor.models.MetricNamespaceName
"""

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'properties': {'key': 'properties', 'type': 'MetricNamespaceName'},
}

def __init__(self, *, id: str=None, type: str=None, name: str=None, properties=None, **kwargs) -> None:
super(MetricNamespace, 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 @@ -31,6 +31,7 @@
from .operations.metric_alerts_operations import MetricAlertsOperations
from .operations.metric_alerts_status_operations import MetricAlertsStatusOperations
from .operations.scheduled_query_rules_operations import ScheduledQueryRulesOperations
from .operations.metric_namespaces_operations import MetricNamespacesOperations
from . import models


Expand Down Expand Up @@ -108,6 +109,8 @@ class MonitorManagementClient(SDKClient):
:vartype metric_alerts_status: azure.mgmt.monitor.operations.MetricAlertsStatusOperations
:ivar scheduled_query_rules: ScheduledQueryRules operations
:vartype scheduled_query_rules: azure.mgmt.monitor.operations.ScheduledQueryRulesOperations
:ivar metric_namespaces: MetricNamespaces operations
:vartype metric_namespaces: azure.mgmt.monitor.operations.MetricNamespacesOperations

:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
Expand Down Expand Up @@ -163,3 +166,5 @@ def __init__(
self._client, self.config, self._serialize, self._deserialize)
self.scheduled_query_rules = ScheduledQueryRulesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.metric_namespaces = MetricNamespacesOperations(
self._client, self.config, self._serialize, self._deserialize)
2 changes: 2 additions & 0 deletions azure-mgmt-monitor/azure/mgmt/monitor/operations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from .metric_alerts_operations import MetricAlertsOperations
from .metric_alerts_status_operations import MetricAlertsStatusOperations
from .scheduled_query_rules_operations import ScheduledQueryRulesOperations
from .metric_namespaces_operations import MetricNamespacesOperations

__all__ = [
'AutoscaleSettingsOperations',
Expand All @@ -47,4 +48,5 @@
'MetricAlertsOperations',
'MetricAlertsStatusOperations',
'ScheduledQueryRulesOperations',
'MetricNamespacesOperations',
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

import uuid
from msrest.pipeline import ClientRawResponse

from .. import models


class MetricNamespacesOperations(object):
"""MetricNamespacesOperations operations.

:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
:ivar api_version: Client Api Version. Constant value: "2017-12-01-preview".
"""

models = models

def __init__(self, client, config, serializer, deserializer):

self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.api_version = "2017-12-01-preview"

self.config = config

def list(
self, resource_uri, start_time=None, custom_headers=None, raw=False, **operation_config):
"""Lists the metric namespaces for the resource.

:param resource_uri: The identifier of the resource.
:type resource_uri: str
:param start_time: The ISO 8601 conform Date start time from which to
query for metric namespaces.
:type start_time: 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<msrest:optionsforoperations>`.
:return: An iterator like instance of MetricNamespace
:rtype:
~azure.mgmt.monitor.models.MetricNamespacePaged[~azure.mgmt.monitor.models.MetricNamespace]
:raises:
:class:`ErrorResponseException<azure.mgmt.monitor.models.ErrorResponseException>`
"""
def internal_paging(next_link=None, raw=False):

if not next_link:
# Construct URL
url = self.list.metadata['url']
path_format_arguments = {
'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True)
}
url = self._client.format_url(url, **path_format_arguments)

# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
if start_time is not None:
query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'str')

else:
url = next_link
query_parameters = {}

# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)

if response.status_code not in [200]:
raise models.ErrorResponseException(self._deserialize, response)

return response

# Deserialize response
deserialized = models.MetricNamespacePaged(internal_paging, self._deserialize.dependencies)

if raw:
header_dict = {}
client_raw_response = models.MetricNamespacePaged(internal_paging, self._deserialize.dependencies, header_dict)
return client_raw_response

return deserialized
list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metricNamespaces'}