azure_mgmt_monitor 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/azure_mgmt_monitor.rb +5 -0
  4. data/lib/generated/azure_mgmt_monitor.rb +96 -0
  5. data/lib/generated/azure_mgmt_monitor/action_groups.rb +579 -0
  6. data/lib/generated/azure_mgmt_monitor/activity_log_alerts.rb +593 -0
  7. data/lib/generated/azure_mgmt_monitor/alert_rule_incidents.rb +211 -0
  8. data/lib/generated/azure_mgmt_monitor/alert_rules.rb +510 -0
  9. data/lib/generated/azure_mgmt_monitor/autoscale_settings.rb +618 -0
  10. data/lib/generated/azure_mgmt_monitor/log_profiles.rb +477 -0
  11. data/lib/generated/azure_mgmt_monitor/models/action_group_list.rb +63 -0
  12. data/lib/generated/azure_mgmt_monitor/models/action_group_resource.rb +164 -0
  13. data/lib/generated/azure_mgmt_monitor/models/activity_log_alert_action_group.rb +65 -0
  14. data/lib/generated/azure_mgmt_monitor/models/activity_log_alert_action_list.rb +54 -0
  15. data/lib/generated/azure_mgmt_monitor/models/activity_log_alert_all_of_condition.rb +55 -0
  16. data/lib/generated/azure_mgmt_monitor/models/activity_log_alert_leaf_condition.rb +61 -0
  17. data/lib/generated/azure_mgmt_monitor/models/activity_log_alert_list.rb +64 -0
  18. data/lib/generated/azure_mgmt_monitor/models/activity_log_alert_patch_body.rb +65 -0
  19. data/lib/generated/azure_mgmt_monitor/models/activity_log_alert_resource.rb +147 -0
  20. data/lib/generated/azure_mgmt_monitor/models/alert_rule_resource.rb +159 -0
  21. data/lib/generated/azure_mgmt_monitor/models/alert_rule_resource_collection.rb +54 -0
  22. data/lib/generated/azure_mgmt_monitor/models/alert_rule_resource_patch.rb +131 -0
  23. data/lib/generated/azure_mgmt_monitor/models/autoscale_notification.rb +78 -0
  24. data/lib/generated/azure_mgmt_monitor/models/autoscale_profile.rb +101 -0
  25. data/lib/generated/azure_mgmt_monitor/models/autoscale_setting_resource.rb +155 -0
  26. data/lib/generated/azure_mgmt_monitor/models/autoscale_setting_resource_collection.rb +95 -0
  27. data/lib/generated/azure_mgmt_monitor/models/autoscale_setting_resource_patch.rb +127 -0
  28. data/lib/generated/azure_mgmt_monitor/models/comparison_operation_type.rb +20 -0
  29. data/lib/generated/azure_mgmt_monitor/models/condition_operator.rb +18 -0
  30. data/lib/generated/azure_mgmt_monitor/models/email_notification.rb +75 -0
  31. data/lib/generated/azure_mgmt_monitor/models/email_receiver.rb +69 -0
  32. data/lib/generated/azure_mgmt_monitor/models/enable_request.rb +45 -0
  33. data/lib/generated/azure_mgmt_monitor/models/error_response.rb +55 -0
  34. data/lib/generated/azure_mgmt_monitor/models/incident.rb +93 -0
  35. data/lib/generated/azure_mgmt_monitor/models/incident_list_result.rb +53 -0
  36. data/lib/generated/azure_mgmt_monitor/models/location_threshold_rule_condition.rb +85 -0
  37. data/lib/generated/azure_mgmt_monitor/models/log_profile_collection.rb +53 -0
  38. data/lib/generated/azure_mgmt_monitor/models/log_profile_resource.rb +154 -0
  39. data/lib/generated/azure_mgmt_monitor/models/log_profile_resource_patch.rb +126 -0
  40. data/lib/generated/azure_mgmt_monitor/models/log_settings.rb +70 -0
  41. data/lib/generated/azure_mgmt_monitor/models/management_event_aggregation_condition.rb +70 -0
  42. data/lib/generated/azure_mgmt_monitor/models/management_event_rule_condition.rb +73 -0
  43. data/lib/generated/azure_mgmt_monitor/models/metric_settings.rb +67 -0
  44. data/lib/generated/azure_mgmt_monitor/models/metric_statistic_type.rb +18 -0
  45. data/lib/generated/azure_mgmt_monitor/models/metric_trigger.rb +134 -0
  46. data/lib/generated/azure_mgmt_monitor/models/receiver_status.rb +17 -0
  47. data/lib/generated/azure_mgmt_monitor/models/recurrence.rb +62 -0
  48. data/lib/generated/azure_mgmt_monitor/models/recurrence_frequency.rb +22 -0
  49. data/lib/generated/azure_mgmt_monitor/models/recurrent_schedule.rb +139 -0
  50. data/lib/generated/azure_mgmt_monitor/models/retention_policy.rb +60 -0
  51. data/lib/generated/azure_mgmt_monitor/models/rule_action.rb +48 -0
  52. data/lib/generated/azure_mgmt_monitor/models/rule_condition.rb +63 -0
  53. data/lib/generated/azure_mgmt_monitor/models/rule_data_source.rb +58 -0
  54. data/lib/generated/azure_mgmt_monitor/models/rule_email_action.rb +80 -0
  55. data/lib/generated/azure_mgmt_monitor/models/rule_management_event_claims_data_source.rb +45 -0
  56. data/lib/generated/azure_mgmt_monitor/models/rule_management_event_data_source.rb +150 -0
  57. data/lib/generated/azure_mgmt_monitor/models/rule_metric_data_source.rb +68 -0
  58. data/lib/generated/azure_mgmt_monitor/models/rule_webhook_action.rb +80 -0
  59. data/lib/generated/azure_mgmt_monitor/models/scale_action.rb +86 -0
  60. data/lib/generated/azure_mgmt_monitor/models/scale_capacity.rb +69 -0
  61. data/lib/generated/azure_mgmt_monitor/models/scale_direction.rb +17 -0
  62. data/lib/generated/azure_mgmt_monitor/models/scale_rule.rb +57 -0
  63. data/lib/generated/azure_mgmt_monitor/models/scale_type.rb +17 -0
  64. data/lib/generated/azure_mgmt_monitor/models/service_diagnostic_settings_resource.rb +163 -0
  65. data/lib/generated/azure_mgmt_monitor/models/service_diagnostic_settings_resource_patch.rb +135 -0
  66. data/lib/generated/azure_mgmt_monitor/models/sms_receiver.rb +79 -0
  67. data/lib/generated/azure_mgmt_monitor/models/threshold_rule_condition.rb +108 -0
  68. data/lib/generated/azure_mgmt_monitor/models/time_aggregation_operator.rb +19 -0
  69. data/lib/generated/azure_mgmt_monitor/models/time_aggregation_type.rb +19 -0
  70. data/lib/generated/azure_mgmt_monitor/models/time_window.rb +104 -0
  71. data/lib/generated/azure_mgmt_monitor/models/webhook_notification.rb +63 -0
  72. data/lib/generated/azure_mgmt_monitor/models/webhook_receiver.rb +56 -0
  73. data/lib/generated/azure_mgmt_monitor/module_definition.rb +8 -0
  74. data/lib/generated/azure_mgmt_monitor/monitor_management_client.rb +150 -0
  75. data/lib/generated/azure_mgmt_monitor/service_diagnostic_settings_operations.rb +330 -0
  76. data/lib/generated/azure_mgmt_monitor/version.rb +8 -0
  77. metadata +188 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fb805667d38052162d18477a9bf6acd10fa7e281
