azure_mgmt_security 0.16.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.
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,585 @@
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 SecurityContacts
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the SecurityContacts 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 contact configurations for 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<SecurityContact>] 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 contact configurations for 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 contact configurations for 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/securityContacts'
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::SecurityContactList.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 contact configurations for the subscription
111
+ #
112
+ # @param security_contact_name [String] Name of the security contact object
113
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
114
+ # will be added to the HTTP request.
115
+ #
116
+ # @return [SecurityContact] operation results.
117
+ #
118
+ def get(security_contact_name, custom_headers:nil)
119
+ response = get_async(security_contact_name, custom_headers:custom_headers).value!
120
+ response.body unless response.nil?
121
+ end
122
+
123
+ #
124
+ # Security contact configurations for the subscription
125
+ #
126
+ # @param security_contact_name [String] Name of the security contact object
127
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
128
+ # will be added to the HTTP request.
129
+ #
130
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
131
+ #
132
+ def get_with_http_info(security_contact_name, custom_headers:nil)
133
+ get_async(security_contact_name, custom_headers:custom_headers).value!
134
+ end
135
+
136
+ #
137
+ # Security contact configurations for the subscription
138
+ #
139
+ # @param security_contact_name [String] Name of the security contact object
140
+ # @param [Hash{String => String}] A hash of custom headers that will be added
141
+ # to the HTTP request.
142
+ #
143
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
144
+ #
145
+ def get_async(security_contact_name, custom_headers:nil)
146
+ @client.api_version = '2017-08-01-preview'
147
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
148
+ 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?
149
+ fail ArgumentError, 'security_contact_name is nil' if security_contact_name.nil?
150
+
151
+
152
+ request_headers = {}
153
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
154
+
155
+ # Set Headers
156
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
157
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
158
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}'
159
+
160
+ request_url = @base_url || @client.base_url
161
+
162
+ options = {
163
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
164
+ path_params: {'subscriptionId' => @client.subscription_id,'securityContactName' => security_contact_name},
165
+ query_params: {'api-version' => @client.api_version},
166
+ headers: request_headers.merge(custom_headers || {}),
167
+ base_url: request_url
168
+ }
169
+ promise = @client.make_request_async(:get, path_template, options)
170
+
171
+ promise = promise.then do |result|
172
+ http_response = result.response
173
+ status_code = http_response.status
174
+ response_content = http_response.body
175
+ unless status_code == 200
176
+ error_model = JSON.load(response_content)
177
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
178
+ end
179
+
180
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
181
+ # Deserialize Response
182
+ if status_code == 200
183
+ begin
184
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
185
+ result_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::SecurityContact.mapper()
186
+ result.body = @client.deserialize(result_mapper, parsed_response)
187
+ rescue Exception => e
188
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
189
+ end
190
+ end
191
+
192
+ result
193
+ end
194
+
195
+ promise.execute
196
+ end
197
+
198
+ #
199
+ # Security contact configurations for the subscription
200
+ #
201
+ # @param security_contact_name [String] Name of the security contact object
202
+ # @param security_contact [SecurityContact] Security contact object
203
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
204
+ # will be added to the HTTP request.
205
+ #
206
+ # @return [SecurityContact] operation results.
207
+ #
208
+ def crete(security_contact_name, security_contact, custom_headers:nil)
209
+ response = crete_async(security_contact_name, security_contact, custom_headers:custom_headers).value!
210
+ response.body unless response.nil?
211
+ end
212
+
213
+ #
214
+ # Security contact configurations for the subscription
215
+ #
216
+ # @param security_contact_name [String] Name of the security contact object
217
+ # @param security_contact [SecurityContact] Security contact object
218
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
219
+ # will be added to the HTTP request.
220
+ #
221
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
222
+ #
223
+ def crete_with_http_info(security_contact_name, security_contact, custom_headers:nil)
224
+ crete_async(security_contact_name, security_contact, custom_headers:custom_headers).value!
225
+ end
226
+
227
+ #
228
+ # Security contact configurations for the subscription
229
+ #
230
+ # @param security_contact_name [String] Name of the security contact object
231
+ # @param security_contact [SecurityContact] Security contact object
232
+ # @param [Hash{String => String}] A hash of custom headers that will be added
233
+ # to the HTTP request.
234
+ #
235
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
236
+ #
237
+ def crete_async(security_contact_name, security_contact, custom_headers:nil)
238
+ @client.api_version = '2017-08-01-preview'
239
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
240
+ 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?
241
+ fail ArgumentError, 'security_contact_name is nil' if security_contact_name.nil?
242
+ fail ArgumentError, 'security_contact is nil' if security_contact.nil?
243
+
244
+
245
+ request_headers = {}
246
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
247
+
248
+ # Set Headers
249
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
250
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
251
+
252
+ # Serialize Request
253
+ request_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::SecurityContact.mapper()
254
+ request_content = @client.serialize(request_mapper, security_contact)
255
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
256
+
257
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}'
258
+
259
+ request_url = @base_url || @client.base_url
260
+
261
+ options = {
262
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
263
+ path_params: {'subscriptionId' => @client.subscription_id,'securityContactName' => security_contact_name},
264
+ query_params: {'api-version' => @client.api_version},
265
+ body: request_content,
266
+ headers: request_headers.merge(custom_headers || {}),
267
+ base_url: request_url
268
+ }
269
+ promise = @client.make_request_async(:put, path_template, options)
270
+
271
+ promise = promise.then do |result|
272
+ http_response = result.response
273
+ status_code = http_response.status
274
+ response_content = http_response.body
275
+ unless status_code == 200
276
+ error_model = JSON.load(response_content)
277
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
278
+ end
279
+
280
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
281
+ # Deserialize Response
282
+ if status_code == 200
283
+ begin
284
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
285
+ result_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::SecurityContact.mapper()
286
+ result.body = @client.deserialize(result_mapper, parsed_response)
287
+ rescue Exception => e
288
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
289
+ end
290
+ end
291
+
292
+ result
293
+ end
294
+
295
+ promise.execute
296
+ end
297
+
298
+ #
299
+ # Security contact configurations for the subscription
300
+ #
301
+ # @param security_contact_name [String] Name of the security contact object
302
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
303
+ # will be added to the HTTP request.
304
+ #
305
+ #
306
+ def delete(security_contact_name, custom_headers:nil)
307
+ response = delete_async(security_contact_name, custom_headers:custom_headers).value!
308
+ nil
309
+ end
310
+
311
+ #
312
+ # Security contact configurations for the subscription
313
+ #
314
+ # @param security_contact_name [String] Name of the security contact object
315
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
316
+ # will be added to the HTTP request.
317
+ #
318
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
319
+ #
320
+ def delete_with_http_info(security_contact_name, custom_headers:nil)
321
+ delete_async(security_contact_name, custom_headers:custom_headers).value!
322
+ end
323
+
324
+ #
325
+ # Security contact configurations for the subscription
326
+ #
327
+ # @param security_contact_name [String] Name of the security contact object
328
+ # @param [Hash{String => String}] A hash of custom headers that will be added
329
+ # to the HTTP request.
330
+ #
331
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
332
+ #
333
+ def delete_async(security_contact_name, custom_headers:nil)
334
+ @client.api_version = '2017-08-01-preview'
335
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
336
+ 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?
337
+ fail ArgumentError, 'security_contact_name is nil' if security_contact_name.nil?
338
+
339
+
340
+ request_headers = {}
341
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
342
+
343
+ # Set Headers
344
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
345
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
346
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}'
347
+
348
+ request_url = @base_url || @client.base_url
349
+
350
+ options = {
351
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
352
+ path_params: {'subscriptionId' => @client.subscription_id,'securityContactName' => security_contact_name},
353
+ query_params: {'api-version' => @client.api_version},
354
+ headers: request_headers.merge(custom_headers || {}),
355
+ base_url: request_url
356
+ }
357
+ promise = @client.make_request_async(:delete, path_template, options)
358
+
359
+ promise = promise.then do |result|
360
+ http_response = result.response
361
+ status_code = http_response.status
362
+ response_content = http_response.body
363
+ unless status_code == 200
364
+ error_model = JSON.load(response_content)
365
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
366
+ end
367
+
368
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
369
+
370
+ result
371
+ end
372
+
373
+ promise.execute
374
+ end
375
+
376
+ #
377
+ # Security contact configurations for the subscription
378
+ #
379
+ # @param security_contact_name [String] Name of the security contact object
380
+ # @param security_contact [SecurityContact] Security contact object
381
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
382
+ # will be added to the HTTP request.
383
+ #
384
+ # @return [SecurityContact] operation results.
385
+ #
386
+ def update(security_contact_name, security_contact, custom_headers:nil)
387
+ response = update_async(security_contact_name, security_contact, custom_headers:custom_headers).value!
388
+ response.body unless response.nil?
389
+ end
390
+
391
+ #
392
+ # Security contact configurations for the subscription
393
+ #
394
+ # @param security_contact_name [String] Name of the security contact object
395
+ # @param security_contact [SecurityContact] Security contact object
396
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
397
+ # will be added to the HTTP request.
398
+ #
399
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
400
+ #
401
+ def update_with_http_info(security_contact_name, security_contact, custom_headers:nil)
402
+ update_async(security_contact_name, security_contact, custom_headers:custom_headers).value!
403
+ end
404
+
405
+ #
406
+ # Security contact configurations for the subscription
407
+ #
408
+ # @param security_contact_name [String] Name of the security contact object
409
+ # @param security_contact [SecurityContact] Security contact object
410
+ # @param [Hash{String => String}] A hash of custom headers that will be added
411
+ # to the HTTP request.
412
+ #
413
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
414
+ #
415
+ def update_async(security_contact_name, security_contact, custom_headers:nil)
416
+ @client.api_version = '2017-08-01-preview'
417
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
418
+ 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?
419
+ fail ArgumentError, 'security_contact_name is nil' if security_contact_name.nil?
420
+ fail ArgumentError, 'security_contact is nil' if security_contact.nil?
421
+
422
+
423
+ request_headers = {}
424
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
425
+
426
+ # Set Headers
427
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
428
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
429
+
430
+ # Serialize Request
431
+ request_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::SecurityContact.mapper()
432
+ request_content = @client.serialize(request_mapper, security_contact)
433
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
434
+
435
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}'
436
+
437
+ request_url = @base_url || @client.base_url
438
+
439
+ options = {
440
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
441
+ path_params: {'subscriptionId' => @client.subscription_id,'securityContactName' => security_contact_name},
442
+ query_params: {'api-version' => @client.api_version},
443
+ body: request_content,
444
+ headers: request_headers.merge(custom_headers || {}),
445
+ base_url: request_url
446
+ }
447
+ promise = @client.make_request_async(:patch, path_template, options)
448
+
449
+ promise = promise.then do |result|
450
+ http_response = result.response
451
+ status_code = http_response.status
452
+ response_content = http_response.body
453
+ unless status_code == 200
454
+ error_model = JSON.load(response_content)
455
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
456
+ end
457
+
458
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
459
+ # Deserialize Response
460
+ if status_code == 200
461
+ begin
462
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
463
+ result_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::SecurityContact.mapper()
464
+ result.body = @client.deserialize(result_mapper, parsed_response)
465
+ rescue Exception => e
466
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
467
+ end
468
+ end
469
+
470
+ result
471
+ end
472
+
473
+ promise.execute
474
+ end
475
+
476
+ #
477
+ # Security contact configurations for the subscription
478
+ #
479
+ # @param next_page_link [String] The NextLink from the previous successful call
480
+ # to List operation.
481
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
482
+ # will be added to the HTTP request.
483
+ #
484
+ # @return [SecurityContactList] operation results.
485
+ #
486
+ def list_next(next_page_link, custom_headers:nil)
487
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
488
+ response.body unless response.nil?
489
+ end
490
+
491
+ #
492
+ # Security contact configurations for the subscription
493
+ #
494
+ # @param next_page_link [String] The NextLink from the previous successful call
495
+ # to List operation.
496
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
497
+ # will be added to the HTTP request.
498
+ #
499
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
500
+ #
501
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
502
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
503
+ end
504
+
505
+ #
506
+ # Security contact configurations for the subscription
507
+ #
508
+ # @param next_page_link [String] The NextLink from the previous successful call
509
+ # to List operation.
510
+ # @param [Hash{String => String}] A hash of custom headers that will be added
511
+ # to the HTTP request.
512
+ #
513
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
514
+ #
515
+ def list_next_async(next_page_link, custom_headers:nil)
516
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
517
+
518
+
519
+ request_headers = {}
520
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
521
+
522
+ # Set Headers
523
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
524
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
525
+ path_template = '{nextLink}'
526
+
527
+ request_url = @base_url || @client.base_url
528
+
529
+ options = {
530
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
531
+ skip_encoding_path_params: {'nextLink' => next_page_link},
532
+ headers: request_headers.merge(custom_headers || {}),
533
+ base_url: request_url
534
+ }
535
+ promise = @client.make_request_async(:get, path_template, options)
536
+
537
+ promise = promise.then do |result|
538
+ http_response = result.response
539
+ status_code = http_response.status
540
+ response_content = http_response.body
541
+ unless status_code == 200
542
+ error_model = JSON.load(response_content)
543
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
544
+ end
545
+
546
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
547
+ # Deserialize Response
548
+ if status_code == 200
549
+ begin
550
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
551
+ result_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::SecurityContactList.mapper()
552
+ result.body = @client.deserialize(result_mapper, parsed_response)
553
+ rescue Exception => e
554
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
555
+ end
556
+ end
557
+
558
+ result
559
+ end
560
+
561
+ promise.execute
562
+ end
563
+
564
+ #
565
+ # Security contact configurations for the subscription
566
+ #
567
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
568
+ # will be added to the HTTP request.
569
+ #
570
+ # @return [SecurityContactList] which provide lazy access to pages of the
571
+ # response.
572
+ #
573
+ def list_as_lazy(custom_headers:nil)
574
+ response = list_async(custom_headers:custom_headers).value!
575
+ unless response.nil?
576
+ page = response.body
577
+ page.next_method = Proc.new do |next_page_link|
578
+ list_next_async(next_page_link, custom_headers:custom_headers)
579
+ end
580
+ page
581
+ end
582
+ end
583
+
584
+ end
585
+ end