azure_mgmt_dns 0.4.0

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