azure_mgmt_monitor 0.16.0 → 0.16.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2015-04-01/generated/azure_mgmt_monitor.rb +14 -4
  3. data/lib/2015-04-01/generated/azure_mgmt_monitor/activity_logs.rb +313 -0
  4. data/lib/2015-04-01/generated/azure_mgmt_monitor/autoscale_settings.rb +1 -1
  5. data/lib/2015-04-01/generated/azure_mgmt_monitor/event_categories.rb +113 -0
  6. data/lib/2015-04-01/generated/azure_mgmt_monitor/models/event_category_collection.rb +57 -0
  7. data/lib/2015-04-01/generated/azure_mgmt_monitor/models/event_data.rb +380 -0
  8. data/lib/2015-04-01/generated/azure_mgmt_monitor/models/event_data_collection.rb +99 -0
  9. data/lib/2015-04-01/generated/azure_mgmt_monitor/models/event_level.rb +19 -0
  10. data/lib/2015-04-01/generated/azure_mgmt_monitor/models/http_request_info.rb +79 -0
  11. data/lib/2015-04-01/generated/azure_mgmt_monitor/models/localizable_string.rb +57 -0
  12. data/lib/2015-04-01/generated/azure_mgmt_monitor/models/sender_authorization.rb +71 -0
  13. data/lib/2015-04-01/generated/azure_mgmt_monitor/monitor_management_client.rb +12 -0
  14. data/lib/2015-04-01/generated/azure_mgmt_monitor/operations.rb +1 -1
  15. data/lib/2015-04-01/generated/azure_mgmt_monitor/tenant_activity_logs.rb +339 -0
  16. data/lib/2016-03-01/generated/azure_mgmt_monitor.rb +17 -10
  17. data/lib/2016-03-01/generated/azure_mgmt_monitor/alert_rule_incidents.rb +1 -1
  18. data/lib/2016-03-01/generated/azure_mgmt_monitor/alert_rules.rb +1 -1
  19. data/lib/2016-03-01/generated/azure_mgmt_monitor/log_profiles.rb +1 -1
  20. data/lib/2016-03-01/generated/azure_mgmt_monitor/metric_definitions.rb +133 -0
  21. data/lib/2016-03-01/generated/azure_mgmt_monitor/models/aggregation_type.rb +20 -0
  22. data/lib/2016-03-01/generated/azure_mgmt_monitor/models/localizable_string.rb +57 -0
  23. data/lib/2016-03-01/generated/azure_mgmt_monitor/models/metric_availability.rb +60 -0
  24. data/lib/2016-03-01/generated/azure_mgmt_monitor/models/metric_definition.rb +120 -0
  25. data/lib/2016-03-01/generated/azure_mgmt_monitor/models/metric_definition_collection.rb +56 -0
  26. data/lib/2016-03-01/generated/azure_mgmt_monitor/models/unit.rb +21 -0
  27. data/lib/2016-03-01/generated/azure_mgmt_monitor/monitor_management_client.rb +8 -4
  28. data/lib/2016-09-01/generated/azure_mgmt_monitor.rb +9 -3
  29. data/lib/2016-09-01/generated/azure_mgmt_monitor/metrics.rb +172 -0
  30. data/lib/2016-09-01/generated/azure_mgmt_monitor/models/localizable_string.rb +57 -0
  31. data/lib/2016-09-01/generated/azure_mgmt_monitor/models/metric.rb +105 -0
  32. data/lib/2016-09-01/generated/azure_mgmt_monitor/models/metric_collection.rb +55 -0
  33. data/lib/2016-09-01/generated/azure_mgmt_monitor/models/metric_value.rb +104 -0
  34. data/lib/2016-09-01/generated/azure_mgmt_monitor/models/unit.rb +21 -0
  35. data/lib/2016-09-01/generated/azure_mgmt_monitor/monitor_client.rb +4 -0
  36. data/lib/2016-09-01/generated/azure_mgmt_monitor/service_diagnostic_settings_operations.rb +4 -4
  37. data/lib/2017-04-01/generated/azure_mgmt_monitor/action_groups.rb +1 -1
  38. data/lib/2017-04-01/generated/azure_mgmt_monitor/activity_log_alerts.rb +1 -1
  39. data/lib/2017-04-01/generated/azure_mgmt_monitor/models/action_group_resource.rb +1 -1
  40. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor.rb +19 -5
  41. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/diagnostic_settings_category_operations.rb +4 -3
  42. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/diagnostic_settings_operations.rb +8 -5
  43. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/metric_definitions.rb +112 -0
  44. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/metrics.rb +190 -0
  45. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/models/aggregation_type.rb +20 -0
  46. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/models/localizable_string.rb +57 -0
  47. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/models/metadata_value.rb +58 -0
  48. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/models/metric.rb +105 -0
  49. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/models/metric_availability.rb +60 -0
  50. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/models/metric_definition.rb +152 -0
  51. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/models/metric_definition_collection.rb +56 -0
  52. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/models/metric_value.rb +104 -0
  53. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/models/response.rb +98 -0
  54. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/models/result_type.rb +16 -0
  55. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/models/time_series_element.rb +79 -0
  56. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/models/unit.rb +23 -0
  57. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/monitor_management_client.rb +11 -3
  58. data/lib/2017-11-01-preview/generated/azure_mgmt_monitor/metric_baseline.rb +1 -1
  59. data/lib/2018-01-01/generated/azure_mgmt_monitor.rb +42 -0
  60. data/lib/2018-01-01/generated/azure_mgmt_monitor/metric_definitions.rb +118 -0
  61. data/lib/2018-01-01/generated/azure_mgmt_monitor/metrics.rb +199 -0
  62. data/lib/2018-01-01/generated/azure_mgmt_monitor/models/aggregation_type.rb +20 -0
  63. data/lib/2018-01-01/generated/azure_mgmt_monitor/models/error_response.rb +57 -0
  64. data/lib/2018-01-01/generated/azure_mgmt_monitor/models/localizable_string.rb +57 -0
  65. data/lib/2018-01-01/generated/azure_mgmt_monitor/models/metadata_value.rb +58 -0
  66. data/lib/2018-01-01/generated/azure_mgmt_monitor/models/metric.rb +105 -0
  67. data/lib/2018-01-01/generated/azure_mgmt_monitor/models/metric_availability.rb +60 -0
  68. data/lib/2018-01-01/generated/azure_mgmt_monitor/models/metric_definition.rb +184 -0
  69. data/lib/2018-01-01/generated/azure_mgmt_monitor/models/metric_definition_collection.rb +56 -0
  70. data/lib/2018-01-01/generated/azure_mgmt_monitor/models/metric_value.rb +104 -0
  71. data/lib/2018-01-01/generated/azure_mgmt_monitor/models/response.rb +120 -0
  72. data/lib/2018-01-01/generated/azure_mgmt_monitor/models/result_type.rb +16 -0
  73. data/lib/2018-01-01/generated/azure_mgmt_monitor/models/time_series_element.rb +79 -0
  74. data/lib/2018-01-01/generated/azure_mgmt_monitor/models/unit.rb +23 -0
  75. data/lib/2018-01-01/generated/azure_mgmt_monitor/module_definition.rb +9 -0
  76. data/lib/2018-01-01/generated/azure_mgmt_monitor/monitor_management_client.rb +131 -0
  77. data/lib/2018-03-01/generated/azure_mgmt_monitor.rb +57 -0
  78. data/lib/2018-03-01/generated/azure_mgmt_monitor/action_groups.rb +693 -0
  79. data/lib/2018-03-01/generated/azure_mgmt_monitor/metric_alerts.rb +582 -0
  80. data/lib/2018-03-01/generated/azure_mgmt_monitor/metric_alerts_status.rb +213 -0
  81. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/action_group_list.rb +67 -0
  82. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/action_group_patch_body.rb +68 -0
  83. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/action_group_resource.rb +304 -0
  84. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/automation_runbook_receiver.rb +102 -0
  85. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/azure_app_push_receiver.rb +58 -0
  86. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/azure_function_receiver.rb +80 -0
  87. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/email_receiver.rb +72 -0
  88. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/enable_request.rb +46 -0
  89. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/error_response.rb +57 -0
  90. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/itsm_receiver.rb +94 -0
  91. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/logic_app_receiver.rb +69 -0
  92. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/metric_alert_action.rb +65 -0
  93. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/metric_alert_criteria.rb +65 -0
  94. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/metric_alert_resource.rb +226 -0
  95. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/metric_alert_resource_collection.rb +56 -0
  96. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/metric_alert_resource_patch.rb +194 -0
  97. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/metric_alert_single_resource_multiple_metric_criteria.rb +88 -0
  98. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/metric_alert_status.rb +81 -0
  99. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/metric_alert_status_collection.rb +56 -0
  100. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/metric_alert_status_properties.rb +76 -0
  101. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/metric_criteria.rb +122 -0
  102. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/metric_dimension.rb +77 -0
  103. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/receiver_status.rb +17 -0
  104. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/resource.rb +101 -0
  105. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/sms_receiver.rb +83 -0
  106. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/voice_receiver.rb +69 -0
  107. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/webhook_receiver.rb +58 -0
  108. data/lib/2018-03-01/generated/azure_mgmt_monitor/module_definition.rb +9 -0
  109. data/lib/2018-03-01/generated/azure_mgmt_monitor/monitor_management_client.rb +138 -0
  110. data/lib/2018-04-16/generated/azure_mgmt_monitor.rb +46 -0
  111. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/action.rb +47 -0
  112. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/alert_severity.rb +19 -0
  113. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/alerting_action.rb +99 -0
  114. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/az_ns_action_group.rb +78 -0
  115. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/conditional_operator.rb +17 -0
  116. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/enabled.rb +16 -0
  117. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/error_response.rb +57 -0
  118. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/log_metric_trigger.rb +83 -0
  119. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/log_search_rule_resource.rb +174 -0
  120. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/log_search_rule_resource_collection.rb +56 -0
  121. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/log_search_rule_resource_patch.rb +67 -0
  122. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/metric_trigger_type.rb +16 -0
  123. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/provisioning_state.rb +18 -0
  124. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/query_type.rb +15 -0
  125. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/resource.rb +101 -0
  126. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/schedule.rb +59 -0
  127. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/source.rb +89 -0
  128. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/trigger_condition.rb +72 -0
  129. data/lib/2018-04-16/generated/azure_mgmt_monitor/module_definition.rb +9 -0
  130. data/lib/2018-04-16/generated/azure_mgmt_monitor/monitor_client.rb +130 -0
  131. data/lib/2018-04-16/generated/azure_mgmt_monitor/scheduled_query_rules.rb +610 -0
  132. data/lib/azure_mgmt_monitor.rb +5 -2
  133. data/lib/profiles/latest/modules/monitor_profile_module.rb +119 -45
  134. data/lib/version.rb +1 -1
  135. metadata +113 -3
