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 PeeringServiceLocations
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the PeeringServiceLocations 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<PeeringServiceLocation>] 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/peeringServiceLocations'
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::PeeringServiceLocationListResult.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 [PeeringServiceLocationListResult] 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::PeeringServiceLocationListResult.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 [PeeringServiceLocationListResult] 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,332 @@
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 PeeringServicePrefixes
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the PeeringServicePrefixes 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 peering service prefix.
26
+ #
27
+ # @param resource_group_name [String] The resource group name.
28
+ # @param peering_service_name [String] The peering service name.
29
+ # @param prefix_name [String] The prefix name.
30
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
31
+ # will be added to the HTTP request.
32
+ #
33
+ # @return [PeeringServicePrefix] operation results.
34
+ #
35
+ def get(resource_group_name, peering_service_name, prefix_name, custom_headers:nil)
36
+ response = get_async(resource_group_name, peering_service_name, prefix_name, custom_headers:custom_headers).value!
37
+ response.body unless response.nil?
38
+ end
39
+
40
+ #
41
+ # Gets the peering service prefix.
42
+ #
43
+ # @param resource_group_name [String] The resource group name.
44
+ # @param peering_service_name [String] The peering service name.
45
+ # @param prefix_name [String] The prefix name.
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, prefix_name, custom_headers:nil)
52
+ get_async(resource_group_name, peering_service_name, prefix_name, custom_headers:custom_headers).value!
53
+ end
54
+
55
+ #
56
+ # Gets the peering service prefix.
57
+ #
58
+ # @param resource_group_name [String] The resource group name.
59
+ # @param peering_service_name [String] The peering service name.
60
+ # @param prefix_name [String] The prefix name.
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, prefix_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, 'prefix_name is nil' if prefix_name.nil?
70
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
71
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
72
+
73
+
74
+ request_headers = {}
75
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
76
+
77
+ # Set Headers
78
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
79
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
80
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/prefixes/{prefixName}'
81
+
82
+ request_url = @base_url || @client.base_url
83
+
84
+ options = {
85
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
86
+ path_params: {'resourceGroupName' => resource_group_name,'peeringServiceName' => peering_service_name,'prefixName' => prefix_name,'subscriptionId' => @client.subscription_id},
87
+ query_params: {'api-version' => @client.api_version},
88
+ headers: request_headers.merge(custom_headers || {}),
89
+ base_url: request_url
90
+ }
91
+ promise = @client.make_request_async(:get, path_template, options)
92
+
93
+ promise = promise.then do |result|
94
+ http_response = result.response
95
+ status_code = http_response.status
96
+ response_content = http_response.body
97
+ unless status_code == 200
98
+ error_model = JSON.load(response_content)
99
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
100
+ end
101
+
102
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
103
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
104
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
105
+ # Deserialize Response
106
+ if status_code == 200
107
+ begin
108
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
109
+ result_mapper = Azure::Peering::Mgmt::V2019_08_01_preview::Models::PeeringServicePrefix.mapper()
110
+ result.body = @client.deserialize(result_mapper, parsed_response)
111
+ rescue Exception => e
112
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
113
+ end
114
+ end
115
+
116
+ result
117
+ end
118
+
119
+ promise.execute
120
+ end
121
+
122
+ #
123
+ # Creates or updates the peering prefix.
124
+ #
125
+ # @param resource_group_name [String] The resource group name.
126
+ # @param peering_service_name [String] The peering service name.
127
+ # @param prefix_name [String] The prefix name
128
+ # @param peering_service_prefix [PeeringServicePrefix] The IP prefix for an
129
+ # peering
130
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
131
+ # will be added to the HTTP request.
132
+ #
133
+ # @return [PeeringServicePrefix] operation results.
134
+ #
135
+ def create_or_update(resource_group_name, peering_service_name, prefix_name, peering_service_prefix, custom_headers:nil)
136
+ response = create_or_update_async(resource_group_name, peering_service_name, prefix_name, peering_service_prefix, custom_headers:custom_headers).value!
137
+ response.body unless response.nil?
138
+ end
139
+
140
+ #
141
+ # Creates or updates the peering prefix.
142
+ #
143
+ # @param resource_group_name [String] The resource group name.
144
+ # @param peering_service_name [String] The peering service name.
145
+ # @param prefix_name [String] The prefix name
146
+ # @param peering_service_prefix [PeeringServicePrefix] The IP prefix for an
147
+ # peering
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 create_or_update_with_http_info(resource_group_name, peering_service_name, prefix_name, peering_service_prefix, custom_headers:nil)
154
+ create_or_update_async(resource_group_name, peering_service_name, prefix_name, peering_service_prefix, custom_headers:custom_headers).value!
155
+ end
156
+
157
+ #
158
+ # Creates or updates the peering prefix.
159
+ #
160
+ # @param resource_group_name [String] The resource group name.
161
+ # @param peering_service_name [String] The peering service name.
162
+ # @param prefix_name [String] The prefix name
163
+ # @param peering_service_prefix [PeeringServicePrefix] The IP prefix for an
164
+ # peering
165
+ # @param [Hash{String => String}] A hash of custom headers that will be added
166
+ # to the HTTP request.
167
+ #
168
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
169
+ #
170
+ def create_or_update_async(resource_group_name, peering_service_name, prefix_name, peering_service_prefix, custom_headers:nil)
171
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
172
+ fail ArgumentError, 'peering_service_name is nil' if peering_service_name.nil?
173
+ fail ArgumentError, 'prefix_name is nil' if prefix_name.nil?
174
+ fail ArgumentError, 'peering_service_prefix is nil' if peering_service_prefix.nil?
175
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
176
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
177
+
178
+
179
+ request_headers = {}
180
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
181
+
182
+ # Set Headers
183
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
184
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
185
+
186
+ # Serialize Request
187
+ request_mapper = Azure::Peering::Mgmt::V2019_08_01_preview::Models::PeeringServicePrefix.mapper()
188
+ request_content = @client.serialize(request_mapper, peering_service_prefix)
189
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
190
+
191
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/prefixes/{prefixName}'
192
+
193
+ request_url = @base_url || @client.base_url
194
+
195
+ options = {
196
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
197
+ path_params: {'resourceGroupName' => resource_group_name,'peeringServiceName' => peering_service_name,'prefixName' => prefix_name,'subscriptionId' => @client.subscription_id},
198
+ query_params: {'api-version' => @client.api_version},
199
+ body: request_content,
200
+ headers: request_headers.merge(custom_headers || {}),
201
+ base_url: request_url
202
+ }
203
+ promise = @client.make_request_async(:put, path_template, options)
204
+
205
+ promise = promise.then do |result|
206
+ http_response = result.response
207
+ status_code = http_response.status
208
+ response_content = http_response.body
209
+ unless status_code == 200 || status_code == 201
210
+ error_model = JSON.load(response_content)
211
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
212
+ end
213
+
214
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
215
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
216
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
217
+ # Deserialize Response
218
+ if status_code == 200
219
+ begin
220
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
221
+ result_mapper = Azure::Peering::Mgmt::V2019_08_01_preview::Models::PeeringServicePrefix.mapper()
222
+ result.body = @client.deserialize(result_mapper, parsed_response)
223
+ rescue Exception => e
224
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
225
+ end
226
+ end
227
+ # Deserialize Response
228
+ if status_code == 201
229
+ begin
230
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
231
+ result_mapper = Azure::Peering::Mgmt::V2019_08_01_preview::Models::PeeringServicePrefix.mapper()
232
+ result.body = @client.deserialize(result_mapper, parsed_response)
233
+ rescue Exception => e
234
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
235
+ end
236
+ end
237
+
238
+ result
239
+ end
240
+
241
+ promise.execute
242
+ end
243
+
244
+ #
245
+ # removes the peering prefix.
246
+ #
247
+ # @param resource_group_name [String] The resource group name.
248
+ # @param peering_service_name [String] The peering service name.
249
+ # @param prefix_name [String] The prefix name
250
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
251
+ # will be added to the HTTP request.
252
+ #
253
+ #
254
+ def delete(resource_group_name, peering_service_name, prefix_name, custom_headers:nil)
255
+ response = delete_async(resource_group_name, peering_service_name, prefix_name, custom_headers:custom_headers).value!
256
+ nil
257
+ end
258
+
259
+ #
260
+ # removes the peering prefix.
261
+ #
262
+ # @param resource_group_name [String] The resource group name.
263
+ # @param peering_service_name [String] The peering service name.
264
+ # @param prefix_name [String] The prefix name
265
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
266
+ # will be added to the HTTP request.
267
+ #
268
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
269
+ #
270
+ def delete_with_http_info(resource_group_name, peering_service_name, prefix_name, custom_headers:nil)
271
+ delete_async(resource_group_name, peering_service_name, prefix_name, custom_headers:custom_headers).value!
272
+ end
273
+
274
+ #
275
+ # removes the peering prefix.
276
+ #
277
+ # @param resource_group_name [String] The resource group name.
278
+ # @param peering_service_name [String] The peering service name.
279
+ # @param prefix_name [String] The prefix name
280
+ # @param [Hash{String => String}] A hash of custom headers that will be added
281
+ # to the HTTP request.
282
+ #
283
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
284
+ #
285
+ def delete_async(resource_group_name, peering_service_name, prefix_name, custom_headers:nil)
286
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
287
+ fail ArgumentError, 'peering_service_name is nil' if peering_service_name.nil?
288
+ fail ArgumentError, 'prefix_name is nil' if prefix_name.nil?
289
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
290
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
291
+
292
+
293
+ request_headers = {}
294
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
295
+
296
+ # Set Headers
297
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
298
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
299
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/prefixes/{prefixName}'
300
+
301
+ request_url = @base_url || @client.base_url
302
+
303
+ options = {
304
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
305
+ path_params: {'resourceGroupName' => resource_group_name,'peeringServiceName' => peering_service_name,'prefixName' => prefix_name,'subscriptionId' => @client.subscription_id},
306
+ query_params: {'api-version' => @client.api_version},
307
+ headers: request_headers.merge(custom_headers || {}),
308
+ base_url: request_url
309
+ }
310
+ promise = @client.make_request_async(:delete, path_template, options)
311
+
312
+ promise = promise.then do |result|
313
+ http_response = result.response
314
+ status_code = http_response.status
315
+ response_content = http_response.body
316
+ unless status_code == 200 || status_code == 204
317
+ error_model = JSON.load(response_content)
318
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
319
+ end
320
+
321
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
322
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
323
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
324
+
325
+ result
326
+ end
327
+
328
+ promise.execute
329
+ end
330
+
331
+ end
332
+ end