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