From 4feb8b3fc4a439a8dbf4d5649db436079f47480a Mon Sep 17 00:00:00 2001 From: SwaggerToSDK Automation Date: Thu, 16 Feb 2017 17:37:26 +0000 Subject: [PATCH] Generated from efed63280648eebdec8be513470cd6c23783efb6 --- .../monitor/insights_management_client.py | 35 ++---------- .../azure/mgmt/monitor/models/__init__.py | 4 -- .../monitor/models/log_profile_properties.py | 57 ------------------- .../monitor/models/log_profile_resource.py | 3 +- .../mgmt/monitor/models/recurrent_schedule.py | 4 +- .../models/service_diagnostic_settings.py | 52 ----------------- .../azure/mgmt/monitor/models/time_window.py | 41 ++++++++++++- .../operations/log_profiles_operations.py | 6 +- .../service_diagnostic_settings_operations.py | 12 ++-- .../azure/monitor/insights_client.py | 35 ++---------- azure-monitor/azure/monitor/models/metric.py | 10 +++- .../monitor/operations/metrics_operations.py | 29 +++++----- .../operations/usage_metrics_operations.py | 10 ++-- 13 files changed, 88 insertions(+), 210 deletions(-) delete mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/log_profile_properties.py delete mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/service_diagnostic_settings.py diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/insights_management_client.py b/azure-mgmt-monitor/azure/mgmt/monitor/insights_management_client.py index 5fdf7334abc3..243423b9771c 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/insights_management_client.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/insights_management_client.py @@ -31,22 +31,11 @@ class InsightsManagementClientConfiguration(AzureConfiguration): object` :param subscription_id: The Azure subscription Id. :type subscription_id: str - :param accept_language: Gets or sets the preferred language for the - response. - :type accept_language: str - :param long_running_operation_retry_timeout: Gets or sets the retry - timeout in seconds for Long Running Operations. Default value is 30. - :type long_running_operation_retry_timeout: int - :param generate_client_request_id: When set to true a unique - x-ms-client-request-id value is generated and included in each request. - Default is true. - :type generate_client_request_id: bool :param str base_url: Service URL - :param str filepath: Existing config """ def __init__( - self, credentials, subscription_id, accept_language='en-US', long_running_operation_retry_timeout=30, generate_client_request_id=True, base_url=None, filepath=None): + self, credentials, subscription_id, base_url=None): if credentials is None: raise ValueError("Parameter 'credentials' must not be None.") @@ -54,21 +43,16 @@ def __init__( raise ValueError("Parameter 'subscription_id' must not be None.") if not isinstance(subscription_id, str): raise TypeError("Parameter 'subscription_id' must be str.") - if accept_language is not None and not isinstance(accept_language, str): - raise TypeError("Optional parameter 'accept_language' must be str.") if not base_url: base_url = 'https://management.azure.com' - super(InsightsManagementClientConfiguration, self).__init__(base_url, filepath) + super(InsightsManagementClientConfiguration, self).__init__(base_url) self.add_user_agent('insightsmanagementclient/{}'.format(VERSION)) self.add_user_agent('Azure-SDK-For-Python') self.credentials = credentials self.subscription_id = subscription_id - self.accept_language = accept_language - self.long_running_operation_retry_timeout = long_running_operation_retry_timeout - self.generate_client_request_id = generate_client_request_id class InsightsManagementClient(object): @@ -93,24 +77,13 @@ class InsightsManagementClient(object): object` :param subscription_id: The Azure subscription Id. :type subscription_id: str - :param accept_language: Gets or sets the preferred language for the - response. - :type accept_language: str - :param long_running_operation_retry_timeout: Gets or sets the retry - timeout in seconds for Long Running Operations. Default value is 30. - :type long_running_operation_retry_timeout: int - :param generate_client_request_id: When set to true a unique - x-ms-client-request-id value is generated and included in each request. - Default is true. - :type generate_client_request_id: bool :param str base_url: Service URL - :param str filepath: Existing config """ def __init__( - self, credentials, subscription_id, accept_language='en-US', long_running_operation_retry_timeout=30, generate_client_request_id=True, base_url=None, filepath=None): + self, credentials, subscription_id, base_url=None): - self.config = InsightsManagementClientConfiguration(credentials, subscription_id, accept_language, long_running_operation_retry_timeout, generate_client_request_id, base_url, filepath) + self.config = InsightsManagementClientConfiguration(credentials, subscription_id, base_url) self._client = ServiceClient(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py index 73480a75318d..fdb1fde555f9 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py @@ -25,7 +25,6 @@ from .retention_policy import RetentionPolicy from .metric_settings import MetricSettings from .log_settings import LogSettings -from .service_diagnostic_settings import ServiceDiagnosticSettings from .service_diagnostic_settings_resource import ServiceDiagnosticSettingsResource from .rule_condition import RuleCondition from .rule_data_source import RuleDataSource @@ -41,7 +40,6 @@ from .rule_webhook_action import RuleWebhookAction from .alert_rule_resource import AlertRuleResource from .incident import Incident -from .log_profile_properties import LogProfileProperties from .log_profile_resource import LogProfileResource from .autoscale_setting_resource_paged import AutoscaleSettingResourcePaged from .alert_rule_resource_paged import AlertRuleResourcePaged @@ -75,7 +73,6 @@ 'RetentionPolicy', 'MetricSettings', 'LogSettings', - 'ServiceDiagnosticSettings', 'ServiceDiagnosticSettingsResource', 'RuleCondition', 'RuleDataSource', @@ -91,7 +88,6 @@ 'RuleWebhookAction', 'AlertRuleResource', 'Incident', - 'LogProfileProperties', 'LogProfileResource', 'AutoscaleSettingResourcePaged', 'AlertRuleResourcePaged', diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_profile_properties.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_profile_properties.py deleted file mode 100644 index f07d2749069d..000000000000 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_profile_properties.py +++ /dev/null @@ -1,57 +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.serialization import Model - - -class LogProfileProperties(Model): - """The log profile properties. - - :param storage_account_id: the resource id of the storage account to which - you would like to send the Activity Log. - :type storage_account_id: str - :param service_bus_rule_id: The service bus rule ID of the service bus - namespace in which you would like to have Event Hubs created for streaming - the Activity Log. The rule ID is of the format: '{service bus resource - ID}/authorizationrules/{key name}'. - :type service_bus_rule_id: str - :param locations: List of regions for which Activity Log events should be - stored or streamed. It is a comma separated list of valid ARM locations - including the 'global' location. - :type locations: list of str - :param categories: the categories of the logs. These categories are - created as is convenient to the user. Some values are: 'Write', 'Delete', - and/or 'Action.' - :type categories: list of str - :param retention_policy: the retention policy for the events in the log. - :type retention_policy: :class:`RetentionPolicy - ` - """ - - _validation = { - 'storage_account_id': {'required': True}, - 'locations': {'required': True}, - } - - _attribute_map = { - 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, - 'service_bus_rule_id': {'key': 'serviceBusRuleId', 'type': 'str'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'categories': {'key': 'categories', 'type': '[str]'}, - 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, - } - - def __init__(self, storage_account_id, locations, service_bus_rule_id=None, categories=None, retention_policy=None): - self.storage_account_id = storage_account_id - self.service_bus_rule_id = service_bus_rule_id - self.locations = locations - self.categories = categories - self.retention_policy = retention_policy diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_profile_resource.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_profile_resource.py index 6b4d89a5fea3..06c38fc03d0b 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_profile_resource.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_profile_resource.py @@ -53,7 +53,6 @@ class LogProfileResource(Resource): 'id': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, - 'storage_account_id': {'required': True}, 'locations': {'required': True}, } @@ -70,7 +69,7 @@ class LogProfileResource(Resource): 'retention_policy': {'key': 'properties.retentionPolicy', 'type': 'RetentionPolicy'}, } - def __init__(self, location, storage_account_id, locations, name=None, tags=None, service_bus_rule_id=None, categories=None, retention_policy=None): + def __init__(self, location, locations, name=None, tags=None, storage_account_id=None, service_bus_rule_id=None, categories=None, retention_policy=None): super(LogProfileResource, self).__init__(name=name, location=location, tags=tags) self.storage_account_id = storage_account_id self.service_bus_rule_id = service_bus_rule_id diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/recurrent_schedule.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/recurrent_schedule.py index 58e83e808445..0f5af3860bed 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/recurrent_schedule.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/recurrent_schedule.py @@ -15,8 +15,8 @@ class RecurrentSchedule(Model): """The scheduling constraints for when the profile begins. - :param time_zone: the time zone for the hours of the profile. See examples - of valid timezone are: Dateline Standard Time, UTC-11, Hawaiian Standard + :param time_zone: the timezone for the hours of the profile. Some examples + of valid timezones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/service_diagnostic_settings.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/service_diagnostic_settings.py deleted file mode 100644 index ba4f4ffa0263..000000000000 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/service_diagnostic_settings.py +++ /dev/null @@ -1,52 +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.serialization import Model - - -class ServiceDiagnosticSettings(Model): - """The diagnostic settings for service. - - :param storage_account_id: The resource ID of the storage account to which - you would like to send Diagnostic Logs. - :type storage_account_id: str - :param service_bus_rule_id: The service bus rule ID of the service bus - namespace in which you would like to have Event Hubs created for streaming - Diagnostic Logs. The rule ID is of the format: '{service bus resource - ID}/authorizationrules/{key name}'. - :type service_bus_rule_id: str - :param metrics: the list of metric settings. - :type metrics: list of :class:`MetricSettings - ` - :param logs: the list of logs settings. - :type logs: list of :class:`LogSettings - ` - :param workspace_id: The workspace ID (resource ID of a Log Analytics - workspace) for a Log Analytics workspace to which you would like to send - Diagnostic Logs. Example: - /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 - :type workspace_id: str - """ - - _attribute_map = { - 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, - 'service_bus_rule_id': {'key': 'serviceBusRuleId', 'type': 'str'}, - 'metrics': {'key': 'metrics', 'type': '[MetricSettings]'}, - 'logs': {'key': 'logs', 'type': '[LogSettings]'}, - 'workspace_id': {'key': 'workspaceId', 'type': 'str'}, - } - - def __init__(self, storage_account_id=None, service_bus_rule_id=None, metrics=None, logs=None, workspace_id=None): - self.storage_account_id = storage_account_id - self.service_bus_rule_id = service_bus_rule_id - self.metrics = metrics - self.logs = logs - self.workspace_id = workspace_id diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/time_window.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/time_window.py index d9095b859eaa..77300df3ff84 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/time_window.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/time_window.py @@ -15,9 +15,44 @@ class TimeWindow(Model): """A specific date-time for the profile. - :param time_zone: the time zone of the start and end times for the - profile. See examples of valid timezone ids over here: - https://msdn.microsoft.com/en-us/library/azure/dn931928.aspx + :param time_zone: the timezone of the start and end times for the profile. + Some examples of valid timezones are: Dateline Standard Time, UTC-11, + Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time + (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain + Standard Time (Mexico), Mountain Standard Time, Central America Standard + Time, Central Standard Time, Central Standard Time (Mexico), Canada + Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US + Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, + Atlantic Standard Time, Central Brazilian Standard Time, SA Western + Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. + South America Standard Time, Argentina Standard Time, SA Eastern Standard + Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard + Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde + Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich + Standard Time, W. Europe Standard Time, Central Europe Standard Time, + Romance Standard Time, Central European Standard Time, W. Central Africa + Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard + Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, + E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, + Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, + Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus + Standard Time, Russian Standard Time, E. Africa Standard Time, Iran + Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia + Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus + Standard Time, Afghanistan Standard Time, West Asia Standard Time, + Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, + Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, + Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard + Time, SE Asia Standard Time, North Asia Standard Time, China Standard + Time, North Asia East Standard Time, Singapore Standard Time, W. Australia + Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo + Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia + Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS + Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, + Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, + Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard + Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard + Time, Samoa Standard Time, Line Islands Standard Time :type time_zone: str :param start: the start time for the profile in ISO 8601 format. :type start: datetime diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/operations/log_profiles_operations.py b/azure-mgmt-monitor/azure/mgmt/monitor/operations/log_profiles_operations.py index 0623effb3ded..687b06c02688 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/operations/log_profiles_operations.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/operations/log_profiles_operations.py @@ -152,8 +152,8 @@ def create_or_update( :param log_profile_name: The name of the log profile. :type log_profile_name: str :param parameters: Parameters supplied to the operation. - :type parameters: :class:`LogProfileProperties - ` + :type parameters: :class:`LogProfileResource + ` :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -188,7 +188,7 @@ def create_or_update( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(parameters, 'LogProfileProperties') + body_content = self._serialize.body(parameters, 'LogProfileResource') # Construct and send request request = self._client.put(url, query_parameters) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/operations/service_diagnostic_settings_operations.py b/azure-mgmt-monitor/azure/mgmt/monitor/operations/service_diagnostic_settings_operations.py index b5485f906ba9..5f4f7fb161f7 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/operations/service_diagnostic_settings_operations.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/operations/service_diagnostic_settings_operations.py @@ -55,8 +55,7 @@ def get( # Construct URL url = '/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service' path_format_arguments = { - 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -101,8 +100,8 @@ def create_or_update( :param resource_uri: The identifier of the resource. :type resource_uri: str :param parameters: Parameters supplied to the operation. - :type parameters: :class:`ServiceDiagnosticSettings - ` + :type parameters: :class:`ServiceDiagnosticSettingsResource + ` :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -117,8 +116,7 @@ def create_or_update( # Construct URL url = '/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service' path_format_arguments = { - 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -137,7 +135,7 @@ def create_or_update( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(parameters, 'ServiceDiagnosticSettings') + body_content = self._serialize.body(parameters, 'ServiceDiagnosticSettingsResource') # Construct and send request request = self._client.put(url, query_parameters) diff --git a/azure-monitor/azure/monitor/insights_client.py b/azure-monitor/azure/monitor/insights_client.py index a65c1fc1c8e0..810cab43f436 100644 --- a/azure-monitor/azure/monitor/insights_client.py +++ b/azure-monitor/azure/monitor/insights_client.py @@ -32,22 +32,11 @@ class InsightsClientConfiguration(AzureConfiguration): object` :param subscription_id: The Azure subscription Id. :type subscription_id: str - :param accept_language: Gets or sets the preferred language for the - response. - :type accept_language: str - :param long_running_operation_retry_timeout: Gets or sets the retry - timeout in seconds for Long Running Operations. Default value is 30. - :type long_running_operation_retry_timeout: int - :param generate_client_request_id: When set to true a unique - x-ms-client-request-id value is generated and included in each request. - Default is true. - :type generate_client_request_id: bool :param str base_url: Service URL - :param str filepath: Existing config """ def __init__( - self, credentials, subscription_id, accept_language='en-US', long_running_operation_retry_timeout=30, generate_client_request_id=True, base_url=None, filepath=None): + self, credentials, subscription_id, base_url=None): if credentials is None: raise ValueError("Parameter 'credentials' must not be None.") @@ -55,21 +44,16 @@ def __init__( raise ValueError("Parameter 'subscription_id' must not be None.") if not isinstance(subscription_id, str): raise TypeError("Parameter 'subscription_id' must be str.") - if accept_language is not None and not isinstance(accept_language, str): - raise TypeError("Optional parameter 'accept_language' must be str.") if not base_url: base_url = 'https://management.azure.com' - super(InsightsClientConfiguration, self).__init__(base_url, filepath) + super(InsightsClientConfiguration, self).__init__(base_url) self.add_user_agent('insightsclient/{}'.format(VERSION)) self.add_user_agent('Azure-SDK-For-Python') self.credentials = credentials self.subscription_id = subscription_id - self.accept_language = accept_language - self.long_running_operation_retry_timeout = long_running_operation_retry_timeout - self.generate_client_request_id = generate_client_request_id class InsightsClient(object): @@ -96,24 +80,13 @@ class InsightsClient(object): object` :param subscription_id: The Azure subscription Id. :type subscription_id: str - :param accept_language: Gets or sets the preferred language for the - response. - :type accept_language: str - :param long_running_operation_retry_timeout: Gets or sets the retry - timeout in seconds for Long Running Operations. Default value is 30. - :type long_running_operation_retry_timeout: int - :param generate_client_request_id: When set to true a unique - x-ms-client-request-id value is generated and included in each request. - Default is true. - :type generate_client_request_id: bool :param str base_url: Service URL - :param str filepath: Existing config """ def __init__( - self, credentials, subscription_id, accept_language='en-US', long_running_operation_retry_timeout=30, generate_client_request_id=True, base_url=None, filepath=None): + self, credentials, subscription_id, base_url=None): - self.config = InsightsClientConfiguration(credentials, subscription_id, accept_language, long_running_operation_retry_timeout, generate_client_request_id, base_url, filepath) + self.config = InsightsClientConfiguration(credentials, subscription_id, base_url) self._client = ServiceClient(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} diff --git a/azure-monitor/azure/monitor/models/metric.py b/azure-monitor/azure/monitor/models/metric.py index 4853e255cfe0..5aa3edbf6307 100644 --- a/azure-monitor/azure/monitor/models/metric.py +++ b/azure-monitor/azure/monitor/models/metric.py @@ -15,6 +15,10 @@ class Metric(Model): """A set of metric values in a time range. + :param id: the id, resourceId, of the metric. + :type id: str + :param type: the resource type of the metric resource. + :type type: str :param name: the name and the display name of the metric, i.e. it is localizable string. :type name: :class:`LocalizableString @@ -35,12 +39,16 @@ class Metric(Model): } _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, 'name': {'key': 'name', 'type': 'LocalizableString'}, 'unit': {'key': 'unit', 'type': 'Unit'}, 'data': {'key': 'data', 'type': '[MetricValue]'}, } - def __init__(self, name, unit, data): + def __init__(self, name, unit, data, id=None, type=None): + self.id = id + self.type = type self.name = name self.unit = unit self.data = data diff --git a/azure-monitor/azure/monitor/operations/metrics_operations.py b/azure-monitor/azure/monitor/operations/metrics_operations.py index b26a5c389dcb..0c00d48ef90f 100644 --- a/azure-monitor/azure/monitor/operations/metrics_operations.py +++ b/azure-monitor/azure/monitor/operations/metrics_operations.py @@ -37,22 +37,25 @@ def __init__(self, client, config, serializer, deserializer): def list( self, resource_uri, filter=None, custom_headers=None, raw=False, **operation_config): - """Lists the metric values for a resource. The $filter is used to reduce - the set of metric data returned. Some common properties for this - expression will be: name.value, aggregationType, startTime, endTime, - timeGrain. The filter expression uses these properties with comparison - operators (eg. eq, gt, lt) and multiple expressions can be combined - with parentheses and 'and/or' operators. 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 + """**Lists the metric values for a resource**.
The **$filter** is used + to reduce the set of metric data returned. Some common properties for + this expression will be: name.value, aggregationType, startTime, + endTime, timeGrain. The filter expression uses these properties with + comparison operators (eg. eq, gt, lt) and multiple expressions can be + combined with parentheses and 'and/or' operators.
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'. + 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 resource_uri: The identifier of the resource. :type resource_uri: str diff --git a/azure-monitor/azure/monitor/operations/usage_metrics_operations.py b/azure-monitor/azure/monitor/operations/usage_metrics_operations.py index 97c416f762d7..227a8a6b972d 100644 --- a/azure-monitor/azure/monitor/operations/usage_metrics_operations.py +++ b/azure-monitor/azure/monitor/operations/usage_metrics_operations.py @@ -23,7 +23,6 @@ class UsageMetricsOperations(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. NOTE: This is not a client property, it must be explicit in the call and there is no default value. Constant value: "2014-04-01". """ def __init__(self, client, config, serializer, deserializer): @@ -31,16 +30,19 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2014-04-01" self.config = config def list( - self, resource_uri, filter=None, custom_headers=None, raw=False, **operation_config): + self, resource_uri, api_version, filter=None, custom_headers=None, raw=False, **operation_config): """The List operation lists the usage metrics for the resource. :param resource_uri: The identifier of the resource. :type resource_uri: str + :param api_version: Client Api Version. NOTE: This is not a client + property, it must be explicit in the call and there is no default + value. + :type api_version: str :param filter: The filter to apply on the operation. :type filter: str :param dict custom_headers: headers that will be added to the request @@ -64,7 +66,7 @@ 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') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')