@@ -0,0 +1,56 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Monitor::Mgmt::V2016_03_01
7
+ module Models
8
+ #
9
+ # Represents collection of metric definitions.
10
+ #
11
+ class MetricDefinitionCollection
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [Array<MetricDefinition>] the values for the metric
16
+ # definitions.
17
+ attr_accessor :value
18
+
19
+
20
+ #
21
+ # Mapper for MetricDefinitionCollection class as Ruby Hash.
22
+ # This will be used for serialization/deserialization.
23
+ #
24
+ def self.mapper()
25
+ {
26
+ client_side_validation: true,
27
+ required: false,
28
+ serialized_name: 'MetricDefinitionCollection',
29
+ type: {
30
+ name: 'Composite',
31
+ class_name: 'MetricDefinitionCollection',
32
+ model_properties: {
33
+ value: {
34
+ client_side_validation: true,
35
+ required: true,
36
+ serialized_name: 'value',
37
+ type: {
38
+ name: 'Sequence',
39
+ element: {
40
+ client_side_validation: true,
41
+ required: false,
42
+ serialized_name: 'MetricDefinitionElementType',
43
+ type: {
44
+ name: 'Composite',
45
+ class_name: 'MetricDefinition'
46
+ }
47
+ }
48
+ }
49
+ }
50
+ }
51
+ }
52
+ }
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,21 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Monitor::Mgmt::V2016_03_01
7
+ module Models
8
+ #
9
+ # Defines values for Unit
10
+ #
11
+ module Unit
12
+ Count = "Count"
13
+ Bytes = "Bytes"
14
+ Seconds = "Seconds"
15
+ CountPerSecond = "CountPerSecond"
16
+ BytesPerSecond = "BytesPerSecond"
17
+ Percent = "Percent"
18
+ MilliSeconds = "MilliSeconds"
19
+ end
20
+ end
21
+ end
@@ -34,15 +34,18 @@ module Azure::Monitor::Mgmt::V2016_03_01
34
34
  # is generated and included in each request. Default is true.
