azure_mgmt_insights 0.8.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_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
@@ -0,0 +1,521 @@
|
|
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 AutoscaleSettings
|
11
|
+
include Azure::ARM::Insights::Models
|
12
|
+
include MsRestAzure
|
13
|
+
|
14
|
+
#
|
15
|
+
# Creates and initializes a new instance of the AutoscaleSettings 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
|
+
# Lists the autoscale settings for a resource group
|
27
|
+
#
|
28
|
+
# @param resource_group_name [String] The name of the resource group.
|
29
|
+
# @param filter [String] The filter to apply on the operation. For more
|
30
|
+
# information please see
|
31
|
+
# https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx
|
32
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
33
|
+
# will be added to the HTTP request.
|
34
|
+
#
|
35
|
+
# @return [Array<AutoscaleSettingResource>] operation results.
|
36
|
+
#
|
37
|
+
def list_by_resource_group(resource_group_name, filter = nil, custom_headers = nil)
|
38
|
+
first_page = list_by_resource_group_as_lazy(resource_group_name, filter, custom_headers)
|
39
|
+
first_page.get_all_items
|
40
|
+
end
|
41
|
+
|
42
|
+
#
|
43
|
+
# Lists the autoscale settings for a resource group
|
44
|
+
#
|
45
|
+
# @param resource_group_name [String] The name of the resource group.
|
46
|
+
# @param filter [String] The filter to apply on the operation. For more
|
47
|
+
# information please see
|
48
|
+
# https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx
|
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 list_by_resource_group_with_http_info(resource_group_name, filter = nil, custom_headers = nil)
|
55
|
+
list_by_resource_group_async(resource_group_name, filter, custom_headers).value!
|
56
|
+
end
|
57
|
+
|
58
|
+
#
|
59
|
+
# Lists the autoscale settings for a resource group
|
60
|
+
#
|
61
|
+
# @param resource_group_name [String] The name of the resource group.
|
62
|
+
# @param filter [String] The filter to apply on the operation. For more
|
63
|
+
# information please see
|
64
|
+
# https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx
|
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 list_by_resource_group_async(resource_group_name, filter = nil, custom_headers = nil)
|
71
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
72
|
+
api_version = '2015-04-01'
|
73
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
74
|
+
|
75
|
+
|
76
|
+
request_headers = {}
|
77
|
+
|
78
|
+
# Set Headers
|
79
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
80
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
81
|
+
path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings'
|
82
|
+
|
83
|
+
request_url = @base_url || @client.base_url
|
84
|
+
|
85
|
+
options = {
|
86
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
87
|
+
path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
|
88
|
+
query_params: {'$filter' => filter,'api-version' => api_version},
|
89
|
+
headers: request_headers.merge(custom_headers || {}),
|
90
|
+
base_url: request_url
|
91
|
+
}
|
92
|
+
promise = @client.make_request_async(:get, path_template, options)
|
93
|
+
|
94
|
+
promise = promise.then do |result|
|
95
|
+
http_response = result.response
|
96
|
+
status_code = http_response.status
|
97
|
+
response_content = http_response.body
|
98
|
+
unless status_code == 200
|
99
|
+
error_model = JSON.load(response_content)
|
100
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
101
|
+
end
|
102
|
+
|
103
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
104
|
+
# Deserialize Response
|
105
|
+
if status_code == 200
|
106
|
+
begin
|
107
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
108
|
+
result_mapper = AutoscaleSettingResourceCollection.mapper()
|
109
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
110
|
+
rescue Exception => e
|
111
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
result
|
116
|
+
end
|
117
|
+
|
118
|
+
promise.execute
|
119
|
+
end
|
120
|
+
|
121
|
+
#
|
122
|
+
# Creates or updates an autoscale setting.
|
123
|
+
#
|
124
|
+
# @param resource_group_name [String] The name of the resource group.
|
125
|
+
# @param autoscale_setting_name [String] The autoscale setting name.
|
126
|
+
# @param parameters [AutoscaleSettingResource] Parameters supplied to the
|
127
|
+
# operation.
|
128
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
129
|
+
# will be added to the HTTP request.
|
130
|
+
#
|
131
|
+
# @return [AutoscaleSettingResource] operation results.
|
132
|
+
#
|
133
|
+
def create_or_update(resource_group_name, autoscale_setting_name, parameters, custom_headers = nil)
|
134
|
+
response = create_or_update_async(resource_group_name, autoscale_setting_name, parameters, custom_headers).value!
|
135
|
+
response.body unless response.nil?
|
136
|
+
end
|
137
|
+
|
138
|
+
#
|
139
|
+
# Creates or updates an autoscale setting.
|
140
|
+
#
|
141
|
+
# @param resource_group_name [String] The name of the resource group.
|
142
|
+
# @param autoscale_setting_name [String] The autoscale setting name.
|
143
|
+
# @param parameters [AutoscaleSettingResource] Parameters supplied to the
|
144
|
+
# operation.
|
145
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
146
|
+
# will be added to the HTTP request.
|
147
|
+
#
|
148
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
149
|
+
#
|
150
|
+
def create_or_update_with_http_info(resource_group_name, autoscale_setting_name, parameters, custom_headers = nil)
|
151
|
+
create_or_update_async(resource_group_name, autoscale_setting_name, parameters, custom_headers).value!
|
152
|
+
end
|
153
|
+
|
154
|
+
#
|
155
|
+
# Creates or updates an autoscale setting.
|
156
|
+
#
|
157
|
+
# @param resource_group_name [String] The name of the resource group.
|
158
|
+
# @param autoscale_setting_name [String] The autoscale setting name.
|
159
|
+
# @param parameters [AutoscaleSettingResource] Parameters supplied to the
|
160
|
+
# operation.
|
161
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
162
|
+
# to the HTTP request.
|
163
|
+
#
|
164
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
165
|
+
#
|
166
|
+
def create_or_update_async(resource_group_name, autoscale_setting_name, parameters, custom_headers = nil)
|
167
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
168
|
+
fail ArgumentError, 'autoscale_setting_name is nil' if autoscale_setting_name.nil?
|
169
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
170
|
+
api_version = '2015-04-01'
|
171
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
172
|
+
|
173
|
+
|
174
|
+
request_headers = {}
|
175
|
+
|
176
|
+
# Set Headers
|
177
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
178
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
179
|
+
|
180
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
181
|
+
|
182
|
+
# Serialize Request
|
183
|
+
request_mapper = AutoscaleSettingResource.mapper()
|
184
|
+
request_content = @client.serialize(request_mapper, parameters, 'parameters')
|
185
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
186
|
+
|
187
|
+
path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}'
|
188
|
+
|
189
|
+
request_url = @base_url || @client.base_url
|
190
|
+
|
191
|
+
options = {
|
192
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
193
|
+
path_params: {'resourceGroupName' => resource_group_name,'autoscaleSettingName' => autoscale_setting_name,'subscriptionId' => @client.subscription_id},
|
194
|
+
query_params: {'api-version' => api_version},
|
195
|
+
body: request_content,
|
196
|
+
headers: request_headers.merge(custom_headers || {}),
|
197
|
+
base_url: request_url
|
198
|
+
}
|
199
|
+
promise = @client.make_request_async(:put, path_template, options)
|
200
|
+
|
201
|
+
promise = promise.then do |result|
|
202
|
+
http_response = result.response
|
203
|
+
status_code = http_response.status
|
204
|
+
response_content = http_response.body
|
205
|
+
unless status_code == 200 || status_code == 201
|
206
|
+
error_model = JSON.load(response_content)
|
207
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
208
|
+
end
|
209
|
+
|
210
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
211
|
+
# Deserialize Response
|
212
|
+
if status_code == 200
|
213
|
+
begin
|
214
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
215
|
+
result_mapper = AutoscaleSettingResource.mapper()
|
216
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
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
|
+
# Deserialize Response
|
222
|
+
if status_code == 201
|
223
|
+
begin
|
224
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
225
|
+
result_mapper = AutoscaleSettingResource.mapper()
|
226
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
227
|
+
rescue Exception => e
|
228
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
result
|
233
|
+
end
|
234
|
+
|
235
|
+
promise.execute
|
236
|
+
end
|
237
|
+
|
238
|
+
#
|
239
|
+
# Deletes and autoscale setting
|
240
|
+
#
|
241
|
+
# @param resource_group_name [String] The name of the resource group.
|
242
|
+
# @param autoscale_setting_name [String] The autoscale setting name.
|
243
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
244
|
+
# will be added to the HTTP request.
|
245
|
+
#
|
246
|
+
#
|
247
|
+
def delete(resource_group_name, autoscale_setting_name, custom_headers = nil)
|
248
|
+
response = delete_async(resource_group_name, autoscale_setting_name, custom_headers).value!
|
249
|
+
nil
|
250
|
+
end
|
251
|
+
|
252
|
+
#
|
253
|
+
# Deletes and autoscale setting
|
254
|
+
#
|
255
|
+
# @param resource_group_name [String] The name of the resource group.
|
256
|
+
# @param autoscale_setting_name [String] The autoscale setting name.
|
257
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
258
|
+
# will be added to the HTTP request.
|
259
|
+
#
|
260
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
261
|
+
#
|
262
|
+
def delete_with_http_info(resource_group_name, autoscale_setting_name, custom_headers = nil)
|
263
|
+
delete_async(resource_group_name, autoscale_setting_name, custom_headers).value!
|
264
|
+
end
|
265
|
+
|
266
|
+
#
|
267
|
+
# Deletes and autoscale setting
|
268
|
+
#
|
269
|
+
# @param resource_group_name [String] The name of the resource group.
|
270
|
+
# @param autoscale_setting_name [String] The autoscale setting name.
|
271
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
272
|
+
# to the HTTP request.
|
273
|
+
#
|
274
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
275
|
+
#
|
276
|
+
def delete_async(resource_group_name, autoscale_setting_name, custom_headers = nil)
|
277
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
278
|
+
fail ArgumentError, 'autoscale_setting_name is nil' if autoscale_setting_name.nil?
|
279
|
+
api_version = '2015-04-01'
|
280
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
281
|
+
|
282
|
+
|
283
|
+
request_headers = {}
|
284
|
+
|
285
|
+
# Set Headers
|
286
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
287
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
288
|
+
path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}'
|
289
|
+
|
290
|
+
request_url = @base_url || @client.base_url
|
291
|
+
|
292
|
+
options = {
|
293
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
294
|
+
path_params: {'resourceGroupName' => resource_group_name,'autoscaleSettingName' => autoscale_setting_name,'subscriptionId' => @client.subscription_id},
|
295
|
+
query_params: {'api-version' => api_version},
|
296
|
+
headers: request_headers.merge(custom_headers || {}),
|
297
|
+
base_url: request_url
|
298
|
+
}
|
299
|
+
promise = @client.make_request_async(:delete, path_template, options)
|
300
|
+
|
301
|
+
promise = promise.then do |result|
|
302
|
+
http_response = result.response
|
303
|
+
status_code = http_response.status
|
304
|
+
response_content = http_response.body
|
305
|
+
unless status_code == 200 || status_code == 204
|
306
|
+
error_model = JSON.load(response_content)
|
307
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
308
|
+
end
|
309
|
+
|
310
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
311
|
+
|
312
|
+
result
|
313
|
+
end
|
314
|
+
|
315
|
+
promise.execute
|
316
|
+
end
|
317
|
+
|
318
|
+
#
|
319
|
+
# Gets an autoscale setting
|
320
|
+
#
|
321
|
+
# @param resource_group_name [String] The name of the resource group.
|
322
|
+
# @param autoscale_setting_name [String] The autoscale setting name.
|
323
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
324
|
+
# will be added to the HTTP request.
|
325
|
+
#
|
326
|
+
# @return [AutoscaleSettingResource] operation results.
|
327
|
+
#
|
328
|
+
def get(resource_group_name, autoscale_setting_name, custom_headers = nil)
|
329
|
+
response = get_async(resource_group_name, autoscale_setting_name, custom_headers).value!
|
330
|
+
response.body unless response.nil?
|
331
|
+
end
|
332
|
+
|
333
|
+
#
|
334
|
+
# Gets an autoscale setting
|
335
|
+
#
|
336
|
+
# @param resource_group_name [String] The name of the resource group.
|
337
|
+
# @param autoscale_setting_name [String] The autoscale setting name.
|
338
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
339
|
+
# will be added to the HTTP request.
|
340
|
+
#
|
341
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
342
|
+
#
|
343
|
+
def get_with_http_info(resource_group_name, autoscale_setting_name, custom_headers = nil)
|
344
|
+
get_async(resource_group_name, autoscale_setting_name, custom_headers).value!
|
345
|
+
end
|
346
|
+
|
347
|
+
#
|
348
|
+
# Gets an autoscale setting
|
349
|
+
#
|
350
|
+
# @param resource_group_name [String] The name of the resource group.
|
351
|
+
# @param autoscale_setting_name [String] The autoscale setting name.
|
352
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
353
|
+
# to the HTTP request.
|
354
|
+
#
|
355
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
356
|
+
#
|
357
|
+
def get_async(resource_group_name, autoscale_setting_name, custom_headers = nil)
|
358
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
359
|
+
fail ArgumentError, 'autoscale_setting_name is nil' if autoscale_setting_name.nil?
|
360
|
+
api_version = '2015-04-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/autoscalesettings/{autoscaleSettingName}'
|
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,'autoscaleSettingName' => autoscale_setting_name,'subscriptionId' => @client.subscription_id},
|
376
|
+
query_params: {'api-version' => api_version},
|
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 = AutoscaleSettingResource.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
|
+
#
|
410
|
+
# Lists the autoscale settings for a resource group
|
411
|
+
#
|
412
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
413
|
+
# to List operation.
|
414
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
415
|
+
# will be added to the HTTP request.
|
416
|
+
#
|
417
|
+
# @return [AutoscaleSettingResourceCollection] operation results.
|
418
|
+
#
|
419
|
+
def list_by_resource_group_next(next_page_link, custom_headers = nil)
|
420
|
+
response = list_by_resource_group_next_async(next_page_link, custom_headers).value!
|
421
|
+
response.body unless response.nil?
|
422
|
+
end
|
423
|
+
|
424
|
+
#
|
425
|
+
# Lists the autoscale settings for a resource group
|
426
|
+
#
|
427
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
428
|
+
# to List operation.
|
429
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
430
|
+
# will be added to the HTTP request.
|
431
|
+
#
|
432
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
433
|
+
#
|
434
|
+
def list_by_resource_group_next_with_http_info(next_page_link, custom_headers = nil)
|
435
|
+
list_by_resource_group_next_async(next_page_link, custom_headers).value!
|
436
|
+
end
|
437
|
+
|
438
|
+
#
|
439
|
+
# Lists the autoscale settings for a resource group
|
440
|
+
#
|
441
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
442
|
+
# to List operation.
|
443
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
444
|
+
# to the HTTP request.
|
445
|
+
#
|
446
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
447
|
+
#
|
448
|
+
def list_by_resource_group_next_async(next_page_link, custom_headers = nil)
|
449
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
450
|
+
|
451
|
+
|
452
|
+
request_headers = {}
|
453
|
+
|
454
|
+
# Set Headers
|
455
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
456
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
457
|
+
path_template = '{nextLink}'
|
458
|
+
|
459
|
+
request_url = @base_url || @client.base_url
|
460
|
+
|
461
|
+
options = {
|
462
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
463
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
464
|
+
headers: request_headers.merge(custom_headers || {}),
|
465
|
+
base_url: request_url
|
466
|
+
}
|
467
|
+
promise = @client.make_request_async(:get, path_template, options)
|
468
|
+
|
469
|
+
promise = promise.then do |result|
|
470
|
+
http_response = result.response
|
471
|
+
status_code = http_response.status
|
472
|
+
response_content = http_response.body
|
473
|
+
unless status_code == 200
|
474
|
+
error_model = JSON.load(response_content)
|
475
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
476
|
+
end
|
477
|
+
|
478
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
479
|
+
# Deserialize Response
|
480
|
+
if status_code == 200
|
481
|
+
begin
|
482
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
483
|
+
result_mapper = AutoscaleSettingResourceCollection.mapper()
|
484
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
485
|
+
rescue Exception => e
|
486
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
487
|
+
end
|
488
|
+
end
|
489
|
+
|
490
|
+
result
|
491
|
+
end
|
492
|
+
|
493
|
+
promise.execute
|
494
|
+
end
|
495
|
+
|
496
|
+
#
|
497
|
+
# Lists the autoscale settings for a resource group
|
498
|
+
#
|
499
|
+
# @param resource_group_name [String] The name of the resource group.
|
500
|
+
# @param filter [String] The filter to apply on the operation. For more
|
501
|
+
# information please see
|
502
|
+
# https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx
|
503
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
504
|
+
# will be added to the HTTP request.
|
505
|
+
#
|
506
|
+
# @return [AutoscaleSettingResourceCollection] which provide lazy access to
|
507
|
+
# pages of the response.
|
508
|
+
#
|
509
|
+
def list_by_resource_group_as_lazy(resource_group_name, filter = nil, custom_headers = nil)
|
510
|
+
response = list_by_resource_group_async(resource_group_name, filter, custom_headers).value!
|
511
|
+
unless response.nil?
|
512
|
+
page = response.body
|
513
|
+
page.next_method = Proc.new do |next_page_link|
|
514
|
+
list_by_resource_group_next_async(next_page_link, custom_headers)
|
515
|
+
end
|
516
|
+
page
|
517
|
+
end
|
518
|
+
end
|
519
|
+
|
520
|
+
end
|
521
|
+
end
|