azure_mgmt_advisor 0.17.0 → 0.17.1
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 +5 -5
- data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/advisor_management_client.rb +1 -1
- data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/operations.rb +4 -0
- data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/recommendations.rb +10 -0
- data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/suppressions.rb +8 -0
- data/lib/2017-03-31/generated/azure_mgmt_advisor/advisor_management_client.rb +1 -1
- data/lib/2017-03-31/generated/azure_mgmt_advisor/operations.rb +4 -0
- data/lib/2017-03-31/generated/azure_mgmt_advisor/recommendations.rb +10 -0
- data/lib/2017-03-31/generated/azure_mgmt_advisor/suppressions.rb +8 -0
- data/lib/2017-04-19/generated/azure_mgmt_advisor/advisor_management_client.rb +1 -1
- data/lib/2017-04-19/generated/azure_mgmt_advisor/configurations.rb +10 -0
- data/lib/2017-04-19/generated/azure_mgmt_advisor/operations.rb +4 -0
- data/lib/2017-04-19/generated/azure_mgmt_advisor/recommendations.rb +10 -0
- data/lib/2017-04-19/generated/azure_mgmt_advisor/suppressions.rb +10 -0
- data/lib/2020-01-01/generated/azure_mgmt_advisor.rb +56 -0
- data/lib/2020-01-01/generated/azure_mgmt_advisor/advisor_management_client.rb +148 -0
- data/lib/2020-01-01/generated/azure_mgmt_advisor/configurations.rb +547 -0
- data/lib/2020-01-01/generated/azure_mgmt_advisor/models/arm_error_response.rb +48 -0
- data/lib/2020-01-01/generated/azure_mgmt_advisor/models/armerror_response_body.rb +59 -0
- data/lib/2020-01-01/generated/azure_mgmt_advisor/models/category.rb +19 -0
- data/lib/2020-01-01/generated/azure_mgmt_advisor/models/config_data.rb +108 -0
- data/lib/2020-01-01/generated/azure_mgmt_advisor/models/configuration_list_result.rb +98 -0
- data/lib/2020-01-01/generated/azure_mgmt_advisor/models/cpu_threshold.rb +18 -0
- data/lib/2020-01-01/generated/azure_mgmt_advisor/models/digest_config.rb +115 -0
- data/lib/2020-01-01/generated/azure_mgmt_advisor/models/digest_config_state.rb +16 -0
- data/lib/2020-01-01/generated/azure_mgmt_advisor/models/impact.rb +17 -0
- data/lib/2020-01-01/generated/azure_mgmt_advisor/models/metadata_entity.rb +140 -0
- data/lib/2020-01-01/generated/azure_mgmt_advisor/models/metadata_entity_list_result.rb +98 -0
- data/lib/2020-01-01/generated/azure_mgmt_advisor/models/metadata_supported_value_detail.rb +57 -0
- data/lib/2020-01-01/generated/azure_mgmt_advisor/models/operation_display_info.rb +80 -0
- data/lib/2020-01-01/generated/azure_mgmt_advisor/models/operation_entity.rb +58 -0
- data/lib/2020-01-01/generated/azure_mgmt_advisor/models/operation_entity_list_result.rb +98 -0
- data/lib/2020-01-01/generated/azure_mgmt_advisor/models/resource.rb +80 -0
- data/lib/2020-01-01/generated/azure_mgmt_advisor/models/resource_metadata.rb +57 -0
- data/lib/2020-01-01/generated/azure_mgmt_advisor/models/resource_recommendation_base.rb +225 -0
- data/lib/2020-01-01/generated/azure_mgmt_advisor/models/resource_recommendation_base_list_result.rb +99 -0
- data/lib/2020-01-01/generated/azure_mgmt_advisor/models/risk.rb +17 -0
- data/lib/2020-01-01/generated/azure_mgmt_advisor/models/scenario.rb +15 -0
- data/lib/2020-01-01/generated/azure_mgmt_advisor/models/short_description.rb +59 -0
- data/lib/2020-01-01/generated/azure_mgmt_advisor/models/suppression_contract.rb +85 -0
- data/lib/2020-01-01/generated/azure_mgmt_advisor/models/suppression_contract_list_result.rb +98 -0
- data/lib/2020-01-01/generated/azure_mgmt_advisor/module_definition.rb +9 -0
- data/lib/2020-01-01/generated/azure_mgmt_advisor/operations.rb +219 -0
- data/lib/2020-01-01/generated/azure_mgmt_advisor/recommendation_metadata.rb +318 -0
- data/lib/2020-01-01/generated/azure_mgmt_advisor/recommendations.rb +513 -0
- data/lib/2020-01-01/generated/azure_mgmt_advisor/suppressions.rb +563 -0
- data/lib/azure_mgmt_advisor.rb +2 -1
- data/lib/profiles/latest/modules/advisor_profile_module.rb +80 -46
- data/lib/version.rb +1 -1
- metadata +37 -5
@@ -0,0 +1,563 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::Advisor::Mgmt::V2020_01_01
|
7
|
+
#
|
8
|
+
# REST APIs for Azure Advisor
|
9
|
+
#
|
10
|
+
class Suppressions
|
11
|
+
include MsRestAzure
|
12
|
+
|
13
|
+
#
|
14
|
+
# Creates and initializes a new instance of the Suppressions class.
|
15
|
+
# @param client service class for accessing basic functionality.
|
16
|
+
#
|
17
|
+
def initialize(client)
|
18
|
+
@client = client
|
19
|
+
end
|
20
|
+
|
21
|
+
# @return [AdvisorManagementClient] reference to the AdvisorManagementClient
|
22
|
+
attr_reader :client
|
23
|
+
|
24
|
+
#
|
25
|
+
# Obtains the details of a suppression.
|
26
|
+
#
|
27
|
+
# @param resource_uri [String] The fully qualified Azure Resource Manager
|
28
|
+
# identifier of the resource to which the recommendation applies.
|
29
|
+
# @param recommendation_id [String] The recommendation ID.
|
30
|
+
# @param name [String] The name of the suppression.
|
31
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
32
|
+
# will be added to the HTTP request.
|
33
|
+
#
|
34
|
+
# @return [SuppressionContract] operation results.
|
35
|
+
#
|
36
|
+
def get(resource_uri, recommendation_id, name, custom_headers:nil)
|
37
|
+
response = get_async(resource_uri, recommendation_id, name, custom_headers:custom_headers).value!
|
38
|
+
response.body unless response.nil?
|
39
|
+
end
|
40
|
+
|
41
|
+
#
|
42
|
+
# Obtains the details of a suppression.
|
43
|
+
#
|
44
|
+
# @param resource_uri [String] The fully qualified Azure Resource Manager
|
45
|
+
# identifier of the resource to which the recommendation applies.
|
46
|
+
# @param recommendation_id [String] The recommendation ID.
|
47
|
+
# @param name [String] The name of the suppression.
|
48
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
49
|
+
# will be added to the HTTP request.
|
50
|
+
#
|
51
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
52
|
+
#
|
53
|
+
def get_with_http_info(resource_uri, recommendation_id, name, custom_headers:nil)
|
54
|
+
get_async(resource_uri, recommendation_id, name, custom_headers:custom_headers).value!
|
55
|
+
end
|
56
|
+
|
57
|
+
#
|
58
|
+
# Obtains the details of a suppression.
|
59
|
+
#
|
60
|
+
# @param resource_uri [String] The fully qualified Azure Resource Manager
|
61
|
+
# identifier of the resource to which the recommendation applies.
|
62
|
+
# @param recommendation_id [String] The recommendation ID.
|
63
|
+
# @param name [String] The name of the suppression.
|
64
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
65
|
+
# to the HTTP request.
|
66
|
+
#
|
67
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
68
|
+
#
|
69
|
+
def get_async(resource_uri, recommendation_id, name, custom_headers:nil)
|
70
|
+
fail ArgumentError, 'resource_uri is nil' if resource_uri.nil?
|
71
|
+
fail ArgumentError, 'recommendation_id is nil' if recommendation_id.nil?
|
72
|
+
fail ArgumentError, 'name is nil' if name.nil?
|
73
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
74
|
+
|
75
|
+
|
76
|
+
request_headers = {}
|
77
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
78
|
+
|
79
|
+
# Set Headers
|
80
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
81
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
82
|
+
path_template = '{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}'
|
83
|
+
|
84
|
+
request_url = @base_url || @client.base_url
|
85
|
+
|
86
|
+
options = {
|
87
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
88
|
+
path_params: {'resourceUri' => resource_uri,'recommendationId' => recommendation_id,'name' => name},
|
89
|
+
query_params: {'api-version' => @client.api_version},
|
90
|
+
headers: request_headers.merge(custom_headers || {}),
|
91
|
+
base_url: request_url
|
92
|
+
}
|
93
|
+
promise = @client.make_request_async(:get, path_template, options)
|
94
|
+
|
95
|
+
promise = promise.then do |result|
|
96
|
+
http_response = result.response
|
97
|
+
status_code = http_response.status
|
98
|
+
response_content = http_response.body
|
99
|
+
unless status_code == 200
|
100
|
+
error_model = JSON.load(response_content)
|
101
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
102
|
+
end
|
103
|
+
|
104
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
105
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
106
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
107
|
+
# Deserialize Response
|
108
|
+
if status_code == 200
|
109
|
+
begin
|
110
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
111
|
+
result_mapper = Azure::Advisor::Mgmt::V2020_01_01::Models::SuppressionContract.mapper()
|
112
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
113
|
+
rescue Exception => e
|
114
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
result
|
119
|
+
end
|
120
|
+
|
121
|
+
promise.execute
|
122
|
+
end
|
123
|
+
|
124
|
+
#
|
125
|
+
# Enables the snoozed or dismissed attribute of a recommendation. The snoozed
|
126
|
+
# or dismissed attribute is referred to as a suppression. Use this API to
|
127
|
+
# create or update the snoozed or dismissed status of a recommendation.
|
128
|
+
#
|
129
|
+
# @param resource_uri [String] The fully qualified Azure Resource Manager
|
130
|
+
# identifier of the resource to which the recommendation applies.
|
131
|
+
# @param recommendation_id [String] The recommendation ID.
|
132
|
+
# @param name [String] The name of the suppression.
|
133
|
+
# @param suppression_contract [SuppressionContract] The snoozed or dismissed
|
134
|
+
# attribute; for example, the snooze duration.
|
135
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
136
|
+
# will be added to the HTTP request.
|
137
|
+
#
|
138
|
+
# @return [SuppressionContract] operation results.
|
139
|
+
#
|
140
|
+
def create(resource_uri, recommendation_id, name, suppression_contract, custom_headers:nil)
|
141
|
+
response = create_async(resource_uri, recommendation_id, name, suppression_contract, custom_headers:custom_headers).value!
|
142
|
+
response.body unless response.nil?
|
143
|
+
end
|
144
|
+
|
145
|
+
#
|
146
|
+
# Enables the snoozed or dismissed attribute of a recommendation. The snoozed
|
147
|
+
# or dismissed attribute is referred to as a suppression. Use this API to
|
148
|
+
# create or update the snoozed or dismissed status of a recommendation.
|
149
|
+
#
|
150
|
+
# @param resource_uri [String] The fully qualified Azure Resource Manager
|
151
|
+
# identifier of the resource to which the recommendation applies.
|
152
|
+
# @param recommendation_id [String] The recommendation ID.
|
153
|
+
# @param name [String] The name of the suppression.
|
154
|
+
# @param suppression_contract [SuppressionContract] The snoozed or dismissed
|
155
|
+
# attribute; for example, the snooze duration.
|
156
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
157
|
+
# will be added to the HTTP request.
|
158
|
+
#
|
159
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
160
|
+
#
|
161
|
+
def create_with_http_info(resource_uri, recommendation_id, name, suppression_contract, custom_headers:nil)
|
162
|
+
create_async(resource_uri, recommendation_id, name, suppression_contract, custom_headers:custom_headers).value!
|
163
|
+
end
|
164
|
+
|
165
|
+
#
|
166
|
+
# Enables the snoozed or dismissed attribute of a recommendation. The snoozed
|
167
|
+
# or dismissed attribute is referred to as a suppression. Use this API to
|
168
|
+
# create or update the snoozed or dismissed status of a recommendation.
|
169
|
+
#
|
170
|
+
# @param resource_uri [String] The fully qualified Azure Resource Manager
|
171
|
+
# identifier of the resource to which the recommendation applies.
|
172
|
+
# @param recommendation_id [String] The recommendation ID.
|
173
|
+
# @param name [String] The name of the suppression.
|
174
|
+
# @param suppression_contract [SuppressionContract] The snoozed or dismissed
|
175
|
+
# attribute; for example, the snooze duration.
|
176
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
177
|
+
# to the HTTP request.
|
178
|
+
#
|
179
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
180
|
+
#
|
181
|
+
def create_async(resource_uri, recommendation_id, name, suppression_contract, custom_headers:nil)
|
182
|
+
fail ArgumentError, 'resource_uri is nil' if resource_uri.nil?
|
183
|
+
fail ArgumentError, 'recommendation_id is nil' if recommendation_id.nil?
|
184
|
+
fail ArgumentError, 'name is nil' if name.nil?
|
185
|
+
fail ArgumentError, 'suppression_contract is nil' if suppression_contract.nil?
|
186
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
187
|
+
|
188
|
+
|
189
|
+
request_headers = {}
|
190
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
191
|
+
|
192
|
+
# Set Headers
|
193
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
194
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
195
|
+
|
196
|
+
# Serialize Request
|
197
|
+
request_mapper = Azure::Advisor::Mgmt::V2020_01_01::Models::SuppressionContract.mapper()
|
198
|
+
request_content = @client.serialize(request_mapper, suppression_contract)
|
199
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
200
|
+
|
201
|
+
path_template = '{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}'
|
202
|
+
|
203
|
+
request_url = @base_url || @client.base_url
|
204
|
+
|
205
|
+
options = {
|
206
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
207
|
+
path_params: {'resourceUri' => resource_uri,'recommendationId' => recommendation_id,'name' => name},
|
208
|
+
query_params: {'api-version' => @client.api_version},
|
209
|
+
body: request_content,
|
210
|
+
headers: request_headers.merge(custom_headers || {}),
|
211
|
+
base_url: request_url
|
212
|
+
}
|
213
|
+
promise = @client.make_request_async(:put, path_template, options)
|
214
|
+
|
215
|
+
promise = promise.then do |result|
|
216
|
+
http_response = result.response
|
217
|
+
status_code = http_response.status
|
218
|
+
response_content = http_response.body
|
219
|
+
unless status_code == 200
|
220
|
+
error_model = JSON.load(response_content)
|
221
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
222
|
+
end
|
223
|
+
|
224
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
225
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
226
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
227
|
+
# Deserialize Response
|
228
|
+
if status_code == 200
|
229
|
+
begin
|
230
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
231
|
+
result_mapper = Azure::Advisor::Mgmt::V2020_01_01::Models::SuppressionContract.mapper()
|
232
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
233
|
+
rescue Exception => e
|
234
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
result
|
239
|
+
end
|
240
|
+
|
241
|
+
promise.execute
|
242
|
+
end
|
243
|
+
|
244
|
+
#
|
245
|
+
# Enables the activation of a snoozed or dismissed recommendation. The snoozed
|
246
|
+
# or dismissed attribute of a recommendation is referred to as a suppression.
|
247
|
+
#
|
248
|
+
# @param resource_uri [String] The fully qualified Azure Resource Manager
|
249
|
+
# identifier of the resource to which the recommendation applies.
|
250
|
+
# @param recommendation_id [String] The recommendation ID.
|
251
|
+
# @param name [String] The name of the suppression.
|
252
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
253
|
+
# will be added to the HTTP request.
|
254
|
+
#
|
255
|
+
#
|
256
|
+
def delete(resource_uri, recommendation_id, name, custom_headers:nil)
|
257
|
+
response = delete_async(resource_uri, recommendation_id, name, custom_headers:custom_headers).value!
|
258
|
+
nil
|
259
|
+
end
|
260
|
+
|
261
|
+
#
|
262
|
+
# Enables the activation of a snoozed or dismissed recommendation. The snoozed
|
263
|
+
# or dismissed attribute of a recommendation is referred to as a suppression.
|
264
|
+
#
|
265
|
+
# @param resource_uri [String] The fully qualified Azure Resource Manager
|
266
|
+
# identifier of the resource to which the recommendation applies.
|
267
|
+
# @param recommendation_id [String] The recommendation ID.
|
268
|
+
# @param name [String] The name of the suppression.
|
269
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
270
|
+
# will be added to the HTTP request.
|
271
|
+
#
|
272
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
273
|
+
#
|
274
|
+
def delete_with_http_info(resource_uri, recommendation_id, name, custom_headers:nil)
|
275
|
+
delete_async(resource_uri, recommendation_id, name, custom_headers:custom_headers).value!
|
276
|
+
end
|
277
|
+
|
278
|
+
#
|
279
|
+
# Enables the activation of a snoozed or dismissed recommendation. The snoozed
|
280
|
+
# or dismissed attribute of a recommendation is referred to as a suppression.
|
281
|
+
#
|
282
|
+
# @param resource_uri [String] The fully qualified Azure Resource Manager
|
283
|
+
# identifier of the resource to which the recommendation applies.
|
284
|
+
# @param recommendation_id [String] The recommendation ID.
|
285
|
+
# @param name [String] The name of the suppression.
|
286
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
287
|
+
# to the HTTP request.
|
288
|
+
#
|
289
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
290
|
+
#
|
291
|
+
def delete_async(resource_uri, recommendation_id, name, custom_headers:nil)
|
292
|
+
fail ArgumentError, 'resource_uri is nil' if resource_uri.nil?
|
293
|
+
fail ArgumentError, 'recommendation_id is nil' if recommendation_id.nil?
|
294
|
+
fail ArgumentError, 'name is nil' if name.nil?
|
295
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
296
|
+
|
297
|
+
|
298
|
+
request_headers = {}
|
299
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
300
|
+
|
301
|
+
# Set Headers
|
302
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
303
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
304
|
+
path_template = '{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}'
|
305
|
+
|
306
|
+
request_url = @base_url || @client.base_url
|
307
|
+
|
308
|
+
options = {
|
309
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
310
|
+
path_params: {'resourceUri' => resource_uri,'recommendationId' => recommendation_id,'name' => name},
|
311
|
+
query_params: {'api-version' => @client.api_version},
|
312
|
+
headers: request_headers.merge(custom_headers || {}),
|
313
|
+
base_url: request_url
|
314
|
+
}
|
315
|
+
promise = @client.make_request_async(:delete, path_template, options)
|
316
|
+
|
317
|
+
promise = promise.then do |result|
|
318
|
+
http_response = result.response
|
319
|
+
status_code = http_response.status
|
320
|
+
response_content = http_response.body
|
321
|
+
unless status_code == 204
|
322
|
+
error_model = JSON.load(response_content)
|
323
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
324
|
+
end
|
325
|
+
|
326
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
327
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
328
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
329
|
+
|
330
|
+
result
|
331
|
+
end
|
332
|
+
|
333
|
+
promise.execute
|
334
|
+
end
|
335
|
+
|
336
|
+
#
|
337
|
+
# Retrieves the list of snoozed or dismissed suppressions for a subscription.
|
338
|
+
# The snoozed or dismissed attribute of a recommendation is referred to as a
|
339
|
+
# suppression.
|
340
|
+
#
|
341
|
+
# @param top [Integer] The number of suppressions per page if a paged version
|
342
|
+
# of this API is being used.
|
343
|
+
# @param skip_token [String] The page-continuation token to use with a paged
|
344
|
+
# version of this API.
|
345
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
346
|
+
# will be added to the HTTP request.
|
347
|
+
#
|
348
|
+
# @return [Array<SuppressionContract>] operation results.
|
349
|
+
#
|
350
|
+
def list(top:nil, skip_token:nil, custom_headers:nil)
|
351
|
+
first_page = list_as_lazy(top:top, skip_token:skip_token, custom_headers:custom_headers)
|
352
|
+
first_page.get_all_items
|
353
|
+
end
|
354
|
+
|
355
|
+
#
|
356
|
+
# Retrieves the list of snoozed or dismissed suppressions for a subscription.
|
357
|
+
# The snoozed or dismissed attribute of a recommendation is referred to as a
|
358
|
+
# suppression.
|
359
|
+
#
|
360
|
+
# @param top [Integer] The number of suppressions per page if a paged version
|
361
|
+
# of this API is being used.
|
362
|
+
# @param skip_token [String] The page-continuation token to use with a paged
|
363
|
+
# version of this API.
|
364
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
365
|
+
# will be added to the HTTP request.
|
366
|
+
#
|
367
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
368
|
+
#
|
369
|
+
def list_with_http_info(top:nil, skip_token:nil, custom_headers:nil)
|
370
|
+
list_async(top:top, skip_token:skip_token, custom_headers:custom_headers).value!
|
371
|
+
end
|
372
|
+
|
373
|
+
#
|
374
|
+
# Retrieves the list of snoozed or dismissed suppressions for a subscription.
|
375
|
+
# The snoozed or dismissed attribute of a recommendation is referred to as a
|
376
|
+
# suppression.
|
377
|
+
#
|
378
|
+
# @param top [Integer] The number of suppressions per page if a paged version
|
379
|
+
# of this API is being used.
|
380
|
+
# @param skip_token [String] The page-continuation token to use with a paged
|
381
|
+
# version of this API.
|
382
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
383
|
+
# to the HTTP request.
|
384
|
+
#
|
385
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
386
|
+
#
|
387
|
+
def list_async(top:nil, skip_token:nil, custom_headers:nil)
|
388
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
389
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
390
|
+
|
391
|
+
|
392
|
+
request_headers = {}
|
393
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
394
|
+
|
395
|
+
# Set Headers
|
396
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
397
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
398
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Advisor/suppressions'
|
399
|
+
|
400
|
+
request_url = @base_url || @client.base_url
|
401
|
+
|
402
|
+
options = {
|
403
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
404
|
+
path_params: {'subscriptionId' => @client.subscription_id},
|
405
|
+
query_params: {'api-version' => @client.api_version,'$top' => top,'$skipToken' => skip_token},
|
406
|
+
headers: request_headers.merge(custom_headers || {}),
|
407
|
+
base_url: request_url
|
408
|
+
}
|
409
|
+
promise = @client.make_request_async(:get, path_template, options)
|
410
|
+
|
411
|
+
promise = promise.then do |result|
|
412
|
+
http_response = result.response
|
413
|
+
status_code = http_response.status
|
414
|
+
response_content = http_response.body
|
415
|
+
unless status_code == 200
|
416
|
+
error_model = JSON.load(response_content)
|
417
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
418
|
+
end
|
419
|
+
|
420
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
421
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
422
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
423
|
+
# Deserialize Response
|
424
|
+
if status_code == 200
|
425
|
+
begin
|
426
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
427
|
+
result_mapper = Azure::Advisor::Mgmt::V2020_01_01::Models::SuppressionContractListResult.mapper()
|
428
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
429
|
+
rescue Exception => e
|
430
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
431
|
+
end
|
432
|
+
end
|
433
|
+
|
434
|
+
result
|
435
|
+
end
|
436
|
+
|
437
|
+
promise.execute
|
438
|
+
end
|
439
|
+
|
440
|
+
#
|
441
|
+
# Retrieves the list of snoozed or dismissed suppressions for a subscription.
|
442
|
+
# The snoozed or dismissed attribute of a recommendation is referred to as a
|
443
|
+
# suppression.
|
444
|
+
#
|
445
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
446
|
+
# to List operation.
|
447
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
448
|
+
# will be added to the HTTP request.
|
449
|
+
#
|
450
|
+
# @return [SuppressionContractListResult] operation results.
|
451
|
+
#
|
452
|
+
def list_next(next_page_link, custom_headers:nil)
|
453
|
+
response = list_next_async(next_page_link, custom_headers:custom_headers).value!
|
454
|
+
response.body unless response.nil?
|
455
|
+
end
|
456
|
+
|
457
|
+
#
|
458
|
+
# Retrieves the list of snoozed or dismissed suppressions for a subscription.
|
459
|
+
# The snoozed or dismissed attribute of a recommendation is referred to as a
|
460
|
+
# suppression.
|
461
|
+
#
|
462
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
463
|
+
# to List operation.
|
464
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
465
|
+
# will be added to the HTTP request.
|
466
|
+
#
|
467
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
468
|
+
#
|
469
|
+
def list_next_with_http_info(next_page_link, custom_headers:nil)
|
470
|
+
list_next_async(next_page_link, custom_headers:custom_headers).value!
|
471
|
+
end
|
472
|
+
|
473
|
+
#
|
474
|
+
# Retrieves the list of snoozed or dismissed suppressions for a subscription.
|
475
|
+
# The snoozed or dismissed attribute of a recommendation is referred to as a
|
476
|
+
# suppression.
|
477
|
+
#
|
478
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
479
|
+
# to List operation.
|
480
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
481
|
+
# to the HTTP request.
|
482
|
+
#
|
483
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
484
|
+
#
|
485
|
+
def list_next_async(next_page_link, custom_headers:nil)
|
486
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
487
|
+
|
488
|
+
|
489
|
+
request_headers = {}
|
490
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
491
|
+
|
492
|
+
# Set Headers
|
493
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
494
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
495
|
+
path_template = '{nextLink}'
|
496
|
+
|
497
|
+
request_url = @base_url || @client.base_url
|
498
|
+
|
499
|
+
options = {
|
500
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
501
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
502
|
+
headers: request_headers.merge(custom_headers || {}),
|
503
|
+
base_url: request_url
|
504
|
+
}
|
505
|
+
promise = @client.make_request_async(:get, path_template, options)
|
506
|
+
|
507
|
+
promise = promise.then do |result|
|
508
|
+
http_response = result.response
|
509
|
+
status_code = http_response.status
|
510
|
+
response_content = http_response.body
|
511
|
+
unless status_code == 200
|
512
|
+
error_model = JSON.load(response_content)
|
513
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
514
|
+
end
|
515
|
+
|
516
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
517
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
518
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
519
|
+
# Deserialize Response
|
520
|
+
if status_code == 200
|
521
|
+
begin
|
522
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
523
|
+
result_mapper = Azure::Advisor::Mgmt::V2020_01_01::Models::SuppressionContractListResult.mapper()
|
524
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
525
|
+
rescue Exception => e
|
526
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
527
|
+
end
|
528
|
+
end
|
529
|
+
|
530
|
+
result
|
531
|
+
end
|
532
|
+
|
533
|
+
promise.execute
|
534
|
+
end
|
535
|
+
|
536
|
+
#
|
537
|
+
# Retrieves the list of snoozed or dismissed suppressions for a subscription.
|
538
|
+
# The snoozed or dismissed attribute of a recommendation is referred to as a
|
539
|
+
# suppression.
|
540
|
+
#
|
541
|
+
# @param top [Integer] The number of suppressions per page if a paged version
|
542
|
+
# of this API is being used.
|
543
|
+
# @param skip_token [String] The page-continuation token to use with a paged
|
544
|
+
# version of this API.
|
545
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
546
|
+
# will be added to the HTTP request.
|
547
|
+
#
|
548
|
+
# @return [SuppressionContractListResult] which provide lazy access to pages of
|
549
|
+
# the response.
|
550
|
+
#
|
551
|
+
def list_as_lazy(top:nil, skip_token:nil, custom_headers:nil)
|
552
|
+
response = list_async(top:top, skip_token:skip_token, custom_headers:custom_headers).value!
|
553
|
+
unless response.nil?
|
554
|
+
page = response.body
|
555
|
+
page.next_method = Proc.new do |next_page_link|
|
556
|
+
list_next_async(next_page_link, custom_headers:custom_headers)
|
557
|
+
end
|
558
|
+
page
|
559
|
+
end
|
560
|
+
end
|
561
|
+
|
562
|
+
end
|
563
|
+
end
|