azure_mgmt_peering 0.17.0

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