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,283 @@
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
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class PeeringClient < MsRestAzure::AzureServiceClient
11
+ include MsRestAzure
12
+ include MsRestAzure::Serialization
13
+
14
+ # @return [String] the base URI of the service.
15
+ attr_accessor :base_url
16
+
17
+ # @return Credentials needed for the client to connect to Azure.
18
+ attr_reader :credentials
19
+
20
+ # @return [String] The Azure subscription ID.
21
+ attr_accessor :subscription_id
22
+
23
+ # @return [String] The client API version.
24
+ attr_reader :api_version
25
+
26
+ # @return [String] The preferred language for the response.
27
+ attr_accessor :accept_language
28
+
29
+ # @return [Integer] The retry timeout in seconds for Long Running
30
+ # Operations. Default value is 30.
31
+ attr_accessor :long_running_operation_retry_timeout
32
+
33
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
34
+ # generated. When set to true a unique x-ms-client-request-id value is
35
+ # generated and included in each request. Default is true.
36
+ attr_accessor :generate_client_request_id
37
+
38
+ # @return [LegacyPeerings] legacy_peerings
39
+ attr_reader :legacy_peerings
40
+
41
+ # @return [Operations] operations
42
+ attr_reader :operations
43
+
44
+ # @return [PeerAsns] peer_asns
45
+ attr_reader :peer_asns
46
+
47
+ # @return [PeeringLocations] peering_locations
48
+ attr_reader :peering_locations
49
+
50
+ # @return [Peerings] peerings
51
+ attr_reader :peerings
52
+
53
+ # @return [PeeringServiceLocations] peering_service_locations
54
+ attr_reader :peering_service_locations
55
+
56
+ # @return [PeeringServicePrefixes] peering_service_prefixes
57
+ attr_reader :peering_service_prefixes
58
+
59
+ # @return [Prefixes] prefixes
60
+ attr_reader :prefixes
61
+
62
+ # @return [PeeringServiceProviders] peering_service_providers
63
+ attr_reader :peering_service_providers
64
+
65
+ # @return [PeeringServices] peering_services
66
+ attr_reader :peering_services
67
+
68
+ #
69
+ # Creates initializes a new instance of the PeeringClient class.
70
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
71
+ # @param base_url [String] the base URI of the service.
72
+ # @param options [Array] filters to be applied to the HTTP requests.
73
+ #
74
+ def initialize(credentials = nil, base_url = nil, options = nil)
75
+ super(credentials, options)
76
+ @base_url = base_url || 'https://management.azure.com'
77
+
78
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
79
+ @credentials = credentials
80
+
81
+ @legacy_peerings = LegacyPeerings.new(self)
82
+ @operations = Operations.new(self)
83
+ @peer_asns = PeerAsns.new(self)
84
+ @peering_locations = PeeringLocations.new(self)
85
+ @peerings = Peerings.new(self)
86
+ @peering_service_locations = PeeringServiceLocations.new(self)
87
+ @peering_service_prefixes = PeeringServicePrefixes.new(self)
88
+ @prefixes = Prefixes.new(self)
89
+ @peering_service_providers = PeeringServiceProviders.new(self)
90
+ @peering_services = PeeringServices.new(self)
91
+ @api_version = '2019-08-01-preview'
92
+ @accept_language = 'en-US'
93
+ @long_running_operation_retry_timeout = 30
94
+ @generate_client_request_id = true
95
+ add_telemetry
96
+ end
97
+
98
+ #
99
+ # Makes a request and returns the body of the response.
100
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
101
+ # @param path [String] the path, relative to {base_url}.
102
+ # @param options [Hash{String=>String}] specifying any request options like :body.
103
+ # @return [Hash{String=>String}] containing the body of the response.
104
+ # Example:
105
+ #
106
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
107
+ # path = "/path"
108
+ # options = {
109
+ # body: request_content,
110
+ # query_params: {'api-version' => '2016-02-01'}
111
+ # }
112
+ # result = @client.make_request(:put, path, options)
113
+ #
114
+ def make_request(method, path, options = {})
115
+ result = make_request_with_http_info(method, path, options)
116
+ result.body unless result.nil?
117
+ end
118
+
119
+ #
120
+ # Makes a request and returns the operation response.
121
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
122
+ # @param path [String] the path, relative to {base_url}.
123
+ # @param options [Hash{String=>String}] specifying any request options like :body.
124
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
125
+ #
126
+ def make_request_with_http_info(method, path, options = {})
127
+ result = make_request_async(method, path, options).value!
128
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
129
+ result
130
+ end
131
+
132
+ #
133
+ # Makes a request asynchronously.
134
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
135
+ # @param path [String] the path, relative to {base_url}.
136
+ # @param options [Hash{String=>String}] specifying any request options like :body.
137
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
138
+ #
139
+ def make_request_async(method, path, options = {})
140
+ fail ArgumentError, 'method is nil' if method.nil?
141
+ fail ArgumentError, 'path is nil' if path.nil?
142
+
143
+ request_url = options[:base_url] || @base_url
144
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
145
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
146
+ end
147
+
148
+ request_headers = @request_headers
149
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
150
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
151
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
152
+
153
+ super(request_url, method, path, options)
154
+ end
155
+
156
+ #
157
+ # Checks if the peering service provider is present within 1000 miles of
158
+ # customer's location
159
+ #
160
+ # @param check_service_provider_availability_input
161
+ # [CheckServiceProviderAvailabilityInput] The
162
+ # CheckServiceProviderAvailabilityInput
163
+ # indicating customer location and service provider.
164
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
165
+ # will be added to the HTTP request.
166
+ #
167
+ # @return [enum] operation results.
168
+ #
169
+ def check_service_provider_availability(check_service_provider_availability_input, custom_headers:nil)
170
+ response = check_service_provider_availability_async(check_service_provider_availability_input, custom_headers:custom_headers).value!
171
+ response.body unless response.nil?
172
+ end
173
+
174
+ #
175
+ # Checks if the peering service provider is present within 1000 miles of
176
+ # customer's location
177
+ #
178
+ # @param check_service_provider_availability_input
179
+ # [CheckServiceProviderAvailabilityInput] The
180
+ # CheckServiceProviderAvailabilityInput
181
+ # indicating customer location and service provider.
182
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
183
+ # will be added to the HTTP request.
184
+ #
185
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
186
+ #
187
+ def check_service_provider_availability_with_http_info(check_service_provider_availability_input, custom_headers:nil)
188
+ check_service_provider_availability_async(check_service_provider_availability_input, custom_headers:custom_headers).value!
189
+ end
190
+
191
+ #
192
+ # Checks if the peering service provider is present within 1000 miles of
193
+ # customer's location
194
+ #
195
+ # @param check_service_provider_availability_input
196
+ # [CheckServiceProviderAvailabilityInput] The
197
+ # CheckServiceProviderAvailabilityInput
198
+ # indicating customer location and service provider.
199
+ # @param [Hash{String => String}] A hash of custom headers that will be added
200
+ # to the HTTP request.
201
+ #
202
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
203
+ #
204
+ def check_service_provider_availability_async(check_service_provider_availability_input, custom_headers:nil)
205
+ fail ArgumentError, 'check_service_provider_availability_input is nil' if check_service_provider_availability_input.nil?
206
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
207
+ fail ArgumentError, 'api_version is nil' if api_version.nil?
208
+
209
+
210
+ request_headers = {}
211
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
212
+
213
+ # Set Headers
214
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
215
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
216
+
217
+ # Serialize Request
218
+ request_mapper = Azure::Peering::Mgmt::V2019_08_01_preview::Models::CheckServiceProviderAvailabilityInput.mapper()
219
+ request_content = self.serialize(request_mapper, check_service_provider_availability_input)
220
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
221
+
222
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Peering/CheckServiceProviderAvailability'
223
+
224
+ request_url = @base_url || self.base_url
225
+
226
+ options = {
227
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
228
+ path_params: {'subscriptionId' => subscription_id},
229
+ query_params: {'api-version' => api_version},
230
+ body: request_content,
231
+ headers: request_headers.merge(custom_headers || {}),
232
+ base_url: request_url
233
+ }
234
+ promise = self.make_request_async(:post, path_template, options)
235
+
236
+ promise = promise.then do |result|
237
+ http_response = result.response
238
+ status_code = http_response.status
239
+ response_content = http_response.body
240
+ unless status_code == 200
241
+ error_model = JSON.load(response_content)
242
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
243
+ end
244
+
245
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
246
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
247
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
248
+ # Deserialize Response
249
+ if status_code == 200
250
+ begin
251
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
252
+ result_mapper = {
253
+ client_side_validation: true,
254
+ required: false,
255
+ serialized_name: 'parsed_response',
256
+ type: {
257
+ name: 'String'
258
+ }
259
+ }
260
+ result.body = self.deserialize(result_mapper, parsed_response)
261
+ rescue Exception => e
262
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
263
+ end
264
+ end
265
+
266
+ result
267
+ end
268
+
269
+ promise.execute
270
+ end
271
+
272
+
273
+ private
274
+ #
275
+ # Adds telemetry information.
276
+ #
277
+ def add_telemetry
278
+ sdk_information = 'azure_mgmt_peering'
279
+ sdk_information = "#{sdk_information}/0.17.0"
280
+ add_user_agent_information(sdk_information)
281
+ end
282
+ end
283
+ end
@@ -0,0 +1,245 @@
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 PeeringLocations
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the PeeringLocations 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
+ # Lists all of the available peering locations for the specified kind of
26
+ # peering.
27
+ #
28
+ # @param kind [Enum] The kind of the peering. Possible values include:
29
+ # 'Direct', 'Exchange'
30
+ # @param direct_peering_type [Enum] The type of direct peering. Possible values
31
+ # include: 'Edge', 'Transit', 'Cdn', 'Internal'
32
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
33
+ # will be added to the HTTP request.
34
+ #
35
+ # @return [Array<PeeringLocation>] operation results.
36
+ #
37
+ def list(kind, direct_peering_type:nil, custom_headers:nil)
38
+ first_page = list_as_lazy(kind, direct_peering_type:direct_peering_type, custom_headers:custom_headers)
39
+ first_page.get_all_items
40
+ end
41
+
42
+ #
43
+ # Lists all of the available peering locations for the specified kind of
44
+ # peering.
45
+ #
46
+ # @param kind [Enum] The kind of the peering. Possible values include:
47
+ # 'Direct', 'Exchange'
48
+ # @param direct_peering_type [Enum] The type of direct peering. Possible values
49
+ # include: 'Edge', 'Transit', 'Cdn', 'Internal'
50
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
51
+ # will be added to the HTTP request.
52
+ #
53
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
54
+ #
55
+ def list_with_http_info(kind, direct_peering_type:nil, custom_headers:nil)
56
+ list_async(kind, direct_peering_type:direct_peering_type, custom_headers:custom_headers).value!
57
+ end
58
+
59
+ #
60
+ # Lists all of the available peering locations for the specified kind of
61
+ # peering.
62
+ #
63
+ # @param kind [Enum] The kind of the peering. Possible values include:
64
+ # 'Direct', 'Exchange'
65
+ # @param direct_peering_type [Enum] The type of direct peering. Possible values
66
+ # include: 'Edge', 'Transit', 'Cdn', 'Internal'
67
+ # @param [Hash{String => String}] A hash of custom headers that will be added
68
+ # to the HTTP request.
69
+ #
70
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
71
+ #
72
+ def list_async(kind, direct_peering_type:nil, custom_headers:nil)
73
+ fail ArgumentError, 'kind is nil' if kind.nil?
74
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
75
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
76
+
77
+
78
+ request_headers = {}
79
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
80
+
81
+ # Set Headers
82
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
83
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
84
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringLocations'
85
+
86
+ request_url = @base_url || @client.base_url
87
+
88
+ options = {
89
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
90
+ path_params: {'subscriptionId' => @client.subscription_id},
91
+ query_params: {'kind' => kind,'directPeeringType' => direct_peering_type,'api-version' => @client.api_version},
92
+ headers: request_headers.merge(custom_headers || {}),
93
+ base_url: request_url
94
+ }
95
+ promise = @client.make_request_async(:get, path_template, options)
96
+
97
+ promise = promise.then do |result|
98
+ http_response = result.response
99
+ status_code = http_response.status
100
+ response_content = http_response.body
101
+ unless status_code == 200
102
+ error_model = JSON.load(response_content)
103
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
104
+ end
105
+
106
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
107
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
108
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
109
+ # Deserialize Response
110
+ if status_code == 200
111
+ begin
112
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
113
+ result_mapper = Azure::Peering::Mgmt::V2019_08_01_preview::Models::PeeringLocationListResult.mapper()
114
+ result.body = @client.deserialize(result_mapper, parsed_response)
115
+ rescue Exception => e
116
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
117
+ end
118
+ end
119
+
120
+ result
121
+ end
122
+
123
+ promise.execute
124
+ end
125
+
126
+ #
127
+ # Lists all of the available peering locations for the specified kind of
128
+ # peering.
129
+ #
130
+ # @param next_page_link [String] The NextLink from the previous successful call
131
+ # to List operation.
132
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
133
+ # will be added to the HTTP request.
134
+ #
135
+ # @return [PeeringLocationListResult] operation results.
136
+ #
137
+ def list_next(next_page_link, custom_headers:nil)
138
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
139
+ response.body unless response.nil?
140
+ end
141
+
142
+ #
143
+ # Lists all of the available peering locations for the specified kind of
144
+ # peering.
145
+ #
146
+ # @param next_page_link [String] The NextLink from the previous successful call
147
+ # to List operation.
148
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
149
+ # will be added to the HTTP request.
150
+ #
151
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
152
+ #
153
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
154
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
155
+ end
156
+
157
+ #
158
+ # Lists all of the available peering locations for the specified kind of
159
+ # peering.
160
+ #
161
+ # @param next_page_link [String] The NextLink from the previous successful call
162
+ # to List operation.
163
+ # @param [Hash{String => String}] A hash of custom headers that will be added
164
+ # to the HTTP request.
165
+ #
166
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
167
+ #
168
+ def list_next_async(next_page_link, custom_headers:nil)
169
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
170
+
171
+
172
+ request_headers = {}
173
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
174
+
175
+ # Set Headers
176
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
177
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
178
+ path_template = '{nextLink}'
179
+
180
+ request_url = @base_url || @client.base_url
181
+
182
+ options = {
183
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
184
+ skip_encoding_path_params: {'nextLink' => next_page_link},
185
+ headers: request_headers.merge(custom_headers || {}),
186
+ base_url: request_url
187
+ }
188
+ promise = @client.make_request_async(:get, path_template, options)
189
+
190
+ promise = promise.then do |result|
191
+ http_response = result.response
192
+ status_code = http_response.status
193
+ response_content = http_response.body
194
+ unless status_code == 200
195
+ error_model = JSON.load(response_content)
196
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
197
+ end
198
+
199
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
200
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
201
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
202
+ # Deserialize Response
203
+ if status_code == 200
204
+ begin
205
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
206
+ result_mapper = Azure::Peering::Mgmt::V2019_08_01_preview::Models::PeeringLocationListResult.mapper()
207
+ result.body = @client.deserialize(result_mapper, parsed_response)
208
+ rescue Exception => e
209
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
210
+ end
211
+ end
212
+
213
+ result
214
+ end
215
+
216
+ promise.execute
217
+ end
218
+
219
+ #
220
+ # Lists all of the available peering locations for the specified kind of
221
+ # peering.
222
+ #
223
+ # @param kind [Enum] The kind of the peering. Possible values include:
224
+ # 'Direct', 'Exchange'
225
+ # @param direct_peering_type [Enum] The type of direct peering. Possible values
226
+ # include: 'Edge', 'Transit', 'Cdn', 'Internal'
227
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
228
+ # will be added to the HTTP request.
229
+ #
230
+ # @return [PeeringLocationListResult] which provide lazy access to pages of the
231
+ # response.
232
+ #
233
+ def list_as_lazy(kind, direct_peering_type:nil, custom_headers:nil)
234
+ response = list_async(kind, direct_peering_type:direct_peering_type, custom_headers:custom_headers).value!
235
+ unless response.nil?
236
+ page = response.body
237
+ page.next_method = Proc.new do |next_page_link|
238
+ list_next_async(next_page_link, custom_headers:custom_headers)
239
+ end
240
+ page
241
+ end
242
+ end
243
+
244
+ end
245
+ end