4
+ data.tar.gz: ebed43f4dc587663249246df89e4d670bbb6bfc7
5
+ SHA512:
6
+ metadata.gz: 89d09a701a7785c728c7faa80eed1567bee5cfc2bafb4701a13b8676461e599714c22cf5fb521095e77759e794880f3fc50febbaca7a6d19d136496cc5b2daea
7
+ data.tar.gz: 8eec8a92b89d8ad2ed9d4332f229aea85a6a7cac98c51647241e8bf75165855566901da7048318cd3b4c2217d5e3c14914bc85f15d268a812ea4aab0d53f6f0e
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Microsoft Corporation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # Licensed under the MIT License. See License.txt in the project root for license information.
4
+
5
+ require 'generated/azure_mgmt_monitor'
@@ -0,0 +1,96 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0
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 'generated/azure_mgmt_monitor/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::ARM::Monitor
23
+ autoload :AutoscaleSettings, 'generated/azure_mgmt_monitor/autoscale_settings.rb'
24
+ autoload :AlertRuleIncidents, 'generated/azure_mgmt_monitor/alert_rule_incidents.rb'
25
+ autoload :AlertRules, 'generated/azure_mgmt_monitor/alert_rules.rb'
26
+ autoload :LogProfiles, 'generated/azure_mgmt_monitor/log_profiles.rb'
27
+ autoload :ServiceDiagnosticSettingsOperations, 'generated/azure_mgmt_monitor/service_diagnostic_settings_operations.rb'
28
+ autoload :ActionGroups, 'generated/azure_mgmt_monitor/action_groups.rb'
29
+ autoload :ActivityLogAlerts, 'generated/azure_mgmt_monitor/activity_log_alerts.rb'
30
+ autoload :MonitorManagementClient, 'generated/azure_mgmt_monitor/monitor_management_client.rb'
31
+
32
+ module Models
33
+ autoload :RuleAction, 'generated/azure_mgmt_monitor/models/rule_action.rb'
34
+ autoload :ActionGroupList, 'generated/azure_mgmt_monitor/models/action_group_list.rb'
35
+ autoload :MetricTrigger, 'generated/azure_mgmt_monitor/models/metric_trigger.rb'
36
+ autoload :ActivityLogAlertLeafCondition, 'generated/azure_mgmt_monitor/models/activity_log_alert_leaf_condition.rb'
37
+ autoload :ScaleRule, 'generated/azure_mgmt_monitor/models/scale_rule.rb'
38
+ autoload :ManagementEventAggregationCondition, 'generated/azure_mgmt_monitor/models/management_event_aggregation_condition.rb'
39
+ autoload :RecurrentSchedule, 'generated/azure_mgmt_monitor/models/recurrent_schedule.rb'
40
+ autoload :EnableRequest, 'generated/azure_mgmt_monitor/models/enable_request.rb'
41
+ autoload :AutoscaleProfile, 'generated/azure_mgmt_monitor/models/autoscale_profile.rb'
42
+ autoload :ScaleCapacity, 'generated/azure_mgmt_monitor/models/scale_capacity.rb'
43
+ autoload :WebhookNotification, 'generated/azure_mgmt_monitor/models/webhook_notification.rb'
44
+ autoload :AutoscaleNotification, 'generated/azure_mgmt_monitor/models/autoscale_notification.rb'
45
+ autoload :AutoscaleSettingResourcePatch, 'generated/azure_mgmt_monitor/models/autoscale_setting_resource_patch.rb'
46
+ autoload :SmsReceiver, 'generated/azure_mgmt_monitor/models/sms_receiver.rb'
47
+ autoload :ErrorResponse, 'generated/azure_mgmt_monitor/models/error_response.rb'
48
+ autoload :ActivityLogAlertPatchBody, 'generated/azure_mgmt_monitor/models/activity_log_alert_patch_body.rb'
49
+ autoload :IncidentListResult, 'generated/azure_mgmt_monitor/models/incident_list_result.rb'
50
+ autoload :ActivityLogAlertList, 'generated/azure_mgmt_monitor/models/activity_log_alert_list.rb'
51
+ autoload :RuleCondition, 'generated/azure_mgmt_monitor/models/rule_condition.rb'
52
+ autoload :AlertRuleResourcePatch, 'generated/azure_mgmt_monitor/models/alert_rule_resource_patch.rb'
53
+ autoload :RuleManagementEventClaimsDataSource, 'generated/azure_mgmt_monitor/models/rule_management_event_claims_data_source.rb'
54
+ autoload :AlertRuleResourceCollection, 'generated/azure_mgmt_monitor/models/alert_rule_resource_collection.rb'
55
+ autoload :ScaleAction, 'generated/azure_mgmt_monitor/models/scale_action.rb'
56
+ autoload :RetentionPolicy, 'generated/azure_mgmt_monitor/models/retention_policy.rb'
57
+ autoload :Recurrence, 'generated/azure_mgmt_monitor/models/recurrence.rb'
58
+ autoload :ActivityLogAlertActionList, 'generated/azure_mgmt_monitor/models/activity_log_alert_action_list.rb'
59
+ autoload :AutoscaleSettingResourceCollection, 'generated/azure_mgmt_monitor/models/autoscale_setting_resource_collection.rb'
60
+ autoload :LogProfileResourcePatch, 'generated/azure_mgmt_monitor/models/log_profile_resource_patch.rb'
61
+ autoload :RuleDataSource, 'generated/azure_mgmt_monitor/models/rule_data_source.rb'
62
+ autoload :LogProfileCollection, 'generated/azure_mgmt_monitor/models/log_profile_collection.rb'
63
+ autoload :WebhookReceiver, 'generated/azure_mgmt_monitor/models/webhook_receiver.rb'
64
+ autoload :MetricSettings, 'generated/azure_mgmt_monitor/models/metric_settings.rb'
65
+ autoload :EmailNotification, 'generated/azure_mgmt_monitor/models/email_notification.rb'
66
+ autoload :LogSettings, 'generated/azure_mgmt_monitor/models/log_settings.rb'
67
+ autoload :ActivityLogAlertAllOfCondition, 'generated/azure_mgmt_monitor/models/activity_log_alert_all_of_condition.rb'
68
+ autoload :ActivityLogAlertActionGroup, 'generated/azure_mgmt_monitor/models/activity_log_alert_action_group.rb'
69
+ autoload :Incident, 'generated/azure_mgmt_monitor/models/incident.rb'
70
+ autoload :ServiceDiagnosticSettingsResourcePatch, 'generated/azure_mgmt_monitor/models/service_diagnostic_settings_resource_patch.rb'
71
+ autoload :TimeWindow, 'generated/azure_mgmt_monitor/models/time_window.rb'
72
+ autoload :EmailReceiver, 'generated/azure_mgmt_monitor/models/email_receiver.rb'
73
+ autoload :AutoscaleSettingResource, 'generated/azure_mgmt_monitor/models/autoscale_setting_resource.rb'
74
+ autoload :RuleMetricDataSource, 'generated/azure_mgmt_monitor/models/rule_metric_data_source.rb'
75
+ autoload :RuleManagementEventDataSource, 'generated/azure_mgmt_monitor/models/rule_management_event_data_source.rb'
76
+ autoload :ThresholdRuleCondition, 'generated/azure_mgmt_monitor/models/threshold_rule_condition.rb'
77
+ autoload :LocationThresholdRuleCondition, 'generated/azure_mgmt_monitor/models/location_threshold_rule_condition.rb'
78
+ autoload :ManagementEventRuleCondition, 'generated/azure_mgmt_monitor/models/management_event_rule_condition.rb'
79
+ autoload :RuleEmailAction, 'generated/azure_mgmt_monitor/models/rule_email_action.rb'
80
+ autoload :RuleWebhookAction, 'generated/azure_mgmt_monitor/models/rule_webhook_action.rb'
81
+ autoload :AlertRuleResource, 'generated/azure_mgmt_monitor/models/alert_rule_resource.rb'
82
+ autoload :LogProfileResource, 'generated/azure_mgmt_monitor/models/log_profile_resource.rb'
83
+ autoload :ServiceDiagnosticSettingsResource, 'generated/azure_mgmt_monitor/models/service_diagnostic_settings_resource.rb'
84
+ autoload :ActionGroupResource, 'generated/azure_mgmt_monitor/models/action_group_resource.rb'
85
+ autoload :ActivityLogAlertResource, 'generated/azure_mgmt_monitor/models/activity_log_alert_resource.rb'
86
+ autoload :MetricStatisticType, 'generated/azure_mgmt_monitor/models/metric_statistic_type.rb'
87
+ autoload :TimeAggregationType, 'generated/azure_mgmt_monitor/models/time_aggregation_type.rb'
88
+ autoload :ComparisonOperationType, 'generated/azure_mgmt_monitor/models/comparison_operation_type.rb'
89
+ autoload :ScaleDirection, 'generated/azure_mgmt_monitor/models/scale_direction.rb'
90
+ autoload :ScaleType, 'generated/azure_mgmt_monitor/models/scale_type.rb'
91
+ autoload :RecurrenceFrequency, 'generated/azure_mgmt_monitor/models/recurrence_frequency.rb'
92
+ autoload :ConditionOperator, 'generated/azure_mgmt_monitor/models/condition_operator.rb'
93
+ autoload :TimeAggregationOperator, 'generated/azure_mgmt_monitor/models/time_aggregation_operator.rb'
94
+ autoload :ReceiverStatus, 'generated/azure_mgmt_monitor/models/receiver_status.rb'
95
+ end
96
+ end
@@ -0,0 +1,579 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::Monitor
7
+ #
8
+ # Monitor Management Client
9
+ #
10
+ class ActionGroups
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the ActionGroups 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
+ # Create a new action group or update an existing one.
26
+ #
27
+ # @param resource_group_name [String] The name of the resource group.
28
+ # @param action_group_name [String] The name of the action group.
29
+ # @param action_group [ActionGroupResource] The action group to create or use
30
+ # for the update.
31
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
32
+ # will be added to the HTTP request.
33
+ #
34
+ # @return [ActionGroupResource] operation results.
35
+ #
36
+ def create_or_update(resource_group_name, action_group_name, action_group, custom_headers = nil)
37
+ response = create_or_update_async(resource_group_name, action_group_name, action_group, custom_headers).value!
38
+ response.body unless response.nil?
39
+ end
40
+
41
+ #
42
+ # Create a new action group or update an existing one.
43
+ #
44
+ # @param resource_group_name [String] The name of the resource group.
45
+ # @param action_group_name [String] The name of the action group.
46
+ # @param action_group [ActionGroupResource] The action group to create or use
47
+ # for the update.
48
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
49
+ # will be added to the HTTP request.
50
+ #
51
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
52
+ #
53
+ def create_or_update_with_http_info(resource_group_name, action_group_name, action_group, custom_headers = nil)
54
+ create_or_update_async(resource_group_name, action_group_name, action_group, custom_headers).value!
55
+ end
56
+
57
+ #
58
+ # Create a new action group or update an existing one.
59
+ #
60
+ # @param resource_group_name [String] The name of the resource group.
61
+ # @param action_group_name [String] The name of the action group.
62
+ # @param action_group [ActionGroupResource] The action group to create or use
63
+ # for the update.
64
+ # @param [Hash{String => String}] A hash of custom headers that will be added
65
+ # to the HTTP request.
66
+ #
67
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
68
+ #
69
+ def create_or_update_async(resource_group_name, action_group_name, action_group, custom_headers = nil)
70
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
71
+ fail ArgumentError, 'action_group_name is nil' if action_group_name.nil?
72
+ fail ArgumentError, 'action_group is nil' if action_group.nil?
73
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
74
+ api_version = '2017-04-01'
75
+
76
+
77
+ request_headers = {}
78
+
79
+ # Set Headers
80
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
81
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
82
+
83
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
84
+
85
+ # Serialize Request
86
+ request_mapper = Azure::ARM::Monitor::Models::ActionGroupResource.mapper()
87
+ request_content = @client.serialize(request_mapper, action_group)
88
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
89
+
90
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'
91
+
92
+ request_url = @base_url || @client.base_url
93
+
94
+ options = {
95
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
96
+ path_params: {'resourceGroupName' => resource_group_name,'actionGroupName' => action_group_name,'subscriptionId' => @client.subscription_id},
97
+ query_params: {'api-version' => api_version},
98
+ body: request_content,
99
+ headers: request_headers.merge(custom_headers || {}),
100
+ base_url: request_url
101
+ }
102
+ promise = @client.make_request_async(:put, path_template, options)
103
+
104
+ promise = promise.then do |result|
105
+ http_response = result.response
106
+ status_code = http_response.status
107
+ response_content = http_response.body
108
+ unless status_code == 200 || status_code == 201
109
+ error_model = JSON.load(response_content)
110
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
111
+ end
112
+
113
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
114
+ # Deserialize Response
115
+ if status_code == 200
116
+ begin
117
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
118
+ result_mapper = Azure::ARM::Monitor::Models::ActionGroupResource.mapper()
119
+ result.body = @client.deserialize(result_mapper, parsed_response)
120
+ rescue Exception => e
121
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
122
+ end
123
+ end
124
+ # Deserialize Response
125
+ if status_code == 201
126
+ begin
127
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
128
+ result_mapper = Azure::ARM::Monitor::Models::ActionGroupResource.mapper()
129
+ result.body = @client.deserialize(result_mapper, parsed_response)
130
+ rescue Exception => e
131
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
132
+ end
133
+ end
134
+
135
+ result
136
+ end
137
+
138
+ promise.execute
139
+ end
140
+
141
+ #
142
+ # Get an action group.
143
+ #
144
+ # @param resource_group_name [String] The name of the resource group.
145
+ # @param action_group_name [String] The name of the action group.
146
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
147
+ # will be added to the HTTP request.
148
+ #
149
+ # @return [ActionGroupResource] operation results.
150
+ #
151
+ def get(resource_group_name, action_group_name, custom_headers = nil)
152
+ response = get_async(resource_group_name, action_group_name, custom_headers).value!
153
+ response.body unless response.nil?
154
+ end
155
+
156
+ #
157
+ # Get an action group.
158
+ #
159
+ # @param resource_group_name [String] The name of the resource group.
160
+ # @param action_group_name [String] The name of the action group.
161
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
162
+ # will be added to the HTTP request.
163
+ #
164
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
165
+ #
166
+ def get_with_http_info(resource_group_name, action_group_name, custom_headers = nil)
167
+ get_async(resource_group_name, action_group_name, custom_headers).value!
168
+ end
169
+
170
+ #
171
+ # Get an action group.
172
+ #
173
+ # @param resource_group_name [String] The name of the resource group.
174
+ # @param action_group_name [String] The name of the action group.
175
+ # @param [Hash{String => String}] A hash of custom headers that will be added
176
+ # to the HTTP request.
177
+ #
178
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
179
+ #
180
+ def get_async(resource_group_name, action_group_name, custom_headers = nil)
181
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
182
+ fail ArgumentError, 'action_group_name is nil' if action_group_name.nil?
183
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
184
+ api_version = '2017-04-01'
185
+
186
+
187
+ request_headers = {}
188
+
189
+ # Set Headers
190
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
191
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
192
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'
193
+
194
+ request_url = @base_url || @client.base_url
195
+
196
+ options = {
197
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
198
+ path_params: {'resourceGroupName' => resource_group_name,'actionGroupName' => action_group_name,'subscriptionId' => @client.subscription_id},
199
+ query_params: {'api-version' => api_version},
200
+ headers: request_headers.merge(custom_headers || {}),
201
+ base_url: request_url
202
+ }
203
+ promise = @client.make_request_async(:get, path_template, options)
204
+
205
+ promise = promise.then do |result|
206
+ http_response = result.response
207
+ status_code = http_response.status
208
+ response_content = http_response.body
209
+ unless status_code == 200 || status_code == 404
210
+ error_model = JSON.load(response_content)
211
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
212
+ end
213
+
214
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
215
+ # Deserialize Response
216
+ if status_code == 200
217
+ begin
218
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
219
+ result_mapper = Azure::ARM::Monitor::Models::ActionGroupResource.mapper()
220
+ result.body = @client.deserialize(result_mapper, parsed_response)
221
+ rescue Exception => e
222
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
223
+ end
224
+ end
225
+
226
+ result
227
+ end
228
+
229
+ promise.execute
230
+ end
231
+
232
+ #
233
+ # Delete an action group.
234
+ #
235
+ # @param resource_group_name [String] The name of the resource group.
236
+ # @param action_group_name [String] The name of the action group.
237
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
238
+ # will be added to the HTTP request.
239
+ #
240
+ #
241
+ def delete(resource_group_name, action_group_name, custom_headers = nil)
242
+ response = delete_async(resource_group_name, action_group_name, custom_headers).value!
243
+ nil
244
+ end
245
+
246
+ #
247
+ # Delete an action group.
248
+ #
249
+ # @param resource_group_name [String] The name of the resource group.
250
+ # @param action_group_name [String] The name of the action group.
251
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
252
+ # will be added to the HTTP request.
253
+ #
254
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
255
+ #
256
+ def delete_with_http_info(resource_group_name, action_group_name, custom_headers = nil)
257
+ delete_async(resource_group_name, action_group_name, custom_headers).value!
258
+ end
259
+
260
+ #
261
+ # Delete an action group.
262
+ #
263
+ # @param resource_group_name [String] The name of the resource group.
264
+ # @param action_group_name [String] The name of the action group.
265
+ # @param [Hash{String => String}] A hash of custom headers that will be added
266
+ # to the HTTP request.
267
+ #
268
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
269
+ #
270
+ def delete_async(resource_group_name, action_group_name, custom_headers = nil)
271
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
272
+ fail ArgumentError, 'action_group_name is nil' if action_group_name.nil?
273
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
274
+ api_version = '2017-04-01'
275
+
276
+
277
+ request_headers = {}
278
+
279
+ # Set Headers
280
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
281
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
282
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'
283
+
284
+ request_url = @base_url || @client.base_url
285
+
286
+ options = {
287
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
288
+ path_params: {'resourceGroupName' => resource_group_name,'actionGroupName' => action_group_name,'subscriptionId' => @client.subscription_id},
289
+ query_params: {'api-version' => api_version},
290
+ headers: request_headers.merge(custom_headers || {}),
291
+ base_url: request_url
292
+ }
293
+ promise = @client.make_request_async(:delete, path_template, options)
294
+
295
+ promise = promise.then do |result|
296
+ http_response = result.response
297
+ status_code = http_response.status
298
+ response_content = http_response.body
299
+ unless status_code == 200 || status_code == 204
300
+ error_model = JSON.load(response_content)
301
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
302
+ end
303
+
304
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
305
+
306
+ result
307
+ end
308
+
309
+ promise.execute
310
+ end
311
+
312
+ #
313
+ # Get a list of all action groups in a subscription.
314
+ #
315
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
316
+ # will be added to the HTTP request.
317
+ #
318
+ # @return [ActionGroupList] operation results.
319
+ #
320
+ def list_by_subscription_id(custom_headers = nil)
321
+ response = list_by_subscription_id_async(custom_headers).value!
322
+ response.body unless response.nil?
323
+ end
324
+
325
+ #
326
+ # Get a list of all action groups in a subscription.
327
+ #
328
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
329
+ # will be added to the HTTP request.
330
+ #
331
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
332
+ #
333
+ def list_by_subscription_id_with_http_info(custom_headers = nil)
334
+ list_by_subscription_id_async(custom_headers).value!
335
+ end
336
+
337
+ #
338
+ # Get a list of all action groups in a subscription.
339
+ #
340
+ # @param [Hash{String => String}] A hash of custom headers that will be added
341
+ # to the HTTP request.
342
+ #
343
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
344
+ #
345
+ def list_by_subscription_id_async(custom_headers = nil)
346
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
347
+ api_version = '2017-04-01'
348
+
349
+
350
+ request_headers = {}
351
+
352
+ # Set Headers
353
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
354
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
355
+ path_template = 'subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups'
356
+
357
+ request_url = @base_url || @client.base_url
358
+
359
+ options = {
360
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
361
+ path_params: {'subscriptionId' => @client.subscription_id},
362
+ query_params: {'api-version' => api_version},
363
+ headers: request_headers.merge(custom_headers || {}),
364
+ base_url: request_url
365
+ }
366
+ promise = @client.make_request_async(:get, path_template, options)
367
+
368
+ promise = promise.then do |result|
369
+ http_response = result.response
370
+ status_code = http_response.status
371
+ response_content = http_response.body
372
+ unless status_code == 200
373
+ error_model = JSON.load(response_content)
374
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
375
+ end
376
+
377
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
378
+ # Deserialize Response
379
+ if status_code == 200
380
+ begin
381
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
382
+ result_mapper = Azure::ARM::Monitor::Models::ActionGroupList.mapper()
383
+ result.body = @client.deserialize(result_mapper, parsed_response)
384
+ rescue Exception => e
385
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
386
+ end
387
+ end
388
+
389
+ result
390
+ end
391
+
392
+ promise.execute
393
+ end
394
+
395
+ #
396
+ # Get a list of all action groups in a resource group.
397
+ #
398
+ # @param resource_group_name [String] The name of the resource group.
399
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
400
+ # will be added to the HTTP request.
401
+ #
402
+ # @return [ActionGroupList] operation results.
403
+ #
404
+ def list_by_resource_group(resource_group_name, custom_headers = nil)
405
+ response = list_by_resource_group_async(resource_group_name, custom_headers).value!
406
+ response.body unless response.nil?
407
+ end
408
+
409
+ #
410
+ # Get a list of all action groups in a resource group.
411
+ #
412
+ # @param resource_group_name [String] The name of the resource group.
413
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
414
+ # will be added to the HTTP request.
415
+ #
416
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
417
+ #
418
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers = nil)
419
+ list_by_resource_group_async(resource_group_name, custom_headers).value!
420
+ end
421
+
422
+ #
423
+ # Get a list of all action groups in a resource group.
424
+ #
425
+ # @param resource_group_name [String] The name of the resource group.
426
+ # @param [Hash{String => String}] A hash of custom headers that will be added
427
+ # to the HTTP request.
428
+ #
429
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
430
+ #
431
+ def list_by_resource_group_async(resource_group_name, custom_headers = nil)
432
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
433
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
434
+ api_version = '2017-04-01'
435
+
436
+
437
+ request_headers = {}
438
+
439
+ # Set Headers
440
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
441
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
442
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups'
443
+
444
+ request_url = @base_url || @client.base_url
445
+
446
+ options = {
447
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
448
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
449
+ query_params: {'api-version' => api_version},
450
+ headers: request_headers.merge(custom_headers || {}),
451
+ base_url: request_url
452
+ }
453
+ promise = @client.make_request_async(:get, path_template, options)
454
+
455
+ promise = promise.then do |result|
456
+ http_response = result.response
457
+ status_code = http_response.status
458
+ response_content = http_response.body
459
+ unless status_code == 200
460
+ error_model = JSON.load(response_content)
461
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
462
+ end
463
+
464
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
465
+ # Deserialize Response
466
+ if status_code == 200
467
+ begin
468
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
469
+ result_mapper = Azure::ARM::Monitor::Models::ActionGroupList.mapper()
470
+ result.body = @client.deserialize(result_mapper, parsed_response)
471
+ rescue Exception => e
472
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
473
+ end
474
+ end
475
+
476
+ result
477
+ end
478
+
479
+ promise.execute
480
+ end
481
+
482
+ #
483
+ # Enable a receiver in an action group. This changes the receiver's status from
484
+ # Disabled to Enabled.
485
+ #
486
+ # @param resource_group_name [String] The name of the resource group.
487
+ # @param action_group_name [String] The name of the action group.
488
+ # @param enable_request [EnableRequest] The receiver to re-enable.
489
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
490
+ # will be added to the HTTP request.
491
+ #
492
+ #
493
+ def enable_receiver(resource_group_name, action_group_name, enable_request, custom_headers = nil)
494
+ response = enable_receiver_async(resource_group_name, action_group_name, enable_request, custom_headers).value!
495
+ nil
496
+ end
497
+
498
+ #
499
+ # Enable a receiver in an action group. This changes the receiver's status from
500
+ # Disabled to Enabled.
501
+ #
502
+ # @param resource_group_name [String] The name of the resource group.
503
+ # @param action_group_name [String] The name of the action group.
504
+ # @param enable_request [EnableRequest] The receiver to re-enable.
505
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
506
+ # will be added to the HTTP request.
507
+ #
508
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
509
+ #
510
+ def enable_receiver_with_http_info(resource_group_name, action_group_name, enable_request, custom_headers = nil)
511
+ enable_receiver_async(resource_group_name, action_group_name, enable_request, custom_headers).value!
512
+ end
513
+
514
+ #
515
+ # Enable a receiver in an action group. This changes the receiver's status from
516
+ # Disabled to Enabled.
517
+ #
518
+ # @param resource_group_name [String] The name of the resource group.
519
+ # @param action_group_name [String] The name of the action group.
520
+ # @param enable_request [EnableRequest] The receiver to re-enable.
521
+ # @param [Hash{String => String}] A hash of custom headers that will be added
522
+ # to the HTTP request.
523
+ #
524
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
525
+ #
526
+ def enable_receiver_async(resource_group_name, action_group_name, enable_request, custom_headers = nil)
527
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
528
+ fail ArgumentError, 'action_group_name is nil' if action_group_name.nil?
529
+ fail ArgumentError, 'enable_request is nil' if enable_request.nil?
530
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
531
+ api_version = '2017-04-01'
532
+
533
+
534
+ request_headers = {}
535
+
536
+ # Set Headers
537
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
538
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
539
+
540
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
541
+
542
+ # Serialize Request
543
+ request_mapper = Azure::ARM::Monitor::Models::EnableRequest.mapper()
544
+ request_content = @client.serialize(request_mapper, enable_request)
545
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
546
+
547
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe'
548
+
549
+ request_url = @base_url || @client.base_url
550
+
551
+ options = {
552
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
553
+ path_params: {'resourceGroupName' => resource_group_name,'actionGroupName' => action_group_name,'subscriptionId' => @client.subscription_id},
554
+ query_params: {'api-version' => api_version},
555
+ body: request_content,
556
+ headers: request_headers.merge(custom_headers || {}),
557
+ base_url: request_url
558
+ }
559
+ promise = @client.make_request_async(:post, path_template, options)
560
+
561
+ promise = promise.then do |result|
562
+ http_response = result.response
563
+ status_code = http_response.status
564
+ response_content = http_response.body
565
+ unless status_code == 200 || status_code == 409 || status_code == 404
566
+ error_model = JSON.load(response_content)
567
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
568
+ end
569
+
570
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
571
+
572
+ result
573
+ end
574
+
575
+ promise.execute
576
+ end
577
+
578
+ end
579
+ end