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,219 @@
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 Operations
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Operations 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 API operations for peering resources.
26
+ #
27
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
28
+ # will be added to the HTTP request.
29
+ #
30
+ # @return [Array<Operation>] operation results.
31
+ #
32
+ def list(custom_headers:nil)
33
+ first_page = list_as_lazy(custom_headers:custom_headers)
34
+ first_page.get_all_items
35
+ end
36
+
37
+ #
38
+ # Lists all of the available API operations for peering resources.
39
+ #
40
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
41
+ # will be added to the HTTP request.
42
+ #
43
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
44
+ #
45
+ def list_with_http_info(custom_headers:nil)
46
+ list_async(custom_headers:custom_headers).value!
47
+ end
48
+
49
+ #
50
+ # Lists all of the available API operations for peering resources.
51
+ #
52
+ # @param [Hash{String => String}] A hash of custom headers that will be added
53
+ # to the HTTP request.
54
+ #
55
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
56
+ #
57
+ def list_async(custom_headers:nil)
58
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
59
+
60
+
61
+ request_headers = {}
62
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
63
+
64
+ # Set Headers
65
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
66
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
67
+ path_template = 'providers/Microsoft.Peering/operations'
68
+
69
+ request_url = @base_url || @client.base_url
70
+
71
+ options = {
72
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
73
+ query_params: {'api-version' => @client.api_version},
74
+ headers: request_headers.merge(custom_headers || {}),
75
+ base_url: request_url
76
+ }
77
+ promise = @client.make_request_async(:get, path_template, options)
78
+
79
+ promise = promise.then do |result|
80
+ http_response = result.response
81
+ status_code = http_response.status
82
+ response_content = http_response.body
83
+ unless status_code == 200
84
+ error_model = JSON.load(response_content)
85
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
86
+ end
87
+
88
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
89
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
90
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
91
+ # Deserialize Response
92
+ if status_code == 200
93
+ begin
94
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
95
+ result_mapper = Azure::Peering::Mgmt::V2019_08_01_preview::Models::OperationListResult.mapper()
96
+ result.body = @client.deserialize(result_mapper, parsed_response)
97
+ rescue Exception => e
98
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
99
+ end
100
+ end
101
+
102
+ result
103
+ end
104
+
105
+ promise.execute
106
+ end
107
+
108
+ #
109
+ # Lists all of the available API operations for peering resources.
110
+ #
111
+ # @param next_page_link [String] The NextLink from the previous successful call
112
+ # to List operation.
113
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
114
+ # will be added to the HTTP request.
115
+ #
116
+ # @return [OperationListResult] operation results.
117
+ #
118
+ def list_next(next_page_link, custom_headers:nil)
119
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
120
+ response.body unless response.nil?
121
+ end
122
+
123
+ #
124
+ # Lists all of the available API operations for peering resources.
125
+ #
126
+ # @param next_page_link [String] The NextLink from the previous successful call
127
+ # to List operation.
128
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
129
+ # will be added to the HTTP request.
130
+ #
131
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
132
+ #
133
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
134
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
135
+ end
136
+
137
+ #
138
+ # Lists all of the available API operations for peering resources.
139
+ #
140
+ # @param next_page_link [String] The NextLink from the previous successful call
141
+ # to List operation.
142
+ # @param [Hash{String => String}] A hash of custom headers that will be added
143
+ # to the HTTP request.
144
+ #
145
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
146
+ #
147
+ def list_next_async(next_page_link, custom_headers:nil)
148
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
149
+
150
+
151
+ request_headers = {}
152
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
153
+
154
+ # Set Headers
155
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
156
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
157
+ path_template = '{nextLink}'
158
+
159
+ request_url = @base_url || @client.base_url
160
+
161
+ options = {
162
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
163
+ skip_encoding_path_params: {'nextLink' => next_page_link},
164
+ headers: request_headers.merge(custom_headers || {}),
165
+ base_url: request_url
166
+ }
167
+ promise = @client.make_request_async(:get, path_template, options)
168
+
169
+ promise = promise.then do |result|
170
+ http_response = result.response
171
+ status_code = http_response.status
172
+ response_content = http_response.body
173
+ unless status_code == 200
174
+ error_model = JSON.load(response_content)
175
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
176
+ end
177
+
178
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
179
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
180
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
181
+ # Deserialize Response
182
+ if status_code == 200
183
+ begin
184
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
185
+ result_mapper = Azure::Peering::Mgmt::V2019_08_01_preview::Models::OperationListResult.mapper()
186
+ result.body = @client.deserialize(result_mapper, parsed_response)
187
+ rescue Exception => e
188
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
189
+ end
190
+ end
191
+
192
+ result
193
+ end
194
+
195
+ promise.execute
196
+ end
197
+
198
+ #
199
+ # Lists all of the available API operations for peering resources.
200
+ #
201
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
202
+ # will be added to the HTTP request.
203
+ #
204
+ # @return [OperationListResult] which provide lazy access to pages of the
205
+ # response.
206
+ #
207
+ def list_as_lazy(custom_headers:nil)
208
+ response = list_async(custom_headers:custom_headers).value!
209
+ unless response.nil?
210
+ page = response.body
211
+ page.next_method = Proc.new do |next_page_link|
212
+ list_next_async(next_page_link, custom_headers:custom_headers)
213
+ end
214
+ page
215
+ end
216
+ end
217
+
218
+ end
219
+ end
@@ -0,0 +1,507 @@
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 PeerAsns
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the PeerAsns 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 the peer ASN with the specified name under the given subscription.
26
+ #
27
+ # @param peer_asn_name [String] The peer ASN name.
28
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
29
+ # will be added to the HTTP request.
30
+ #
31
+ # @return [PeerAsn] operation results.
32
+ #
33
+ def get(peer_asn_name, custom_headers:nil)
34
+ response = get_async(peer_asn_name, custom_headers:custom_headers).value!
35
+ response.body unless response.nil?
36
+ end
37
+
38
+ #
39
+ # Gets the peer ASN with the specified name under the given subscription.
40
+ #
41
+ # @param peer_asn_name [String] The peer ASN name.
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 get_with_http_info(peer_asn_name, custom_headers:nil)
48
+ get_async(peer_asn_name, custom_headers:custom_headers).value!
49
+ end
50
+
51
+ #
52
+ # Gets the peer ASN with the specified name under the given subscription.
53
+ #
54
+ # @param peer_asn_name [String] The peer ASN name.
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 get_async(peer_asn_name, custom_headers:nil)
61
+ fail ArgumentError, 'peer_asn_name is nil' if peer_asn_name.nil?
62
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
63
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
64
+
65
+
66
+ request_headers = {}
67
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
68
+
69
+ # Set Headers
70
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
71
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
72
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerAsns/{peerAsnName}'
73
+
74
+ request_url = @base_url || @client.base_url
75
+
76
+ options = {
77
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
78
+ path_params: {'peerAsnName' => peer_asn_name,'subscriptionId' => @client.subscription_id},
79
+ query_params: {'api-version' => @client.api_version},
80
+ headers: request_headers.merge(custom_headers || {}),
81
+ base_url: request_url
82
+ }
83
+ promise = @client.make_request_async(:get, path_template, options)
84
+
85
+ promise = promise.then do |result|
86
+ http_response = result.response
87
+ status_code = http_response.status
88
+ response_content = http_response.body
89
+ unless status_code == 200
90
+ error_model = JSON.load(response_content)
91
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
92
+ end
93
+
94
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
95
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
96
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
97
+ # Deserialize Response
98
+ if status_code == 200
99
+ begin
100
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
101
+ result_mapper = Azure::Peering::Mgmt::V2019_08_01_preview::Models::PeerAsn.mapper()
102
+ result.body = @client.deserialize(result_mapper, parsed_response)
103
+ rescue Exception => e
104
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
105
+ end
106
+ end
107
+
108
+ result
109
+ end
110
+
111
+ promise.execute
112
+ end
113
+
114
+ #
115
+ # Creates a new peer ASN or updates an existing peer ASN with the specified
116
+ # name under the given subscription.
117
+ #
118
+ # @param peer_asn_name [String] The peer ASN name.
119
+ # @param peer_asn [PeerAsn] The peer ASN.
120
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
121
+ # will be added to the HTTP request.
122
+ #
123
+ # @return [PeerAsn] operation results.
124
+ #
125
+ def create_or_update(peer_asn_name, peer_asn, custom_headers:nil)
126
+ response = create_or_update_async(peer_asn_name, peer_asn, custom_headers:custom_headers).value!
127
+ response.body unless response.nil?
128
+ end
129
+
130
+ #
131
+ # Creates a new peer ASN or updates an existing peer ASN with the specified
132
+ # name under the given subscription.
133
+ #
134
+ # @param peer_asn_name [String] The peer ASN name.
135
+ # @param peer_asn [PeerAsn] The peer ASN.
136
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
137
+ # will be added to the HTTP request.
138
+ #
139
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
140
+ #
141
+ def create_or_update_with_http_info(peer_asn_name, peer_asn, custom_headers:nil)
142
+ create_or_update_async(peer_asn_name, peer_asn, custom_headers:custom_headers).value!
143
+ end
144
+
145
+ #
146
+ # Creates a new peer ASN or updates an existing peer ASN with the specified
147
+ # name under the given subscription.
148
+ #
149
+ # @param peer_asn_name [String] The peer ASN name.
150
+ # @param peer_asn [PeerAsn] The peer ASN.
151
+ # @param [Hash{String => String}] A hash of custom headers that will be added
152
+ # to the HTTP request.
153
+ #
154
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
155
+ #
156
+ def create_or_update_async(peer_asn_name, peer_asn, custom_headers:nil)
157
+ fail ArgumentError, 'peer_asn_name is nil' if peer_asn_name.nil?
158
+ fail ArgumentError, 'peer_asn is nil' if peer_asn.nil?
159
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
160
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
161
+
162
+
163
+ request_headers = {}
164
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
165
+
166
+ # Set Headers
167
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
168
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
169
+
170
+ # Serialize Request
171
+ request_mapper = Azure::Peering::Mgmt::V2019_08_01_preview::Models::PeerAsn.mapper()
172
+ request_content = @client.serialize(request_mapper, peer_asn)
173
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
174
+
175
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerAsns/{peerAsnName}'
176
+
177
+ request_url = @base_url || @client.base_url
178
+
179
+ options = {
180
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
181
+ path_params: {'peerAsnName' => peer_asn_name,'subscriptionId' => @client.subscription_id},
182
+ query_params: {'api-version' => @client.api_version},
183
+ body: request_content,
184
+ headers: request_headers.merge(custom_headers || {}),
185
+ base_url: request_url
186
+ }
187
+ promise = @client.make_request_async(:put, path_template, options)
188
+
189
+ promise = promise.then do |result|
190
+ http_response = result.response
191
+ status_code = http_response.status
192
+ response_content = http_response.body
193
+ unless status_code == 200 || status_code == 201
194
+ error_model = JSON.load(response_content)
195
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
196
+ end
197
+
198
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
199
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
200
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
201
+ # Deserialize Response
202
+ if status_code == 200
203
+ begin
204
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
205
+ result_mapper = Azure::Peering::Mgmt::V2019_08_01_preview::Models::PeerAsn.mapper()
206
+ result.body = @client.deserialize(result_mapper, parsed_response)
207
+ rescue Exception => e
208
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
209
+ end
210
+ end
211
+ # Deserialize Response
212
+ if status_code == 201
213
+ begin
214
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
215
+ result_mapper = Azure::Peering::Mgmt::V2019_08_01_preview::Models::PeerAsn.mapper()
216
+ result.body = @client.deserialize(result_mapper, parsed_response)
217
+ rescue Exception => e
218
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
219
+ end
220
+ end
221
+
222
+ result
223
+ end
224
+
225
+ promise.execute
226
+ end
227
+
228
+ #
229
+ # Deletes an existing peer ASN with the specified name under the given
230
+ # subscription.
231
+ #
232
+ # @param peer_asn_name [String] The peer ASN name.
233
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
234
+ # will be added to the HTTP request.
235
+ #
236
+ #
237
+ def delete(peer_asn_name, custom_headers:nil)
238
+ response = delete_async(peer_asn_name, custom_headers:custom_headers).value!
239
+ nil
240
+ end
241
+
242
+ #
243
+ # Deletes an existing peer ASN with the specified name under the given
244
+ # subscription.
245
+ #
246
+ # @param peer_asn_name [String] The peer ASN name.
247
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
248
+ # will be added to the HTTP request.
249
+ #
250
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
251
+ #
252
+ def delete_with_http_info(peer_asn_name, custom_headers:nil)
253
+ delete_async(peer_asn_name, custom_headers:custom_headers).value!
254
+ end
255
+
256
+ #
257
+ # Deletes an existing peer ASN with the specified name under the given
258
+ # subscription.
259
+ #
260
+ # @param peer_asn_name [String] The peer ASN name.
261
+ # @param [Hash{String => String}] A hash of custom headers that will be added
262
+ # to the HTTP request.
263
+ #
264
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
265
+ #
266
+ def delete_async(peer_asn_name, custom_headers:nil)
267
+ fail ArgumentError, 'peer_asn_name is nil' if peer_asn_name.nil?
268
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
269
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
270
+
271
+
272
+ request_headers = {}
273
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
274
+
275
+ # Set Headers
276
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
277
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
278
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerAsns/{peerAsnName}'
279
+
280
+ request_url = @base_url || @client.base_url
281
+
282
+ options = {
283
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
284
+ path_params: {'peerAsnName' => peer_asn_name,'subscriptionId' => @client.subscription_id},
285
+ query_params: {'api-version' => @client.api_version},
286
+ headers: request_headers.merge(custom_headers || {}),
287
+ base_url: request_url
288
+ }
289
+ promise = @client.make_request_async(:delete, path_template, options)
290
+
291
+ promise = promise.then do |result|
292
+ http_response = result.response
293
+ status_code = http_response.status
294
+ response_content = http_response.body
295
+ unless status_code == 200 || status_code == 204
296
+ error_model = JSON.load(response_content)
297
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
298
+ end
299
+
300
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
301
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
302
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
303
+
304
+ result
305
+ end
306
+
307
+ promise.execute
308
+ end
309
+
310
+ #
311
+ # Lists all of the peer ASNs under the given subscription.
312
+ #
313
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
314
+ # will be added to the HTTP request.
315
+ #
316
+ # @return [Array<PeerAsn>] operation results.
317
+ #
318
+ def list_by_subscription(custom_headers:nil)
319
+ first_page = list_by_subscription_as_lazy(custom_headers:custom_headers)
320
+ first_page.get_all_items
321
+ end
322
+
323
+ #
324
+ # Lists all of the peer ASNs under the given subscription.
325
+ #
326
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
327
+ # will be added to the HTTP request.
328
+ #
329
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
330
+ #
331
+ def list_by_subscription_with_http_info(custom_headers:nil)
332
+ list_by_subscription_async(custom_headers:custom_headers).value!
333
+ end
334
+
335
+ #
336
+ # Lists all of the peer ASNs under the given subscription.
337
+ #
338
+ # @param [Hash{String => String}] A hash of custom headers that will be added
339
+ # to the HTTP request.
340
+ #
341
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
342
+ #
343
+ def list_by_subscription_async(custom_headers:nil)
344
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
345
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
346
+
347
+
348
+ request_headers = {}
349
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
350
+
351
+ # Set Headers
352
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
353
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
354
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerAsns'
355
+
356
+ request_url = @base_url || @client.base_url
357
+
358
+ options = {
359
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
360
+ path_params: {'subscriptionId' => @client.subscription_id},
361
+ query_params: {'api-version' => @client.api_version},
362
+ headers: request_headers.merge(custom_headers || {}),
363
+ base_url: request_url
364
+ }
365
+ promise = @client.make_request_async(:get, path_template, options)
366
+
367
+ promise = promise.then do |result|
368
+ http_response = result.response
369
+ status_code = http_response.status
370
+ response_content = http_response.body
371
+ unless status_code == 200
372
+ error_model = JSON.load(response_content)
373
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
374
+ end
375
+
376
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
377
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
378
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
379
+ # Deserialize Response
380
+ if status_code == 200
381
+ begin
382
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
383
+ result_mapper = Azure::Peering::Mgmt::V2019_08_01_preview::Models::PeerAsnListResult.mapper()
384
+ result.body = @client.deserialize(result_mapper, parsed_response)
385
+ rescue Exception => e
386
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
387
+ end
388
+ end
389
+
390
+ result
391
+ end
392
+
393
+ promise.execute
394
+ end
395
+
396
+ #
397
+ # Lists all of the peer ASNs under the given subscription.
398
+ #
399
+ # @param next_page_link [String] The NextLink from the previous successful call
400
+ # to List operation.
401
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
402
+ # will be added to the HTTP request.
403
+ #
404
+ # @return [PeerAsnListResult] operation results.
405
+ #
406
+ def list_by_subscription_next(next_page_link, custom_headers:nil)
407
+ response = list_by_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
408
+ response.body unless response.nil?
409
+ end
410
+
411
+ #
412
+ # Lists all of the peer ASNs under the given subscription.
413
+ #
414
+ # @param next_page_link [String] The NextLink from the previous successful call
415
+ # to List operation.
416
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
417
+ # will be added to the HTTP request.
418
+ #
419
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
420
+ #
421
+ def list_by_subscription_next_with_http_info(next_page_link, custom_headers:nil)
422
+ list_by_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
423
+ end
424
+
425
+ #
426
+ # Lists all of the peer ASNs under the given subscription.
427
+ #
428
+ # @param next_page_link [String] The NextLink from the previous successful call
429
+ # to List operation.
430
+ # @param [Hash{String => String}] A hash of custom headers that will be added
431
+ # to the HTTP request.
432
+ #
433
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
434
+ #
435
+ def list_by_subscription_next_async(next_page_link, custom_headers:nil)
436
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
437
+
438
+
439
+ request_headers = {}
440
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
441
+
442
+ # Set Headers
443
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
444
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
445
+ path_template = '{nextLink}'
446
+
447
+ request_url = @base_url || @client.base_url
448
+
449
+ options = {
450
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
451
+ skip_encoding_path_params: {'nextLink' => next_page_link},
452
+ headers: request_headers.merge(custom_headers || {}),
453
+ base_url: request_url
454
+ }
455
+ promise = @client.make_request_async(:get, path_template, options)
456
+
457
+ promise = promise.then do |result|
458
+ http_response = result.response
459
+ status_code = http_response.status
460
+ response_content = http_response.body
461
+ unless status_code == 200
462
+ error_model = JSON.load(response_content)
463
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
464
+ end
465
+
466
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
467
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
468
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
469
+ # Deserialize Response
470
+ if status_code == 200
471
+ begin
472
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
473
+ result_mapper = Azure::Peering::Mgmt::V2019_08_01_preview::Models::PeerAsnListResult.mapper()
474
+ result.body = @client.deserialize(result_mapper, parsed_response)
475
+ rescue Exception => e
476
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
477
+ end
478
+ end
479
+
480
+ result
481
+ end
482
+
483
+ promise.execute
484
+ end
485
+
486
+ #
487
+ # Lists all of the peer ASNs under the given subscription.
488
+ #
489
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
490
+ # will be added to the HTTP request.
491
+ #
492
+ # @return [PeerAsnListResult] which provide lazy access to pages of the
493
+ # response.
494
+ #
495
+ def list_by_subscription_as_lazy(custom_headers:nil)
496
+ response = list_by_subscription_async(custom_headers:custom_headers).value!
497
+ unless response.nil?
498
+ page = response.body
499
+ page.next_method = Proc.new do |next_page_link|
500
+ list_by_subscription_next_async(next_page_link, custom_headers:custom_headers)
501
+ end
502
+ page
503
+ end
504
+ end
505
+
506
+ end
507
+ end