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,23 @@
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::V2017_05_01_preview
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
+ ByteSeconds = "ByteSeconds"
20
+ Unspecified = "Unspecified"
21
+ end
22
+ end
23
+ end
@@ -31,12 +31,18 @@ module Azure::Monitor::Mgmt::V2017_05_01_preview
31
31
  # is generated and included in each request. Default is true.
32
32
  attr_accessor :generate_client_request_id
33
33
 
34
+ # @return [DiagnosticSettingsOperations] diagnostic_settings_operations
35
+ attr_reader :diagnostic_settings_operations
36
+
34
37
  # @return [DiagnosticSettingsCategoryOperations]
35
38
  # diagnostic_settings_category_operations
36
39
  attr_reader :diagnostic_settings_category_operations
37
40
 
38
- # @return [DiagnosticSettingsOperations] diagnostic_settings_operations
39
- attr_reader :diagnostic_settings_operations
41
+ # @return [MetricDefinitions] metric_definitions
42
+ attr_reader :metric_definitions
43
+
44
+ # @return [Metrics] metrics
45
+ attr_reader :metrics
40
46
 
41
47
  #
42
48
  # Creates initializes a new instance of the MonitorManagementClient class.
@@ -51,8 +57,10 @@ module Azure::Monitor::Mgmt::V2017_05_01_preview
51
57
  fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
52
58
  @credentials = credentials
53
59
 
54
- @diagnostic_settings_category_operations = DiagnosticSettingsCategoryOperations.new(self)
55
60
  @diagnostic_settings_operations = DiagnosticSettingsOperations.new(self)
61
+ @diagnostic_settings_category_operations = DiagnosticSettingsCategoryOperations.new(self)
62
+ @metric_definitions = MetricDefinitions.new(self)
63
+ @metrics = Metrics.new(self)
56
64
  @api_version = '2017-05-01-preview'
57
65
  @accept_language = 'en-US'
58
66
  @long_running_operation_retry_timeout = 30
@@ -5,7 +5,7 @@
5
5
 
6
6
  module Azure::Monitor::Mgmt::V2017_11_01_preview
7
7
  #
8
- # MetricBaseline
8
+ # Monitor Management Client
9
9
  #
10
10
  class MetricBaseline
11
11
  include MsRestAzure
