azure_mgmt_monitor 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/lib/azure_mgmt_monitor.rb +5 -0
- data/lib/generated/azure_mgmt_monitor.rb +96 -0
- data/lib/generated/azure_mgmt_monitor/action_groups.rb +579 -0
- data/lib/generated/azure_mgmt_monitor/activity_log_alerts.rb +593 -0
- data/lib/generated/azure_mgmt_monitor/alert_rule_incidents.rb +211 -0
- data/lib/generated/azure_mgmt_monitor/alert_rules.rb +510 -0
- data/lib/generated/azure_mgmt_monitor/autoscale_settings.rb +618 -0
- data/lib/generated/azure_mgmt_monitor/log_profiles.rb +477 -0
- data/lib/generated/azure_mgmt_monitor/models/action_group_list.rb +63 -0
- data/lib/generated/azure_mgmt_monitor/models/action_group_resource.rb +164 -0
- data/lib/generated/azure_mgmt_monitor/models/activity_log_alert_action_group.rb +65 -0
- data/lib/generated/azure_mgmt_monitor/models/activity_log_alert_action_list.rb +54 -0
- data/lib/generated/azure_mgmt_monitor/models/activity_log_alert_all_of_condition.rb +55 -0
- data/lib/generated/azure_mgmt_monitor/models/activity_log_alert_leaf_condition.rb +61 -0
- data/lib/generated/azure_mgmt_monitor/models/activity_log_alert_list.rb +64 -0
- data/lib/generated/azure_mgmt_monitor/models/activity_log_alert_patch_body.rb +65 -0
- data/lib/generated/azure_mgmt_monitor/models/activity_log_alert_resource.rb +147 -0
- data/lib/generated/azure_mgmt_monitor/models/alert_rule_resource.rb +159 -0
- data/lib/generated/azure_mgmt_monitor/models/alert_rule_resource_collection.rb +54 -0
- data/lib/generated/azure_mgmt_monitor/models/alert_rule_resource_patch.rb +131 -0
- data/lib/generated/azure_mgmt_monitor/models/autoscale_notification.rb +78 -0
- data/lib/generated/azure_mgmt_monitor/models/autoscale_profile.rb +101 -0
- data/lib/generated/azure_mgmt_monitor/models/autoscale_setting_resource.rb +155 -0
- data/lib/generated/azure_mgmt_monitor/models/autoscale_setting_resource_collection.rb +95 -0
- data/lib/generated/azure_mgmt_monitor/models/autoscale_setting_resource_patch.rb +127 -0
- data/lib/generated/azure_mgmt_monitor/models/comparison_operation_type.rb +20 -0
- data/lib/generated/azure_mgmt_monitor/models/condition_operator.rb +18 -0
- data/lib/generated/azure_mgmt_monitor/models/email_notification.rb +75 -0
- data/lib/generated/azure_mgmt_monitor/models/email_receiver.rb +69 -0
- data/lib/generated/azure_mgmt_monitor/models/enable_request.rb +45 -0
- data/lib/generated/azure_mgmt_monitor/models/error_response.rb +55 -0
- data/lib/generated/azure_mgmt_monitor/models/incident.rb +93 -0
- data/lib/generated/azure_mgmt_monitor/models/incident_list_result.rb +53 -0
- data/lib/generated/azure_mgmt_monitor/models/location_threshold_rule_condition.rb +85 -0
- data/lib/generated/azure_mgmt_monitor/models/log_profile_collection.rb +53 -0
- data/lib/generated/azure_mgmt_monitor/models/log_profile_resource.rb +154 -0
- data/lib/generated/azure_mgmt_monitor/models/log_profile_resource_patch.rb +126 -0
- data/lib/generated/azure_mgmt_monitor/models/log_settings.rb +70 -0
- data/lib/generated/azure_mgmt_monitor/models/management_event_aggregation_condition.rb +70 -0
- data/lib/generated/azure_mgmt_monitor/models/management_event_rule_condition.rb +73 -0
- data/lib/generated/azure_mgmt_monitor/models/metric_settings.rb +67 -0
- data/lib/generated/azure_mgmt_monitor/models/metric_statistic_type.rb +18 -0
- data/lib/generated/azure_mgmt_monitor/models/metric_trigger.rb +134 -0
- data/lib/generated/azure_mgmt_monitor/models/receiver_status.rb +17 -0
- data/lib/generated/azure_mgmt_monitor/models/recurrence.rb +62 -0
- data/lib/generated/azure_mgmt_monitor/models/recurrence_frequency.rb +22 -0
- data/lib/generated/azure_mgmt_monitor/models/recurrent_schedule.rb +139 -0
- data/lib/generated/azure_mgmt_monitor/models/retention_policy.rb +60 -0
- data/lib/generated/azure_mgmt_monitor/models/rule_action.rb +48 -0
- data/lib/generated/azure_mgmt_monitor/models/rule_condition.rb +63 -0
- data/lib/generated/azure_mgmt_monitor/models/rule_data_source.rb +58 -0
- data/lib/generated/azure_mgmt_monitor/models/rule_email_action.rb +80 -0
- data/lib/generated/azure_mgmt_monitor/models/rule_management_event_claims_data_source.rb +45 -0
- data/lib/generated/azure_mgmt_monitor/models/rule_management_event_data_source.rb +150 -0
- data/lib/generated/azure_mgmt_monitor/models/rule_metric_data_source.rb +68 -0
- data/lib/generated/azure_mgmt_monitor/models/rule_webhook_action.rb +80 -0
- data/lib/generated/azure_mgmt_monitor/models/scale_action.rb +86 -0
- data/lib/generated/azure_mgmt_monitor/models/scale_capacity.rb +69 -0
- data/lib/generated/azure_mgmt_monitor/models/scale_direction.rb +17 -0
- data/lib/generated/azure_mgmt_monitor/models/scale_rule.rb +57 -0
- data/lib/generated/azure_mgmt_monitor/models/scale_type.rb +17 -0
- data/lib/generated/azure_mgmt_monitor/models/service_diagnostic_settings_resource.rb +163 -0
- data/lib/generated/azure_mgmt_monitor/models/service_diagnostic_settings_resource_patch.rb +135 -0
- data/lib/generated/azure_mgmt_monitor/models/sms_receiver.rb +79 -0
- data/lib/generated/azure_mgmt_monitor/models/threshold_rule_condition.rb +108 -0
- data/lib/generated/azure_mgmt_monitor/models/time_aggregation_operator.rb +19 -0
- data/lib/generated/azure_mgmt_monitor/models/time_aggregation_type.rb +19 -0
- data/lib/generated/azure_mgmt_monitor/models/time_window.rb +104 -0
- data/lib/generated/azure_mgmt_monitor/models/webhook_notification.rb +63 -0
- data/lib/generated/azure_mgmt_monitor/models/webhook_receiver.rb +56 -0
- data/lib/generated/azure_mgmt_monitor/module_definition.rb +8 -0
- data/lib/generated/azure_mgmt_monitor/monitor_management_client.rb +150 -0
- data/lib/generated/azure_mgmt_monitor/service_diagnostic_settings_operations.rb +330 -0
- data/lib/generated/azure_mgmt_monitor/version.rb +8 -0
- metadata +188 -0
|
@@ -0,0 +1,618 @@
|
|
|
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 AutoscaleSettings
|
|
11
|
+
include MsRestAzure
|
|
12
|
+
|
|
13
|
+
#
|
|
14
|
+
# Creates and initializes a new instance of the AutoscaleSettings 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 autoscale settings for a resource group
|
|
26
|
+
#
|
|
27
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
28
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
29
|
+
# will be added to the HTTP request.
|
|
30
|
+
#
|
|
31
|
+
# @return [Array<AutoscaleSettingResource>] operation results.
|
|
32
|
+
#
|
|
33
|
+
def list_by_resource_group(resource_group_name, custom_headers = nil)
|
|
34
|
+
first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers)
|
|
35
|
+
first_page.get_all_items
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
#
|
|
39
|
+
# Lists the autoscale settings for a resource group
|
|
40
|
+
#
|
|
41
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
42
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
43
|
+
# will be added to the HTTP request.
|
|
44
|
+
#
|
|
45
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
46
|
+
#
|
|
47
|
+
def list_by_resource_group_with_http_info(resource_group_name, custom_headers = nil)
|
|
48
|
+
list_by_resource_group_async(resource_group_name, custom_headers).value!
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
#
|
|
52
|
+
# Lists the autoscale settings for a resource group
|
|
53
|
+
#
|
|
54
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
55
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
56
|
+
# to the HTTP request.
|
|
57
|
+
#
|
|
58
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
59
|
+
#
|
|
60
|
+
def list_by_resource_group_async(resource_group_name, custom_headers = nil)
|
|
61
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
|
62
|
+
api_version = '2015-04-01'
|
|
63
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
request_headers = {}
|
|
67
|
+
|
|
68
|
+
# Set Headers
|
|
69
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
70
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
71
|
+
path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings'
|
|
72
|
+
|
|
73
|
+
request_url = @base_url || @client.base_url
|
|
74
|
+
|
|
75
|
+
options = {
|
|
76
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
77
|
+
path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
|
|
78
|
+
query_params: {'api-version' => api_version},
|
|
79
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
80
|
+
base_url: request_url
|
|
81
|
+
}
|
|
82
|
+
promise = @client.make_request_async(:get, path_template, options)
|
|
83
|
+
|
|
84
|
+
promise = promise.then do |result|
|
|
85
|
+
http_response = result.response
|
|
86
|
+
status_code = http_response.status
|
|
87
|
+
response_content = http_response.body
|
|
88
|
+
unless status_code == 200
|
|
89
|
+
error_model = JSON.load(response_content)
|
|
90
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
94
|
+
# Deserialize Response
|
|
95
|
+
if status_code == 200
|
|
96
|
+
begin
|
|
97
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
98
|
+
result_mapper = Azure::ARM::Monitor::Models::AutoscaleSettingResourceCollection.mapper()
|
|
99
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
|
100
|
+
rescue Exception => e
|
|
101
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
result
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
promise.execute
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
#
|
|
112
|
+
# Creates or updates an autoscale setting.
|
|
113
|
+
#
|
|
114
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
115
|
+
# @param autoscale_setting_name [String] The autoscale setting name.
|
|
116
|
+
# @param parameters [AutoscaleSettingResource] Parameters supplied to the
|
|
117
|
+
# operation.
|
|
118
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
119
|
+
# will be added to the HTTP request.
|
|
120
|
+
#
|
|
121
|
+
# @return [AutoscaleSettingResource] operation results.
|
|
122
|
+
#
|
|
123
|
+
def create_or_update(resource_group_name, autoscale_setting_name, parameters, custom_headers = nil)
|
|
124
|
+
response = create_or_update_async(resource_group_name, autoscale_setting_name, parameters, custom_headers).value!
|
|
125
|
+
response.body unless response.nil?
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
#
|
|
129
|
+
# Creates or updates an autoscale setting.
|
|
130
|
+
#
|
|
131
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
132
|
+
# @param autoscale_setting_name [String] The autoscale setting name.
|
|
133
|
+
# @param parameters [AutoscaleSettingResource] Parameters supplied to the
|
|
134
|
+
# operation.
|
|
135
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
136
|
+
# will be added to the HTTP request.
|
|
137
|
+
#
|
|
138
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
139
|
+
#
|
|
140
|
+
def create_or_update_with_http_info(resource_group_name, autoscale_setting_name, parameters, custom_headers = nil)
|
|
141
|
+
create_or_update_async(resource_group_name, autoscale_setting_name, parameters, custom_headers).value!
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
#
|
|
145
|
+
# Creates or updates an autoscale setting.
|
|
146
|
+
#
|
|
147
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
148
|
+
# @param autoscale_setting_name [String] The autoscale setting name.
|
|
149
|
+
# @param parameters [AutoscaleSettingResource] Parameters supplied to the
|
|
150
|
+
# operation.
|
|
151
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
152
|
+
# to the HTTP request.
|
|
153
|
+
#
|
|
154
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
155
|
+
#
|
|
156
|
+
def create_or_update_async(resource_group_name, autoscale_setting_name, parameters, custom_headers = nil)
|
|
157
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
|
158
|
+
fail ArgumentError, 'autoscale_setting_name is nil' if autoscale_setting_name.nil?
|
|
159
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
|
160
|
+
api_version = '2015-04-01'
|
|
161
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
request_headers = {}
|
|
165
|
+
|
|
166
|
+
# Set Headers
|
|
167
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
168
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
169
|
+
|
|
170
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
|
171
|
+
|
|
172
|
+
# Serialize Request
|
|
173
|
+
request_mapper = Azure::ARM::Monitor::Models::AutoscaleSettingResource.mapper()
|
|
174
|
+
request_content = @client.serialize(request_mapper, parameters)
|
|
175
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
|
176
|
+
|
|
177
|
+
path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}'
|
|
178
|
+
|
|
179
|
+
request_url = @base_url || @client.base_url
|
|
180
|
+
|
|
181
|
+
options = {
|
|
182
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
183
|
+
path_params: {'resourceGroupName' => resource_group_name,'autoscaleSettingName' => autoscale_setting_name,'subscriptionId' => @client.subscription_id},
|
|
184
|
+
query_params: {'api-version' => api_version},
|
|
185
|
+
body: request_content,
|
|
186
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
187
|
+
base_url: request_url
|
|
188
|
+
}
|
|
189
|
+
promise = @client.make_request_async(:put, path_template, options)
|
|
190
|
+
|
|
191
|
+
promise = promise.then do |result|
|
|
192
|
+
http_response = result.response
|
|
193
|
+
status_code = http_response.status
|
|
194
|
+
response_content = http_response.body
|
|
195
|
+
unless status_code == 200 || status_code == 201
|
|
196
|
+
error_model = JSON.load(response_content)
|
|
197
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
201
|
+
# Deserialize Response
|
|
202
|
+
if status_code == 200
|
|
203
|
+
begin
|
|
204
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
205
|
+
result_mapper = Azure::ARM::Monitor::Models::AutoscaleSettingResource.mapper()
|
|
206
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
|
207
|
+
rescue Exception => e
|
|
208
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
209
|
+
end
|
|
210
|
+
end
|
|
211
|
+
# Deserialize Response
|
|
212
|
+
if status_code == 201
|
|
213
|
+
begin
|
|
214
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
215
|
+
result_mapper = Azure::ARM::Monitor::Models::AutoscaleSettingResource.mapper()
|
|
216
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
|
217
|
+
rescue Exception => e
|
|
218
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
219
|
+
end
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
result
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
promise.execute
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
#
|
|
229
|
+
# Deletes and autoscale setting
|
|
230
|
+
#
|
|
231
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
232
|
+
# @param autoscale_setting_name [String] The autoscale setting name.
|
|
233
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
234
|
+
# will be added to the HTTP request.
|
|
235
|
+
#
|
|
236
|
+
#
|
|
237
|
+
def delete(resource_group_name, autoscale_setting_name, custom_headers = nil)
|
|
238
|
+
response = delete_async(resource_group_name, autoscale_setting_name, custom_headers).value!
|
|
239
|
+
nil
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
#
|
|
243
|
+
# Deletes and autoscale setting
|
|
244
|
+
#
|
|
245
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
246
|
+
# @param autoscale_setting_name [String] The autoscale setting name.
|
|
247
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
248
|
+
# will be added to the HTTP request.
|
|
249
|
+
#
|
|
250
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
251
|
+
#
|
|
252
|
+
def delete_with_http_info(resource_group_name, autoscale_setting_name, custom_headers = nil)
|
|
253
|
+
delete_async(resource_group_name, autoscale_setting_name, custom_headers).value!
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
#
|
|
257
|
+
# Deletes and autoscale setting
|
|
258
|
+
#
|
|
259
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
260
|
+
# @param autoscale_setting_name [String] The autoscale setting name.
|
|
261
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
262
|
+
# to the HTTP request.
|
|
263
|
+
#
|
|
264
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
265
|
+
#
|
|
266
|
+
def delete_async(resource_group_name, autoscale_setting_name, custom_headers = nil)
|
|
267
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
|
268
|
+
fail ArgumentError, 'autoscale_setting_name is nil' if autoscale_setting_name.nil?
|
|
269
|
+
api_version = '2015-04-01'
|
|
270
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
request_headers = {}
|
|
274
|
+
|
|
275
|
+
# Set Headers
|
|
276
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
277
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
278
|
+
path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}'
|
|
279
|
+
|
|
280
|
+
request_url = @base_url || @client.base_url
|
|
281
|
+
|
|
282
|
+
options = {
|
|
283
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
284
|
+
path_params: {'resourceGroupName' => resource_group_name,'autoscaleSettingName' => autoscale_setting_name,'subscriptionId' => @client.subscription_id},
|
|
285
|
+
query_params: {'api-version' => api_version},
|
|
286
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
287
|
+
base_url: request_url
|
|
288
|
+
}
|
|
289
|
+
promise = @client.make_request_async(:delete, path_template, options)
|
|
290
|
+
|
|
291
|
+
promise = promise.then do |result|
|
|
292
|
+
http_response = result.response
|
|
293
|
+
status_code = http_response.status
|
|
294
|
+
response_content = http_response.body
|
|
295
|
+
unless status_code == 200 || status_code == 204
|
|
296
|
+
error_model = JSON.load(response_content)
|
|
297
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
301
|
+
|
|
302
|
+
result
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
promise.execute
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
#
|
|
309
|
+
# Gets an autoscale setting
|
|
310
|
+
#
|
|
311
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
312
|
+
# @param autoscale_setting_name [String] The autoscale setting name.
|
|
313
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
314
|
+
# will be added to the HTTP request.
|
|
315
|
+
#
|
|
316
|
+
# @return [AutoscaleSettingResource] operation results.
|
|
317
|
+
#
|
|
318
|
+
def get(resource_group_name, autoscale_setting_name, custom_headers = nil)
|
|
319
|
+
response = get_async(resource_group_name, autoscale_setting_name, custom_headers).value!
|
|
320
|
+
response.body unless response.nil?
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
#
|
|
324
|
+
# Gets an autoscale setting
|
|
325
|
+
#
|
|
326
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
327
|
+
# @param autoscale_setting_name [String] The autoscale setting name.
|
|
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 get_with_http_info(resource_group_name, autoscale_setting_name, custom_headers = nil)
|
|
334
|
+
get_async(resource_group_name, autoscale_setting_name, custom_headers).value!
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
#
|
|
338
|
+
# Gets an autoscale setting
|
|
339
|
+
#
|
|
340
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
341
|
+
# @param autoscale_setting_name [String] The autoscale setting name.
|
|
342
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
343
|
+
# to the HTTP request.
|
|
344
|
+
#
|
|
345
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
346
|
+
#
|
|
347
|
+
def get_async(resource_group_name, autoscale_setting_name, custom_headers = nil)
|
|
348
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
|
349
|
+
fail ArgumentError, 'autoscale_setting_name is nil' if autoscale_setting_name.nil?
|
|
350
|
+
api_version = '2015-04-01'
|
|
351
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
request_headers = {}
|
|
355
|
+
|
|
356
|
+
# Set Headers
|
|
357
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
358
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
359
|
+
path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}'
|
|
360
|
+
|
|
361
|
+
request_url = @base_url || @client.base_url
|
|
362
|
+
|
|
363
|
+
options = {
|
|
364
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
365
|
+
path_params: {'resourceGroupName' => resource_group_name,'autoscaleSettingName' => autoscale_setting_name,'subscriptionId' => @client.subscription_id},
|
|
366
|
+
query_params: {'api-version' => api_version},
|
|
367
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
368
|
+
base_url: request_url
|
|
369
|
+
}
|
|
370
|
+
promise = @client.make_request_async(:get, path_template, options)
|
|
371
|
+
|
|
372
|
+
promise = promise.then do |result|
|
|
373
|
+
http_response = result.response
|
|
374
|
+
status_code = http_response.status
|
|
375
|
+
response_content = http_response.body
|
|
376
|
+
unless status_code == 200
|
|
377
|
+
error_model = JSON.load(response_content)
|
|
378
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
|
379
|
+
end
|
|
380
|
+
|
|
381
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
382
|
+
# Deserialize Response
|
|
383
|
+
if status_code == 200
|
|
384
|
+
begin
|
|
385
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
386
|
+
result_mapper = Azure::ARM::Monitor::Models::AutoscaleSettingResource.mapper()
|
|
387
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
|
388
|
+
rescue Exception => e
|
|
389
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
390
|
+
end
|
|
391
|
+
end
|
|
392
|
+
|
|
393
|
+
result
|
|
394
|
+
end
|
|
395
|
+
|
|
396
|
+
promise.execute
|
|
397
|
+
end
|
|
398
|
+
|
|
399
|
+
#
|
|
400
|
+
# Updates an existing AutoscaleSettingsResource. To update other fields use the
|
|
401
|
+
# CreateOrUpdate method.
|
|
402
|
+
#
|
|
403
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
404
|
+
# @param autoscale_setting_name [String] The autoscale setting name.
|
|
405
|
+
# @param autoscale_setting_resource [AutoscaleSettingResourcePatch] Parameters
|
|
406
|
+
# supplied to the operation.
|
|
407
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
408
|
+
# will be added to the HTTP request.
|
|
409
|
+
#
|
|
410
|
+
# @return [AutoscaleSettingResource] operation results.
|
|
411
|
+
#
|
|
412
|
+
def update(resource_group_name, autoscale_setting_name, autoscale_setting_resource, custom_headers = nil)
|
|
413
|
+
response = update_async(resource_group_name, autoscale_setting_name, autoscale_setting_resource, custom_headers).value!
|
|
414
|
+
response.body unless response.nil?
|
|
415
|
+
end
|
|
416
|
+
|
|
417
|
+
#
|
|
418
|
+
# Updates an existing AutoscaleSettingsResource. To update other fields use the
|
|
419
|
+
# CreateOrUpdate method.
|
|
420
|
+
#
|
|
421
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
422
|
+
# @param autoscale_setting_name [String] The autoscale setting name.
|
|
423
|
+
# @param autoscale_setting_resource [AutoscaleSettingResourcePatch] Parameters
|
|
424
|
+
# supplied to the operation.
|
|
425
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
426
|
+
# will be added to the HTTP request.
|
|
427
|
+
#
|
|
428
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
429
|
+
#
|
|
430
|
+
def update_with_http_info(resource_group_name, autoscale_setting_name, autoscale_setting_resource, custom_headers = nil)
|
|
431
|
+
update_async(resource_group_name, autoscale_setting_name, autoscale_setting_resource, custom_headers).value!
|
|
432
|
+
end
|
|
433
|
+
|
|
434
|
+
#
|
|
435
|
+
# Updates an existing AutoscaleSettingsResource. To update other fields use the
|
|
436
|
+
# CreateOrUpdate method.
|
|
437
|
+
#
|
|
438
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
439
|
+
# @param autoscale_setting_name [String] The autoscale setting name.
|
|
440
|
+
# @param autoscale_setting_resource [AutoscaleSettingResourcePatch] Parameters
|
|
441
|
+
# supplied to the operation.
|
|
442
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
443
|
+
# to the HTTP request.
|
|
444
|
+
#
|
|
445
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
446
|
+
#
|
|
447
|
+
def update_async(resource_group_name, autoscale_setting_name, autoscale_setting_resource, custom_headers = nil)
|
|
448
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
449
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
|
450
|
+
fail ArgumentError, 'autoscale_setting_name is nil' if autoscale_setting_name.nil?
|
|
451
|
+
api_version = '2015-04-01'
|
|
452
|
+
fail ArgumentError, 'autoscale_setting_resource is nil' if autoscale_setting_resource.nil?
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
request_headers = {}
|
|
456
|
+
|
|
457
|
+
# Set Headers
|
|
458
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
459
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
460
|
+
|
|
461
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
|
462
|
+
|
|
463
|
+
# Serialize Request
|
|
464
|
+
request_mapper = Azure::ARM::Monitor::Models::AutoscaleSettingResourcePatch.mapper()
|
|
465
|
+
request_content = @client.serialize(request_mapper, autoscale_setting_resource)
|
|
466
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
|
467
|
+
|
|
468
|
+
path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}'
|
|
469
|
+
|
|
470
|
+
request_url = @base_url || @client.base_url
|
|
471
|
+
|
|
472
|
+
options = {
|
|
473
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
474
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'autoscaleSettingName' => autoscale_setting_name},
|
|
475
|
+
query_params: {'api-version' => api_version},
|
|
476
|
+
body: request_content,
|
|
477
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
478
|
+
base_url: request_url
|
|
479
|
+
}
|
|
480
|
+
promise = @client.make_request_async(:patch, path_template, options)
|
|
481
|
+
|
|
482
|
+
promise = promise.then do |result|
|
|
483
|
+
http_response = result.response
|
|
484
|
+
status_code = http_response.status
|
|
485
|
+
response_content = http_response.body
|
|
486
|
+
unless status_code == 200
|
|
487
|
+
error_model = JSON.load(response_content)
|
|
488
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
|
489
|
+
end
|
|
490
|
+
|
|
491
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
492
|
+
# Deserialize Response
|
|
493
|
+
if status_code == 200
|
|
494
|
+
begin
|
|
495
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
496
|
+
result_mapper = Azure::ARM::Monitor::Models::AutoscaleSettingResource.mapper()
|
|
497
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
|
498
|
+
rescue Exception => e
|
|
499
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
500
|
+
end
|
|
501
|
+
end
|
|
502
|
+
|
|
503
|
+
result
|
|
504
|
+
end
|
|
505
|
+
|
|
506
|
+
promise.execute
|
|
507
|
+
end
|
|
508
|
+
|
|
509
|
+
#
|
|
510
|
+
# Lists the autoscale settings for a resource group
|
|
511
|
+
#
|
|
512
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
|
513
|
+
# to List operation.
|
|
514
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
515
|
+
# will be added to the HTTP request.
|
|
516
|
+
#
|
|
517
|
+
# @return [AutoscaleSettingResourceCollection] operation results.
|
|
518
|
+
#
|
|
519
|
+
def list_by_resource_group_next(next_page_link, custom_headers = nil)
|
|
520
|
+
response = list_by_resource_group_next_async(next_page_link, custom_headers).value!
|
|
521
|
+
response.body unless response.nil?
|
|
522
|
+
end
|
|
523
|
+
|
|
524
|
+
#
|
|
525
|
+
# Lists the autoscale settings for a resource group
|
|
526
|
+
#
|
|
527
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
|
528
|
+
# to List operation.
|
|
529
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
530
|
+
# will be added to the HTTP request.
|
|
531
|
+
#
|
|
532
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
533
|
+
#
|
|
534
|
+
def list_by_resource_group_next_with_http_info(next_page_link, custom_headers = nil)
|
|
535
|
+
list_by_resource_group_next_async(next_page_link, custom_headers).value!
|
|
536
|
+
end
|
|
537
|
+
|
|
538
|
+
#
|
|
539
|
+
# Lists the autoscale settings for a resource group
|
|
540
|
+
#
|
|
541
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
|
542
|
+
# to List operation.
|
|
543
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
544
|
+
# to the HTTP request.
|
|
545
|
+
#
|
|
546
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
547
|
+
#
|
|
548
|
+
def list_by_resource_group_next_async(next_page_link, custom_headers = nil)
|
|
549
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+
request_headers = {}
|
|
553
|
+
|
|
554
|
+
# Set Headers
|
|
555
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
556
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
557
|
+
path_template = '{nextLink}'
|
|
558
|
+
|
|
559
|
+
request_url = @base_url || @client.base_url
|
|
560
|
+
|
|
561
|
+
options = {
|
|
562
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
563
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
|
564
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
565
|
+
base_url: request_url
|
|
566
|
+
}
|
|
567
|
+
promise = @client.make_request_async(:get, path_template, options)
|
|
568
|
+
|
|
569
|
+
promise = promise.then do |result|
|
|
570
|
+
http_response = result.response
|
|
571
|
+
status_code = http_response.status
|
|
572
|
+
response_content = http_response.body
|
|
573
|
+
unless status_code == 200
|
|
574
|
+
error_model = JSON.load(response_content)
|
|
575
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
|
576
|
+
end
|
|
577
|
+
|
|
578
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
579
|
+
# Deserialize Response
|
|
580
|
+
if status_code == 200
|
|
581
|
+
begin
|
|
582
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
583
|
+
result_mapper = Azure::ARM::Monitor::Models::AutoscaleSettingResourceCollection.mapper()
|
|
584
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
|
585
|
+
rescue Exception => e
|
|
586
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
587
|
+
end
|
|
588
|
+
end
|
|
589
|
+
|
|
590
|
+
result
|
|
591
|
+
end
|
|
592
|
+
|
|
593
|
+
promise.execute
|
|
594
|
+
end
|
|
595
|
+
|
|
596
|
+
#
|
|
597
|
+
# Lists the autoscale settings for a resource group
|
|
598
|
+
#
|
|
599
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
600
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
601
|
+
# will be added to the HTTP request.
|
|
602
|
+
#
|
|
603
|
+
# @return [AutoscaleSettingResourceCollection] which provide lazy access to
|
|
604
|
+
# pages of the response.
|
|
605
|
+
#
|
|
606
|
+
def list_by_resource_group_as_lazy(resource_group_name, custom_headers = nil)
|
|
607
|
+
response = list_by_resource_group_async(resource_group_name, custom_headers).value!
|
|
608
|
+
unless response.nil?
|
|
609
|
+
page = response.body
|
|
610
|
+
page.next_method = Proc.new do |next_page_link|
|
|
611
|
+
list_by_resource_group_next_async(next_page_link, custom_headers)
|
|
612
|
+
end
|
|
613
|
+
page
|
|
614
|
+
end
|
|
615
|
+
end
|
|
616
|
+
|
|
617
|
+
end
|
|
618
|
+
end
|