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