@@ -0,0 +1,42 @@
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
+ require 'uri'
7
+ require 'cgi'
8
+ require 'date'
9
+ require 'json'
10
+ require 'base64'
11
+ require 'erb'
12
+ require 'securerandom'
13
+ require 'time'
14
+ require 'timeliness'
15
+ require 'faraday'
16
+ require 'faraday-cookie_jar'
17
+ require 'concurrent'
18
+ require 'ms_rest'
19
+ require '2018-01-01/generated/azure_mgmt_monitor/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::Monitor::Mgmt::V2018_01_01
23
+ autoload :MetricDefinitions, '2018-01-01/generated/azure_mgmt_monitor/metric_definitions.rb'
24
+ autoload :Metrics, '2018-01-01/generated/azure_mgmt_monitor/metrics.rb'
25
+ autoload :MonitorManagementClient, '2018-01-01/generated/azure_mgmt_monitor/monitor_management_client.rb'
26
+
27
+ module Models
28
+ autoload :MetricValue, '2018-01-01/generated/azure_mgmt_monitor/models/metric_value.rb'
29
+ autoload :LocalizableString, '2018-01-01/generated/azure_mgmt_monitor/models/localizable_string.rb'
30
+ autoload :MetadataValue, '2018-01-01/generated/azure_mgmt_monitor/models/metadata_value.rb'
31
+ autoload :MetricDefinition, '2018-01-01/generated/azure_mgmt_monitor/models/metric_definition.rb'
32
+ autoload :TimeSeriesElement, '2018-01-01/generated/azure_mgmt_monitor/models/time_series_element.rb'
33
+ autoload :ErrorResponse, '2018-01-01/generated/azure_mgmt_monitor/models/error_response.rb'
34
+ autoload :Metric, '2018-01-01/generated/azure_mgmt_monitor/models/metric.rb'
35
+ autoload :MetricDefinitionCollection, '2018-01-01/generated/azure_mgmt_monitor/models/metric_definition_collection.rb'
36
+ autoload :Response, '2018-01-01/generated/azure_mgmt_monitor/models/response.rb'
37
+ autoload :MetricAvailability, '2018-01-01/generated/azure_mgmt_monitor/models/metric_availability.rb'
38
+ autoload :Unit, '2018-01-01/generated/azure_mgmt_monitor/models/unit.rb'
39
+ autoload :AggregationType, '2018-01-01/generated/azure_mgmt_monitor/models/aggregation_type.rb'
40
+ autoload :ResultType, '2018-01-01/generated/azure_mgmt_monitor/models/result_type.rb'
41
+ end
42
+ end
@@ -0,0 +1,118 @@
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::V2018_01_01
7
+ #
8
+ # Monitor Management Client
9
+ #
10
+ class MetricDefinitions
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the MetricDefinitions class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [MonitorManagementClient] reference to the MonitorManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Lists the metric definitions for the resource.
26
+ #
27
+ # @param resource_uri [String] The identifier of the resource.
28
+ # @param metricnamespace [String] Metric namespace to query metric definitions
29
+ # for.
30
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
31
+ # will be added to the HTTP request.
32
+ #
33
+ # @return [MetricDefinitionCollection] operation results.
34
+ #
35
+ def list(resource_uri, metricnamespace:nil, custom_headers:nil)
36
+ response = list_async(resource_uri, metricnamespace:metricnamespace, custom_headers:custom_headers).value!
37
+ response.body unless response.nil?
38
+ end
39
+
40
+ #
41
+ # Lists the metric definitions for the resource.
42
+ #
43
+ # @param resource_uri [String] The identifier of the resource.
44
+ # @param metricnamespace [String] Metric namespace to query metric definitions
45
+ # for.
46
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
47
+ # will be added to the HTTP request.
48
+ #
49
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
50
+ #
51
+ def list_with_http_info(resource_uri, metricnamespace:nil, custom_headers:nil)
52
+ list_async(resource_uri, metricnamespace:metricnamespace, custom_headers:custom_headers).value!
53
+ end
54
+
55
+ #
56
+ # Lists the metric definitions for the resource.
57
+ #
58
+ # @param resource_uri [String] The identifier of the resource.
59
+ # @param metricnamespace [String] Metric namespace to query metric definitions
60
+ # for.
61
+ # @param [Hash{String => String}] A hash of custom headers that will be added
62
+ # to the HTTP request.
63
+ #
64
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
65
+ #
66
+ def list_async(resource_uri, metricnamespace:nil, custom_headers:nil)
67
+ fail ArgumentError, 'resource_uri is nil' if resource_uri.nil?
68
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
69
+
70
+
71
+ request_headers = {}
72
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
73
+
74
+ # Set Headers
75
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
76
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
77
+ path_template = '{resourceUri}/providers/microsoft.insights/metricDefinitions'
78
+
79
+ request_url = @base_url || @client.base_url
80
+
81
+ options = {
82
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
83
+ skip_encoding_path_params: {'resourceUri' => resource_uri},
84
+ query_params: {'api-version' => @client.api_version,'metricnamespace' => metricnamespace},
85
+ headers: request_headers.merge(custom_headers || {}),
86
+ base_url: request_url
87
+ }
88
+ promise = @client.make_request_async(:get, path_template, options)
89
+
90
+ promise = promise.then do |result|
91
+ http_response = result.response
92
+ status_code = http_response.status
93
+ response_content = http_response.body
94
+ unless status_code == 200
95
+ error_model = JSON.load(response_content)
96
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
97
+ end
98
+
99
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
100
+ # Deserialize Response
101
+ if status_code == 200
102
+ begin
103
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
104
+ result_mapper = Azure::Monitor::Mgmt::V2018_01_01::Models::MetricDefinitionCollection.mapper()
105
+ result.body = @client.deserialize(result_mapper, parsed_response)
106
+ rescue Exception => e
107
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
108
+ end
109
+ end
110
+
111
+ result
112
+ end
113
+
114
+ promise.execute
115
+ end
116
+
117
+ end
118
+ end
@@ -0,0 +1,199 @@
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::V2018_01_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 [MonitorManagementClient] reference to the MonitorManagementClient
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 timespan [String] The timespan of the query. It is a string with the
29
+ # following format 'startDateTime_ISO/endDateTime_ISO'.
30
+ # @param interval [Duration] The interval (i.e. timegrain) of the query.
31
+ # @param metricnames [String] The names of the metrics (comma separated) to
32
+ # retrieve.
33
+ # @param aggregation [String] The list of aggregation types (comma separated)
34
+ # to retrieve.
35
+ # @param top [Integer] The maximum number of records to retrieve.
36
+ # Valid only if $filter is specified.
37
+ # Defaults to 10.
38
+ # @param orderby [String] The aggregation to use for sorting results and the
39
+ # direction of the sort.
40
+ # Only one order can be specified.
41
+ # Examples: sum asc.
42
+ # @param filter [String] The **$filter** is used to reduce the set of metric
43
+ # data returned.<br>Example:<br>Metric contains metadata A, B and C.<br>-
44
+ # Return all time series of C where A = a1 and B = b1 or b2<br>**$filter=A eq
45
+ # ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**<br>- Invalid
46
+ # variant:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B =
47
+ # ‘b2’**<br>This is invalid because the logical or operator cannot separate two
48
+ # different metadata names.<br>- Return all time series where A = a1, B = b1
49
+ # and C = c1:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**<br>- Return
50
+ # all time series where A = a1<br>**$filter=A eq ‘a1’ and B eq ‘*’ and C eq
51
+ # ‘*’**.
52
+ # @param result_type [ResultType] Reduces the set of data collected. The syntax
53
+ # allowed depends on the operation. See the operation's description for
54
+ # details. Possible values include: 'Data', 'Metadata'
55
+ # @param metricnamespace [String] Metric namespace to query metric definitions
56
+ # for.
57
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
58
+ # will be added to the HTTP request.
59
+ #
60
+ # @return [Response] operation results.
61
+ #
62
+ def list(resource_uri, timespan:nil, interval:nil, metricnames:nil, aggregation:nil, top:nil, orderby:nil, filter:nil, result_type:nil, metricnamespace:nil, custom_headers:nil)
63
+ response = list_async(resource_uri, timespan:timespan, interval:interval, metricnames:metricnames, aggregation:aggregation, top:top, orderby:orderby, filter:filter, result_type:result_type, metricnamespace:metricnamespace, custom_headers:custom_headers).value!
64
+ response.body unless response.nil?
65
+ end
66
+
67
+ #
68
+ # **Lists the metric values for a resource**.
69
+ #
70
+ # @param resource_uri [String] The identifier of the resource.
71
+ # @param timespan [String] The timespan of the query. It is a string with the
72
+ # following format 'startDateTime_ISO/endDateTime_ISO'.
73
+ # @param interval [Duration] The interval (i.e. timegrain) of the query.
74
+ # @param metricnames [String] The names of the metrics (comma separated) to
75
+ # retrieve.
76
+ # @param aggregation [String] The list of aggregation types (comma separated)
77
+ # to retrieve.
78
+ # @param top [Integer] The maximum number of records to retrieve.
79
+ # Valid only if $filter is specified.
80
+ # Defaults to 10.
81
+ # @param orderby [String] The aggregation to use for sorting results and the
82
+ # direction of the sort.
83
+ # Only one order can be specified.
84
+ # Examples: sum asc.
85
+ # @param filter [String] The **$filter** is used to reduce the set of metric
86
+ # data returned.<br>Example:<br>Metric contains metadata A, B and C.<br>-
87
+ # Return all time series of C where A = a1 and B = b1 or b2<br>**$filter=A eq
88
+ # ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**<br>- Invalid
89
+ # variant:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B =
90
+ # ‘b2’**<br>This is invalid because the logical or operator cannot separate two
91
+ # different metadata names.<br>- Return all time series where A = a1, B = b1
92
+ # and C = c1:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**<br>- Return
93
+ # all time series where A = a1<br>**$filter=A eq ‘a1’ and B eq ‘*’ and C eq
94
+ # ‘*’**.
95
+ # @param result_type [ResultType] Reduces the set of data collected. The syntax
96
+ # allowed depends on the operation. See the operation's description for
97
+ # details. Possible values include: 'Data', 'Metadata'
98
+ # @param metricnamespace [String] Metric namespace to query metric definitions
99
+ # for.
100
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
101
+ # will be added to the HTTP request.
102
+ #
103
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
104
+ #
105
+ def list_with_http_info(resource_uri, timespan:nil, interval:nil, metricnames:nil, aggregation:nil, top:nil, orderby:nil, filter:nil, result_type:nil, metricnamespace:nil, custom_headers:nil)
106
+ list_async(resource_uri, timespan:timespan, interval:interval, metricnames:metricnames, aggregation:aggregation, top:top, orderby:orderby, filter:filter, result_type:result_type, metricnamespace:metricnamespace, custom_headers:custom_headers).value!
107
+ end
108
+
109
+ #
110
+ # **Lists the metric values for a resource**.
111
+ #
112
+ # @param resource_uri [String] The identifier of the resource.
113
+ # @param timespan [String] The timespan of the query. It is a string with the
114
+ # following format 'startDateTime_ISO/endDateTime_ISO'.
115
+ # @param interval [Duration] The interval (i.e. timegrain) of the query.
116
+ # @param metricnames [String] The names of the metrics (comma separated) to
117
+ # retrieve.
118
+ # @param aggregation [String] The list of aggregation types (comma separated)
119
+ # to retrieve.
120
+ # @param top [Integer] The maximum number of records to retrieve.
121
+ # Valid only if $filter is specified.
122
+ # Defaults to 10.
123
+ # @param orderby [String] The aggregation to use for sorting results and the
124
+ # direction of the sort.
125
+ # Only one order can be specified.
126
+ # Examples: sum asc.
127
+ # @param filter [String] The **$filter** is used to reduce the set of metric
128
+ # data returned.<br>Example:<br>Metric contains metadata A, B and C.<br>-
129
+ # Return all time series of C where A = a1 and B = b1 or b2<br>**$filter=A eq
130
+ # ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**<br>- Invalid
131
+ # variant:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B =
132
+ # ‘b2’**<br>This is invalid because the logical or operator cannot separate two
133
+ # different metadata names.<br>- Return all time series where A = a1, B = b1
134
+ # and C = c1:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**<br>- Return
135
+ # all time series where A = a1<br>**$filter=A eq ‘a1’ and B eq ‘*’ and C eq
136
+ # ‘*’**.
137
+ # @param result_type [ResultType] Reduces the set of data collected. The syntax
138
+ # allowed depends on the operation. See the operation's description for
139
+ # details. Possible values include: 'Data', 'Metadata'
140
+ # @param metricnamespace [String] Metric namespace to query metric definitions
141
+ # for.
142
+ # @param [Hash{String => String}] A hash of custom headers that will be added
143
+ # to the HTTP request.
144
+ #
145
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
146
+ #
147
+ def list_async(resource_uri, timespan:nil, interval:nil, metricnames:nil, aggregation:nil, top:nil, orderby:nil, filter:nil, result_type:nil, metricnamespace:nil, custom_headers:nil)
148
+ fail ArgumentError, 'resource_uri is nil' if resource_uri.nil?
149
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
150
+
151
+
152
+ request_headers = {}
153
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
154
+
155
+ # Set Headers
156
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
157
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
158
+ path_template = '{resourceUri}/providers/microsoft.insights/metrics'
159
+
160
+ request_url = @base_url || @client.base_url
161
+
162
+ options = {
163
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
164
+ skip_encoding_path_params: {'resourceUri' => resource_uri},
165
+ query_params: {'timespan' => timespan,'interval' => interval,'metricnames' => metricnames,'aggregation' => aggregation,'top' => top,'orderby' => orderby,'$filter' => filter,'resultType' => result_type,'api-version' => @client.api_version,'metricnamespace' => metricnamespace},
166
+ headers: request_headers.merge(custom_headers || {}),
167
+ base_url: request_url
168
+ }
169
+ promise = @client.make_request_async(:get, path_template, options)
170
+
171
+ promise = promise.then do |result|
172
+ http_response = result.response
173
+ status_code = http_response.status
174
+ response_content = http_response.body
175
+ unless status_code == 200
176
+ error_model = JSON.load(response_content)
177
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
178
+ end
179
+
180
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
181
+ # Deserialize Response
182
+ if status_code == 200
183
+ begin
184
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
185
+ result_mapper = Azure::Monitor::Mgmt::V2018_01_01::Models::Response.mapper()
186
+ result.body = @client.deserialize(result_mapper, parsed_response)
187
+ rescue Exception => e
188
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
189
+ end
190
+ end
191
+
192
+ result
193
+ end
194
+
195
+ promise.execute
196
+ end
197
+
198
+ end
199
+ end
@@ -0,0 +1,20 @@
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::V2018_01_01
7
+ module Models
8
+ #
9
+ # Defines values for AggregationType
10
+ #
11
+ module AggregationType
12
+ None = "None"
13
+ Average = "Average"
14
+ Count = "Count"
15
+ Minimum = "Minimum"
16
+ Maximum = "Maximum"
17
+ Total = "Total"
18
+ end
19
+ end
20
+ end