azure_mgmt_dns 0.16.0 → 0.16.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2016-04-01/generated/azure_mgmt_dns/dns_management_client.rb +1 -1
  3. data/lib/2017-09-01/generated/azure_mgmt_dns/dns_management_client.rb +1 -1
  4. data/lib/2017-10-01/generated/azure_mgmt_dns.rb +47 -0
  5. data/lib/2017-10-01/generated/azure_mgmt_dns/dns_management_client.rb +135 -0
  6. data/lib/2017-10-01/generated/azure_mgmt_dns/models/aaaa_record.rb +46 -0
  7. data/lib/2017-10-01/generated/azure_mgmt_dns/models/arecord.rb +46 -0
  8. data/lib/2017-10-01/generated/azure_mgmt_dns/models/caa_record.rb +69 -0
  9. data/lib/2017-10-01/generated/azure_mgmt_dns/models/cname_record.rb +46 -0
  10. data/lib/2017-10-01/generated/azure_mgmt_dns/models/mx_record.rb +57 -0
  11. data/lib/2017-10-01/generated/azure_mgmt_dns/models/ns_record.rb +46 -0
  12. data/lib/2017-10-01/generated/azure_mgmt_dns/models/ptr_record.rb +46 -0
  13. data/lib/2017-10-01/generated/azure_mgmt_dns/models/record_set.rb +311 -0
  14. data/lib/2017-10-01/generated/azure_mgmt_dns/models/record_set_list_result.rb +100 -0
  15. data/lib/2017-10-01/generated/azure_mgmt_dns/models/record_set_update_parameters.rb +48 -0
  16. data/lib/2017-10-01/generated/azure_mgmt_dns/models/record_type.rb +24 -0
  17. data/lib/2017-10-01/generated/azure_mgmt_dns/models/resource.rb +101 -0
  18. data/lib/2017-10-01/generated/azure_mgmt_dns/models/soa_record.rb +114 -0
  19. data/lib/2017-10-01/generated/azure_mgmt_dns/models/srv_record.rb +79 -0
  20. data/lib/2017-10-01/generated/azure_mgmt_dns/models/txt_record.rb +54 -0
  21. data/lib/2017-10-01/generated/azure_mgmt_dns/models/zone.rb +146 -0
  22. data/lib/2017-10-01/generated/azure_mgmt_dns/models/zone_list_result.rb +99 -0
  23. data/lib/2017-10-01/generated/azure_mgmt_dns/models/zone_update.rb +54 -0
  24. data/lib/2017-10-01/generated/azure_mgmt_dns/module_definition.rb +9 -0
  25. data/lib/2017-10-01/generated/azure_mgmt_dns/record_sets.rb +1250 -0
  26. data/lib/2017-10-01/generated/azure_mgmt_dns/zones.rb +922 -0
  27. data/lib/2018-03-01-preview/generated/azure_mgmt_dns.rb +49 -0
  28. data/lib/2018-03-01-preview/generated/azure_mgmt_dns/dns_management_client.rb +135 -0
  29. data/lib/2018-03-01-preview/generated/azure_mgmt_dns/models/aaaa_record.rb +46 -0
  30. data/lib/2018-03-01-preview/generated/azure_mgmt_dns/models/arecord.rb +46 -0
  31. data/lib/2018-03-01-preview/generated/azure_mgmt_dns/models/caa_record.rb +69 -0
  32. data/lib/2018-03-01-preview/generated/azure_mgmt_dns/models/cname_record.rb +46 -0
  33. data/lib/2018-03-01-preview/generated/azure_mgmt_dns/models/mx_record.rb +57 -0
  34. data/lib/2018-03-01-preview/generated/azure_mgmt_dns/models/ns_record.rb +46 -0
  35. data/lib/2018-03-01-preview/generated/azure_mgmt_dns/models/ptr_record.rb +46 -0
  36. data/lib/2018-03-01-preview/generated/azure_mgmt_dns/models/record_set.rb +311 -0
  37. data/lib/2018-03-01-preview/generated/azure_mgmt_dns/models/record_set_list_result.rb +100 -0
  38. data/lib/2018-03-01-preview/generated/azure_mgmt_dns/models/record_set_update_parameters.rb +48 -0
  39. data/lib/2018-03-01-preview/generated/azure_mgmt_dns/models/record_type.rb +24 -0
  40. data/lib/2018-03-01-preview/generated/azure_mgmt_dns/models/resource.rb +101 -0
  41. data/lib/2018-03-01-preview/generated/azure_mgmt_dns/models/soa_record.rb +114 -0
  42. data/lib/2018-03-01-preview/generated/azure_mgmt_dns/models/srv_record.rb +79 -0
  43. data/lib/2018-03-01-preview/generated/azure_mgmt_dns/models/sub_resource.rb +46 -0
  44. data/lib/2018-03-01-preview/generated/azure_mgmt_dns/models/txt_record.rb +54 -0
  45. data/lib/2018-03-01-preview/generated/azure_mgmt_dns/models/zone.rb +204 -0
  46. data/lib/2018-03-01-preview/generated/azure_mgmt_dns/models/zone_list_result.rb +99 -0
  47. data/lib/2018-03-01-preview/generated/azure_mgmt_dns/models/zone_type.rb +16 -0
  48. data/lib/2018-03-01-preview/generated/azure_mgmt_dns/models/zone_update.rb +54 -0
  49. data/lib/2018-03-01-preview/generated/azure_mgmt_dns/module_definition.rb +9 -0
  50. data/lib/2018-03-01-preview/generated/azure_mgmt_dns/record_sets.rb +1250 -0
  51. data/lib/2018-03-01-preview/generated/azure_mgmt_dns/zones.rb +922 -0
  52. data/lib/azure_mgmt_dns.rb +2 -0
  53. data/lib/profiles/latest/modules/dns_profile_module.rb +59 -47
  54. data/lib/version.rb +1 -1
  55. metadata +50 -2