35
35
  attr_accessor :generate_client_request_id
36
36
 
37
- # @return [AlertRuleIncidents] alert_rule_incidents
38
- attr_reader :alert_rule_incidents
39
-
40
37
  # @return [AlertRules] alert_rules
41
38
  attr_reader :alert_rules
42
39
 
40
+ # @return [AlertRuleIncidents] alert_rule_incidents
41
+ attr_reader :alert_rule_incidents
42
+
43
43
  # @return [LogProfiles] log_profiles
44
44
  attr_reader :log_profiles
45
45
 
46
+ # @return [MetricDefinitions] metric_definitions
47
+ attr_reader :metric_definitions
48
+
46
49
  #
47
50
  # Creates initializes a new instance of the MonitorManagementClient class.
48
51
  # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
@@ -56,9 +59,10 @@ module Azure::Monitor::Mgmt::V2016_03_01
56
59
  fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
57
60
  @credentials = credentials
58
61
 
59
- @alert_rule_incidents = AlertRuleIncidents.new(self)
60
62
  @alert_rules = AlertRules.new(self)
63
+ @alert_rule_incidents = AlertRuleIncidents.new(self)
61
64
  @log_profiles = LogProfiles.new(self)
65
+ @metric_definitions = MetricDefinitions.new(self)
62
66
  @api_version = '2016-03-01'
