azure_mgmt_dns 0.15.2 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
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,99 @@
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
+ module Models
8
+ #
9
+ # The response to a Zone List or ListAll operation.
10
+ #
11
+ class ZoneListResult
12
+
13
+ include MsRestAzure
14
+
15
+ include MsRest::JSONable
16
+ # @return [Array<Zone>] Information about the DNS zones.
17
+ attr_accessor :value
18
+
19
+ # @return [String] The continuation token for the next page of results.
20
+ attr_accessor :next_link
21
+
22
+ # return [Proc] with next page method call.
23
+ attr_accessor :next_method
24
+
25
+ #
26
+ # Gets the rest of the items for the request, enabling auto-pagination.
27
+ #
28
+ # @return [Array<Zone>] operation results.
29
+ #
30
+ def get_all_items
31
+ items = @value
32
+ page = self
33
+ while page.next_link != nil do
34
+ page = page.get_next_page
35
+ items.concat(page.value)
36
+ end
37
+ items
38
+ end
39
+
40
+ #
41
+ # Gets the next page of results.
42
+ #
43
+ # @return [ZoneListResult] with next page content.
44
+ #
45
+ def get_next_page
46
+ response = @next_method.call(@next_link).value! unless @next_method.nil?
47
+ unless response.nil?
48
+ @next_link = response.body.next_link
49
+ @value = response.body.value
50
+ self
51
+ end
52
+ end
53
+
54
+ #
55
+ # Mapper for ZoneListResult class as Ruby Hash.
56
+ # This will be used for serialization/deserialization.
57
+ #
58
+ def self.mapper()
59
+ {
60
+ client_side_validation: true,
61
+ required: false,
62
+ serialized_name: 'ZoneListResult',
63
+ type: {
64
+ name: 'Composite',
65
+ class_name: 'ZoneListResult',
66
+ model_properties: {
67
+ value: {
68
+ client_side_validation: true,
69
+ required: false,
70
+ serialized_name: 'value',
71
+ type: {
72
+ name: 'Sequence',
73
+ element: {
74
+ client_side_validation: true,
75
+ required: false,
76
+ serialized_name: 'ZoneElementType',
77
+ type: {
78
+ name: 'Composite',
79
+ class_name: 'Zone'
80
+ }
81
+ }
82
+ }
83
+ },
84
+ next_link: {
85
+ client_side_validation: true,
86
+ required: false,
87
+ read_only: true,
88
+ serialized_name: 'nextLink',
89
+ type: {
90
+ name: 'String'
91
+ }
92
+ }
93
+ }
94
+ }
95
+ }
96
+ end
97
+ end
98
+ end
99
+ end
@@ -0,0 +1,9 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure end
7
+ module Azure::Dns end
8
+ module Azure::Dns::Mgmt end
9
+ module Azure::Dns::Mgmt::V2017_09_01 end
@@ -0,0 +1,1020 @@
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 RecordSets
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the RecordSets 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
+ # Updates a record set within a DNS 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 relative_record_set_name [String] The name of the record set, relative
31
+ # to the name of the zone.
32
+ # @param record_type [RecordType] The type of DNS record in this record set.
33
+ # Possible values include: 'A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NS', 'PTR',
34
+ # 'SOA', 'SRV', 'TXT'
35
+ # @param parameters [RecordSet] Parameters supplied to the Update operation.
36
+ # @param if_match [String] The etag of the record set. Omit this value to
37
+ # always overwrite the current record set. Specify the last-seen etag value to
38
+ # prevent accidentally overwritting concurrent changes.
39
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
40
+ # will be added to the HTTP request.
41
+ #
42
+ # @return [RecordSet] operation results.
43
+ #
44
+ def update(resource_group_name, zone_name, relative_record_set_name, record_type, parameters, if_match:nil, custom_headers:nil)
45
+ response = update_async(resource_group_name, zone_name, relative_record_set_name, record_type, parameters, if_match:if_match, custom_headers:custom_headers).value!
46
+ response.body unless response.nil?
47
+ end
48
+
49
+ #
50
+ # Updates a record set within a DNS zone.
51
+ #
52
+ # @param resource_group_name [String] The name of the resource group.
53
+ # @param zone_name [String] The name of the DNS zone (without a terminating
54
+ # dot).
55
+ # @param relative_record_set_name [String] The name of the record set, relative
56
+ # to the name of the zone.
57
+ # @param record_type [RecordType] The type of DNS record in this record set.
58
+ # Possible values include: 'A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NS', 'PTR',
59
+ # 'SOA', 'SRV', 'TXT'
60
+ # @param parameters [RecordSet] Parameters supplied to the Update operation.
61
+ # @param if_match [String] The etag of the record set. Omit this value to
62
+ # always overwrite the current record set. Specify the last-seen etag value to
63
+ # prevent accidentally overwritting concurrent changes.
64
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
65
+ # will be added to the HTTP request.
66
+ #
67
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
68
+ #
69
+ def update_with_http_info(resource_group_name, zone_name, relative_record_set_name, record_type, parameters, if_match:nil, custom_headers:nil)
70
+ update_async(resource_group_name, zone_name, relative_record_set_name, record_type, parameters, if_match:if_match, custom_headers:custom_headers).value!
71
+ end
72
+
73
+ #
74
+ # Updates a record set within a DNS zone.
75
+ #
76
+ # @param resource_group_name [String] The name of the resource group.
77
+ # @param zone_name [String] The name of the DNS zone (without a terminating
78
+ # dot).
79
+ # @param relative_record_set_name [String] The name of the record set, relative
80
+ # to the name of the zone.
81
+ # @param record_type [RecordType] The type of DNS record in this record set.
82
+ # Possible values include: 'A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NS', 'PTR',
83
+ # 'SOA', 'SRV', 'TXT'
84
+ # @param parameters [RecordSet] Parameters supplied to the Update operation.
85
+ # @param if_match [String] The etag of the record set. Omit this value to
86
+ # always overwrite the current record set. Specify the last-seen etag value to
87
+ # prevent accidentally overwritting concurrent changes.
88
+ # @param [Hash{String => String}] A hash of custom headers that will be added
89
+ # to the HTTP request.
90
+ #
91
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
92
+ #
93
+ def update_async(resource_group_name, zone_name, relative_record_set_name, record_type, parameters, if_match:nil, custom_headers:nil)
94
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
95
+ fail ArgumentError, 'zone_name is nil' if zone_name.nil?
96
+ fail ArgumentError, 'relative_record_set_name is nil' if relative_record_set_name.nil?
97
+ fail ArgumentError, 'record_type is nil' if record_type.nil?
98
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
99
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
100
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
101
+
102
+
103
+ request_headers = {}
104
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
105
+
106
+ # Set Headers
107
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
108
+ request_headers['If-Match'] = if_match unless if_match.nil?
109
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
110
+
111
+ # Serialize Request
112
+ request_mapper = Azure::Dns::Mgmt::V2017_09_01::Models::RecordSet.mapper()
113
+ request_content = @client.serialize(request_mapper, parameters)
114
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
115
+
116
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}'
117
+
118
+ request_url = @base_url || @client.base_url
119
+
120
+ options = {
121
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
122
+ path_params: {'resourceGroupName' => resource_group_name,'zoneName' => zone_name,'recordType' => record_type,'subscriptionId' => @client.subscription_id},
123
+ skip_encoding_path_params: {'relativeRecordSetName' => relative_record_set_name},
124
+ query_params: {'api-version' => @client.api_version},
125
+ body: request_content,
126
+ headers: request_headers.merge(custom_headers || {}),
127
+ base_url: request_url
128
+ }
129
+ promise = @client.make_request_async(:patch, path_template, options)
130
+
131
+ promise = promise.then do |result|
132
+ http_response = result.response
133
+ status_code = http_response.status
134
+ response_content = http_response.body
135
+ unless status_code == 200
136
+ error_model = JSON.load(response_content)
137
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
138
+ end
139
+
140
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
141
+ # Deserialize Response
142
+ if status_code == 200
143
+ begin
144
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
145
+ result_mapper = Azure::Dns::Mgmt::V2017_09_01::Models::RecordSet.mapper()
146
+ result.body = @client.deserialize(result_mapper, parsed_response)
147
+ rescue Exception => e
148
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
149
+ end
150
+ end
151
+
152
+ result
153
+ end
154
+
155
+ promise.execute
156
+ end
157
+
158
+ #
159
+ # Creates or updates a record set within a DNS zone.
160
+ #
161
+ # @param resource_group_name [String] The name of the resource group.
162
+ # @param zone_name [String] The name of the DNS zone (without a terminating
163
+ # dot).
164
+ # @param relative_record_set_name [String] The name of the record set, relative
165
+ # to the name of the zone.
166
+ # @param record_type [RecordType] The type of DNS record in this record set.
167
+ # Record sets of type SOA can be updated but not created (they are created when
168
+ # the DNS zone is created). Possible values include: 'A', 'AAAA', 'CAA',
169
+ # 'CNAME', 'MX', 'NS', 'PTR', 'SOA', 'SRV', 'TXT'
170
+ # @param parameters [RecordSet] Parameters supplied to the CreateOrUpdate
171
+ # operation.
172
+ # @param if_match [String] The etag of the record set. Omit this value to
173
+ # always overwrite the current record set. Specify the last-seen etag value to
174
+ # prevent accidentally overwritting any concurrent changes.
175
+ # @param if_none_match [String] Set to '*' to allow a new record set to be
176
+ # created, but to prevent updating an existing record set. Other values will be
177
+ # ignored.
178
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
179
+ # will be added to the HTTP request.
180
+ #
181
+ # @return [RecordSet] operation results.
182
+ #
183
+ def create_or_update(resource_group_name, zone_name, relative_record_set_name, record_type, parameters, if_match:nil, if_none_match:nil, custom_headers:nil)
184
+ response = create_or_update_async(resource_group_name, zone_name, relative_record_set_name, record_type, parameters, if_match:if_match, if_none_match:if_none_match, custom_headers:custom_headers).value!
185
+ response.body unless response.nil?
186
+ end
187
+
188
+ #
189
+ # Creates or updates a record set within a DNS zone.
190
+ #
191
+ # @param resource_group_name [String] The name of the resource group.
192
+ # @param zone_name [String] The name of the DNS zone (without a terminating
193
+ # dot).
194
+ # @param relative_record_set_name [String] The name of the record set, relative
195
+ # to the name of the zone.
196
+ # @param record_type [RecordType] The type of DNS record in this record set.
197
+ # Record sets of type SOA can be updated but not created (they are created when
198
+ # the DNS zone is created). Possible values include: 'A', 'AAAA', 'CAA',
199
+ # 'CNAME', 'MX', 'NS', 'PTR', 'SOA', 'SRV', 'TXT'
200
+ # @param parameters [RecordSet] Parameters supplied to the CreateOrUpdate
201
+ # operation.
202
+ # @param if_match [String] The etag of the record set. Omit this value to
203
+ # always overwrite the current record set. Specify the last-seen etag value to
204
+ # prevent accidentally overwritting any concurrent changes.
205
+ # @param if_none_match [String] Set to '*' to allow a new record set to be
206
+ # created, but to prevent updating an existing record set. Other values will be
207
+ # ignored.
208
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
209
+ # will be added to the HTTP request.
210
+ #
211
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
212
+ #
213
+ def create_or_update_with_http_info(resource_group_name, zone_name, relative_record_set_name, record_type, parameters, if_match:nil, if_none_match:nil, custom_headers:nil)
214
+ create_or_update_async(resource_group_name, zone_name, relative_record_set_name, record_type, parameters, if_match:if_match, if_none_match:if_none_match, custom_headers:custom_headers).value!
215
+ end
216
+
217
+ #
218
+ # Creates or updates a record set within a DNS zone.
219
+ #
220
+ # @param resource_group_name [String] The name of the resource group.
221
+ # @param zone_name [String] The name of the DNS zone (without a terminating
222
+ # dot).
223
+ # @param relative_record_set_name [String] The name of the record set, relative
224
+ # to the name of the zone.
225
+ # @param record_type [RecordType] The type of DNS record in this record set.
226
+ # Record sets of type SOA can be updated but not created (they are created when
227
+ # the DNS zone is created). Possible values include: 'A', 'AAAA', 'CAA',
228
+ # 'CNAME', 'MX', 'NS', 'PTR', 'SOA', 'SRV', 'TXT'
229
+ # @param parameters [RecordSet] Parameters supplied to the CreateOrUpdate
230
+ # operation.
231
+ # @param if_match [String] The etag of the record set. Omit this value to
232
+ # always overwrite the current record set. Specify the last-seen etag value to
233
+ # prevent accidentally overwritting any concurrent changes.
234
+ # @param if_none_match [String] Set to '*' to allow a new record set to be
235
+ # created, but to prevent updating an existing record set. Other values will be
236
+ # ignored.
237
+ # @param [Hash{String => String}] A hash of custom headers that will be added
238
+ # to the HTTP request.
239
+ #
240
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
241
+ #
242
+ def create_or_update_async(resource_group_name, zone_name, relative_record_set_name, record_type, parameters, if_match:nil, if_none_match:nil, custom_headers:nil)
243
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
244
+ fail ArgumentError, 'zone_name is nil' if zone_name.nil?
245
+ fail ArgumentError, 'relative_record_set_name is nil' if relative_record_set_name.nil?
246
+ fail ArgumentError, 'record_type is nil' if record_type.nil?
247
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
248
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
249
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
250
+
251
+
252
+ request_headers = {}
253
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
254
+
255
+ # Set Headers
256
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
257
+ request_headers['If-Match'] = if_match unless if_match.nil?
258
+ request_headers['If-None-Match'] = if_none_match unless if_none_match.nil?
259
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
260
+
261
+ # Serialize Request
262
+ request_mapper = Azure::Dns::Mgmt::V2017_09_01::Models::RecordSet.mapper()
263
+ request_content = @client.serialize(request_mapper, parameters)
264
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
265
+
266
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}'
267
+
268
+ request_url = @base_url || @client.base_url
269
+
270
+ options = {
271
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
272
+ path_params: {'resourceGroupName' => resource_group_name,'zoneName' => zone_name,'recordType' => record_type,'subscriptionId' => @client.subscription_id},
273
+ skip_encoding_path_params: {'relativeRecordSetName' => relative_record_set_name},
274
+ query_params: {'api-version' => @client.api_version},
275
+ body: request_content,
276
+ headers: request_headers.merge(custom_headers || {}),
277
+ base_url: request_url
278
+ }
279
+ promise = @client.make_request_async(:put, path_template, options)
280
+
281
+ promise = promise.then do |result|
282
+ http_response = result.response
283
+ status_code = http_response.status
284
+ response_content = http_response.body
285
+ unless status_code == 201 || status_code == 200
286
+ error_model = JSON.load(response_content)
287
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
288
+ end
289
+
290
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
291
+ # Deserialize Response
292
+ if status_code == 201
293
+ begin
294
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
295
+ result_mapper = Azure::Dns::Mgmt::V2017_09_01::Models::RecordSet.mapper()
296
+ result.body = @client.deserialize(result_mapper, parsed_response)
297
+ rescue Exception => e
298
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
299
+ end
300
+ end
301
+ # Deserialize Response
302
+ if status_code == 200
303
+ begin
304
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
305
+ result_mapper = Azure::Dns::Mgmt::V2017_09_01::Models::RecordSet.mapper()
306
+ result.body = @client.deserialize(result_mapper, parsed_response)
307
+ rescue Exception => e
308
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
309
+ end
310
+ end
311
+
312
+ result
313
+ end
314
+
315
+ promise.execute
316
+ end
317
+
318
+ #
319
+ # Deletes a record set from a DNS zone. This operation cannot be undone.
320
+ #
321
+ # @param resource_group_name [String] The name of the resource group.
322
+ # @param zone_name [String] The name of the DNS zone (without a terminating
323
+ # dot).
324
+ # @param relative_record_set_name [String] The name of the record set, relative
325
+ # to the name of the zone.
326
+ # @param record_type [RecordType] The type of DNS record in this record set.
327
+ # Record sets of type SOA cannot be deleted (they are deleted when the DNS zone
328
+ # is deleted). Possible values include: 'A', 'AAAA', 'CAA', 'CNAME', 'MX',
329
+ # 'NS', 'PTR', 'SOA', 'SRV', 'TXT'
330
+ # @param if_match [String] The etag of the record set. Omit this value to
331
+ # always delete the current record set. Specify the last-seen etag value to
332
+ # prevent accidentally deleting any concurrent changes.
333
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
334
+ # will be added to the HTTP request.
335
+ #
336
+ #
337
+ def delete(resource_group_name, zone_name, relative_record_set_name, record_type, if_match:nil, custom_headers:nil)
338
+ response = delete_async(resource_group_name, zone_name, relative_record_set_name, record_type, if_match:if_match, custom_headers:custom_headers).value!
339
+ nil
340
+ end
341
+
342
+ #
343
+ # Deletes a record set from a DNS zone. This operation cannot be undone.
344
+ #
345
+ # @param resource_group_name [String] The name of the resource group.
346
+ # @param zone_name [String] The name of the DNS zone (without a terminating
347
+ # dot).
348
+ # @param relative_record_set_name [String] The name of the record set, relative
349
+ # to the name of the zone.
350
+ # @param record_type [RecordType] The type of DNS record in this record set.
351
+ # Record sets of type SOA cannot be deleted (they are deleted when the DNS zone
352
+ # is deleted). Possible values include: 'A', 'AAAA', 'CAA', 'CNAME', 'MX',
353
+ # 'NS', 'PTR', 'SOA', 'SRV', 'TXT'
354
+ # @param if_match [String] The etag of the record set. Omit this value to
355
+ # always delete the current record set. Specify the last-seen etag value to
356
+ # prevent accidentally deleting any concurrent changes.
357
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
358
+ # will be added to the HTTP request.
359
+ #
360
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
361
+ #
362
+ def delete_with_http_info(resource_group_name, zone_name, relative_record_set_name, record_type, if_match:nil, custom_headers:nil)
363
+ delete_async(resource_group_name, zone_name, relative_record_set_name, record_type, if_match:if_match, custom_headers:custom_headers).value!
364
+ end
365
+
366
+ #
367
+ # Deletes a record set from a DNS zone. This operation cannot be undone.
368
+ #
369
+ # @param resource_group_name [String] The name of the resource group.
370
+ # @param zone_name [String] The name of the DNS zone (without a terminating
371
+ # dot).
372
+ # @param relative_record_set_name [String] The name of the record set, relative
373
+ # to the name of the zone.
374
+ # @param record_type [RecordType] The type of DNS record in this record set.
375
+ # Record sets of type SOA cannot be deleted (they are deleted when the DNS zone
376
+ # is deleted). Possible values include: 'A', 'AAAA', 'CAA', 'CNAME', 'MX',
377
+ # 'NS', 'PTR', 'SOA', 'SRV', 'TXT'
378
+ # @param if_match [String] The etag of the record set. Omit this value to
379
+ # always delete the current record set. Specify the last-seen etag value to
380
+ # prevent accidentally deleting any concurrent changes.
381
+ # @param [Hash{String => String}] A hash of custom headers that will be added
382
+ # to the HTTP request.
383
+ #
384
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
385
+ #
386
+ def delete_async(resource_group_name, zone_name, relative_record_set_name, record_type, if_match:nil, custom_headers:nil)
387
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
388
+ fail ArgumentError, 'zone_name is nil' if zone_name.nil?
389
+ fail ArgumentError, 'relative_record_set_name is nil' if relative_record_set_name.nil?
390
+ fail ArgumentError, 'record_type is nil' if record_type.nil?
391
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
392
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
393
+
394
+
395
+ request_headers = {}
396
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
397
+
398
+ # Set Headers
399
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
400
+ request_headers['If-Match'] = if_match unless if_match.nil?
401
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
402
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}'
403
+
404
+ request_url = @base_url || @client.base_url
405
+
406
+ options = {
407
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
408
+ path_params: {'resourceGroupName' => resource_group_name,'zoneName' => zone_name,'recordType' => record_type,'subscriptionId' => @client.subscription_id},
409
+ skip_encoding_path_params: {'relativeRecordSetName' => relative_record_set_name},
410
+ query_params: {'api-version' => @client.api_version},
411
+ headers: request_headers.merge(custom_headers || {}),
412
+ base_url: request_url
413
+ }
414
+ promise = @client.make_request_async(:delete, path_template, options)
415
+
416
+ promise = promise.then do |result|
417
+ http_response = result.response
418
+ status_code = http_response.status
419
+ response_content = http_response.body
420
+ unless status_code == 204 || status_code == 200
421
+ error_model = JSON.load(response_content)
422
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
423
+ end
424
+
425
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
426
+
427
+ result
428
+ end
429
+
430
+ promise.execute
431
+ end
432
+
433
+ #
434
+ # Gets a record set.
435
+ #
436
+ # @param resource_group_name [String] The name of the resource group.
437
+ # @param zone_name [String] The name of the DNS zone (without a terminating
438
+ # dot).
439
+ # @param relative_record_set_name [String] The name of the record set, relative
440
+ # to the name of the zone.
441
+ # @param record_type [RecordType] The type of DNS record in this record set.
442
+ # Possible values include: 'A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NS', 'PTR',
443
+ # 'SOA', 'SRV', 'TXT'
444
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
445
+ # will be added to the HTTP request.
446
+ #
447
+ # @return [RecordSet] operation results.
448
+ #
449
+ def get(resource_group_name, zone_name, relative_record_set_name, record_type, custom_headers:nil)
450
+ response = get_async(resource_group_name, zone_name, relative_record_set_name, record_type, custom_headers:custom_headers).value!
451
+ response.body unless response.nil?
452
+ end
453
+
454
+ #
455
+ # Gets a record set.
456
+ #
457
+ # @param resource_group_name [String] The name of the resource group.
458
+ # @param zone_name [String] The name of the DNS zone (without a terminating
459
+ # dot).
460
+ # @param relative_record_set_name [String] The name of the record set, relative
461
+ # to the name of the zone.
462
+ # @param record_type [RecordType] The type of DNS record in this record set.
463
+ # Possible values include: 'A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NS', 'PTR',
464
+ # 'SOA', 'SRV', 'TXT'
465
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
466
+ # will be added to the HTTP request.
467
+ #
468
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
469
+ #
470
+ def get_with_http_info(resource_group_name, zone_name, relative_record_set_name, record_type, custom_headers:nil)
471
+ get_async(resource_group_name, zone_name, relative_record_set_name, record_type, custom_headers:custom_headers).value!
472
+ end
473
+
474
+ #
475
+ # Gets a record set.
476
+ #
477
+ # @param resource_group_name [String] The name of the resource group.
478
+ # @param zone_name [String] The name of the DNS zone (without a terminating
479
+ # dot).
480
+ # @param relative_record_set_name [String] The name of the record set, relative
481
+ # to the name of the zone.
482
+ # @param record_type [RecordType] The type of DNS record in this record set.
483
+ # Possible values include: 'A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NS', 'PTR',
484
+ # 'SOA', 'SRV', 'TXT'
485
+ # @param [Hash{String => String}] A hash of custom headers that will be added
486
+ # to the HTTP request.
487
+ #
488
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
489
+ #
490
+ def get_async(resource_group_name, zone_name, relative_record_set_name, record_type, custom_headers:nil)
491
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
492
+ fail ArgumentError, 'zone_name is nil' if zone_name.nil?
493
+ fail ArgumentError, 'relative_record_set_name is nil' if relative_record_set_name.nil?
494
+ fail ArgumentError, 'record_type is nil' if record_type.nil?
495
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
496
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
497
+
498
+
499
+ request_headers = {}
500
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
501
+
502
+ # Set Headers
503
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
504
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
505
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}'
506
+
507
+ request_url = @base_url || @client.base_url
508
+
509
+ options = {
510
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
511
+ path_params: {'resourceGroupName' => resource_group_name,'zoneName' => zone_name,'recordType' => record_type,'subscriptionId' => @client.subscription_id},
512
+ skip_encoding_path_params: {'relativeRecordSetName' => relative_record_set_name},
513
+ query_params: {'api-version' => @client.api_version},
514
+ headers: request_headers.merge(custom_headers || {}),
515
+ base_url: request_url
516
+ }
517
+ promise = @client.make_request_async(:get, path_template, options)
518
+
519
+ promise = promise.then do |result|
520
+ http_response = result.response
521
+ status_code = http_response.status
522
+ response_content = http_response.body
523
+ unless status_code == 200
524
+ error_model = JSON.load(response_content)
525
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
526
+ end
527
+
528
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
529
+ # Deserialize Response
530
+ if status_code == 200
531
+ begin
532
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
533
+ result_mapper = Azure::Dns::Mgmt::V2017_09_01::Models::RecordSet.mapper()
534
+ result.body = @client.deserialize(result_mapper, parsed_response)
535
+ rescue Exception => e
536
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
537
+ end
538
+ end
539
+
540
+ result
541
+ end
542
+
543
+ promise.execute
544
+ end
545
+
546
+ #
547
+ # Lists the record sets of a specified type in a DNS zone.
548
+ #
549
+ # @param resource_group_name [String] The name of the resource group.
550
+ # @param zone_name [String] The name of the DNS zone (without a terminating
551
+ # dot).
552
+ # @param record_type [RecordType] The type of record sets to enumerate.
553
+ # Possible values include: 'A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NS', 'PTR',
554
+ # 'SOA', 'SRV', 'TXT'
555
+ # @param top [Integer] The maximum number of record sets to return. If not
556
+ # specified, returns up to 100 record sets.
557
+ # @param recordsetnamesuffix [String] The suffix label of the record set name
558
+ # that has to be used to filter the record set enumerations. If this parameter
559
+ # is specified, Enumeration will return only records that end with
560
+ # .<recordSetNameSuffix>
561
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
562
+ # will be added to the HTTP request.
563
+ #
564
+ # @return [Array<RecordSet>] operation results.
565
+ #
566
+ def list_by_type(resource_group_name, zone_name, record_type, top:nil, recordsetnamesuffix:nil, custom_headers:nil)
567
+ first_page = list_by_type_as_lazy(resource_group_name, zone_name, record_type, top:top, recordsetnamesuffix:recordsetnamesuffix, custom_headers:custom_headers)
568
+ first_page.get_all_items
569
+ end
570
+
571
+ #
572
+ # Lists the record sets of a specified type in a DNS zone.
573
+ #
574
+ # @param resource_group_name [String] The name of the resource group.
575
+ # @param zone_name [String] The name of the DNS zone (without a terminating
576
+ # dot).
577
+ # @param record_type [RecordType] The type of record sets to enumerate.
578
+ # Possible values include: 'A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NS', 'PTR',
579
+ # 'SOA', 'SRV', 'TXT'
580
+ # @param top [Integer] The maximum number of record sets to return. If not
581
+ # specified, returns up to 100 record sets.
582
+ # @param recordsetnamesuffix [String] The suffix label of the record set name
583
+ # that has to be used to filter the record set enumerations. If this parameter
584
+ # is specified, Enumeration will return only records that end with
585
+ # .<recordSetNameSuffix>
586
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
587
+ # will be added to the HTTP request.
588
+ #
589
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
590
+ #
591
+ def list_by_type_with_http_info(resource_group_name, zone_name, record_type, top:nil, recordsetnamesuffix:nil, custom_headers:nil)
592
+ list_by_type_async(resource_group_name, zone_name, record_type, top:top, recordsetnamesuffix:recordsetnamesuffix, custom_headers:custom_headers).value!
593
+ end
594
+
595
+ #
596
+ # Lists the record sets of a specified type in a DNS zone.
597
+ #
598
+ # @param resource_group_name [String] The name of the resource group.
599
+ # @param zone_name [String] The name of the DNS zone (without a terminating
600
+ # dot).
601
+ # @param record_type [RecordType] The type of record sets to enumerate.
602
+ # Possible values include: 'A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NS', 'PTR',
603
+ # 'SOA', 'SRV', 'TXT'
604
+ # @param top [Integer] The maximum number of record sets to return. If not
605
+ # specified, returns up to 100 record sets.
606
+ # @param recordsetnamesuffix [String] The suffix label of the record set name
607
+ # that has to be used to filter the record set enumerations. If this parameter
608
+ # is specified, Enumeration will return only records that end with
609
+ # .<recordSetNameSuffix>
610
+ # @param [Hash{String => String}] A hash of custom headers that will be added
611
+ # to the HTTP request.
612
+ #
613
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
614
+ #
615
+ def list_by_type_async(resource_group_name, zone_name, record_type, top:nil, recordsetnamesuffix:nil, custom_headers:nil)
616
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
617
+ fail ArgumentError, 'zone_name is nil' if zone_name.nil?
618
+ fail ArgumentError, 'record_type is nil' if record_type.nil?
619
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
620
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
621
+
622
+
623
+ request_headers = {}
624
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
625
+
626
+ # Set Headers
627
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
628
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
629
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}'
630
+
631
+ request_url = @base_url || @client.base_url
632
+
633
+ options = {
634
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
635
+ path_params: {'resourceGroupName' => resource_group_name,'zoneName' => zone_name,'recordType' => record_type,'subscriptionId' => @client.subscription_id},
636
+ query_params: {'$top' => top,'$recordsetnamesuffix' => recordsetnamesuffix,'api-version' => @client.api_version},
637
+ headers: request_headers.merge(custom_headers || {}),
638
+ base_url: request_url
639
+ }
640
+ promise = @client.make_request_async(:get, path_template, options)
641
+
642
+ promise = promise.then do |result|
643
+ http_response = result.response
644
+ status_code = http_response.status
645
+ response_content = http_response.body
646
+ unless status_code == 200
647
+ error_model = JSON.load(response_content)
648
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
649
+ end
650
+
651
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
652
+ # Deserialize Response
653
+ if status_code == 200
654
+ begin
655
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
656
+ result_mapper = Azure::Dns::Mgmt::V2017_09_01::Models::RecordSetListResult.mapper()
657
+ result.body = @client.deserialize(result_mapper, parsed_response)
658
+ rescue Exception => e
659
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
660
+ end
661
+ end
662
+
663
+ result
664
+ end
665
+
666
+ promise.execute
667
+ end
668
+
669
+ #
670
+ # Lists all record sets in a DNS zone.
671
+ #
672
+ # @param resource_group_name [String] The name of the resource group.
673
+ # @param zone_name [String] The name of the DNS zone (without a terminating
674
+ # dot).
675
+ # @param top [Integer] The maximum number of record sets to return. If not
676
+ # specified, returns up to 100 record sets.
677
+ # @param recordsetnamesuffix [String] The suffix label of the record set name
678
+ # that has to be used to filter the record set enumerations. If this parameter
679
+ # is specified, Enumeration will return only records that end with
680
+ # .<recordSetNameSuffix>
681
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
682
+ # will be added to the HTTP request.
683
+ #
684
+ # @return [Array<RecordSet>] operation results.
685
+ #
686
+ def list_by_dns_zone(resource_group_name, zone_name, top:nil, recordsetnamesuffix:nil, custom_headers:nil)
687
+ first_page = list_by_dns_zone_as_lazy(resource_group_name, zone_name, top:top, recordsetnamesuffix:recordsetnamesuffix, custom_headers:custom_headers)
688
+ first_page.get_all_items
689
+ end
690
+
691
+ #
692
+ # Lists all record sets in a DNS zone.
693
+ #
694
+ # @param resource_group_name [String] The name of the resource group.
695
+ # @param zone_name [String] The name of the DNS zone (without a terminating
696
+ # dot).
697
+ # @param top [Integer] The maximum number of record sets to return. If not
698
+ # specified, returns up to 100 record sets.
699
+ # @param recordsetnamesuffix [String] The suffix label of the record set name
700
+ # that has to be used to filter the record set enumerations. If this parameter
701
+ # is specified, Enumeration will return only records that end with
702
+ # .<recordSetNameSuffix>
703
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
704
+ # will be added to the HTTP request.
705
+ #
706
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
707
+ #
708
+ def list_by_dns_zone_with_http_info(resource_group_name, zone_name, top:nil, recordsetnamesuffix:nil, custom_headers:nil)
709
+ list_by_dns_zone_async(resource_group_name, zone_name, top:top, recordsetnamesuffix:recordsetnamesuffix, custom_headers:custom_headers).value!
710
+ end
711
+
712
+ #
713
+ # Lists all record sets in a DNS zone.
714
+ #
715
+ # @param resource_group_name [String] The name of the resource group.
716
+ # @param zone_name [String] The name of the DNS zone (without a terminating
717
+ # dot).
718
+ # @param top [Integer] The maximum number of record sets to return. If not
719
+ # specified, returns up to 100 record sets.
720
+ # @param recordsetnamesuffix [String] The suffix label of the record set name
721
+ # that has to be used to filter the record set enumerations. If this parameter
722
+ # is specified, Enumeration will return only records that end with
723
+ # .<recordSetNameSuffix>
724
+ # @param [Hash{String => String}] A hash of custom headers that will be added
725
+ # to the HTTP request.
726
+ #
727
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
728
+ #
729
+ def list_by_dns_zone_async(resource_group_name, zone_name, top:nil, recordsetnamesuffix:nil, custom_headers:nil)
730
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
731
+ fail ArgumentError, 'zone_name is nil' if zone_name.nil?
732
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
733
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
734
+
735
+
736
+ request_headers = {}
737
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
738
+
739
+ # Set Headers
740
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
741
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
742
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/recordsets'
743
+
744
+ request_url = @base_url || @client.base_url
745
+
746
+ options = {
747
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
748
+ path_params: {'resourceGroupName' => resource_group_name,'zoneName' => zone_name,'subscriptionId' => @client.subscription_id},
749
+ query_params: {'$top' => top,'$recordsetnamesuffix' => recordsetnamesuffix,'api-version' => @client.api_version},
750
+ headers: request_headers.merge(custom_headers || {}),
751
+ base_url: request_url
752
+ }
753
+ promise = @client.make_request_async(:get, path_template, options)
754
+
755
+ promise = promise.then do |result|
756
+ http_response = result.response
757
+ status_code = http_response.status
758
+ response_content = http_response.body
759
+ unless status_code == 200
760
+ error_model = JSON.load(response_content)
761
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
762
+ end
763
+
764
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
765
+ # Deserialize Response
766
+ if status_code == 200
767
+ begin
768
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
769
+ result_mapper = Azure::Dns::Mgmt::V2017_09_01::Models::RecordSetListResult.mapper()
770
+ result.body = @client.deserialize(result_mapper, parsed_response)
771
+ rescue Exception => e
772
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
773
+ end
774
+ end
775
+
776
+ result
777
+ end
778
+
779
+ promise.execute
780
+ end
781
+
782
+ #
783
+ # Lists the record sets of a specified type in a DNS zone.
784
+ #
785
+ # @param next_page_link [String] The NextLink from the previous successful call
786
+ # to List operation.
787
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
788
+ # will be added to the HTTP request.
789
+ #
790
+ # @return [RecordSetListResult] operation results.
791
+ #
792
+ def list_by_type_next(next_page_link, custom_headers:nil)
793
+ response = list_by_type_next_async(next_page_link, custom_headers:custom_headers).value!
794
+ response.body unless response.nil?
795
+ end
796
+
797
+ #
798
+ # Lists the record sets of a specified type in a DNS zone.
799
+ #
800
+ # @param next_page_link [String] The NextLink from the previous successful call
801
+ # to List operation.
802
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
803
+ # will be added to the HTTP request.
804
+ #
805
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
806
+ #
807
+ def list_by_type_next_with_http_info(next_page_link, custom_headers:nil)
808
+ list_by_type_next_async(next_page_link, custom_headers:custom_headers).value!
809
+ end
810
+
811
+ #
812
+ # Lists the record sets of a specified type in a DNS zone.
813
+ #
814
+ # @param next_page_link [String] The NextLink from the previous successful call
815
+ # to List operation.
816
+ # @param [Hash{String => String}] A hash of custom headers that will be added
817
+ # to the HTTP request.
818
+ #
819
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
820
+ #
821
+ def list_by_type_next_async(next_page_link, custom_headers:nil)
822
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
823
+
824
+
825
+ request_headers = {}
826
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
827
+
828
+ # Set Headers
829
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
830
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
831
+ path_template = '{nextLink}'
832
+
833
+ request_url = @base_url || @client.base_url
834
+
835
+ options = {
836
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
837
+ skip_encoding_path_params: {'nextLink' => next_page_link},
838
+ headers: request_headers.merge(custom_headers || {}),
839
+ base_url: request_url
840
+ }
841
+ promise = @client.make_request_async(:get, path_template, options)
842
+
843
+ promise = promise.then do |result|
844
+ http_response = result.response
845
+ status_code = http_response.status
846
+ response_content = http_response.body
847
+ unless status_code == 200
848
+ error_model = JSON.load(response_content)
849
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
850
+ end
851
+
852
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
853
+ # Deserialize Response
854
+ if status_code == 200
855
+ begin
856
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
857
+ result_mapper = Azure::Dns::Mgmt::V2017_09_01::Models::RecordSetListResult.mapper()
858
+ result.body = @client.deserialize(result_mapper, parsed_response)
859
+ rescue Exception => e
860
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
861
+ end
862
+ end
863
+
864
+ result
865
+ end
866
+
867
+ promise.execute
868
+ end
869
+
870
+ #
871
+ # Lists all record sets in a DNS zone.
872
+ #
873
+ # @param next_page_link [String] The NextLink from the previous successful call
874
+ # to List operation.
875
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
876
+ # will be added to the HTTP request.
877
+ #
878
+ # @return [RecordSetListResult] operation results.
879
+ #
880
+ def list_by_dns_zone_next(next_page_link, custom_headers:nil)
881
+ response = list_by_dns_zone_next_async(next_page_link, custom_headers:custom_headers).value!
882
+ response.body unless response.nil?
883
+ end
884
+
885
+ #
886
+ # Lists all record sets in a DNS zone.
887
+ #
888
+ # @param next_page_link [String] The NextLink from the previous successful call
889
+ # to List operation.
890
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
891
+ # will be added to the HTTP request.
892
+ #
893
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
894
+ #
895
+ def list_by_dns_zone_next_with_http_info(next_page_link, custom_headers:nil)
896
+ list_by_dns_zone_next_async(next_page_link, custom_headers:custom_headers).value!
897
+ end
898
+
899
+ #
900
+ # Lists all record sets in a DNS zone.
901
+ #
902
+ # @param next_page_link [String] The NextLink from the previous successful call
903
+ # to List operation.
904
+ # @param [Hash{String => String}] A hash of custom headers that will be added
905
+ # to the HTTP request.
906
+ #
907
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
908
+ #
909
+ def list_by_dns_zone_next_async(next_page_link, custom_headers:nil)
910
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
911
+
912
+
913
+ request_headers = {}
914
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
915
+
916
+ # Set Headers
917
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
918
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
919
+ path_template = '{nextLink}'
920
+
921
+ request_url = @base_url || @client.base_url
922
+
923
+ options = {
924
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
925
+ skip_encoding_path_params: {'nextLink' => next_page_link},
926
+ headers: request_headers.merge(custom_headers || {}),
927
+ base_url: request_url
928
+ }
929
+ promise = @client.make_request_async(:get, path_template, options)
930
+
931
+ promise = promise.then do |result|
932
+ http_response = result.response
933
+ status_code = http_response.status
934
+ response_content = http_response.body
935
+ unless status_code == 200
936
+ error_model = JSON.load(response_content)
937
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
938
+ end
939
+
940
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
941
+ # Deserialize Response
942
+ if status_code == 200
943
+ begin
944
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
945
+ result_mapper = Azure::Dns::Mgmt::V2017_09_01::Models::RecordSetListResult.mapper()
946
+ result.body = @client.deserialize(result_mapper, parsed_response)
947
+ rescue Exception => e
948
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
949
+ end
950
+ end
951
+
952
+ result
953
+ end
954
+
955
+ promise.execute
956
+ end
957
+
958
+ #
959
+ # Lists the record sets of a specified type in a DNS zone.
960
+ #
961
+ # @param resource_group_name [String] The name of the resource group.
962
+ # @param zone_name [String] The name of the DNS zone (without a terminating
963
+ # dot).
964
+ # @param record_type [RecordType] The type of record sets to enumerate.
965
+ # Possible values include: 'A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NS', 'PTR',
966
+ # 'SOA', 'SRV', 'TXT'
967
+ # @param top [Integer] The maximum number of record sets to return. If not
968
+ # specified, returns up to 100 record sets.
969
+ # @param recordsetnamesuffix [String] The suffix label of the record set name
970
+ # that has to be used to filter the record set enumerations. If this parameter
971
+ # is specified, Enumeration will return only records that end with
972
+ # .<recordSetNameSuffix>
973
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
974
+ # will be added to the HTTP request.
975
+ #
976
+ # @return [RecordSetListResult] which provide lazy access to pages of the
977
+ # response.
978
+ #
979
+ def list_by_type_as_lazy(resource_group_name, zone_name, record_type, top:nil, recordsetnamesuffix:nil, custom_headers:nil)
980
+ response = list_by_type_async(resource_group_name, zone_name, record_type, top:top, recordsetnamesuffix:recordsetnamesuffix, custom_headers:custom_headers).value!
981
+ unless response.nil?
982
+ page = response.body
983
+ page.next_method = Proc.new do |next_page_link|
984
+ list_by_type_next_async(next_page_link, custom_headers:custom_headers)
985
+ end
986
+ page
987
+ end
988
+ end
989
+
990
+ #
991
+ # Lists all record sets in a DNS zone.
992
+ #
993
+ # @param resource_group_name [String] The name of the resource group.
994
+ # @param zone_name [String] The name of the DNS zone (without a terminating
995
+ # dot).
996
+ # @param top [Integer] The maximum number of record sets to return. If not
997
+ # specified, returns up to 100 record sets.
998
+ # @param recordsetnamesuffix [String] The suffix label of the record set name
999
+ # that has to be used to filter the record set enumerations. If this parameter
1000
+ # is specified, Enumeration will return only records that end with
1001
+ # .<recordSetNameSuffix>
1002
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1003
+ # will be added to the HTTP request.
1004
+ #
1005
+ # @return [RecordSetListResult] which provide lazy access to pages of the
1006
+ # response.
1007
+ #
1008
+ def list_by_dns_zone_as_lazy(resource_group_name, zone_name, top:nil, recordsetnamesuffix:nil, custom_headers:nil)
1009
+ response = list_by_dns_zone_async(resource_group_name, zone_name, top:top, recordsetnamesuffix:recordsetnamesuffix, custom_headers:custom_headers).value!
1010
+ unless response.nil?
1011
+ page = response.body
1012
+ page.next_method = Proc.new do |next_page_link|
1013
+ list_by_dns_zone_next_async(next_page_link, custom_headers:custom_headers)
1014
+ end
1015
+ page
1016
+ end
1017
+ end
1018
+
1019
+ end
1020
+ end