azure_mgmt_resources 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.rspec +3 -0
  4. data/.travis.yml +3 -0
  5. data/Gemfile +14 -0
  6. data/LICENSE.txt +21 -0
  7. data/README.md +106 -0
  8. data/Rakefile +5 -0
  9. data/azure_mgmt_resources.gemspec +38 -0
  10. data/lib/azure_mgmt_resources.rb +74 -0
  11. data/lib/azure_mgmt_resources/Models/basic_dependency.rb +76 -0
  12. data/lib/azure_mgmt_resources/Models/dependency.rb +105 -0
  13. data/lib/azure_mgmt_resources/Models/deployment.rb +64 -0
  14. data/lib/azure_mgmt_resources/Models/deployment_extended.rb +83 -0
  15. data/lib/azure_mgmt_resources/Models/deployment_extended_filter.rb +58 -0
  16. data/lib/azure_mgmt_resources/Models/deployment_list_result.rb +88 -0
  17. data/lib/azure_mgmt_resources/Models/deployment_mode.rb +15 -0
  18. data/lib/azure_mgmt_resources/Models/deployment_operation.rb +83 -0
  19. data/lib/azure_mgmt_resources/Models/deployment_operation_properties.rb +102 -0
  20. data/lib/azure_mgmt_resources/Models/deployment_operations_list_result.rb +88 -0
  21. data/lib/azure_mgmt_resources/Models/deployment_properties.rb +116 -0
  22. data/lib/azure_mgmt_resources/Models/deployment_properties_extended.rb +216 -0
  23. data/lib/azure_mgmt_resources/Models/deployment_validate_result.rb +82 -0
  24. data/lib/azure_mgmt_resources/Models/generic_resource.rb +103 -0
  25. data/lib/azure_mgmt_resources/Models/generic_resource_filter.rb +76 -0
  26. data/lib/azure_mgmt_resources/Models/parameters_link.rb +68 -0
  27. data/lib/azure_mgmt_resources/Models/plan.rb +85 -0
  28. data/lib/azure_mgmt_resources/Models/provider.rb +106 -0
  29. data/lib/azure_mgmt_resources/Models/provider_list_result.rb +87 -0
  30. data/lib/azure_mgmt_resources/Models/provider_resource_type.rb +88 -0
  31. data/lib/azure_mgmt_resources/Models/resource_group.rb +105 -0
  32. data/lib/azure_mgmt_resources/Models/resource_group_extended.rb +113 -0
  33. data/lib/azure_mgmt_resources/Models/resource_group_extended_filter.rb +63 -0
  34. data/lib/azure_mgmt_resources/Models/resource_group_filter.rb +67 -0
  35. data/lib/azure_mgmt_resources/Models/resource_group_format_resource_properties.rb +54 -0
  36. data/lib/azure_mgmt_resources/Models/resource_group_list_result.rb +88 -0
  37. data/lib/azure_mgmt_resources/Models/resource_group_properties.rb +58 -0
  38. data/lib/azure_mgmt_resources/Models/resource_list_result.rb +88 -0
  39. data/lib/azure_mgmt_resources/Models/resource_management_error.rb +77 -0
  40. data/lib/azure_mgmt_resources/Models/resource_management_error_with_details.rb +106 -0
  41. data/lib/azure_mgmt_resources/Models/resource_provider_operation_definition.rb +74 -0
  42. data/lib/azure_mgmt_resources/Models/resource_provider_operation_detail_list_result.rb +80 -0
  43. data/lib/azure_mgmt_resources/Models/resource_provider_operation_display_properties.rb +95 -0
  44. data/lib/azure_mgmt_resources/Models/resources_move_info.rb +67 -0
  45. data/lib/azure_mgmt_resources/Models/tag_count.rb +67 -0
  46. data/lib/azure_mgmt_resources/Models/tag_details.rb +112 -0
  47. data/lib/azure_mgmt_resources/Models/tag_value.rb +82 -0
  48. data/lib/azure_mgmt_resources/Models/tags_list_result.rb +87 -0
  49. data/lib/azure_mgmt_resources/Models/target_resource.rb +76 -0
  50. data/lib/azure_mgmt_resources/Models/template_link.rb +68 -0
  51. data/lib/azure_mgmt_resources/deployment_operations.rb +297 -0
  52. data/lib/azure_mgmt_resources/deployments.rb +601 -0
  53. data/lib/azure_mgmt_resources/module_definition.rb +6 -0
  54. data/lib/azure_mgmt_resources/providers.rb +461 -0
  55. data/lib/azure_mgmt_resources/resource_groups.rb +891 -0
  56. data/lib/azure_mgmt_resources/resource_management_client.rb +85 -0
  57. data/lib/azure_mgmt_resources/resource_provider_operation_details.rb +126 -0
  58. data/lib/azure_mgmt_resources/resources.rb +737 -0
  59. data/lib/azure_mgmt_resources/tags.rb +546 -0
  60. data/lib/azure_mgmt_resources/version.rb +6 -0
  61. metadata +235 -0