63
67
  @accept_language = 'en-US'
64
68
  @long_running_operation_retry_timeout = 30
@@ -20,16 +20,22 @@ require '2016-09-01/generated/azure_mgmt_monitor/module_definition'
20
20
  require 'ms_rest_azure'
21
21
 
22
22
  module Azure::Monitor::Mgmt::V2016_09_01
23
+ autoload :Metrics, '2016-09-01/generated/azure_mgmt_monitor/metrics.rb'
23
24
  autoload :ServiceDiagnosticSettingsOperations, '2016-09-01/generated/azure_mgmt_monitor/service_diagnostic_settings_operations.rb'
24
25
  autoload :MonitorClient, '2016-09-01/generated/azure_mgmt_monitor/monitor_client.rb'
25
26
 
26
27
  module Models
27
- autoload :LogSettings, '2016-09-01/generated/azure_mgmt_monitor/models/log_settings.rb'
28
28
  autoload :Resource, '2016-09-01/generated/azure_mgmt_monitor/models/resource.rb'
29
- autoload :MetricSettings, '2016-09-01/generated/azure_mgmt_monitor/models/metric_settings.rb'
30
- autoload :ServiceDiagnosticSettingsResourcePatch, '2016-09-01/generated/azure_mgmt_monitor/models/service_diagnostic_settings_resource_patch.rb'
31
29
  autoload :RetentionPolicy, '2016-09-01/generated/azure_mgmt_monitor/models/retention_policy.rb'
30
+ autoload :MetricValue, '2016-09-01/generated/azure_mgmt_monitor/models/metric_value.rb'
31
+ autoload :MetricSettings, '2016-09-01/generated/azure_mgmt_monitor/models/metric_settings.rb'
32
+ autoload :MetricCollection, '2016-09-01/generated/azure_mgmt_monitor/models/metric_collection.rb'
33
+ autoload :LogSettings, '2016-09-01/generated/azure_mgmt_monitor/models/log_settings.rb'
34
+ autoload :LocalizableString, '2016-09-01/generated/azure_mgmt_monitor/models/localizable_string.rb'
35
+ autoload :Metric, '2016-09-01/generated/azure_mgmt_monitor/models/metric.rb'
32
36
  autoload :ErrorResponse, '2016-09-01/generated/azure_mgmt_monitor/models/error_response.rb'
