azure_mgmt_security 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2017-08-01-preview/generated/azure_mgmt_security.rb +48 -0
  4. data/lib/2017-08-01-preview/generated/azure_mgmt_security/auto_provisioning_settings.rb +407 -0
  5. data/lib/2017-08-01-preview/generated/azure_mgmt_security/compliances.rb +325 -0
  6. data/lib/2017-08-01-preview/generated/azure_mgmt_security/models/alert_notifications.rb +16 -0
  7. data/lib/2017-08-01-preview/generated/azure_mgmt_security/models/alerts_to_admins.rb +16 -0
  8. data/lib/2017-08-01-preview/generated/azure_mgmt_security/models/auto_provisioning_setting.rb +75 -0
  9. data/lib/2017-08-01-preview/generated/azure_mgmt_security/models/auto_provisioning_setting_list.rb +100 -0
  10. data/lib/2017-08-01-preview/generated/azure_mgmt_security/models/compliance.rb +111 -0
  11. data/lib/2017-08-01-preview/generated/azure_mgmt_security/models/compliance_list.rb +99 -0
  12. data/lib/2017-08-01-preview/generated/azure_mgmt_security/models/compliance_segment.rb +60 -0
  13. data/lib/2017-08-01-preview/generated/azure_mgmt_security/models/pricing.rb +74 -0
  14. data/lib/2017-08-01-preview/generated/azure_mgmt_security/models/pricing_list.rb +99 -0
  15. data/lib/2017-08-01-preview/generated/azure_mgmt_security/models/pricing_tier.rb +16 -0
  16. data/lib/2017-08-01-preview/generated/azure_mgmt_security/models/provisioning_setting.rb +16 -0
  17. data/lib/2017-08-01-preview/generated/azure_mgmt_security/models/resource.rb +71 -0
  18. data/lib/2017-08-01-preview/generated/azure_mgmt_security/models/security_contact.rb +109 -0
  19. data/lib/2017-08-01-preview/generated/azure_mgmt_security/models/security_contact_list.rb +100 -0
  20. data/lib/2017-08-01-preview/generated/azure_mgmt_security/models/workspace_setting.rb +86 -0
  21. data/lib/2017-08-01-preview/generated/azure_mgmt_security/models/workspace_setting_list.rb +99 -0
  22. data/lib/2017-08-01-preview/generated/azure_mgmt_security/module_definition.rb +9 -0
  23. data/lib/2017-08-01-preview/generated/azure_mgmt_security/pricings.rb +822 -0
  24. data/lib/2017-08-01-preview/generated/azure_mgmt_security/security_contacts.rb +585 -0
  25. data/lib/2017-08-01-preview/generated/azure_mgmt_security/security_management_client.rb +146 -0
  26. data/lib/2017-08-01-preview/generated/azure_mgmt_security/workspace_settings.rb +588 -0
  27. data/lib/azure_mgmt_security.rb +6 -0
  28. data/lib/module_definition.rb +7 -0
  29. data/lib/profiles/latest/modules/security_profile_module.rb +133 -0
  30. data/lib/profiles/latest/security_latest_profile_client.rb +40 -0
  31. data/lib/profiles/latest/security_module_definition.rb +8 -0
  32. data/lib/version.rb +7 -0
  33. metadata +150 -0