@@ -0,0 +1,546 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::Resources
7
+ #
8
+ # Tags
9
+ #
10
+ class Tags
11
+ include Azure::ARM::Resources::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the Tags class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return reference to the ResourceManagementClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Delete a subscription resource tag value.
27
+ # @param tag_name [String] The name of the tag.
28
+ # @param tag_value [String] The value of the tag.
29
+ # @param [Hash{String => String}] The hash of custom headers need to be
30
+ # applied to HTTP request.
31
+ #
32
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
33
+ # response.
34
+ #
35
+ def delete_value(tag_name, tag_value, custom_headers = nil)
36
+ fail ArgumentError, 'tag_name is nil' if tag_name.nil?
37
+ fail ArgumentError, 'tag_value is nil' if tag_value.nil?
38
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
39
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
40
+ # Construct URL
41
+ path = "/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}"
42
+ path['{tagName}'] = ERB::Util.url_encode(tag_name) if path.include?('{tagName}')
43
+ path['{tagValue}'] = ERB::Util.url_encode(tag_value) if path.include?('{tagValue}')
44
+ path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
45
+ url = URI.join(@client.base_url, path)
46
+ properties = {}
47
+ properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
48
+ unless url.query.nil?
49
+ url.query.split('&').each do |url_item|
50
+ url_items_parts = url_item.split('=')
51
+ properties[url_items_parts[0]] = url_items_parts[1]
52
+ end
53
+ end
54
+ properties.reject!{ |key, value| value.nil? }
55
+ url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
56
+ fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
57
+ corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
58
+ url = URI.parse(corrected_url)
59
+
60
+ connection = Faraday.new(:url => url) do |faraday|
61
+ faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
62
+ faraday.use :cookie_jar
63
+ faraday.adapter Faraday.default_adapter
64
+ end
65
+ request_headers = Hash.new
66
+
67
+ # Set Headers
68
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
69
+ request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
70
+
71
+ unless custom_headers.nil?
72
+ custom_headers.each do |key, value|
73
+ request_headers[key] = value
74
+ end
75
+ end
76
+
77
+ # Send Request
78
+ promise = Concurrent::Promise.new do
79
+ connection.delete do |request|
80
+ request.headers = request_headers
81
+ @client.credentials.sign_request(request) unless @client.credentials.nil?
82
+ end
83
+ end
84
+
85
+ promise = promise.then do |http_response|
86
+ status_code = http_response.status
87
+ response_content = http_response.body
88
+ unless (status_code == 200 || status_code == 204)
89
+ fail MsRestAzure::AzureOperationError.new(connection, http_response)
90
+ end
91
+
92
+ # Create Result
93
+ result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
94
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
95
+
96
+ result
97
+ end
98
+
99
+ promise.execute
100
+ end
101
+
102
+ #
103
+ # Create a subscription resource tag value.
104
+ # @param tag_name [String] The name of the tag.
105
+ # @param tag_value [String] The value of the tag.
106
+ # @param [Hash{String => String}] The hash of custom headers need to be
107
+ # applied to HTTP request.
108
+ #
109
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
110
+ # response.
111
+ #
112
+ def create_or_update_value(tag_name, tag_value, custom_headers = nil)
113
+ fail ArgumentError, 'tag_name is nil' if tag_name.nil?
114
+ fail ArgumentError, 'tag_value is nil' if tag_value.nil?
115
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
116
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
117
+ # Construct URL
118
+ path = "/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}"
119
+ path['{tagName}'] = ERB::Util.url_encode(tag_name) if path.include?('{tagName}')
120
+ path['{tagValue}'] = ERB::Util.url_encode(tag_value) if path.include?('{tagValue}')
121
+ path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
122
+ url = URI.join(@client.base_url, path)
123
+ properties = {}
124
+ properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
125
+ unless url.query.nil?
126
+ url.query.split('&').each do |url_item|
127
+ url_items_parts = url_item.split('=')
128
+ properties[url_items_parts[0]] = url_items_parts[1]
129
+ end
130
+ end
131
+ properties.reject!{ |key, value| value.nil? }
132
+ url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
133
+ fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
134
+ corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
135
+ url = URI.parse(corrected_url)
136
+
137
+ connection = Faraday.new(:url => url) do |faraday|
138
+ faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
139
+ faraday.use :cookie_jar
140
+ faraday.adapter Faraday.default_adapter
141
+ end
142
+ request_headers = Hash.new
143
+
144
+ # Set Headers
145
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
146
+ request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
147
+
148
+ unless custom_headers.nil?
149
+ custom_headers.each do |key, value|
150
+ request_headers[key] = value
151
+ end
152
+ end
153
+
154
+ # Send Request
155
+ promise = Concurrent::Promise.new do
156
+ connection.put do |request|
157
+ request.headers = request_headers
158
+ @client.credentials.sign_request(request) unless @client.credentials.nil?
159
+ end
160
+ end
161
+
162
+ promise = promise.then do |http_response|
163
+ status_code = http_response.status
164
+ response_content = http_response.body
165
+ unless (status_code == 200 || status_code == 201)
166
+ error_model = JSON.load(response_content)
167
+ fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
168
+ end
169
+
170
+ # Create Result
171
+ result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
172
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
173
+ # Deserialize Response
174
+ if status_code == 200
175
+ begin
176
+ parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
177
+ unless parsed_response.nil?
178
+ parsed_response = TagValue.deserialize_object(parsed_response)
179
+ end
180
+ result.body = parsed_response
181
+ rescue Exception => e
182
+ fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
183
+ end
184
+ end
185
+ # Deserialize Response
186
+ if status_code == 201
187
+ begin
188
+ parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
189
+ unless parsed_response.nil?
190
+ parsed_response = TagValue.deserialize_object(parsed_response)
191
+ end
192
+ result.body = parsed_response
193
+ rescue Exception => e
194
+ fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
195
+ end
196
+ end
197
+
198
+ result
199
+ end
200
+
201
+ promise.execute
202
+ end
203
+
204
+ #
205
+ # Create a subscription resource tag.
206
+ # @param tag_name [String] The name of the tag.
207
+ # @param [Hash{String => String}] The hash of custom headers need to be
208
+ # applied to HTTP request.
209
+ #
210
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
211
+ # response.
212
+ #
213
+ def create_or_update(tag_name, custom_headers = nil)
214
+ fail ArgumentError, 'tag_name is nil' if tag_name.nil?
215
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
216
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
217
+ # Construct URL
218
+ path = "/subscriptions/{subscriptionId}/tagNames/{tagName}"
219
+ path['{tagName}'] = ERB::Util.url_encode(tag_name) if path.include?('{tagName}')
220
+ path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
221
+ url = URI.join(@client.base_url, path)
222
+ properties = {}
223
+ properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
224
+ unless url.query.nil?
225
+ url.query.split('&').each do |url_item|
226
+ url_items_parts = url_item.split('=')
227
+ properties[url_items_parts[0]] = url_items_parts[1]
228
+ end
229
+ end
230
+ properties.reject!{ |key, value| value.nil? }
231
+ url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
232
+ fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
233
+ corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
234
+ url = URI.parse(corrected_url)
235
+
236
+ connection = Faraday.new(:url => url) do |faraday|
237
+ faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
238
+ faraday.use :cookie_jar
239
+ faraday.adapter Faraday.default_adapter
240
+ end
241
+ request_headers = Hash.new
242
+
243
+ # Set Headers
244
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
245
+ request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
246
+
247
+ unless custom_headers.nil?
248
+ custom_headers.each do |key, value|
249
+ request_headers[key] = value
250
+ end
251
+ end
252
+
253
+ # Send Request
254
+ promise = Concurrent::Promise.new do
255
+ connection.put do |request|
256
+ request.headers = request_headers
257
+ @client.credentials.sign_request(request) unless @client.credentials.nil?
258
+ end
259
+ end
260
+
261
+ promise = promise.then do |http_response|
262
+ status_code = http_response.status
263
+ response_content = http_response.body
264
+ unless (status_code == 200 || status_code == 201)
265
+ error_model = JSON.load(response_content)
266
+ fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
267
+ end
268
+
269
+ # Create Result
270
+ result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
271
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
272
+ # Deserialize Response
273
+ if status_code == 200
274
+ begin
275
+ parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
276
+ unless parsed_response.nil?
277
+ parsed_response = TagDetails.deserialize_object(parsed_response)
278
+ end
279
+ result.body = parsed_response
280
+ rescue Exception => e
281
+ fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
282
+ end
283
+ end
284
+ # Deserialize Response
285
+ if status_code == 201
286
+ begin
287
+ parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
288
+ unless parsed_response.nil?
289
+ parsed_response = TagDetails.deserialize_object(parsed_response)
290
+ end
291
+ result.body = parsed_response
292
+ rescue Exception => e
293
+ fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
294
+ end
295
+ end
296
+
297
+ result
298
+ end
299
+
300
+ promise.execute
301
+ end
302
+
303
+ #
304
+ # Delete a subscription resource tag.
305
+ # @param tag_name [String] The name of the tag.
306
+ # @param [Hash{String => String}] The hash of custom headers need to be
307
+ # applied to HTTP request.
308
+ #
309
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
310
+ # response.
311
+ #
312
+ def delete(tag_name, custom_headers = nil)
313
+ fail ArgumentError, 'tag_name is nil' if tag_name.nil?
314
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
315
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
316
+ # Construct URL
317
+ path = "/subscriptions/{subscriptionId}/tagNames/{tagName}"
318
+ path['{tagName}'] = ERB::Util.url_encode(tag_name) if path.include?('{tagName}')
319
+ path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
320
+ url = URI.join(@client.base_url, path)
321
+ properties = {}
322
+ properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
323
+ unless url.query.nil?
324
+ url.query.split('&').each do |url_item|
325
+ url_items_parts = url_item.split('=')
326
+ properties[url_items_parts[0]] = url_items_parts[1]
327
+ end
328
+ end
329
+ properties.reject!{ |key, value| value.nil? }
330
+ url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
331
+ fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
332
+ corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
333
+ url = URI.parse(corrected_url)
334
+
335
+ connection = Faraday.new(:url => url) do |faraday|
336
+ faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
337
+ faraday.use :cookie_jar
338
+ faraday.adapter Faraday.default_adapter
339
+ end
340
+ request_headers = Hash.new
341
+
342
+ # Set Headers
343
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
344
+ request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
345
+
346
+ unless custom_headers.nil?
347
+ custom_headers.each do |key, value|
348
+ request_headers[key] = value
349
+ end
350
+ end
351
+
352
+ # Send Request
353
+ promise = Concurrent::Promise.new do
354
+ connection.delete do |request|
355
+ request.headers = request_headers
356
+ @client.credentials.sign_request(request) unless @client.credentials.nil?
357
+ end
358
+ end
359
+
360
+ promise = promise.then do |http_response|
361
+ status_code = http_response.status
362
+ response_content = http_response.body
363
+ unless (status_code == 200 || status_code == 204)
364
+ fail MsRestAzure::AzureOperationError.new(connection, http_response)
365
+ end
366
+
367
+ # Create Result
368
+ result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
369
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
370
+
371
+ result
372
+ end
373
+
374
+ promise.execute
375
+ end
376
+
377
+ #
378
+ # Get a list of subscription resource tags.
379
+ # @param [Hash{String => String}] The hash of custom headers need to be
380
+ # applied to HTTP request.
381
+ #
382
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
383
+ # response.
384
+ #
385
+ def list(custom_headers = nil)
386
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
387
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
388
+ # Construct URL
389
+ path = "/subscriptions/{subscriptionId}/tagNames"
390
+ path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
391
+ url = URI.join(@client.base_url, path)
392
+ properties = {}
393
+ properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
394
+ unless url.query.nil?
395
+ url.query.split('&').each do |url_item|
396
+ url_items_parts = url_item.split('=')
397
+ properties[url_items_parts[0]] = url_items_parts[1]
398
+ end
399
+ end
400
+ properties.reject!{ |key, value| value.nil? }
401
+ url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
402
+ fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
403
+ corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
404
+ url = URI.parse(corrected_url)
405
+
406
+ connection = Faraday.new(:url => url) do |faraday|
407
+ faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
408
+ faraday.use :cookie_jar
409
+ faraday.adapter Faraday.default_adapter
410
+ end
411
+ request_headers = Hash.new
412
+
413
+ # Set Headers
414
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
415
+ request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
416
+
417
+ unless custom_headers.nil?
418
+ custom_headers.each do |key, value|
419
+ request_headers[key] = value
420
+ end
421
+ end
422
+
423
+ # Send Request
424
+ promise = Concurrent::Promise.new do
425
+ connection.get do |request|
426
+ request.headers = request_headers
427
+ @client.credentials.sign_request(request) unless @client.credentials.nil?
428
+ end
429
+ end
430
+
431
+ promise = promise.then do |http_response|
432
+ status_code = http_response.status
433
+ response_content = http_response.body
434
+ unless (status_code == 200)
435
+ error_model = JSON.load(response_content)
436
+ fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
437
+ end
438
+
439
+ # Create Result
440
+ result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
441
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
442
+ # Deserialize Response
443
+ if status_code == 200
444
+ begin
445
+ parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
446
+ unless parsed_response.nil?
447
+ parsed_response = TagsListResult.deserialize_object(parsed_response)
448
+ end
449
+ result.body = parsed_response
450
+ rescue Exception => e
451
+ fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
452
+ end
453
+ end
454
+
455
+ result
456
+ end
457
+
458
+ promise.execute
459
+ end
460
+
461
+ #
462
+ # Get a list of subscription resource tags.
463
+ # @param next_page_link [String] The NextLink from the previous successful
464
+ # call to List operation.
465
+ # @param [Hash{String => String}] The hash of custom headers need to be
466
+ # applied to HTTP request.
467
+ #
468
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
469
+ # response.
470
+ #
471
+ def list_next(next_page_link, custom_headers = nil)
472
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
473
+ # Construct URL
474
+ path = "{nextLink}"
475
+ path['{nextLink}'] = next_page_link if path.include?('{nextLink}')
476
+ url = URI.parse(path)
477
+ properties = {}
478
+ unless url.query.nil?
479
+ url.query.split('&').each do |url_item|
480
+ url_items_parts = url_item.split('=')
481
+ properties[url_items_parts[0]] = url_items_parts[1]
482
+ end
483
+ end
484
+ properties.reject!{ |key, value| value.nil? }
485
+ url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
486
+ fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
487
+ corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
488
+ url = URI.parse(corrected_url)
489
+
490
+ connection = Faraday.new(:url => url) do |faraday|
491
+ faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
492
+ faraday.use :cookie_jar
493
+ faraday.adapter Faraday.default_adapter
494
+ end
495
+ request_headers = Hash.new
496
+
497
+ # Set Headers
498
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
499
+ request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
500
+
501
+ unless custom_headers.nil?
502
+ custom_headers.each do |key, value|
503
+ request_headers[key] = value
504
+ end
505
+ end
506
+
507
+ # Send Request
508
+ promise = Concurrent::Promise.new do
509
+ connection.get do |request|
510
+ request.headers = request_headers
511
+ @client.credentials.sign_request(request) unless @client.credentials.nil?
512
+ end
513
+ end
514
+
515
+ promise = promise.then do |http_response|
516
+ status_code = http_response.status
517
+ response_content = http_response.body
518
+ unless (status_code == 200)
519
+ error_model = JSON.load(response_content)
520
+ fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
521
+ end
522
+
523
+ # Create Result
524
+ result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
525
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
526
+ # Deserialize Response
527
+ if status_code == 200
528
+ begin
529
+ parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
530
+ unless parsed_response.nil?
531
+ parsed_response = TagsListResult.deserialize_object(parsed_response)
532
+ end
533
+ result.body = parsed_response
534
+ rescue Exception => e
535
+ fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
536
+ end
537
+ end
538
+
539
+ result
540
+ end
541
+
542
+ promise.execute
543
+ end
544
+
545
+ end
546
+ end