diff --git a/azure-monitor/azure/monitor/__init__.py b/azure-monitor/azure/monitor/__init__.py old mode 100755 new mode 100644 diff --git a/azure-monitor/azure/monitor/models/__init__.py b/azure-monitor/azure/monitor/models/__init__.py old mode 100755 new mode 100644 index 5ade138fb829..a7a91b0fbe1d --- a/azure-monitor/azure/monitor/models/__init__.py +++ b/azure-monitor/azure/monitor/models/__init__.py @@ -18,16 +18,19 @@ from .metric_availability import MetricAvailability from .metric_definition import MetricDefinition from .metric_value import MetricValue +from .metadata_value import MetadataValue +from .time_series_element import TimeSeriesElement from .metric import Metric +from .response import Response from .usage_metric_paged import UsageMetricPaged -from .localizable_string_paged import LocalizableStringPaged from .event_data_paged import EventDataPaged +from .localizable_string_paged import LocalizableStringPaged from .metric_definition_paged import MetricDefinitionPaged -from .metric_paged import MetricPaged from .monitor_client_enums import ( EventLevel, Unit, AggregationType, + ResultType, ) __all__ = [ @@ -40,13 +43,16 @@ 'MetricAvailability', 'MetricDefinition', 'MetricValue', + 'MetadataValue', + 'TimeSeriesElement', 'Metric', + 'Response', 'UsageMetricPaged', - 'LocalizableStringPaged', 'EventDataPaged', + 'LocalizableStringPaged', 'MetricDefinitionPaged', - 'MetricPaged', 'EventLevel', 'Unit', 'AggregationType', + 'ResultType', ] diff --git a/azure-monitor/azure/monitor/models/error_response.py b/azure-monitor/azure/monitor/models/error_response.py old mode 100755 new mode 100644 diff --git a/azure-monitor/azure/monitor/models/event_data.py b/azure-monitor/azure/monitor/models/event_data.py old mode 100755 new mode 100644 diff --git a/azure-monitor/azure/monitor/models/event_data_paged.py b/azure-monitor/azure/monitor/models/event_data_paged.py old mode 100755 new mode 100644 index 3fa078fa9778..7c31363bf7c6 --- a/azure-monitor/azure/monitor/models/event_data_paged.py +++ b/azure-monitor/azure/monitor/models/event_data_paged.py @@ -14,7 +14,7 @@ class EventDataPaged(Paged): """ - A paging container for iterating over a list of EventData object + A paging container for iterating over a list of :class:`EventData ` object """ _attribute_map = { diff --git a/azure-monitor/azure/monitor/models/http_request_info.py b/azure-monitor/azure/monitor/models/http_request_info.py old mode 100755 new mode 100644 diff --git a/azure-monitor/azure/monitor/models/localizable_string.py b/azure-monitor/azure/monitor/models/localizable_string.py old mode 100755 new mode 100644 diff --git a/azure-monitor/azure/monitor/models/localizable_string_paged.py b/azure-monitor/azure/monitor/models/localizable_string_paged.py old mode 100755 new mode 100644 index 9b0fd5e7bfba..685a2913f991 --- a/azure-monitor/azure/monitor/models/localizable_string_paged.py +++ b/azure-monitor/azure/monitor/models/localizable_string_paged.py @@ -14,7 +14,7 @@ class LocalizableStringPaged(Paged): """ - A paging container for iterating over a list of LocalizableString object + A paging container for iterating over a list of :class:`LocalizableString ` object """ _attribute_map = { diff --git a/azure-monitor/azure/monitor/models/metadata_value.py b/azure-monitor/azure/monitor/models/metadata_value.py new file mode 100644 index 000000000000..822920fee9c6 --- /dev/null +++ b/azure-monitor/azure/monitor/models/metadata_value.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 MetadataValue(Model): + """Represents a metric metadata value. + + :param name: the name of the metadata. + :type name: :class:`LocalizableString + ` + :param value: the value of the metadata. + :type value: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, name=None, value=None): + self.name = name + self.value = value diff --git a/azure-monitor/azure/monitor/models/metric.py b/azure-monitor/azure/monitor/models/metric.py old mode 100755 new mode 100644 index 5aa3edbf6307..4ab30ffc13f9 --- a/azure-monitor/azure/monitor/models/metric.py +++ b/azure-monitor/azure/monitor/models/metric.py @@ -13,9 +13,9 @@ class Metric(Model): - """A set of metric values in a time range. + """The result data of a query. - :param id: the id, resourceId, of the metric. + :param id: the metric Id. :type id: str :param type: the resource type of the metric resource. :type type: str @@ -27,15 +27,18 @@ class Metric(Model): 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', 'MilliSeconds' :type unit: str or :class:`Unit ` - :param data: Array of data points representing the metric values. - :type data: list of :class:`MetricValue - ` + :param timeseries: the time series returned when a data query is + performed. + :type timeseries: list of :class:`TimeSeriesElement + ` """ _validation = { + 'id': {'required': True}, + 'type': {'required': True}, 'name': {'required': True}, 'unit': {'required': True}, - 'data': {'required': True}, + 'timeseries': {'required': True}, } _attribute_map = { @@ -43,12 +46,12 @@ class Metric(Model): 'type': {'key': 'type', 'type': 'str'}, 'name': {'key': 'name', 'type': 'LocalizableString'}, 'unit': {'key': 'unit', 'type': 'Unit'}, - 'data': {'key': 'data', 'type': '[MetricValue]'}, + 'timeseries': {'key': 'timeseries', 'type': '[TimeSeriesElement]'}, } - def __init__(self, name, unit, data, id=None, type=None): + def __init__(self, id, type, name, unit, timeseries): self.id = id self.type = type self.name = name self.unit = unit - self.data = data + self.timeseries = timeseries diff --git a/azure-monitor/azure/monitor/models/metric_availability.py b/azure-monitor/azure/monitor/models/metric_availability.py old mode 100755 new mode 100644 diff --git a/azure-monitor/azure/monitor/models/metric_definition.py b/azure-monitor/azure/monitor/models/metric_definition.py old mode 100755 new mode 100644 index 25c61f39b0ef..09b72ac7067c --- a/azure-monitor/azure/monitor/models/metric_definition.py +++ b/azure-monitor/azure/monitor/models/metric_definition.py @@ -15,6 +15,9 @@ class MetricDefinition(Model): """Metric definition class specifies the metadata for a metric. + :param is_dimension_required: Flag to indicate whether the dimension is + required. + :type is_dimension_required: bool :param resource_id: the resource identifier of the resource that emitted the metric. :type resource_id: str @@ -37,21 +40,29 @@ class MetricDefinition(Model): ` :param id: the resource identifier of the metric definition. :type id: str + :param dimensions: the name and the display name of the dimension, i.e. it + is a localizable string. + :type dimensions: list of :class:`LocalizableString + ` """ _attribute_map = { + 'is_dimension_required': {'key': 'isDimensionRequired', 'type': 'bool'}, 'resource_id': {'key': 'resourceId', 'type': 'str'}, 'name': {'key': 'name', 'type': 'LocalizableString'}, 'unit': {'key': 'unit', 'type': 'Unit'}, 'primary_aggregation_type': {'key': 'primaryAggregationType', 'type': 'AggregationType'}, 'metric_availabilities': {'key': 'metricAvailabilities', 'type': '[MetricAvailability]'}, 'id': {'key': 'id', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[LocalizableString]'}, } - def __init__(self, resource_id=None, name=None, unit=None, primary_aggregation_type=None, metric_availabilities=None, id=None): + def __init__(self, is_dimension_required=None, resource_id=None, name=None, unit=None, primary_aggregation_type=None, metric_availabilities=None, id=None, dimensions=None): + self.is_dimension_required = is_dimension_required self.resource_id = resource_id self.name = name self.unit = unit self.primary_aggregation_type = primary_aggregation_type self.metric_availabilities = metric_availabilities self.id = id + self.dimensions = dimensions diff --git a/azure-monitor/azure/monitor/models/metric_definition_paged.py b/azure-monitor/azure/monitor/models/metric_definition_paged.py old mode 100755 new mode 100644 index 8771cfa7a53c..81f40e93184b --- a/azure-monitor/azure/monitor/models/metric_definition_paged.py +++ b/azure-monitor/azure/monitor/models/metric_definition_paged.py @@ -14,7 +14,7 @@ class MetricDefinitionPaged(Paged): """ - A paging container for iterating over a list of MetricDefinition object + A paging container for iterating over a list of :class:`MetricDefinition ` object """ _attribute_map = { diff --git a/azure-monitor/azure/monitor/models/metric_paged.py b/azure-monitor/azure/monitor/models/metric_paged.py deleted file mode 100755 index 83ecbca49e80..000000000000 --- a/azure-monitor/azure/monitor/models/metric_paged.py +++ /dev/null @@ -1,27 +0,0 @@ -# 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 MetricPaged(Paged): - """ - A paging container for iterating over a list of Metric object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Metric]'} - } - - def __init__(self, *args, **kwargs): - - super(MetricPaged, self).__init__(*args, **kwargs) diff --git a/azure-monitor/azure/monitor/models/metric_value.py b/azure-monitor/azure/monitor/models/metric_value.py old mode 100755 new mode 100644 diff --git a/azure-monitor/azure/monitor/models/monitor_client_enums.py b/azure-monitor/azure/monitor/models/monitor_client_enums.py old mode 100755 new mode 100644 index e728d3171817..a2068acbc55f --- a/azure-monitor/azure/monitor/models/monitor_client_enums.py +++ b/azure-monitor/azure/monitor/models/monitor_client_enums.py @@ -40,3 +40,9 @@ class AggregationType(Enum): minimum = "Minimum" maximum = "Maximum" total = "Total" + + +class ResultType(Enum): + + data = "Data" + metadata = "Metadata" diff --git a/azure-monitor/azure/monitor/models/response.py b/azure-monitor/azure/monitor/models/response.py new file mode 100644 index 000000000000..255eb280bb62 --- /dev/null +++ b/azure-monitor/azure/monitor/models/response.py @@ -0,0 +1,52 @@ +# 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 Response(Model): + """The response to a metrics query. + + :param cost: The integer value representing the cost of the query, for + data case. + :type cost: float + :param timespan: The timespan for which the data was retrieved. Its value + consists of two datatimes concatenated, separated by '/'. This may be + adjusted in the future and returned back from what was originally + requested. + :type timespan: str + :param interval: The interval (window size) for which the metric data was + returned in. This may be adjusted in the future and returned back from + what was originally requested. This is not present if a metadata request + was made. + :type interval: timedelta + :param value: the value of the collection. + :type value: list of :class:`Metric ` + """ + + _validation = { + 'cost': {'minimum': 0}, + 'timespan': {'required': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'cost': {'key': 'cost', 'type': 'float'}, + 'timespan': {'key': 'timespan', 'type': 'str'}, + 'interval': {'key': 'interval', 'type': 'duration'}, + 'value': {'key': 'value', 'type': '[Metric]'}, + } + + def __init__(self, timespan, value, cost=None, interval=None): + self.cost = cost + self.timespan = timespan + self.interval = interval + self.value = value diff --git a/azure-monitor/azure/monitor/models/sender_authorization.py b/azure-monitor/azure/monitor/models/sender_authorization.py old mode 100755 new mode 100644 diff --git a/azure-monitor/azure/monitor/models/time_series_element.py b/azure-monitor/azure/monitor/models/time_series_element.py new file mode 100644 index 000000000000..7f11a5a202ce --- /dev/null +++ b/azure-monitor/azure/monitor/models/time_series_element.py @@ -0,0 +1,36 @@ +# 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 TimeSeriesElement(Model): + """A time series result type. The discriminator value is always TimeSeries in + this case. + + :param metadatavalues: the metadata values returned if $filter was + specified in the call. + :type metadatavalues: list of :class:`MetadataValue + ` + :param data: An array of data points representing the metric values. This + is only returned if a result type of data is specified. + :type data: list of :class:`MetricValue + ` + """ + + _attribute_map = { + 'metadatavalues': {'key': 'metadatavalues', 'type': '[MetadataValue]'}, + 'data': {'key': 'data', 'type': '[MetricValue]'}, + } + + def __init__(self, metadatavalues=None, data=None): + self.metadatavalues = metadatavalues + self.data = data diff --git a/azure-monitor/azure/monitor/models/usage_metric.py b/azure-monitor/azure/monitor/models/usage_metric.py old mode 100755 new mode 100644 diff --git a/azure-monitor/azure/monitor/models/usage_metric_paged.py b/azure-monitor/azure/monitor/models/usage_metric_paged.py old mode 100755 new mode 100644 index 62d2f7c7567a..617eecac9247 --- a/azure-monitor/azure/monitor/models/usage_metric_paged.py +++ b/azure-monitor/azure/monitor/models/usage_metric_paged.py @@ -14,7 +14,7 @@ class UsageMetricPaged(Paged): """ - A paging container for iterating over a list of UsageMetric object + A paging container for iterating over a list of :class:`UsageMetric ` object """ _attribute_map = { diff --git a/azure-monitor/azure/monitor/monitor_client.py b/azure-monitor/azure/monitor/monitor_client.py old mode 100755 new mode 100644 index dd0dd8fe16f6..d793ff0b4952 --- a/azure-monitor/azure/monitor/monitor_client.py +++ b/azure-monitor/azure/monitor/monitor_client.py @@ -14,8 +14,8 @@ from msrestazure import AzureConfiguration from .version import VERSION from .operations.usage_metrics_operations import UsageMetricsOperations -from .operations.event_categories_operations import EventCategoriesOperations from .operations.activity_logs_operations import ActivityLogsOperations +from .operations.event_categories_operations import EventCategoriesOperations from .operations.tenant_activity_logs_operations import TenantActivityLogsOperations from .operations.metric_definitions_operations import MetricDefinitionsOperations from .operations.metrics_operations import MetricsOperations @@ -57,17 +57,17 @@ def __init__( class MonitorClient(object): - """Composite Swagger for Monitor Client + """Monitor Client :ivar config: Configuration for client. :vartype config: MonitorClientConfiguration :ivar usage_metrics: UsageMetrics operations :vartype usage_metrics: azure.monitor.operations.UsageMetricsOperations - :ivar event_categories: EventCategories operations - :vartype event_categories: azure.monitor.operations.EventCategoriesOperations :ivar activity_logs: ActivityLogs operations :vartype activity_logs: azure.monitor.operations.ActivityLogsOperations + :ivar event_categories: EventCategories operations + :vartype event_categories: azure.monitor.operations.EventCategoriesOperations :ivar tenant_activity_logs: TenantActivityLogs operations :vartype tenant_activity_logs: azure.monitor.operations.TenantActivityLogsOperations :ivar metric_definitions: MetricDefinitions operations @@ -95,10 +95,10 @@ def __init__( self.usage_metrics = UsageMetricsOperations( self._client, self.config, self._serialize, self._deserialize) - self.event_categories = EventCategoriesOperations( - self._client, self.config, self._serialize, self._deserialize) self.activity_logs = ActivityLogsOperations( self._client, self.config, self._serialize, self._deserialize) + self.event_categories = EventCategoriesOperations( + self._client, self.config, self._serialize, self._deserialize) self.tenant_activity_logs = TenantActivityLogsOperations( self._client, self.config, self._serialize, self._deserialize) self.metric_definitions = MetricDefinitionsOperations( diff --git a/azure-monitor/azure/monitor/operations/__init__.py b/azure-monitor/azure/monitor/operations/__init__.py old mode 100755 new mode 100644 index 2ae3c64846e1..4c190fe90bfe --- a/azure-monitor/azure/monitor/operations/__init__.py +++ b/azure-monitor/azure/monitor/operations/__init__.py @@ -10,16 +10,16 @@ # -------------------------------------------------------------------------- from .usage_metrics_operations import UsageMetricsOperations -from .event_categories_operations import EventCategoriesOperations from .activity_logs_operations import ActivityLogsOperations +from .event_categories_operations import EventCategoriesOperations from .tenant_activity_logs_operations import TenantActivityLogsOperations from .metric_definitions_operations import MetricDefinitionsOperations from .metrics_operations import MetricsOperations __all__ = [ 'UsageMetricsOperations', - 'EventCategoriesOperations', 'ActivityLogsOperations', + 'EventCategoriesOperations', 'TenantActivityLogsOperations', 'MetricDefinitionsOperations', 'MetricsOperations', diff --git a/azure-monitor/azure/monitor/operations/activity_logs_operations.py b/azure-monitor/azure/monitor/operations/activity_logs_operations.py old mode 100755 new mode 100644 index 52c7effc39ea..b848cf8208e1 --- a/azure-monitor/azure/monitor/operations/activity_logs_operations.py +++ b/azure-monitor/azure/monitor/operations/activity_logs_operations.py @@ -9,8 +9,8 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.pipeline import ClientRawResponse import uuid +from msrest.pipeline import ClientRawResponse from .. import models @@ -71,6 +71,8 @@ def list( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: An iterator like instance of :class:`EventData + ` :rtype: :class:`EventDataPaged ` :raises: :class:`ErrorResponseException` diff --git a/azure-monitor/azure/monitor/operations/event_categories_operations.py b/azure-monitor/azure/monitor/operations/event_categories_operations.py old mode 100755 new mode 100644 index a8003e07825b..0550c89e2ebe --- a/azure-monitor/azure/monitor/operations/event_categories_operations.py +++ b/azure-monitor/azure/monitor/operations/event_categories_operations.py @@ -9,8 +9,8 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.pipeline import ClientRawResponse import uuid +from msrest.pipeline import ClientRawResponse from .. import models @@ -45,6 +45,8 @@ def list( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: An iterator like instance of :class:`LocalizableString + ` :rtype: :class:`LocalizableStringPaged ` :raises: diff --git a/azure-monitor/azure/monitor/operations/metric_definitions_operations.py b/azure-monitor/azure/monitor/operations/metric_definitions_operations.py old mode 100755 new mode 100644 index 3531dec961d0..0e370ca4ebf3 --- a/azure-monitor/azure/monitor/operations/metric_definitions_operations.py +++ b/azure-monitor/azure/monitor/operations/metric_definitions_operations.py @@ -9,8 +9,8 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.pipeline import ClientRawResponse import uuid +from msrest.pipeline import ClientRawResponse from .. import models @@ -22,7 +22,7 @@ class MetricDefinitionsOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An objec model deserializer. - :ivar api_version: Client Api Version. Constant value: "2016-03-01". + :ivar api_version: Client Api Version. Constant value: "2017-05-01-preview". """ def __init__(self, client, config, serializer, deserializer): @@ -30,29 +30,23 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2016-03-01" + self.api_version = "2017-05-01-preview" self.config = config def list( - self, resource_uri, filter=None, custom_headers=None, raw=False, **operation_config): + self, resource_uri, custom_headers=None, raw=False, **operation_config): """Lists the metric definitions for the resource. :param resource_uri: The identifier of the resource. :type resource_uri: str - :param filter: Reduces the set of data collected by retrieving - particular metric definitions from all the definitions available for - the resource.
For example, to get just the definition for the 'CPU - percentage' counter: $filter=name.value eq '\\Processor(_Total)\\% - Processor Time'.
Multiple metrics can be retrieved by joining - together *'name eq '* clauses separated by *or* logical - operators.
**NOTE**: No other syntax is allowed. - :type filter: 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: An iterator like instance of :class:`MetricDefinition + ` :rtype: :class:`MetricDefinitionPaged ` :raises: @@ -71,8 +65,6 @@ def internal_paging(next_link=None, raw=False): # Construct parameters query_parameters = {} query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') else: url = next_link diff --git a/azure-monitor/azure/monitor/operations/metrics_operations.py b/azure-monitor/azure/monitor/operations/metrics_operations.py old mode 100755 new mode 100644 index f909691b4c3a..62406cb22e67 --- a/azure-monitor/azure/monitor/operations/metrics_operations.py +++ b/azure-monitor/azure/monitor/operations/metrics_operations.py @@ -9,8 +9,8 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.pipeline import ClientRawResponse import uuid +from msrest.pipeline import ClientRawResponse from .. import models @@ -22,7 +22,7 @@ class MetricsOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An objec model deserializer. - :ivar api_version: Client Api Version. Constant value: "2016-09-01". + :ivar api_version: Client Api Version. Constant value: "2017-05-01-preview". """ def __init__(self, client, config, serializer, deserializer): @@ -30,94 +30,115 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2016-09-01" + self.api_version = "2017-05-01-preview" self.config = config def list( - self, resource_uri, filter=None, custom_headers=None, raw=False, **operation_config): - """Lists the metric values for a resource. + self, resource_uri, timespan=None, interval=None, metric=None, aggregation=None, top=None, orderby=None, filter=None, result_type=None, custom_headers=None, raw=False, **operation_config): + """**Lists the metric values for a resource**. :param resource_uri: The identifier of the resource. :type resource_uri: str - :param filter: Reduces the set of data collected.
The filter is - optional. If present it must contain a list of metric names to - retrieve of the form: *(name.value eq 'metricName' [or name.value eq - 'metricName' or ...])*. Optionally, the filter can contain conditions - for the following attributes *aggregationType*, *startTime*, - *endTime*, and *timeGrain* of the form *attributeName operator value*. - Where operator is one of *ne*, *eq*, *gt*, *lt*.
Several conditions - can be combined with parentheses and logical operators, e.g: *and*, - *or*.
Some example filter expressions are:
- $filter=(name.value - eq 'RunsSucceeded') and aggregationType eq 'Total' and startTime eq - 2016-02-20 and endTime eq 2016-02-21 and timeGrain eq - duration'PT1M',
- $filter=(name.value eq 'RunsSucceeded') and - (aggregationType eq 'Total' or aggregationType eq 'Average') and - startTime eq 2016-02-20 and endTime eq 2016-02-21 and timeGrain eq - duration'PT1H',
- $filter=(name.value eq 'ActionsCompleted' or - name.value eq 'RunsSucceeded') and (aggregationType eq 'Total' or - aggregationType eq 'Average') and startTime eq 2016-02-20 and endTime - eq 2016-02-21 and timeGrain eq duration'PT1M'.

**NOTE**: When a - metrics query comes in with multiple metrics, but with no aggregation - types defined, the service will pick the Primary aggregation type of - the first metrics to be used as the default aggregation type for all - the metrics. + :param timespan: The timespan of the query. It is a string with the + following format 'startDateTime_ISO/endDateTime_ISO'. + :type timespan: str + :param interval: The interval (i.e. timegrain) of the query. + :type interval: timedelta + :param metric: The name of the metric to retrieve. + :type metric: str + :param aggregation: The list of aggregation types (comma separated) to + retrieve. + :type aggregation: str + :param top: The maximum number of records to retrieve. + Valid only if $filter is specified. + Defaults to 10. + :type top: float + :param orderby: The aggregation to use for sorting results and the + direction of the sort. + Only one order can be specified. + Examples: sum asc. + :type orderby: str + :param filter: The **$filter** is used to reduce the set of metric + data returned.
Example:
Metric contains metadata A, B and + C.
- Return all time series of C where A = a1 and B = b1 or + b2
**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq + ‘*’**
- Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C + eq ‘*’ or B = ‘b2’**
This is invalid because the logical or + operator cannot separate two different metadata names.
- Return all + time series where A = a1, B = b1 and C = c1:
**$filter=A eq ‘a1’ + and B eq ‘b1’ and C eq ‘c1’**
- Return all time series where A = + a1
**$filter=A eq ‘a1’ and B eq ‘*’ and C eq ‘*’**. :type filter: str + :param result_type: Reduces the set of data collected. The syntax + allowed depends on the operation. See the operation's description for + details. Possible values include: 'Data', 'Metadata' + :type result_type: str or :class:`ResultType + ` :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`. - :rtype: :class:`MetricPaged ` + :return: :class:`Response ` or + :class:`ClientRawResponse` if + raw=true + :rtype: :class:`Response ` or + :class:`ClientRawResponse` :raises: :class:`ErrorResponseException` """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = '/{resourceUri}/providers/microsoft.insights/metrics' - 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 = {} - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # 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: - 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) - response = self._client.send( - request, header_parameters, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - return response - - # Deserialize response - deserialized = models.MetricPaged(internal_paging, self._deserialize.dependencies) + # Construct URL + url = '/{resourceUri}/providers/microsoft.insights/metrics' + 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 = {} + if timespan is not None: + query_parameters['timespan'] = self._serialize.query("timespan", timespan, 'str') + if interval is not None: + query_parameters['interval'] = self._serialize.query("interval", interval, 'duration') + if metric is not None: + query_parameters['metric'] = self._serialize.query("metric", metric, 'str') + if aggregation is not None: + query_parameters['aggregation'] = self._serialize.query("aggregation", aggregation, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'float') + if orderby is not None: + query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if result_type is not None: + query_parameters['resultType'] = self._serialize.query("result_type", result_type, 'ResultType') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # 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: + 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) + response = self._client.send(request, header_parameters, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Response', response) if raw: - header_dict = {} - client_raw_response = models.MetricPaged(internal_paging, self._deserialize.dependencies, header_dict) + client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized diff --git a/azure-monitor/azure/monitor/operations/tenant_activity_logs_operations.py b/azure-monitor/azure/monitor/operations/tenant_activity_logs_operations.py old mode 100755 new mode 100644 index 174c4c064ef5..34e3ca28d296 --- a/azure-monitor/azure/monitor/operations/tenant_activity_logs_operations.py +++ b/azure-monitor/azure/monitor/operations/tenant_activity_logs_operations.py @@ -9,8 +9,8 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.pipeline import ClientRawResponse import uuid +from msrest.pipeline import ClientRawResponse from .. import models @@ -77,6 +77,8 @@ def list( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: An iterator like instance of :class:`EventData + ` :rtype: :class:`EventDataPaged ` :raises: :class:`ErrorResponseException` diff --git a/azure-monitor/azure/monitor/operations/usage_metrics_operations.py b/azure-monitor/azure/monitor/operations/usage_metrics_operations.py old mode 100755 new mode 100644 index b7aaedd4f7a3..989f69423db2 --- a/azure-monitor/azure/monitor/operations/usage_metrics_operations.py +++ b/azure-monitor/azure/monitor/operations/usage_metrics_operations.py @@ -9,8 +9,8 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.pipeline import ClientRawResponse import uuid +from msrest.pipeline import ClientRawResponse from .. import models @@ -53,6 +53,8 @@ def list( deserialized response :param operation_config: :ref:`Operation configuration overrides`. + :return: An iterator like instance of :class:`UsageMetric + ` :rtype: :class:`UsageMetricPaged ` :raises: diff --git a/azure-monitor/azure/monitor/version.py b/azure-monitor/azure/monitor/version.py old mode 100755 new mode 100644 index 3e682bbd5fb1..85da2c00c1a6 --- a/azure-monitor/azure/monitor/version.py +++ b/azure-monitor/azure/monitor/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.3.0" +VERSION = "0.4.0" diff --git a/azure-monitor/build.json b/azure-monitor/build.json index 457cc7b10c4e..5d37b91936bc 100644 --- a/azure-monitor/build.json +++ b/azure-monitor/build.json @@ -1,5 +1 @@ -{ - "autorest": "1.0.1-20170417-2300-nightly", - "date": "2017-04-18T20:13:42Z", - "version": "0.3.0" -} \ No newline at end of file +{"autorest": "1.2.2", "date": "2017-09-01T18:43:10Z", "version": ""} \ No newline at end of file