@@ -0,0 +1,922 @@
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::V2018_03_01_preview
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::V2018_03_01_preview::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::V2018_03_01_preview::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::V2018_03_01_preview::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::V2018_03_01_preview::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
+ # Updates a DNS zone. Does not modify DNS records within the zone.
307
+ #
308
+ # @param resource_group_name [String] The name of the resource group.
309
+ # @param zone_name [String] The name of the DNS zone (without a terminating
310
+ # dot).
311
+ # @param parameters [ZoneUpdate] Parameters supplied to the Update operation.
312
+ # @param if_match [String] The etag of the DNS zone. Omit this value to always
313
+ # overwrite the current zone. Specify the last-seen etag value to prevent
314
+ # accidentally overwritting any concurrent changes.
315
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
316
+ # will be added to the HTTP request.
317
+ #
318
+ # @return [Zone] operation results.
319
+ #
320
+ def update(resource_group_name, zone_name, parameters, if_match:nil, custom_headers:nil)
321
+ response = update_async(resource_group_name, zone_name, parameters, if_match:if_match, custom_headers:custom_headers).value!
322
+ response.body unless response.nil?
323
+ end
324
+
325
+ #
326
+ # Updates a DNS zone. Does not modify DNS records within the zone.
327
+ #
328
+ # @param resource_group_name [String] The name of the resource group.
329
+ # @param zone_name [String] The name of the DNS zone (without a terminating
330
+ # dot).
331
+ # @param parameters [ZoneUpdate] Parameters supplied to the Update operation.
332
+ # @param if_match [String] The etag of the DNS zone. Omit this value to always
333
+ # overwrite the current zone. Specify the last-seen etag value to prevent
334
+ # accidentally overwritting any concurrent changes.
335
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
336
+ # will be added to the HTTP request.
337
+ #
338
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
339
+ #
340
+ def update_with_http_info(resource_group_name, zone_name, parameters, if_match:nil, custom_headers:nil)
341
+ update_async(resource_group_name, zone_name, parameters, if_match:if_match, custom_headers:custom_headers).value!
342
+ end
343
+
344
+ #
345
+ # Updates a DNS zone. Does not modify DNS records within the zone.
346
+ #
347
+ # @param resource_group_name [String] The name of the resource group.
348
+ # @param zone_name [String] The name of the DNS zone (without a terminating
349
+ # dot).
350
+ # @param parameters [ZoneUpdate] Parameters supplied to the Update operation.
351
+ # @param if_match [String] The etag of the DNS zone. Omit this value to always
352
+ # overwrite the current zone. Specify the last-seen etag value to prevent
353
+ # accidentally overwritting any concurrent changes.
354
+ # @param [Hash{String => String}] A hash of custom headers that will be added
355
+ # to the HTTP request.
356
+ #
357
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
358
+ #
359
+ def update_async(resource_group_name, zone_name, parameters, if_match:nil, custom_headers:nil)
360
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
361
+ fail ArgumentError, 'zone_name is nil' if zone_name.nil?
362
+ fail ArgumentError, 'parameters is nil' if parameters.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
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
369
+
370
+ # Set Headers
371
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
372
+ request_headers['If-Match'] = if_match unless if_match.nil?
373
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
374
+
375
+ # Serialize Request
376
+ request_mapper = Azure::Dns::Mgmt::V2018_03_01_preview::Models::ZoneUpdate.mapper()
377
+ request_content = @client.serialize(request_mapper, parameters)
378
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
379
+
380
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}'
381
+
382
+ request_url = @base_url || @client.base_url
383
+
384
+ options = {
385
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
386
+ path_params: {'resourceGroupName' => resource_group_name,'zoneName' => zone_name,'subscriptionId' => @client.subscription_id},
387
+ query_params: {'api-version' => @client.api_version},
388
+ body: request_content,
389
+ headers: request_headers.merge(custom_headers || {}),
390
+ base_url: request_url
391
+ }
392
+ promise = @client.make_request_async(:patch, path_template, options)
393
+
394
+ promise = promise.then do |result|
395
+ http_response = result.response
396
+ status_code = http_response.status
397
+ response_content = http_response.body
398
+ unless status_code == 200
399
+ error_model = JSON.load(response_content)
400
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
401
+ end
402
+
403
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
404
+ # Deserialize Response
405
+ if status_code == 200
406
+ begin
407
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
408
+ result_mapper = Azure::Dns::Mgmt::V2018_03_01_preview::Models::Zone.mapper()
409
+ result.body = @client.deserialize(result_mapper, parsed_response)
410
+ rescue Exception => e
411
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
412
+ end
413
+ end
414
+
415
+ result
416
+ end
417
+
418
+ promise.execute
419
+ end
420
+
421
+ #
422
+ # Lists the DNS zones within a resource group.
423
+ #
424
+ # @param resource_group_name [String] The name of the resource group.
425
+ # @param top [Integer] The maximum number of record sets to return. If not
426
+ # specified, returns up to 100 record sets.
427
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
428
+ # will be added to the HTTP request.
429
+ #
430
+ # @return [Array<Zone>] operation results.
431
+ #
432
+ def list_by_resource_group(resource_group_name, top:nil, custom_headers:nil)
433
+ first_page = list_by_resource_group_as_lazy(resource_group_name, top:top, custom_headers:custom_headers)
434
+ first_page.get_all_items
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 [Integer] The maximum number of record sets to return. If not
442
+ # specified, returns up to 100 record sets.
443
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
444
+ # will be added to the HTTP request.
445
+ #
446
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
447
+ #
448
+ def list_by_resource_group_with_http_info(resource_group_name, top:nil, custom_headers:nil)
449
+ list_by_resource_group_async(resource_group_name, top:top, custom_headers:custom_headers).value!
450
+ end
451
+
452
+ #
453
+ # Lists the DNS zones within a resource group.
454
+ #
455
+ # @param resource_group_name [String] The name of the resource group.
456
+ # @param top [Integer] The maximum number of record sets to return. If not
457
+ # specified, returns up to 100 record sets.
458
+ # @param [Hash{String => String}] A hash of custom headers that will be added
459
+ # to the HTTP request.
460
+ #
461
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
462
+ #
463
+ def list_by_resource_group_async(resource_group_name, top:nil, custom_headers:nil)
464
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
465
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
466
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
467
+
468
+
469
+ request_headers = {}
470
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
471
+
472
+ # Set Headers
473
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
474
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
475
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones'
476
+
477
+ request_url = @base_url || @client.base_url
478
+
479
+ options = {
480
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
481
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
482
+ query_params: {'$top' => top,'api-version' => @client.api_version},
483
+ headers: request_headers.merge(custom_headers || {}),
484
+ base_url: request_url
485
+ }
486
+ promise = @client.make_request_async(:get, path_template, options)
487
+
488
+ promise = promise.then do |result|
489
+ http_response = result.response
490
+ status_code = http_response.status
491
+ response_content = http_response.body
492
+ unless status_code == 200
493
+ error_model = JSON.load(response_content)
494
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
495
+ end
496
+
497
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
498
+ # Deserialize Response
499
+ if status_code == 200
500
+ begin
501
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
502
+ result_mapper = Azure::Dns::Mgmt::V2018_03_01_preview::Models::ZoneListResult.mapper()
503
+ result.body = @client.deserialize(result_mapper, parsed_response)
504
+ rescue Exception => e
505
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
506
+ end
507
+ end
508
+
509
+ result
510
+ end
511
+
512
+ promise.execute
513
+ end
514
+
515
+ #
516
+ # Lists the DNS zones in all resource groups in a subscription.
517
+ #
518
+ # @param top [Integer] The maximum number of DNS zones to return. If not
519
+ # specified, returns up to 100 zones.
520
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
521
+ # will be added to the HTTP request.
522
+ #
523
+ # @return [Array<Zone>] operation results.
524
+ #
525
+ def list(top:nil, custom_headers:nil)
526
+ first_page = list_as_lazy(top:top, custom_headers:custom_headers)
527
+ first_page.get_all_items
528
+ end
529
+
530
+ #
531
+ # Lists the DNS zones in all resource groups in a subscription.
532
+ #
533
+ # @param top [Integer] The maximum number of DNS zones to return. If not
534
+ # specified, returns up to 100 zones.
535
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
536
+ # will be added to the HTTP request.
537
+ #
538
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
539
+ #
540
+ def list_with_http_info(top:nil, custom_headers:nil)
541
+ list_async(top:top, custom_headers:custom_headers).value!
542
+ end
543
+
544
+ #
545
+ # Lists the DNS zones in all resource groups in a subscription.
546
+ #
547
+ # @param top [Integer] The maximum number of DNS zones to return. If not
548
+ # specified, returns up to 100 zones.
549
+ # @param [Hash{String => String}] A hash of custom headers that will be added
550
+ # to the HTTP request.
551
+ #
552
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
553
+ #
554
+ def list_async(top:nil, custom_headers:nil)
555
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
556
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
557
+
558
+
559
+ request_headers = {}
560
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
561
+
562
+ # Set Headers
563
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
564
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
565
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Network/dnszones'
566
+
567
+ request_url = @base_url || @client.base_url
568
+
569
+ options = {
570
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
571
+ path_params: {'subscriptionId' => @client.subscription_id},
572
+ query_params: {'$top' => top,'api-version' => @client.api_version},
573
+ headers: request_headers.merge(custom_headers || {}),
574
+ base_url: request_url
575
+ }
576
+ promise = @client.make_request_async(:get, path_template, options)
577
+
578
+ promise = promise.then do |result|
579
+ http_response = result.response
580
+ status_code = http_response.status
581
+ response_content = http_response.body
582
+ unless status_code == 200
583
+ error_model = JSON.load(response_content)
584
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
585
+ end
586
+
587
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
588
+ # Deserialize Response
589
+ if status_code == 200
590
+ begin
591
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
592
+ result_mapper = Azure::Dns::Mgmt::V2018_03_01_preview::Models::ZoneListResult.mapper()
593
+ result.body = @client.deserialize(result_mapper, parsed_response)
594
+ rescue Exception => e
595
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
596
+ end
597
+ end
598
+
599
+ result
600
+ end
601
+
602
+ promise.execute
603
+ end
604
+
605
+ #
606
+ # Deletes a DNS zone. WARNING: All DNS records in the zone will also be
607
+ # deleted. This operation cannot be undone.
608
+ #
609
+ # @param resource_group_name [String] The name of the resource group.
610
+ # @param zone_name [String] The name of the DNS zone (without a terminating
611
+ # dot).
612
+ # @param if_match [String] The etag of the DNS zone. Omit this value to always
613
+ # delete the current zone. Specify the last-seen etag value to prevent
614
+ # accidentally deleting any concurrent changes.
615
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
616
+ # will be added to the HTTP request.
617
+ #
618
+ #
619
+ def begin_delete(resource_group_name, zone_name, if_match:nil, custom_headers:nil)
620
+ response = begin_delete_async(resource_group_name, zone_name, if_match:if_match, custom_headers:custom_headers).value!
621
+ nil
622
+ end
623
+
624
+ #
625
+ # Deletes a DNS zone. WARNING: All DNS records in the zone will also be
626
+ # deleted. This operation cannot be undone.
627
+ #
628
+ # @param resource_group_name [String] The name of the resource group.
629
+ # @param zone_name [String] The name of the DNS zone (without a terminating
630
+ # dot).
631
+ # @param if_match [String] The etag of the DNS zone. Omit this value to always
632
+ # delete the current zone. Specify the last-seen etag value to prevent
633
+ # accidentally deleting any concurrent changes.
634
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
635
+ # will be added to the HTTP request.
636
+ #
637
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
638
+ #
639
+ def begin_delete_with_http_info(resource_group_name, zone_name, if_match:nil, custom_headers:nil)
640
+ begin_delete_async(resource_group_name, zone_name, if_match:if_match, custom_headers:custom_headers).value!
641
+ end
642
+
643
+ #
644
+ # Deletes a DNS zone. WARNING: All DNS records in the zone will also be
645
+ # deleted. This operation cannot be undone.
646
+ #
647
+ # @param resource_group_name [String] The name of the resource group.
648
+ # @param zone_name [String] The name of the DNS zone (without a terminating
649
+ # dot).
650
+ # @param if_match [String] The etag of the DNS zone. Omit this value to always
651
+ # delete the current zone. Specify the last-seen etag value to prevent
652
+ # accidentally deleting any concurrent changes.
653
+ # @param [Hash{String => String}] A hash of custom headers that will be added
654
+ # to the HTTP request.
655
+ #
656
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
657
+ #
658
+ def begin_delete_async(resource_group_name, zone_name, if_match:nil, custom_headers:nil)
659
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
660
+ fail ArgumentError, 'zone_name is nil' if zone_name.nil?
661
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
662
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
663
+
664
+
665
+ request_headers = {}
666
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
667
+
668
+ # Set Headers
669
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
670
+ request_headers['If-Match'] = if_match unless if_match.nil?
671
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
672
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}'
673
+
674
+ request_url = @base_url || @client.base_url
675
+
676
+ options = {
677
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
678
+ path_params: {'resourceGroupName' => resource_group_name,'zoneName' => zone_name,'subscriptionId' => @client.subscription_id},
679
+ query_params: {'api-version' => @client.api_version},
680
+ headers: request_headers.merge(custom_headers || {}),
681
+ base_url: request_url
682
+ }
683
+ promise = @client.make_request_async(:delete, path_template, options)
684
+
685
+ promise = promise.then do |result|
686
+ http_response = result.response
687
+ status_code = http_response.status
688
+ response_content = http_response.body
689
+ unless status_code == 204 || status_code == 202 || status_code == 200
690
+ error_model = JSON.load(response_content)
691
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
692
+ end
693
+
694
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
695
+
696
+ result
697
+ end
698
+
699
+ promise.execute
700
+ end
701
+
702
+ #
703
+ # Lists the DNS zones within a resource group.
704
+ #
705
+ # @param next_page_link [String] The NextLink from the previous successful call
706
+ # to List operation.
707
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
708
+ # will be added to the HTTP request.
709
+ #
710
+ # @return [ZoneListResult] operation results.
711
+ #
712
+ def list_by_resource_group_next(next_page_link, custom_headers:nil)
713
+ response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
714
+ response.body unless response.nil?
715
+ end
716
+
717
+ #
718
+ # Lists the DNS zones within a resource group.
719
+ #
720
+ # @param next_page_link [String] The NextLink from the previous successful call
721
+ # to List operation.
722
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
723
+ # will be added to the HTTP request.
724
+ #
725
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
726
+ #
727
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
728
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
729
+ end
730
+
731
+ #
732
+ # Lists the DNS zones within a resource group.
733
+ #
734
+ # @param next_page_link [String] The NextLink from the previous successful call
735
+ # to List operation.
736
+ # @param [Hash{String => String}] A hash of custom headers that will be added
737
+ # to the HTTP request.
738
+ #
739
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
740
+ #
741
+ def list_by_resource_group_next_async(next_page_link, custom_headers:nil)
742
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
743
+
744
+
745
+ request_headers = {}
746
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
747
+
748
+ # Set Headers
749
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
750
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
751
+ path_template = '{nextLink}'
752
+
753
+ request_url = @base_url || @client.base_url
754
+
755
+ options = {
756
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
757
+ skip_encoding_path_params: {'nextLink' => next_page_link},
758
+ headers: request_headers.merge(custom_headers || {}),
759
+ base_url: request_url
760
+ }
761
+ promise = @client.make_request_async(:get, path_template, options)
762
+
763
+ promise = promise.then do |result|
764
+ http_response = result.response
765
+ status_code = http_response.status
766
+ response_content = http_response.body
767
+ unless status_code == 200
768
+ error_model = JSON.load(response_content)
769
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
770
+ end
771
+
772
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
773
+ # Deserialize Response
774
+ if status_code == 200
775
+ begin
776
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
777
+ result_mapper = Azure::Dns::Mgmt::V2018_03_01_preview::Models::ZoneListResult.mapper()
778
+ result.body = @client.deserialize(result_mapper, parsed_response)
779
+ rescue Exception => e
780
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
781
+ end
782
+ end
783
+
784
+ result
785
+ end
786
+
787
+ promise.execute
788
+ end
789
+
790
+ #
791
+ # Lists the DNS zones in all resource groups in a subscription.
792
+ #
793
+ # @param next_page_link [String] The NextLink from the previous successful call
794
+ # to List operation.
795
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
796
+ # will be added to the HTTP request.
797
+ #
798
+ # @return [ZoneListResult] operation results.
799
+ #
800
+ def list_next(next_page_link, custom_headers:nil)
801
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
802
+ response.body unless response.nil?
803
+ end
804
+
805
+ #
806
+ # Lists the DNS zones in all resource groups in a subscription.
807
+ #
808
+ # @param next_page_link [String] The NextLink from the previous successful call
809
+ # to List operation.
810
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
811
+ # will be added to the HTTP request.
812
+ #
813
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
814
+ #
815
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
816
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
817
+ end
818
+
819
+ #
820
+ # Lists the DNS zones in all resource groups in a subscription.
821
+ #
822
+ # @param next_page_link [String] The NextLink from the previous successful call
823
+ # to List operation.
824
+ # @param [Hash{String => String}] A hash of custom headers that will be added
825
+ # to the HTTP request.
826
+ #
827
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
828
+ #
829
+ def list_next_async(next_page_link, custom_headers:nil)
830
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
831
+
832
+
833
+ request_headers = {}
834
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
835
+
836
+ # Set Headers
837
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
838
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
839
+ path_template = '{nextLink}'
840
+
841
+ request_url = @base_url || @client.base_url
842
+
843
+ options = {
844
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
845
+ skip_encoding_path_params: {'nextLink' => next_page_link},
846
+ headers: request_headers.merge(custom_headers || {}),
847
+ base_url: request_url
848
+ }
849
+ promise = @client.make_request_async(:get, path_template, options)
850
+
851
+ promise = promise.then do |result|
852
+ http_response = result.response
853
+ status_code = http_response.status
854
+ response_content = http_response.body
855
+ unless status_code == 200
856
+ error_model = JSON.load(response_content)
857
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
858
+ end
859
+
860
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
861
+ # Deserialize Response
862
+ if status_code == 200
863
+ begin
864
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
865
+ result_mapper = Azure::Dns::Mgmt::V2018_03_01_preview::Models::ZoneListResult.mapper()
866
+ result.body = @client.deserialize(result_mapper, parsed_response)
867
+ rescue Exception => e
868
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
869
+ end
870
+ end
871
+
872
+ result
873
+ end
874
+
875
+ promise.execute
876
+ end
877
+
878
+ #
879
+ # Lists the DNS zones within a resource group.
880
+ #
881
+ # @param resource_group_name [String] The name of the resource group.
882
+ # @param top [Integer] The maximum number of record sets to return. If not
883
+ # specified, returns up to 100 record sets.
884
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
885
+ # will be added to the HTTP request.
886
+ #
887
+ # @return [ZoneListResult] which provide lazy access to pages of the response.
888
+ #
889
+ def list_by_resource_group_as_lazy(resource_group_name, top:nil, custom_headers:nil)
890
+ response = list_by_resource_group_async(resource_group_name, top:top, custom_headers:custom_headers).value!
891
+ unless response.nil?
892
+ page = response.body
893
+ page.next_method = Proc.new do |next_page_link|
894
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
895
+ end
896
+ page
897
+ end
898
+ end
899
+
900
+ #
901
+ # Lists the DNS zones in all resource groups in a subscription.
902
+ #
903
+ # @param top [Integer] The maximum number of DNS zones to return. If not
904
+ # specified, returns up to 100 zones.
905
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
906
+ # will be added to the HTTP request.
907
+ #
908
+ # @return [ZoneListResult] which provide lazy access to pages of the response.
909
+ #
910
+ def list_as_lazy(top:nil, custom_headers:nil)
911
+ response = list_async(top:top, custom_headers:custom_headers).value!
912
+ unless response.nil?
913
+ page = response.body
914
+ page.next_method = Proc.new do |next_page_link|
915
+ list_next_async(next_page_link, custom_headers:custom_headers)
916
+ end
917
+ page
918
+ end
919
+ end
920
+
921
+ end
922
+ end