azure_mgmt_insights 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/lib/azure_mgmt_insights.rb +5 -0
- data/lib/generated/azure_mgmt_insights.rb +77 -0
- data/lib/generated/azure_mgmt_insights/alert_rule_incidents.rb +121 -0
- data/lib/generated/azure_mgmt_insights/alert_rules.rb +410 -0
- data/lib/generated/azure_mgmt_insights/autoscale_settings.rb +521 -0
- data/lib/generated/azure_mgmt_insights/incidents.rb +117 -0
- data/lib/generated/azure_mgmt_insights/insights_management_client.rb +147 -0
- data/lib/generated/azure_mgmt_insights/log_profiles.rb +375 -0
- data/lib/generated/azure_mgmt_insights/models/alert_rule_resource.rb +156 -0
- data/lib/generated/azure_mgmt_insights/models/alert_rule_resource_collection.rb +53 -0
- data/lib/generated/azure_mgmt_insights/models/autoscale_notification.rb +77 -0
- data/lib/generated/azure_mgmt_insights/models/autoscale_profile.rb +100 -0
- data/lib/generated/azure_mgmt_insights/models/autoscale_setting_resource.rb +152 -0
- data/lib/generated/azure_mgmt_insights/models/autoscale_setting_resource_collection.rb +94 -0
- data/lib/generated/azure_mgmt_insights/models/comparison_operation_type.rb +20 -0
- data/lib/generated/azure_mgmt_insights/models/condition_operator.rb +18 -0
- data/lib/generated/azure_mgmt_insights/models/email_notification.rb +73 -0
- data/lib/generated/azure_mgmt_insights/models/incident.rb +92 -0
- data/lib/generated/azure_mgmt_insights/models/incident_list_result.rb +52 -0
- data/lib/generated/azure_mgmt_insights/models/location_threshold_rule_condition.rb +85 -0
- data/lib/generated/azure_mgmt_insights/models/log_profile_collection.rb +52 -0
- data/lib/generated/azure_mgmt_insights/models/log_profile_create_or_update_parameters.rb +99 -0
- data/lib/generated/azure_mgmt_insights/models/log_profile_resource.rb +143 -0
- data/lib/generated/azure_mgmt_insights/models/log_settings.rb +66 -0
- data/lib/generated/azure_mgmt_insights/models/management_event_aggregation_condition.rb +69 -0
- data/lib/generated/azure_mgmt_insights/models/management_event_rule_condition.rb +74 -0
- data/lib/generated/azure_mgmt_insights/models/metric_settings.rb +66 -0
- data/lib/generated/azure_mgmt_insights/models/metric_statistic_type.rb +18 -0
- data/lib/generated/azure_mgmt_insights/models/metric_trigger.rb +133 -0
- data/lib/generated/azure_mgmt_insights/models/recurrence.rb +61 -0
- data/lib/generated/azure_mgmt_insights/models/recurrence_frequency.rb +22 -0
- data/lib/generated/azure_mgmt_insights/models/recurrent_schedule.rb +101 -0
- data/lib/generated/azure_mgmt_insights/models/retention_policy.rb +55 -0
- data/lib/generated/azure_mgmt_insights/models/rule_action.rb +47 -0
- data/lib/generated/azure_mgmt_insights/models/rule_condition.rb +47 -0
- data/lib/generated/azure_mgmt_insights/models/rule_data_source.rb +46 -0
- data/lib/generated/azure_mgmt_insights/models/rule_email_action.rb +78 -0
- data/lib/generated/azure_mgmt_insights/models/rule_management_event_claims_data_source.rb +44 -0
- data/lib/generated/azure_mgmt_insights/models/rule_management_event_data_source.rb +151 -0
- data/lib/generated/azure_mgmt_insights/models/rule_metric_data_source.rb +70 -0
- data/lib/generated/azure_mgmt_insights/models/rule_webhook_action.rb +77 -0
- data/lib/generated/azure_mgmt_insights/models/scale_action.rb +85 -0
- data/lib/generated/azure_mgmt_insights/models/scale_capacity.rb +67 -0
- data/lib/generated/azure_mgmt_insights/models/scale_direction.rb +17 -0
- data/lib/generated/azure_mgmt_insights/models/scale_rule.rb +57 -0
- data/lib/generated/azure_mgmt_insights/models/service_diagnostic_settings_create_or_update_parameters.rb +101 -0
- data/lib/generated/azure_mgmt_insights/models/service_diagnostic_settings_resource.rb +144 -0
- data/lib/generated/azure_mgmt_insights/models/threshold_rule_condition.rb +111 -0
- data/lib/generated/azure_mgmt_insights/models/time_aggregation_operator.rb +19 -0
- data/lib/generated/azure_mgmt_insights/models/time_aggregation_type.rb +19 -0
- data/lib/generated/azure_mgmt_insights/models/time_window.rb +67 -0
- data/lib/generated/azure_mgmt_insights/models/webhook_notification.rb +61 -0
- data/lib/generated/azure_mgmt_insights/module_definition.rb +8 -0
- data/lib/generated/azure_mgmt_insights/service_diagnostic_settings_operations.rb +216 -0
- data/lib/generated/azure_mgmt_insights/version.rb +8 -0
- metadata +169 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c38aa0d2b35f34a4e3909fea242e1c800ec9eaff
|
4
|
+
data.tar.gz: f64f4c1296d5575f5027b20997b51c561d7ba455
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4d72a9d3f4be88feeefe348d80fe1ee1eacf88d6dd34e78bb6a13536f12c11b3ded603c21b4bc3bd62364cc558ce2a38fcfbdb88a80ab017d62820e6afcf6b81
|
7
|
+
data.tar.gz: afadf70f12a71c31251e32790398391f7bdfdd9448b23df172bb21df5ff52a777132ee64080bb6ebdb398a63c3bb490c3476dd82ed15745a4ca4df5ad71ace94
|
data/LICENSE.txt
ADDED
@@ -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,77 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.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_insights/module_definition'
|
20
|
+
require 'ms_rest_azure'
|
21
|
+
|
22
|
+
module Azure::ARM::Insights
|
23
|
+
autoload :AutoscaleSettings, 'generated/azure_mgmt_insights/autoscale_settings.rb'
|
24
|
+
autoload :ServiceDiagnosticSettingsOperations, 'generated/azure_mgmt_insights/service_diagnostic_settings_operations.rb'
|
25
|
+
autoload :AlertRuleIncidents, 'generated/azure_mgmt_insights/alert_rule_incidents.rb'
|
26
|
+
autoload :Incidents, 'generated/azure_mgmt_insights/incidents.rb'
|
27
|
+
autoload :AlertRules, 'generated/azure_mgmt_insights/alert_rules.rb'
|
28
|
+
autoload :LogProfiles, 'generated/azure_mgmt_insights/log_profiles.rb'
|
29
|
+
autoload :InsightsManagementClient, 'generated/azure_mgmt_insights/insights_management_client.rb'
|
30
|
+
|
31
|
+
module Models
|
32
|
+
autoload :Incident, 'generated/azure_mgmt_insights/models/incident.rb'
|
33
|
+
autoload :IncidentListResult, 'generated/azure_mgmt_insights/models/incident_list_result.rb'
|
34
|
+
autoload :MetricTrigger, 'generated/azure_mgmt_insights/models/metric_trigger.rb'
|
35
|
+
autoload :RuleCondition, 'generated/azure_mgmt_insights/models/rule_condition.rb'
|
36
|
+
autoload :ScaleRule, 'generated/azure_mgmt_insights/models/scale_rule.rb'
|
37
|
+
autoload :RuleDataSource, 'generated/azure_mgmt_insights/models/rule_data_source.rb'
|
38
|
+
autoload :RecurrentSchedule, 'generated/azure_mgmt_insights/models/recurrent_schedule.rb'
|
39
|
+
autoload :ServiceDiagnosticSettingsCreateOrUpdateParameters, 'generated/azure_mgmt_insights/models/service_diagnostic_settings_create_or_update_parameters.rb'
|
40
|
+
autoload :ScaleCapacity, 'generated/azure_mgmt_insights/models/scale_capacity.rb'
|
41
|
+
autoload :EmailNotification, 'generated/azure_mgmt_insights/models/email_notification.rb'
|
42
|
+
autoload :ScaleAction, 'generated/azure_mgmt_insights/models/scale_action.rb'
|
43
|
+
autoload :AutoscaleNotification, 'generated/azure_mgmt_insights/models/autoscale_notification.rb'
|
44
|
+
autoload :TimeWindow, 'generated/azure_mgmt_insights/models/time_window.rb'
|
45
|
+
autoload :AutoscaleSettingResourceCollection, 'generated/azure_mgmt_insights/models/autoscale_setting_resource_collection.rb'
|
46
|
+
autoload :Recurrence, 'generated/azure_mgmt_insights/models/recurrence.rb'
|
47
|
+
autoload :MetricSettings, 'generated/azure_mgmt_insights/models/metric_settings.rb'
|
48
|
+
autoload :RuleAction, 'generated/azure_mgmt_insights/models/rule_action.rb'
|
49
|
+
autoload :AutoscaleProfile, 'generated/azure_mgmt_insights/models/autoscale_profile.rb'
|
50
|
+
autoload :RuleManagementEventClaimsDataSource, 'generated/azure_mgmt_insights/models/rule_management_event_claims_data_source.rb'
|
51
|
+
autoload :ManagementEventAggregationCondition, 'generated/azure_mgmt_insights/models/management_event_aggregation_condition.rb'
|
52
|
+
autoload :RetentionPolicy, 'generated/azure_mgmt_insights/models/retention_policy.rb'
|
53
|
+
autoload :LogProfileCollection, 'generated/azure_mgmt_insights/models/log_profile_collection.rb'
|
54
|
+
autoload :WebhookNotification, 'generated/azure_mgmt_insights/models/webhook_notification.rb'
|
55
|
+
autoload :LogProfileCreateOrUpdateParameters, 'generated/azure_mgmt_insights/models/log_profile_create_or_update_parameters.rb'
|
56
|
+
autoload :LogSettings, 'generated/azure_mgmt_insights/models/log_settings.rb'
|
57
|
+
autoload :AlertRuleResourceCollection, 'generated/azure_mgmt_insights/models/alert_rule_resource_collection.rb'
|
58
|
+
autoload :AutoscaleSettingResource, 'generated/azure_mgmt_insights/models/autoscale_setting_resource.rb'
|
59
|
+
autoload :ServiceDiagnosticSettingsResource, 'generated/azure_mgmt_insights/models/service_diagnostic_settings_resource.rb'
|
60
|
+
autoload :RuleMetricDataSource, 'generated/azure_mgmt_insights/models/rule_metric_data_source.rb'
|
61
|
+
autoload :RuleManagementEventDataSource, 'generated/azure_mgmt_insights/models/rule_management_event_data_source.rb'
|
62
|
+
autoload :ThresholdRuleCondition, 'generated/azure_mgmt_insights/models/threshold_rule_condition.rb'
|
63
|
+
autoload :LocationThresholdRuleCondition, 'generated/azure_mgmt_insights/models/location_threshold_rule_condition.rb'
|
64
|
+
autoload :ManagementEventRuleCondition, 'generated/azure_mgmt_insights/models/management_event_rule_condition.rb'
|
65
|
+
autoload :RuleEmailAction, 'generated/azure_mgmt_insights/models/rule_email_action.rb'
|
66
|
+
autoload :RuleWebhookAction, 'generated/azure_mgmt_insights/models/rule_webhook_action.rb'
|
67
|
+
autoload :AlertRuleResource, 'generated/azure_mgmt_insights/models/alert_rule_resource.rb'
|
68
|
+
autoload :LogProfileResource, 'generated/azure_mgmt_insights/models/log_profile_resource.rb'
|
69
|
+
autoload :MetricStatisticType, 'generated/azure_mgmt_insights/models/metric_statistic_type.rb'
|
70
|
+
autoload :TimeAggregationType, 'generated/azure_mgmt_insights/models/time_aggregation_type.rb'
|
71
|
+
autoload :ComparisonOperationType, 'generated/azure_mgmt_insights/models/comparison_operation_type.rb'
|
72
|
+
autoload :ScaleDirection, 'generated/azure_mgmt_insights/models/scale_direction.rb'
|
73
|
+
autoload :RecurrenceFrequency, 'generated/azure_mgmt_insights/models/recurrence_frequency.rb'
|
74
|
+
autoload :ConditionOperator, 'generated/azure_mgmt_insights/models/condition_operator.rb'
|
75
|
+
autoload :TimeAggregationOperator, 'generated/azure_mgmt_insights/models/time_aggregation_operator.rb'
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::Insights
|
7
|
+
#
|
8
|
+
# Composite Swagger for Insights Management Client
|
9
|
+
#
|
10
|
+
class AlertRuleIncidents
|
11
|
+
include Azure::ARM::Insights::Models
|
12
|
+
include MsRestAzure
|
13
|
+
|
14
|
+
#
|
15
|
+
# Creates and initializes a new instance of the AlertRuleIncidents class.
|
16
|
+
# @param client service class for accessing basic functionality.
|
17
|
+
#
|
18
|
+
def initialize(client)
|
19
|
+
@client = client
|
20
|
+
end
|
21
|
+
|
22
|
+
# @return [InsightsManagementClient] reference to the InsightsManagementClient
|
23
|
+
attr_reader :client
|
24
|
+
|
25
|
+
#
|
26
|
+
# Gets an incident associated to an alert rule
|
27
|
+
#
|
28
|
+
# @param resource_group_name [String] The name of the resource group.
|
29
|
+
# @param rule_name [String] The name of the rule.
|
30
|
+
# @param incident_name [String] The name of the incident to retrieve.
|
31
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
32
|
+
# will be added to the HTTP request.
|
33
|
+
#
|
34
|
+
# @return [Incident] operation results.
|
35
|
+
#
|
36
|
+
def get(resource_group_name, rule_name, incident_name, custom_headers = nil)
|
37
|
+
response = get_async(resource_group_name, rule_name, incident_name, custom_headers).value!
|
38
|
+
response.body unless response.nil?
|
39
|
+
end
|
40
|
+
|
41
|
+
#
|
42
|
+
# Gets an incident associated to an alert rule
|
43
|
+
#
|
44
|
+
# @param resource_group_name [String] The name of the resource group.
|
45
|
+
# @param rule_name [String] The name of the rule.
|
46
|
+
# @param incident_name [String] The name of the incident to retrieve.
|
47
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
48
|
+
# will be added to the HTTP request.
|
49
|
+
#
|
50
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
51
|
+
#
|
52
|
+
def get_with_http_info(resource_group_name, rule_name, incident_name, custom_headers = nil)
|
53
|
+
get_async(resource_group_name, rule_name, incident_name, custom_headers).value!
|
54
|
+
end
|
55
|
+
|
56
|
+
#
|
57
|
+
# Gets an incident associated to an alert rule
|
58
|
+
#
|
59
|
+
# @param resource_group_name [String] The name of the resource group.
|
60
|
+
# @param rule_name [String] The name of the rule.
|
61
|
+
# @param incident_name [String] The name of the incident to retrieve.
|
62
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
63
|
+
# to the HTTP request.
|
64
|
+
#
|
65
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
66
|
+
#
|
67
|
+
def get_async(resource_group_name, rule_name, incident_name, custom_headers = nil)
|
68
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
69
|
+
fail ArgumentError, 'rule_name is nil' if rule_name.nil?
|
70
|
+
fail ArgumentError, 'incident_name is nil' if incident_name.nil?
|
71
|
+
api_version = '2016-03-01'
|
72
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
73
|
+
|
74
|
+
|
75
|
+
request_headers = {}
|
76
|
+
|
77
|
+
# Set Headers
|
78
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
79
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
80
|
+
path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents/{incidentName}'
|
81
|
+
|
82
|
+
request_url = @base_url || @client.base_url
|
83
|
+
|
84
|
+
options = {
|
85
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
86
|
+
path_params: {'resourceGroupName' => resource_group_name,'ruleName' => rule_name,'incidentName' => incident_name,'subscriptionId' => @client.subscription_id},
|
87
|
+
query_params: {'api-version' => api_version},
|
88
|
+
headers: request_headers.merge(custom_headers || {}),
|
89
|
+
base_url: request_url
|
90
|
+
}
|
91
|
+
promise = @client.make_request_async(:get, path_template, options)
|
92
|
+
|
93
|
+
promise = promise.then do |result|
|
94
|
+
http_response = result.response
|
95
|
+
status_code = http_response.status
|
96
|
+
response_content = http_response.body
|
97
|
+
unless status_code == 200
|
98
|
+
error_model = JSON.load(response_content)
|
99
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
100
|
+
end
|
101
|
+
|
102
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
103
|
+
# Deserialize Response
|
104
|
+
if status_code == 200
|
105
|
+
begin
|
106
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
107
|
+
result_mapper = Incident.mapper()
|
108
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
109
|
+
rescue Exception => e
|
110
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
result
|
115
|
+
end
|
116
|
+
|
117
|
+
promise.execute
|
118
|
+
end
|
119
|
+
|
120
|
+
end
|
121
|
+
end
|
@@ -0,0 +1,410 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::Insights
|
7
|
+
#
|
8
|
+
# Composite Swagger for Insights Management Client
|
9
|
+
#
|
10
|
+
class AlertRules
|
11
|
+
include Azure::ARM::Insights::Models
|
12
|
+
include MsRestAzure
|
13
|
+
|
14
|
+
#
|
15
|
+
# Creates and initializes a new instance of the AlertRules class.
|
16
|
+
# @param client service class for accessing basic functionality.
|
17
|
+
#
|
18
|
+
def initialize(client)
|
19
|
+
@client = client
|
20
|
+
end
|
21
|
+
|
22
|
+
# @return [InsightsManagementClient] reference to the InsightsManagementClient
|
23
|
+
attr_reader :client
|
24
|
+
|
25
|
+
#
|
26
|
+
# Creates or updates an alert rule
|
27
|
+
#
|
28
|
+
# @param resource_group_name [String] The name of the resource group.
|
29
|
+
# @param rule_name [String] The name of the rule.
|
30
|
+
# @param parameters [AlertRuleResource] The parameters of the rule to create or
|
31
|
+
# update.
|
32
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
33
|
+
# will be added to the HTTP request.
|
34
|
+
#
|
35
|
+
# @return [AlertRuleResource] operation results.
|
36
|
+
#
|
37
|
+
def create_or_update(resource_group_name, rule_name, parameters, custom_headers = nil)
|
38
|
+
response = create_or_update_async(resource_group_name, rule_name, parameters, custom_headers).value!
|
39
|
+
response.body unless response.nil?
|
40
|
+
end
|
41
|
+
|
42
|
+
#
|
43
|
+
# Creates or updates an alert rule
|
44
|
+
#
|
45
|
+
# @param resource_group_name [String] The name of the resource group.
|
46
|
+
# @param rule_name [String] The name of the rule.
|
47
|
+
# @param parameters [AlertRuleResource] The parameters of the rule to create or
|
48
|
+
# update.
|
49
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
50
|
+
# will be added to the HTTP request.
|
51
|
+
#
|
52
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
53
|
+
#
|
54
|
+
def create_or_update_with_http_info(resource_group_name, rule_name, parameters, custom_headers = nil)
|
55
|
+
create_or_update_async(resource_group_name, rule_name, parameters, custom_headers).value!
|
56
|
+
end
|
57
|
+
|
58
|
+
#
|
59
|
+
# Creates or updates an alert rule
|
60
|
+
#
|
61
|
+
# @param resource_group_name [String] The name of the resource group.
|
62
|
+
# @param rule_name [String] The name of the rule.
|
63
|
+
# @param parameters [AlertRuleResource] The parameters of the rule to create or
|
64
|
+
# update.
|
65
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
66
|
+
# to the HTTP request.
|
67
|
+
#
|
68
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
69
|
+
#
|
70
|
+
def create_or_update_async(resource_group_name, rule_name, parameters, custom_headers = nil)
|
71
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
72
|
+
fail ArgumentError, 'rule_name is nil' if rule_name.nil?
|
73
|
+
api_version = '2016-03-01'
|
74
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
75
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
76
|
+
|
77
|
+
|
78
|
+
request_headers = {}
|
79
|
+
|
80
|
+
# Set Headers
|
81
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
82
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
83
|
+
|
84
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
85
|
+
|
86
|
+
# Serialize Request
|
87
|
+
request_mapper = AlertRuleResource.mapper()
|
88
|
+
request_content = @client.serialize(request_mapper, parameters, 'parameters')
|
89
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
90
|
+
|
91
|
+
path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}'
|
92
|
+
|
93
|
+
request_url = @base_url || @client.base_url
|
94
|
+
|
95
|
+
options = {
|
96
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
97
|
+
path_params: {'resourceGroupName' => resource_group_name,'ruleName' => rule_name,'subscriptionId' => @client.subscription_id},
|
98
|
+
query_params: {'api-version' => api_version},
|
99
|
+
body: request_content,
|
100
|
+
headers: request_headers.merge(custom_headers || {}),
|
101
|
+
base_url: request_url
|
102
|
+
}
|
103
|
+
promise = @client.make_request_async(:put, path_template, options)
|
104
|
+
|
105
|
+
promise = promise.then do |result|
|
106
|
+
http_response = result.response
|
107
|
+
status_code = http_response.status
|
108
|
+
response_content = http_response.body
|
109
|
+
unless status_code == 200 || status_code == 201
|
110
|
+
error_model = JSON.load(response_content)
|
111
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
112
|
+
end
|
113
|
+
|
114
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
115
|
+
# Deserialize Response
|
116
|
+
if status_code == 200
|
117
|
+
begin
|
118
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
119
|
+
result_mapper = AlertRuleResource.mapper()
|
120
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
121
|
+
rescue Exception => e
|
122
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
# Deserialize Response
|
126
|
+
if status_code == 201
|
127
|
+
begin
|
128
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
129
|
+
result_mapper = AlertRuleResource.mapper()
|
130
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
131
|
+
rescue Exception => e
|
132
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
result
|
137
|
+
end
|
138
|
+
|
139
|
+
promise.execute
|
140
|
+
end
|
141
|
+
|
142
|
+
#
|
143
|
+
# Deletes an alert rule
|
144
|
+
#
|
145
|
+
# @param resource_group_name [String] The name of the resource group.
|
146
|
+
# @param rule_name [String] The name of the rule.
|
147
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
148
|
+
# will be added to the HTTP request.
|
149
|
+
#
|
150
|
+
#
|
151
|
+
def delete(resource_group_name, rule_name, custom_headers = nil)
|
152
|
+
response = delete_async(resource_group_name, rule_name, custom_headers).value!
|
153
|
+
nil
|
154
|
+
end
|
155
|
+
|
156
|
+
#
|
157
|
+
# Deletes an alert rule
|
158
|
+
#
|
159
|
+
# @param resource_group_name [String] The name of the resource group.
|
160
|
+
# @param rule_name [String] The name of the rule.
|
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 delete_with_http_info(resource_group_name, rule_name, custom_headers = nil)
|
167
|
+
delete_async(resource_group_name, rule_name, custom_headers).value!
|
168
|
+
end
|
169
|
+
|
170
|
+
#
|
171
|
+
# Deletes an alert rule
|
172
|
+
#
|
173
|
+
# @param resource_group_name [String] The name of the resource group.
|
174
|
+
# @param rule_name [String] The name of the rule.
|
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 delete_async(resource_group_name, rule_name, custom_headers = nil)
|
181
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
182
|
+
fail ArgumentError, 'rule_name is nil' if rule_name.nil?
|
183
|
+
api_version = '2016-03-01'
|
184
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
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/alertrules/{ruleName}'
|
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,'ruleName' => rule_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(:delete, 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 == 204 || status_code == 200
|
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
|
+
|
216
|
+
result
|
217
|
+
end
|
218
|
+
|
219
|
+
promise.execute
|
220
|
+
end
|
221
|
+
|
222
|
+
#
|
223
|
+
# Gets an alert rule
|
224
|
+
#
|
225
|
+
# @param resource_group_name [String] The name of the resource group.
|
226
|
+
# @param rule_name [String] The name of the rule.
|
227
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
228
|
+
# will be added to the HTTP request.
|
229
|
+
#
|
230
|
+
# @return [AlertRuleResource] operation results.
|
231
|
+
#
|
232
|
+
def get(resource_group_name, rule_name, custom_headers = nil)
|
233
|
+
response = get_async(resource_group_name, rule_name, custom_headers).value!
|
234
|
+
response.body unless response.nil?
|
235
|
+
end
|
236
|
+
|
237
|
+
#
|
238
|
+
# Gets an alert rule
|
239
|
+
#
|
240
|
+
# @param resource_group_name [String] The name of the resource group.
|
241
|
+
# @param rule_name [String] The name of the rule.
|
242
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
243
|
+
# will be added to the HTTP request.
|
244
|
+
#
|
245
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
246
|
+
#
|
247
|
+
def get_with_http_info(resource_group_name, rule_name, custom_headers = nil)
|
248
|
+
get_async(resource_group_name, rule_name, custom_headers).value!
|
249
|
+
end
|
250
|
+
|
251
|
+
#
|
252
|
+
# Gets an alert rule
|
253
|
+
#
|
254
|
+
# @param resource_group_name [String] The name of the resource group.
|
255
|
+
# @param rule_name [String] The name of the rule.
|
256
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
257
|
+
# to the HTTP request.
|
258
|
+
#
|
259
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
260
|
+
#
|
261
|
+
def get_async(resource_group_name, rule_name, custom_headers = nil)
|
262
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
263
|
+
fail ArgumentError, 'rule_name is nil' if rule_name.nil?
|
264
|
+
api_version = '2016-03-01'
|
265
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
266
|
+
|
267
|
+
|
268
|
+
request_headers = {}
|
269
|
+
|
270
|
+
# Set Headers
|
271
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
272
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
273
|
+
path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}'
|
274
|
+
|
275
|
+
request_url = @base_url || @client.base_url
|
276
|
+
|
277
|
+
options = {
|
278
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
279
|
+
path_params: {'resourceGroupName' => resource_group_name,'ruleName' => rule_name,'subscriptionId' => @client.subscription_id},
|
280
|
+
query_params: {'api-version' => api_version},
|
281
|
+
headers: request_headers.merge(custom_headers || {}),
|
282
|
+
base_url: request_url
|
283
|
+
}
|
284
|
+
promise = @client.make_request_async(:get, path_template, options)
|
285
|
+
|
286
|
+
promise = promise.then do |result|
|
287
|
+
http_response = result.response
|
288
|
+
status_code = http_response.status
|
289
|
+
response_content = http_response.body
|
290
|
+
unless status_code == 200
|
291
|
+
error_model = JSON.load(response_content)
|
292
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
293
|
+
end
|
294
|
+
|
295
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
296
|
+
# Deserialize Response
|
297
|
+
if status_code == 200
|
298
|
+
begin
|
299
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
300
|
+
result_mapper = AlertRuleResource.mapper()
|
301
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
302
|
+
rescue Exception => e
|
303
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
307
|
+
result
|
308
|
+
end
|
309
|
+
|
310
|
+
promise.execute
|
311
|
+
end
|
312
|
+
|
313
|
+
#
|
314
|
+
# List the alert rules within a resource group.
|
315
|
+
#
|
316
|
+
# @param resource_group_name [String] The name of the resource group.
|
317
|
+
# @param filter [String] The filter to apply on the operation. For more
|
318
|
+
# information please see
|
319
|
+
# https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx
|
320
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
321
|
+
# will be added to the HTTP request.
|
322
|
+
#
|
323
|
+
# @return [AlertRuleResourceCollection] operation results.
|
324
|
+
#
|
325
|
+
def list_by_resource_group(resource_group_name, filter = nil, custom_headers = nil)
|
326
|
+
response = list_by_resource_group_async(resource_group_name, filter, custom_headers).value!
|
327
|
+
response.body unless response.nil?
|
328
|
+
end
|
329
|
+
|
330
|
+
#
|
331
|
+
# List the alert rules within a resource group.
|
332
|
+
#
|
333
|
+
# @param resource_group_name [String] The name of the resource group.
|
334
|
+
# @param filter [String] The filter to apply on the operation. For more
|
335
|
+
# information please see
|
336
|
+
# https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx
|
337
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
338
|
+
# will be added to the HTTP request.
|
339
|
+
#
|
340
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
341
|
+
#
|
342
|
+
def list_by_resource_group_with_http_info(resource_group_name, filter = nil, custom_headers = nil)
|
343
|
+
list_by_resource_group_async(resource_group_name, filter, custom_headers).value!
|
344
|
+
end
|
345
|
+
|
346
|
+
#
|
347
|
+
# List the alert rules within a resource group.
|
348
|
+
#
|
349
|
+
# @param resource_group_name [String] The name of the resource group.
|
350
|
+
# @param filter [String] The filter to apply on the operation. For more
|
351
|
+
# information please see
|
352
|
+
# https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx
|
353
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
354
|
+
# to the HTTP request.
|
355
|
+
#
|
356
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
357
|
+
#
|
358
|
+
def list_by_resource_group_async(resource_group_name, filter = nil, custom_headers = nil)
|
359
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
360
|
+
api_version = '2016-03-01'
|
361
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
362
|
+
|
363
|
+
|
364
|
+
request_headers = {}
|
365
|
+
|
366
|
+
# Set Headers
|
367
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
368
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
369
|
+
path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules'
|
370
|
+
|
371
|
+
request_url = @base_url || @client.base_url
|
372
|
+
|
373
|
+
options = {
|
374
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
375
|
+
path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
|
376
|
+
query_params: {'api-version' => api_version,'$filter' => filter},
|
377
|
+
headers: request_headers.merge(custom_headers || {}),
|
378
|
+
base_url: request_url
|
379
|
+
}
|
380
|
+
promise = @client.make_request_async(:get, path_template, options)
|
381
|
+
|
382
|
+
promise = promise.then do |result|
|
383
|
+
http_response = result.response
|
384
|
+
status_code = http_response.status
|
385
|
+
response_content = http_response.body
|
386
|
+
unless status_code == 200
|
387
|
+
error_model = JSON.load(response_content)
|
388
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
389
|
+
end
|
390
|
+
|
391
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
392
|
+
# Deserialize Response
|
393
|
+
if status_code == 200
|
394
|
+
begin
|
395
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
396
|
+
result_mapper = AlertRuleResourceCollection.mapper()
|
397
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
398
|
+
rescue Exception => e
|
399
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
400
|
+
end
|
401
|
+
end
|
402
|
+
|
403
|
+
result
|
404
|
+
end
|
405
|
+
|
406
|
+
promise.execute
|
407
|
+
end
|
408
|
+
|
409
|
+
end
|
410
|
+
end
|