37
+ autoload :ServiceDiagnosticSettingsResourcePatch, '2016-09-01/generated/azure_mgmt_monitor/models/service_diagnostic_settings_resource_patch.rb'
33
38
  autoload :ServiceDiagnosticSettingsResource, '2016-09-01/generated/azure_mgmt_monitor/models/service_diagnostic_settings_resource.rb'
39
+ autoload :Unit, '2016-09-01/generated/azure_mgmt_monitor/models/unit.rb'
34
40
  end
35
41
  end
@@ -0,0 +1,172 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Monitor::Mgmt::V2016_09_01
7
+ #
8
+ # Monitor Management Client
9
+ #
10
+ class Metrics
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Metrics class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [MonitorClient] reference to the MonitorClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Lists the metric values for a resource.
26
+ #
27
+ # @param resource_uri [String] The identifier of the resource.
28
+ # @param filter [String] Reduces the set of data collected.<br>The filter is
29
+ # optional. If present it must contain a list of metric names to retrieve of
30
+ # the form: *(name.value eq 'metricName' [or name.value eq 'metricName' or
31
+ # ...])*. Optionally, the filter can contain conditions for the following
32
+ # attributes *aggregationType*, *startTime*, *endTime*, and *timeGrain* of the
33
+ # form *attributeName operator value*. Where operator is one of *ne*, *eq*,
34
+ # *gt*, *lt*.<br>Several conditions can be combined with parentheses and
35
+ # logical operators, e.g: *and*, *or*.<br>Some example filter expressions
36
+ # are:<br>- $filter=(name.value eq 'RunsSucceeded') and aggregationType eq
37
+ # 'Total' and startTime eq 2016-02-20 and endTime eq 2016-02-21 and timeGrain
38
+ # eq duration'PT1M',<br>- $filter=(name.value eq 'RunsSucceeded') and
39
+ # (aggregationType eq 'Total' or aggregationType eq 'Average') and startTime eq
40
+ # 2016-02-20 and endTime eq 2016-02-21 and timeGrain eq duration'PT1H',<br>-
41
+ # $filter=(name.value eq 'ActionsCompleted' or name.value eq 'RunsSucceeded')
42
+ # and (aggregationType eq 'Total' or aggregationType eq 'Average') and
43
+ # startTime eq 2016-02-20 and endTime eq 2016-02-21 and timeGrain eq
44
+ # duration'PT1M'.<br><br>**NOTE**: When a metrics query comes in with multiple
45
+ # metrics, but with no aggregation types defined, the service will pick the
46
+ # Primary aggregation type of the first metrics to be used as the default
47
+ # aggregation type for all the metrics.
48
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
49
+ # will be added to the HTTP request.
50
+ #
51
+ # @return [MetricCollection] operation results.
52
+ #
53
+ def list(resource_uri, filter:nil, custom_headers:nil)
54
+ response = list_async(resource_uri, filter:filter, custom_headers:custom_headers).value!
55
+ response.body unless response.nil?
56
+ end
57
+
58
+ #
59
+ # Lists the metric values for a resource.
60
+ #
61
+ # @param resource_uri [String] The identifier of the resource.
62
+ # @param filter [String] Reduces the set of data collected.<br>The filter is
63
+ # optional. If present it must contain a list of metric names to retrieve of
64
+ # the form: *(name.value eq 'metricName' [or name.value eq 'metricName' or
65
+ # ...])*. Optionally, the filter can contain conditions for the following
66
+ # attributes *aggregationType*, *startTime*, *endTime*, and *timeGrain* of the
67
+ # form *attributeName operator value*. Where operator is one of *ne*, *eq*,
68
+ # *gt*, *lt*.<br>Several conditions can be combined with parentheses and
69
+ # logical operators, e.g: *and*, *or*.<br>Some example filter expressions
70
+ # are:<br>- $filter=(name.value eq 'RunsSucceeded') and aggregationType eq
71
+ # 'Total' and startTime eq 2016-02-20 and endTime eq 2016-02-21 and timeGrain
72
+ # eq duration'PT1M',<br>- $filter=(name.value eq 'RunsSucceeded') and
73
+ # (aggregationType eq 'Total' or aggregationType eq 'Average') and startTime eq
74
+ # 2016-02-20 and endTime eq 2016-02-21 and timeGrain eq duration'PT1H',<br>-
75
+ # $filter=(name.value eq 'ActionsCompleted' or name.value eq 'RunsSucceeded')
76
+ # and (aggregationType eq 'Total' or aggregationType eq 'Average') and
77
+ # startTime eq 2016-02-20 and endTime eq 2016-02-21 and timeGrain eq
78
+ # duration'PT1M'.<br><br>**NOTE**: When a metrics query comes in with multiple
79
+ # metrics, but with no aggregation types defined, the service will pick the
80
+ # Primary aggregation type of the first metrics to be used as the default
81
+ # aggregation type for all the metrics.
82
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
83
+ # will be added to the HTTP request.
84
+ #
85
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
86
+ #
87
+ def list_with_http_info(resource_uri, filter:nil, custom_headers:nil)
88
+ list_async(resource_uri, filter:filter, custom_headers:custom_headers).value!
89
+ end
90
+
91
+ #
92
+ # Lists the metric values for a resource.
93
+ #
94
+ # @param resource_uri [String] The identifier of the resource.
95
+ # @param filter [String] Reduces the set of data collected.<br>The filter is
96
+ # optional. If present it must contain a list of metric names to retrieve of
97
+ # the form: *(name.value eq 'metricName' [or name.value eq 'metricName' or
98
+ # ...])*. Optionally, the filter can contain conditions for the following
99
+ # attributes *aggregationType*, *startTime*, *endTime*, and *timeGrain* of the
100
+ # form *attributeName operator value*. Where operator is one of *ne*, *eq*,
101
+ # *gt*, *lt*.<br>Several conditions can be combined with parentheses and
102
+ # logical operators, e.g: *and*, *or*.<br>Some example filter expressions
103
+ # are:<br>- $filter=(name.value eq 'RunsSucceeded') and aggregationType eq
104
+ # 'Total' and startTime eq 2016-02-20 and endTime eq 2016-02-21 and timeGrain
105
+ # eq duration'PT1M',<br>- $filter=(name.value eq 'RunsSucceeded') and
106
+ # (aggregationType eq 'Total' or aggregationType eq 'Average') and startTime eq
107
+ # 2016-02-20 and endTime eq 2016-02-21 and timeGrain eq duration'PT1H',<br>-
108
+ # $filter=(name.value eq 'ActionsCompleted' or name.value eq 'RunsSucceeded')
109
+ # and (aggregationType eq 'Total' or aggregationType eq 'Average') and
110
+ # startTime eq 2016-02-20 and endTime eq 2016-02-21 and timeGrain eq
111
+ # duration'PT1M'.<br><br>**NOTE**: When a metrics query comes in with multiple
112
+ # metrics, but with no aggregation types defined, the service will pick the
113
+ # Primary aggregation type of the first metrics to be used as the default
114
+ # aggregation type for all the metrics.
115
+ # @param [Hash{String => String}] A hash of custom headers that will be added
116
+ # to the HTTP request.
117
+ #
118
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
119
+ #
120
+ def list_async(resource_uri, filter:nil, custom_headers:nil)
121
+ fail ArgumentError, 'resource_uri is nil' if resource_uri.nil?
122
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
123
+
124
+
125
+ request_headers = {}
126
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
127
+
128
+ # Set Headers
129
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
130
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
131
+ path_template = '{resourceUri}/providers/microsoft.insights/metrics'
132
+
133
+ request_url = @base_url || @client.base_url
134
+
135
+ options = {
136
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
137
+ skip_encoding_path_params: {'resourceUri' => resource_uri},
138
+ query_params: {'$filter' => filter,'api-version' => @client.api_version},
139
+ headers: request_headers.merge(custom_headers || {}),
140
+ base_url: request_url
141
+ }
142
+ promise = @client.make_request_async(:get, path_template, options)
143
+
144
+ promise = promise.then do |result|
145
+ http_response = result.response
146
+ status_code = http_response.status
147
+ response_content = http_response.body
148
+ unless status_code == 200
149
+ error_model = JSON.load(response_content)
150
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
151
+ end
152
+
153
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
154
+ # Deserialize Response
155
+ if status_code == 200
156
+ begin
157
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
158
+ result_mapper = Azure::Monitor::Mgmt::V2016_09_01::Models::MetricCollection.mapper()
159
+ result.body = @client.deserialize(result_mapper, parsed_response)
160
+ rescue Exception => e
161
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
162
+ end
163
+ end
164
+
165
+ result
166
+ end
167
+
168
+ promise.execute
169
+ end
170
+
171
+ end
172
+ end
@@ -0,0 +1,57 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Monitor::Mgmt::V2016_09_01
7
+ module Models
8
+ #
9
+ # The localizable string class.
10
+ #
11
+ class LocalizableString
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [String] the invariant value.
16
+ attr_accessor :value
17
+
18
+ # @return [String] the locale specific value.
19
+ attr_accessor :localized_value
20
+
21
+
22
+ #
23
+ # Mapper for LocalizableString class as Ruby Hash.
24
+ # This will be used for serialization/deserialization.
25
+ #
26
+ def self.mapper()
27
+ {
28
+ client_side_validation: true,
29
+ required: false,
30
+ serialized_name: 'LocalizableString',
31
+ type: {
32
+ name: 'Composite',
33
+ class_name: 'LocalizableString',
34
+ model_properties: {
35
+ value: {
36
+ client_side_validation: true,
37
+ required: true,
38
+ serialized_name: 'value',
39
+ type: {
40
+ name: 'String'
41
+ }
42
+ },
43
+ localized_value: {
44
+ client_side_validation: true,
45
+ required: false,
46
+ serialized_name: 'localizedValue',
47
+ type: {
48
+ name: 'String'
49
+ }
50
+ }
51
+ }
52
+ }
53
+ }
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,105 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Monitor::Mgmt::V2016_09_01
7
+ module Models
8
+ #
9
+ # A set of metric values in a time range.
10
+ #
11
+ class Metric
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [String] the id, resourceId, of the metric.
16
+ attr_accessor :id
17
+
18
+ # @return [String] the resource type of the metric resource.
19
+ attr_accessor :type
20
+
21
+ # @return [LocalizableString] the name and the display name of the
22
+ # metric, i.e. it is localizable string.
23
+ attr_accessor :name
24
+
25
+ # @return [Unit] the unit of the metric. Possible values include:
26
+ # 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond',
27
+ # 'Percent', 'MilliSeconds'
28
+ attr_accessor :unit
29
+
30
+ # @return [Array<MetricValue>] Array of data points representing the
31
+ # metric values.
32
+ attr_accessor :data
33
+
34
+
35
+ #
36
+ # Mapper for Metric class as Ruby Hash.
37
+ # This will be used for serialization/deserialization.
38
+ #
39
+ def self.mapper()
40
+ {
41
+ client_side_validation: true,
42
+ required: false,
43
+ serialized_name: 'Metric',
44
+ type: {
45
+ name: 'Composite',
46
+ class_name: 'Metric',
47
+ model_properties: {
48
+ id: {
49
+ client_side_validation: true,
50
+ required: false,
51
+ serialized_name: 'id',
52
+ type: {
53
+ name: 'String'
54
+ }
55
+ },
56
+ type: {
57
+ client_side_validation: true,
58
+ required: false,
59
+ serialized_name: 'type',
60
+ type: {
61
+ name: 'String'
62
+ }
63
+ },
64
+ name: {
65
+ client_side_validation: true,
66
+ required: true,
67
+ serialized_name: 'name',
68
+ type: {
69
+ name: 'Composite',
70
+ class_name: 'LocalizableString'
71
+ }
72
+ },
73
+ unit: {
74
+ client_side_validation: true,
75
+ required: true,
76
+ serialized_name: 'unit',
77
+ type: {
78
+ name: 'Enum',
79
+ module: 'Unit'
80
+ }
81
+ },
82
+ data: {
83
+ client_side_validation: true,
84
+ required: true,
85
+ serialized_name: 'data',
86
+ type: {
87
+ name: 'Sequence',
88
+ element: {
89
+ client_side_validation: true,
90
+ required: false,
91
+ serialized_name: 'MetricValueElementType',
92
+ type: {
93
+ name: 'Composite',
94
+ class_name: 'MetricValue'
95
+ }
96
+ }
97
+ }
98
+ }
99
+ }
100
+ }
101
+ }
102
+ end
103
+ end
104
+ end
105
+ end