@@ -0,0 +1,9 @@
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 end
7
+ module Azure::Security end
8
+ module Azure::Security::Mgmt end
9
+ module Azure::Security::Mgmt::V2017_08_01_preview end
@@ -0,0 +1,822 @@
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::Security::Mgmt::V2017_08_01_preview
7
+ #
8
+ # API spec for Microsoft.Security (Azure Security Center) resource provider
9
+ #
10
+ class Pricings
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Pricings class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [SecurityManagementClient] reference to the SecurityManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Security pricing configurations in the subscription
26
+ #
27
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
28
+ # will be added to the HTTP request.
29
+ #
30
+ # @return [Array<Pricing>] operation results.
31
+ #
32
+ def list(custom_headers:nil)
33
+ first_page = list_as_lazy(custom_headers:custom_headers)
34
+ first_page.get_all_items
35
+ end
36
+
37
+ #
38
+ # Security pricing configurations in the subscription
39
+ #
40
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
41
+ # will be added to the HTTP request.
42
+ #
43
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
44
+ #
45
+ def list_with_http_info(custom_headers:nil)
46
+ list_async(custom_headers:custom_headers).value!
47
+ end
48
+
49
+ #
50
+ # Security pricing configurations in the subscription
51
+ #
52
+ # @param [Hash{String => String}] A hash of custom headers that will be added
53
+ # to the HTTP request.
54
+ #
55
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
56
+ #
57
+ def list_async(custom_headers:nil)
58
+ @client.api_version = '2017-08-01-preview'
59
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
60
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if !@client.subscription_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
61
+
62
+
63
+ request_headers = {}
64
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
65
+
66
+ # Set Headers
67
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
68
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
69
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings'
70
+
71
+ request_url = @base_url || @client.base_url
72
+
73
+ options = {
74
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
75
+ path_params: {'subscriptionId' => @client.subscription_id},
76
+ query_params: {'api-version' => @client.api_version},
77
+ headers: request_headers.merge(custom_headers || {}),
78
+ base_url: request_url
79
+ }
80
+ promise = @client.make_request_async(:get, path_template, options)
81
+
82
+ promise = promise.then do |result|
83
+ http_response = result.response
84
+ status_code = http_response.status
85
+ response_content = http_response.body
86
+ unless status_code == 200
87
+ error_model = JSON.load(response_content)
88
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
89
+ end
90
+
91
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
92
+ # Deserialize Response
93
+ if status_code == 200
94
+ begin
95
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
96
+ result_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::PricingList.mapper()
97
+ result.body = @client.deserialize(result_mapper, parsed_response)
98
+ rescue Exception => e
99
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
100
+ end
101
+ end
102
+
103
+ result
104
+ end
105
+
106
+ promise.execute
107
+ end
108
+
109
+ #
110
+ # Security pricing configurations in the resource group
111
+ #
112
+ # @param resource_group_name [String] The name of the resource group within the
113
+ # user's subscription. The name is case insensitive.
114
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
115
+ # will be added to the HTTP request.
116
+ #
117
+ # @return [Array<Pricing>] operation results.
118
+ #
119
+ def list_by_resource_group(resource_group_name, custom_headers:nil)
120
+ first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers:custom_headers)
121
+ first_page.get_all_items
122
+ end
123
+
124
+ #
125
+ # Security pricing configurations in the resource group
126
+ #
127
+ # @param resource_group_name [String] The name of the resource group within the
128
+ # user's subscription. The name is case insensitive.
129
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
130
+ # will be added to the HTTP request.
131
+ #
132
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
133
+ #
134
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
135
+ list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
136
+ end
137
+
138
+ #
139
+ # Security pricing configurations in the resource group
140
+ #
141
+ # @param resource_group_name [String] The name of the resource group within the
142
+ # user's subscription. The name is case insensitive.
143
+ # @param [Hash{String => String}] A hash of custom headers that will be added
144
+ # to the HTTP request.
145
+ #
146
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
147
+ #
148
+ def list_by_resource_group_async(resource_group_name, custom_headers:nil)
149
+ @client.api_version = '2017-08-01-preview'
150
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
151
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if !@client.subscription_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
152
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
153
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
154
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
155
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
156
+
157
+
158
+ request_headers = {}
159
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
160
+
161
+ # Set Headers
162
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
163
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
164
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/pricings'
165
+
166
+ request_url = @base_url || @client.base_url
167
+
168
+ options = {
169
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
170
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
171
+ query_params: {'api-version' => @client.api_version},
172
+ headers: request_headers.merge(custom_headers || {}),
173
+ base_url: request_url
174
+ }
175
+ promise = @client.make_request_async(:get, path_template, options)
176
+
177
+ promise = promise.then do |result|
178
+ http_response = result.response
179
+ status_code = http_response.status
180
+ response_content = http_response.body
181
+ unless status_code == 200
182
+ error_model = JSON.load(response_content)
183
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
184
+ end
185
+
186
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
187
+ # Deserialize Response
188
+ if status_code == 200
189
+ begin
190
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
191
+ result_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::PricingList.mapper()
192
+ result.body = @client.deserialize(result_mapper, parsed_response)
193
+ rescue Exception => e
194
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
195
+ end
196
+ end
197
+
198
+ result
199
+ end
200
+
201
+ promise.execute
202
+ end
203
+
204
+ #
205
+ # Security pricing configuration in the subscriptionSecurity pricing
206
+ # configuration in the subscription
207
+ #
208
+ # @param pricing_name [String] name of the pricing configuration
209
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
210
+ # will be added to the HTTP request.
211
+ #
212
+ # @return [Pricing] operation results.
213
+ #
214
+ def get_subscription_pricing(pricing_name, custom_headers:nil)
215
+ response = get_subscription_pricing_async(pricing_name, custom_headers:custom_headers).value!
216
+ response.body unless response.nil?
217
+ end
218
+
219
+ #
220
+ # Security pricing configuration in the subscriptionSecurity pricing
221
+ # configuration in the subscription
222
+ #
223
+ # @param pricing_name [String] name of the pricing configuration
224
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
225
+ # will be added to the HTTP request.
226
+ #
227
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
228
+ #
229
+ def get_subscription_pricing_with_http_info(pricing_name, custom_headers:nil)
230
+ get_subscription_pricing_async(pricing_name, custom_headers:custom_headers).value!
231
+ end
232
+
233
+ #
234
+ # Security pricing configuration in the subscriptionSecurity pricing
235
+ # configuration in the subscription
236
+ #
237
+ # @param pricing_name [String] name of the pricing configuration
238
+ # @param [Hash{String => String}] A hash of custom headers that will be added
239
+ # to the HTTP request.
240
+ #
241
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
242
+ #
243
+ def get_subscription_pricing_async(pricing_name, custom_headers:nil)
244
+ @client.api_version = '2017-08-01-preview'
245
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
246
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if !@client.subscription_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
247
+ fail ArgumentError, 'pricing_name is nil' if pricing_name.nil?
248
+
249
+
250
+ request_headers = {}
251
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
252
+
253
+ # Set Headers
254
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
255
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
256
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}'
257
+
258
+ request_url = @base_url || @client.base_url
259
+
260
+ options = {
261
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
262
+ path_params: {'subscriptionId' => @client.subscription_id,'pricingName' => pricing_name},
263
+ query_params: {'api-version' => @client.api_version},
264
+ headers: request_headers.merge(custom_headers || {}),
265
+ base_url: request_url
266
+ }
267
+ promise = @client.make_request_async(:get, path_template, options)
268
+
269
+ promise = promise.then do |result|
270
+ http_response = result.response
271
+ status_code = http_response.status
272
+ response_content = http_response.body
273
+ unless status_code == 200
274
+ error_model = JSON.load(response_content)
275
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
276
+ end
277
+
278
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
279
+ # Deserialize Response
280
+ if status_code == 200
281
+ begin
282
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
283
+ result_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::Pricing.mapper()
284
+ result.body = @client.deserialize(result_mapper, parsed_response)
285
+ rescue Exception => e
286
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
287
+ end
288
+ end
289
+
290
+ result
291
+ end
292
+
293
+ promise.execute
294
+ end
295
+
296
+ #
297
+ # Security pricing configuration in the subscription
298
+ #
299
+ # @param pricing_name [String] name of the pricing configuration
300
+ # @param pricing [Pricing] Pricing object
301
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
302
+ # will be added to the HTTP request.
303
+ #
304
+ # @return [Pricing] operation results.
305
+ #
306
+ def update_subscription_pricing(pricing_name, pricing, custom_headers:nil)
307
+ response = update_subscription_pricing_async(pricing_name, pricing, custom_headers:custom_headers).value!
308
+ response.body unless response.nil?
309
+ end
310
+
311
+ #
312
+ # Security pricing configuration in the subscription
313
+ #
314
+ # @param pricing_name [String] name of the pricing configuration
315
+ # @param pricing [Pricing] Pricing object
316
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
317
+ # will be added to the HTTP request.
318
+ #
319
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
320
+ #
321
+ def update_subscription_pricing_with_http_info(pricing_name, pricing, custom_headers:nil)
322
+ update_subscription_pricing_async(pricing_name, pricing, custom_headers:custom_headers).value!
323
+ end
324
+
325
+ #
326
+ # Security pricing configuration in the subscription
327
+ #
328
+ # @param pricing_name [String] name of the pricing configuration
329
+ # @param pricing [Pricing] Pricing object
330
+ # @param [Hash{String => String}] A hash of custom headers that will be added
331
+ # to the HTTP request.
332
+ #
333
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
334
+ #
335
+ def update_subscription_pricing_async(pricing_name, pricing, custom_headers:nil)
336
+ @client.api_version = '2017-08-01-preview'
337
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
338
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if !@client.subscription_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
339
+ fail ArgumentError, 'pricing_name is nil' if pricing_name.nil?
340
+ fail ArgumentError, 'pricing is nil' if pricing.nil?
341
+
342
+
343
+ request_headers = {}
344
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
345
+
346
+ # Set Headers
347
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
348
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
349
+
350
+ # Serialize Request
351
+ request_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::Pricing.mapper()
352
+ request_content = @client.serialize(request_mapper, pricing)
353
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
354
+
355
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}'
356
+
357
+ request_url = @base_url || @client.base_url
358
+
359
+ options = {
360
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
361
+ path_params: {'subscriptionId' => @client.subscription_id,'pricingName' => pricing_name},
362
+ query_params: {'api-version' => @client.api_version},
363
+ body: request_content,
364
+ headers: request_headers.merge(custom_headers || {}),
365
+ base_url: request_url
366
+ }
367
+ promise = @client.make_request_async(:put, path_template, options)
368
+
369
+ promise = promise.then do |result|
370
+ http_response = result.response
371
+ status_code = http_response.status
372
+ response_content = http_response.body
373
+ unless status_code == 200
374
+ error_model = JSON.load(response_content)
375
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
376
+ end
377
+
378
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
379
+ # Deserialize Response
380
+ if status_code == 200
381
+ begin
382
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
383
+ result_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::Pricing.mapper()
384
+ result.body = @client.deserialize(result_mapper, parsed_response)
385
+ rescue Exception => e
386
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
387
+ end
388
+ end
389
+
390
+ result
391
+ end
392
+
393
+ promise.execute
394
+ end
395
+
396
+ #
397
+ # Security pricing configuration in the resource group
398
+ #
399
+ # @param resource_group_name [String] The name of the resource group within the
400
+ # user's subscription. The name is case insensitive.
401
+ # @param pricing_name [String] name of the pricing configuration
402
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
403
+ # will be added to the HTTP request.
404
+ #
405
+ # @return [Pricing] operation results.
406
+ #
407
+ def get_resource_group_pricing(resource_group_name, pricing_name, custom_headers:nil)
408
+ response = get_resource_group_pricing_async(resource_group_name, pricing_name, custom_headers:custom_headers).value!
409
+ response.body unless response.nil?
410
+ end
411
+
412
+ #
413
+ # Security pricing configuration in the resource group
414
+ #
415
+ # @param resource_group_name [String] The name of the resource group within the
416
+ # user's subscription. The name is case insensitive.
417
+ # @param pricing_name [String] name of the pricing configuration
418
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
419
+ # will be added to the HTTP request.
420
+ #
421
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
422
+ #
423
+ def get_resource_group_pricing_with_http_info(resource_group_name, pricing_name, custom_headers:nil)
424
+ get_resource_group_pricing_async(resource_group_name, pricing_name, custom_headers:custom_headers).value!
425
+ end
426
+
427
+ #
428
+ # Security pricing configuration in the resource group
429
+ #
430
+ # @param resource_group_name [String] The name of the resource group within the
431
+ # user's subscription. The name is case insensitive.
432
+ # @param pricing_name [String] name of the pricing configuration
433
+ # @param [Hash{String => String}] A hash of custom headers that will be added
434
+ # to the HTTP request.
435
+ #
436
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
437
+ #
438
+ def get_resource_group_pricing_async(resource_group_name, pricing_name, custom_headers:nil)
439
+ @client.api_version = '2017-08-01-preview'
440
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
441
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if !@client.subscription_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
442
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
443
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
444
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
445
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
446
+ fail ArgumentError, 'pricing_name is nil' if pricing_name.nil?
447
+
448
+
449
+ request_headers = {}
450
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
451
+
452
+ # Set Headers
453
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
454
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
455
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/pricings/{pricingName}'
456
+
457
+ request_url = @base_url || @client.base_url
458
+
459
+ options = {
460
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
461
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'pricingName' => pricing_name},
462
+ query_params: {'api-version' => @client.api_version},
463
+ headers: request_headers.merge(custom_headers || {}),
464
+ base_url: request_url
465
+ }
466
+ promise = @client.make_request_async(:get, path_template, options)
467
+
468
+ promise = promise.then do |result|
469
+ http_response = result.response
470
+ status_code = http_response.status
471
+ response_content = http_response.body
472
+ unless status_code == 200
473
+ error_model = JSON.load(response_content)
474
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
475
+ end
476
+
477
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
478
+ # Deserialize Response
479
+ if status_code == 200
480
+ begin
481
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
482
+ result_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::Pricing.mapper()
483
+ result.body = @client.deserialize(result_mapper, parsed_response)
484
+ rescue Exception => e
485
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
486
+ end
487
+ end
488
+
489
+ result
490
+ end
491
+
492
+ promise.execute
493
+ end
494
+
495
+ #
496
+ # Security pricing configuration in the resource group
497
+ #
498
+ # @param resource_group_name [String] The name of the resource group within the
499
+ # user's subscription. The name is case insensitive.
500
+ # @param pricing_name [String] name of the pricing configuration
501
+ # @param pricing [Pricing] Pricing object
502
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
503
+ # will be added to the HTTP request.
504
+ #
505
+ # @return [Pricing] operation results.
506
+ #
507
+ def create_or_update_resource_group_pricing(resource_group_name, pricing_name, pricing, custom_headers:nil)
508
+ response = create_or_update_resource_group_pricing_async(resource_group_name, pricing_name, pricing, custom_headers:custom_headers).value!
509
+ response.body unless response.nil?
510
+ end
511
+
512
+ #
513
+ # Security pricing configuration in the resource group
514
+ #
515
+ # @param resource_group_name [String] The name of the resource group within the
516
+ # user's subscription. The name is case insensitive.
517
+ # @param pricing_name [String] name of the pricing configuration
518
+ # @param pricing [Pricing] Pricing object
519
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
520
+ # will be added to the HTTP request.
521
+ #
522
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
523
+ #
524
+ def create_or_update_resource_group_pricing_with_http_info(resource_group_name, pricing_name, pricing, custom_headers:nil)
525
+ create_or_update_resource_group_pricing_async(resource_group_name, pricing_name, pricing, custom_headers:custom_headers).value!
526
+ end
527
+
528
+ #
529
+ # Security pricing configuration in the resource group
530
+ #
531
+ # @param resource_group_name [String] The name of the resource group within the
532
+ # user's subscription. The name is case insensitive.
533
+ # @param pricing_name [String] name of the pricing configuration
534
+ # @param pricing [Pricing] Pricing object
535
+ # @param [Hash{String => String}] A hash of custom headers that will be added
536
+ # to the HTTP request.
537
+ #
538
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
539
+ #
540
+ def create_or_update_resource_group_pricing_async(resource_group_name, pricing_name, pricing, custom_headers:nil)
541
+ @client.api_version = '2017-08-01-preview'
542
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
543
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if !@client.subscription_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
544
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
545
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
546
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
547
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
548
+ fail ArgumentError, 'pricing_name is nil' if pricing_name.nil?
549
+ fail ArgumentError, 'pricing is nil' if pricing.nil?
550
+
551
+
552
+ request_headers = {}
553
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
554
+
555
+ # Set Headers
556
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
557
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
558
+
559
+ # Serialize Request
560
+ request_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::Pricing.mapper()
561
+ request_content = @client.serialize(request_mapper, pricing)
562
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
563
+
564
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/pricings/{pricingName}'
565
+
566
+ request_url = @base_url || @client.base_url
567
+
568
+ options = {
569
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
570
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'pricingName' => pricing_name},
571
+ query_params: {'api-version' => @client.api_version},
572
+ body: request_content,
573
+ headers: request_headers.merge(custom_headers || {}),
574
+ base_url: request_url
575
+ }
576
+ promise = @client.make_request_async(:put, path_template, options)
577
+
578
+ promise = promise.then do |result|
579
+ http_response = result.response
580
+ status_code = http_response.status
581
+ response_content = http_response.body
582
+ unless status_code == 200
583
+ error_model = JSON.load(response_content)
584
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
585
+ end
586
+
587
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
588
+ # Deserialize Response
589
+ if status_code == 200
590
+ begin
591
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
592
+ result_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::Pricing.mapper()
593
+ result.body = @client.deserialize(result_mapper, parsed_response)
594
+ rescue Exception => e
595
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
596
+ end
597
+ end
598
+
599
+ result
600
+ end
601
+
602
+ promise.execute
603
+ end
604
+
605
+ #
606
+ # Security pricing configurations in the subscription
607
+ #
608
+ # @param next_page_link [String] The NextLink from the previous successful call
609
+ # to List operation.
610
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
611
+ # will be added to the HTTP request.
612
+ #
613
+ # @return [PricingList] operation results.
614
+ #
615
+ def list_next(next_page_link, custom_headers:nil)
616
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
617
+ response.body unless response.nil?
618
+ end
619
+
620
+ #
621
+ # Security pricing configurations in the subscription
622
+ #
623
+ # @param next_page_link [String] The NextLink from the previous successful call
624
+ # to List operation.
625
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
626
+ # will be added to the HTTP request.
627
+ #
628
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
629
+ #
630
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
631
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
632
+ end
633
+
634
+ #
635
+ # Security pricing configurations in the subscription
636
+ #
637
+ # @param next_page_link [String] The NextLink from the previous successful call
638
+ # to List operation.
639
+ # @param [Hash{String => String}] A hash of custom headers that will be added
640
+ # to the HTTP request.
641
+ #
642
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
643
+ #
644
+ def list_next_async(next_page_link, custom_headers:nil)
645
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
646
+
647
+
648
+ request_headers = {}
649
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
650
+
651
+ # Set Headers
652
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
653
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
654
+ path_template = '{nextLink}'
655
+
656
+ request_url = @base_url || @client.base_url
657
+
658
+ options = {
659
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
660
+ skip_encoding_path_params: {'nextLink' => next_page_link},
661
+ headers: request_headers.merge(custom_headers || {}),
662
+ base_url: request_url
663
+ }
664
+ promise = @client.make_request_async(:get, path_template, options)
665
+
666
+ promise = promise.then do |result|
667
+ http_response = result.response
668
+ status_code = http_response.status
669
+ response_content = http_response.body
670
+ unless status_code == 200
671
+ error_model = JSON.load(response_content)
672
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
673
+ end
674
+
675
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
676
+ # Deserialize Response
677
+ if status_code == 200
678
+ begin
679
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
680
+ result_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::PricingList.mapper()
681
+ result.body = @client.deserialize(result_mapper, parsed_response)
682
+ rescue Exception => e
683
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
684
+ end
685
+ end
686
+
687
+ result
688
+ end
689
+
690
+ promise.execute
691
+ end
692
+
693
+ #
694
+ # Security pricing configurations in the resource group
695
+ #
696
+ # @param next_page_link [String] The NextLink from the previous successful call
697
+ # to List operation.
698
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
699
+ # will be added to the HTTP request.
700
+ #
701
+ # @return [PricingList] operation results.
702
+ #
703
+ def list_by_resource_group_next(next_page_link, custom_headers:nil)
704
+ response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
705
+ response.body unless response.nil?
706
+ end
707
+
708
+ #
709
+ # Security pricing configurations in the resource group
710
+ #
711
+ # @param next_page_link [String] The NextLink from the previous successful call
712
+ # to List operation.
713
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
714
+ # will be added to the HTTP request.
715
+ #
716
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
717
+ #
718
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
719
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
720
+ end
721
+
722
+ #
723
+ # Security pricing configurations in the resource group
724
+ #
725
+ # @param next_page_link [String] The NextLink from the previous successful call
726
+ # to List operation.
727
+ # @param [Hash{String => String}] A hash of custom headers that will be added
728
+ # to the HTTP request.
729
+ #
730
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
731
+ #
732
+ def list_by_resource_group_next_async(next_page_link, custom_headers:nil)
733
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
734
+
735
+
736
+ request_headers = {}
737
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
738
+
739
+ # Set Headers
740
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
741
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
742
+ path_template = '{nextLink}'
743
+
744
+ request_url = @base_url || @client.base_url
745
+
746
+ options = {
747
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
748
+ skip_encoding_path_params: {'nextLink' => next_page_link},
749
+ headers: request_headers.merge(custom_headers || {}),
750
+ base_url: request_url
751
+ }
752
+ promise = @client.make_request_async(:get, path_template, options)
753
+
754
+ promise = promise.then do |result|
755
+ http_response = result.response
756
+ status_code = http_response.status
757
+ response_content = http_response.body
758
+ unless status_code == 200
759
+ error_model = JSON.load(response_content)
760
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
761
+ end
762
+
763
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
764
+ # Deserialize Response
765
+ if status_code == 200
766
+ begin
767
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
768
+ result_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::PricingList.mapper()
769
+ result.body = @client.deserialize(result_mapper, parsed_response)
770
+ rescue Exception => e
771
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
772
+ end
773
+ end
774
+
775
+ result
776
+ end
777
+
778
+ promise.execute
779
+ end
780
+
781
+ #
782
+ # Security pricing configurations in the subscription
783
+ #
784
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
785
+ # will be added to the HTTP request.
786
+ #
787
+ # @return [PricingList] which provide lazy access to pages of the response.
788
+ #
789
+ def list_as_lazy(custom_headers:nil)
790
+ response = list_async(custom_headers:custom_headers).value!
791
+ unless response.nil?
792
+ page = response.body
793
+ page.next_method = Proc.new do |next_page_link|
794
+ list_next_async(next_page_link, custom_headers:custom_headers)
795
+ end
796
+ page
797
+ end
798
+ end
799
+
800
+ #
801
+ # Security pricing configurations in the resource group
802
+ #
803
+ # @param resource_group_name [String] The name of the resource group within the
804
+ # user's subscription. The name is case insensitive.
805
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
806
+ # will be added to the HTTP request.
807
+ #
808
+ # @return [PricingList] which provide lazy access to pages of the response.
809
+ #
810
+ def list_by_resource_group_as_lazy(resource_group_name, custom_headers:nil)
811
+ response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
812
+ unless response.nil?
813
+ page = response.body
814
+ page.next_method = Proc.new do |next_page_link|
815
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
816
+ end
817
+ page
818
+ end
819
+ end
820
+
821
+ end
822
+ end