azure_mgmt_network 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generated/azure_mgmt_network.rb +91 -67
  3. data/lib/generated/azure_mgmt_network/application_gateways.rb +12 -12
  4. data/lib/generated/azure_mgmt_network/{available_private_access_services.rb → available_endpoint_services.rb} +21 -25
  5. data/lib/generated/azure_mgmt_network/bgp_service_communities.rb +1 -1
  6. data/lib/generated/azure_mgmt_network/default_security_rules.rb +330 -0
  7. data/lib/generated/azure_mgmt_network/express_route_circuit_authorizations.rb +4 -4
  8. data/lib/generated/azure_mgmt_network/express_route_circuit_peerings.rb +4 -4
  9. data/lib/generated/azure_mgmt_network/express_route_circuits.rb +10 -10
  10. data/lib/generated/azure_mgmt_network/express_route_service_providers.rb +1 -1
  11. data/lib/generated/azure_mgmt_network/inbound_nat_rules.rb +616 -0
  12. data/lib/generated/azure_mgmt_network/load_balancer_backend_address_pools.rb +323 -0
  13. data/lib/generated/azure_mgmt_network/load_balancer_frontend_ipconfigurations.rb +323 -0
  14. data/lib/generated/azure_mgmt_network/load_balancer_load_balancing_rules.rb +320 -0
  15. data/lib/generated/azure_mgmt_network/load_balancer_network_interfaces.rb +225 -0
  16. data/lib/generated/azure_mgmt_network/load_balancer_probes.rb +320 -0
  17. data/lib/generated/azure_mgmt_network/load_balancers.rb +5 -5
  18. data/lib/generated/azure_mgmt_network/local_network_gateways.rb +4 -4
  19. data/lib/generated/azure_mgmt_network/models/effective_network_security_group.rb +2 -1
  20. data/lib/generated/azure_mgmt_network/models/effective_network_security_group_list_result.rb +1 -0
  21. data/lib/generated/azure_mgmt_network/models/effective_network_security_rule.rb +3 -3
  22. data/lib/generated/azure_mgmt_network/models/effective_route_list_result.rb +1 -0
  23. data/lib/generated/azure_mgmt_network/models/effective_security_rule_protocol.rb +17 -0
  24. data/lib/generated/azure_mgmt_network/models/{private_access_service_result.rb → endpoint_service_result.rb} +7 -7
  25. data/lib/generated/azure_mgmt_network/models/{private_access_services_list_result.rb → endpoint_services_list_result.rb} +11 -11
  26. data/lib/generated/azure_mgmt_network/models/inbound_nat_rule.rb +1 -1
  27. data/lib/generated/azure_mgmt_network/models/inbound_nat_rule_list_result.rb +96 -0
  28. data/lib/generated/azure_mgmt_network/models/ipconfiguration.rb +1 -1
  29. data/lib/generated/azure_mgmt_network/models/load_balancer.rb +11 -0
  30. data/lib/generated/azure_mgmt_network/models/load_balancer_backend_address_pool_list_result.rb +97 -0
  31. data/lib/generated/azure_mgmt_network/models/load_balancer_frontend_ipconfiguration_list_result.rb +98 -0
  32. data/lib/generated/azure_mgmt_network/models/load_balancer_list_result.rb +1 -0
  33. data/lib/generated/azure_mgmt_network/models/load_balancer_load_balancing_rule_list_result.rb +97 -0
  34. data/lib/generated/azure_mgmt_network/models/load_balancer_probe_list_result.rb +95 -0
  35. data/lib/generated/azure_mgmt_network/models/load_balancer_sku.rb +46 -0
  36. data/lib/generated/azure_mgmt_network/models/load_balancer_sku_name.rb +16 -0
  37. data/lib/generated/azure_mgmt_network/models/load_balancing_rule.rb +13 -1
  38. data/lib/generated/azure_mgmt_network/models/local_network_gateway_list_result.rb +1 -0
  39. data/lib/generated/azure_mgmt_network/models/network_interface_ipconfiguration.rb +7 -4
  40. data/lib/generated/azure_mgmt_network/models/network_interface_ipconfiguration_list_result.rb +98 -0
  41. data/lib/generated/azure_mgmt_network/models/network_interface_list_result.rb +1 -0
  42. data/lib/generated/azure_mgmt_network/models/network_interface_load_balancer_list_result.rb +96 -0
  43. data/lib/generated/azure_mgmt_network/models/public_ipaddress.rb +15 -2
  44. data/lib/generated/azure_mgmt_network/models/public_ipaddress_sku.rb +46 -0
  45. data/lib/generated/azure_mgmt_network/models/public_ipaddress_sku_name.rb +16 -0
  46. data/lib/generated/azure_mgmt_network/models/security_rule.rb +35 -1
  47. data/lib/generated/azure_mgmt_network/models/{private_access_service_properties_format.rb → service_endpoint_properties_format.rb} +6 -6
  48. data/lib/generated/azure_mgmt_network/models/subnet.rb +7 -7
  49. data/lib/generated/azure_mgmt_network/models/usage.rb +11 -0
  50. data/lib/generated/azure_mgmt_network/models/virtual_network_connection_gateway_reference.rb +46 -0
  51. data/lib/generated/azure_mgmt_network/models/virtual_network_gateway.rb +0 -22
  52. data/lib/generated/azure_mgmt_network/models/virtual_network_gateway_connection.rb +6 -3
  53. data/lib/generated/azure_mgmt_network/models/virtual_network_gateway_connection_list_entity.rb +300 -0
  54. data/lib/generated/azure_mgmt_network/models/virtual_network_gateway_connection_list_result.rb +1 -0
  55. data/lib/generated/azure_mgmt_network/models/virtual_network_gateway_list_connections_result.rb +100 -0
  56. data/lib/generated/azure_mgmt_network/models/virtual_network_gateway_list_result.rb +1 -0
  57. data/lib/generated/azure_mgmt_network/models/vpn_client_configuration.rb +22 -0
  58. data/lib/generated/azure_mgmt_network/network_interface_ipconfigurations.rb +320 -0
  59. data/lib/generated/azure_mgmt_network/network_interface_load_balancers.rb +225 -0
  60. data/lib/generated/azure_mgmt_network/network_interfaces.rb +7 -7
  61. data/lib/generated/azure_mgmt_network/network_management_client.rb +55 -12
  62. data/lib/generated/azure_mgmt_network/network_security_groups.rb +5 -5
  63. data/lib/generated/azure_mgmt_network/network_watchers.rb +14 -14
  64. data/lib/generated/azure_mgmt_network/packet_captures.rb +6 -6
  65. data/lib/generated/azure_mgmt_network/public_ipaddresses.rb +5 -5
  66. data/lib/generated/azure_mgmt_network/route_filter_rules.rb +5 -5
  67. data/lib/generated/azure_mgmt_network/route_filters.rb +6 -6
  68. data/lib/generated/azure_mgmt_network/route_tables.rb +5 -5
  69. data/lib/generated/azure_mgmt_network/routes.rb +4 -4
  70. data/lib/generated/azure_mgmt_network/security_rules.rb +4 -4
  71. data/lib/generated/azure_mgmt_network/subnets.rb +4 -4
  72. data/lib/generated/azure_mgmt_network/usages.rb +8 -8
  73. data/lib/generated/azure_mgmt_network/version.rb +1 -1
  74. data/lib/generated/azure_mgmt_network/virtual_network_gateway_connections.rb +7 -7
  75. data/lib/generated/azure_mgmt_network/virtual_network_gateways.rb +373 -11
  76. data/lib/generated/azure_mgmt_network/virtual_network_peerings.rb +4 -4
  77. data/lib/generated/azure_mgmt_network/virtual_networks.rb +7 -7
  78. metadata +32 -8
@@ -55,7 +55,7 @@ module Azure::ARM::Network
55
55
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
56
56
  #
57
57
  def list_async(custom_headers = nil)
58
- api_version = '2017-06-01'
58
+ api_version = '2017-08-01'
59
59
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
60
60
 
61
61
 
@@ -0,0 +1,616 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::Network
7
+ #
8
+ # Network Client
9
+ #
10
+ class InboundNatRules
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the InboundNatRules class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [NetworkManagementClient] reference to the NetworkManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Gets all the inbound nat rules in a load balancer.
26
+ #
27
+ # @param resource_group_name [String] The name of the resource group.
28
+ # @param load_balancer_name [String] The name of the load balancer.
29
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
30
+ # will be added to the HTTP request.
31
+ #
32
+ # @return [Array<InboundNatRule>] operation results.
33
+ #
34
+ def list(resource_group_name, load_balancer_name, custom_headers = nil)
35
+ first_page = list_as_lazy(resource_group_name, load_balancer_name, custom_headers)
36
+ first_page.get_all_items
37
+ end
38
+
39
+ #
40
+ # Gets all the inbound nat rules in a load balancer.
41
+ #
42
+ # @param resource_group_name [String] The name of the resource group.
43
+ # @param load_balancer_name [String] The name of the load balancer.
44
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
45
+ # will be added to the HTTP request.
46
+ #
47
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
48
+ #
49
+ def list_with_http_info(resource_group_name, load_balancer_name, custom_headers = nil)
50
+ list_async(resource_group_name, load_balancer_name, custom_headers).value!
51
+ end
52
+
53
+ #
54
+ # Gets all the inbound nat rules in a load balancer.
55
+ #
56
+ # @param resource_group_name [String] The name of the resource group.
57
+ # @param load_balancer_name [String] The name of the load balancer.
58
+ # @param [Hash{String => String}] A hash of custom headers that will be added
59
+ # to the HTTP request.
60
+ #
61
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
62
+ #
63
+ def list_async(resource_group_name, load_balancer_name, custom_headers = nil)
64
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
65
+ fail ArgumentError, 'load_balancer_name is nil' if load_balancer_name.nil?
66
+ api_version = '2017-08-01'
67
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
68
+
69
+
70
+ request_headers = {}
71
+
72
+ # Set Headers
73
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
74
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
75
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules'
76
+
77
+ request_url = @base_url || @client.base_url
78
+
79
+ options = {
80
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
81
+ path_params: {'resourceGroupName' => resource_group_name,'loadBalancerName' => load_balancer_name,'subscriptionId' => @client.subscription_id},
82
+ query_params: {'api-version' => api_version},
83
+ headers: request_headers.merge(custom_headers || {}),
84
+ base_url: request_url
85
+ }
86
+ promise = @client.make_request_async(:get, path_template, options)
87
+
88
+ promise = promise.then do |result|
89
+ http_response = result.response
90
+ status_code = http_response.status
91
+ response_content = http_response.body
92
+ unless status_code == 200
93
+ error_model = JSON.load(response_content)
94
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
95
+ end
96
+
97
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
98
+ # Deserialize Response
99
+ if status_code == 200
100
+ begin
101
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
102
+ result_mapper = Azure::ARM::Network::Models::InboundNatRuleListResult.mapper()
103
+ result.body = @client.deserialize(result_mapper, parsed_response)
104
+ rescue Exception => e
105
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
106
+ end
107
+ end
108
+
109
+ result
110
+ end
111
+
112
+ promise.execute
113
+ end
114
+
115
+ #
116
+ # Deletes the specified load balancer inbound nat rule.
117
+ #
118
+ # @param resource_group_name [String] The name of the resource group.
119
+ # @param load_balancer_name [String] The name of the load balancer.
120
+ # @param inbound_nat_rule_name [String] The name of the inbound nat rule.
121
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
122
+ # will be added to the HTTP request.
123
+ #
124
+ def delete(resource_group_name, load_balancer_name, inbound_nat_rule_name, custom_headers = nil)
125
+ response = delete_async(resource_group_name, load_balancer_name, inbound_nat_rule_name, custom_headers).value!
126
+ nil
127
+ end
128
+
129
+ #
130
+ # @param resource_group_name [String] The name of the resource group.
131
+ # @param load_balancer_name [String] The name of the load balancer.
132
+ # @param inbound_nat_rule_name [String] The name of the inbound nat rule.
133
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
134
+ # will be added to the HTTP request.
135
+ #
136
+ # @return [Concurrent::Promise] promise which provides async access to http
137
+ # response.
138
+ #
139
+ def delete_async(resource_group_name, load_balancer_name, inbound_nat_rule_name, custom_headers = nil)
140
+ # Send request
141
+ promise = begin_delete_async(resource_group_name, load_balancer_name, inbound_nat_rule_name, custom_headers)
142
+
143
+ promise = promise.then do |response|
144
+ # Defining deserialization method.
145
+ deserialize_method = lambda do |parsed_response|
146
+ end
147
+
148
+ # Waiting for response.
149
+ @client.get_long_running_operation_result(response, deserialize_method)
150
+ end
151
+
152
+ promise
153
+ end
154
+
155
+ #
156
+ # Gets the specified load balancer inbound nat rule.
157
+ #
158
+ # @param resource_group_name [String] The name of the resource group.
159
+ # @param load_balancer_name [String] The name of the load balancer.
160
+ # @param inbound_nat_rule_name [String] The name of the inbound nat rule.
161
+ # @param expand [String] Expands referenced resources.
162
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
163
+ # will be added to the HTTP request.
164
+ #
165
+ # @return [InboundNatRule] operation results.
166
+ #
167
+ def get(resource_group_name, load_balancer_name, inbound_nat_rule_name, expand = nil, custom_headers = nil)
168
+ response = get_async(resource_group_name, load_balancer_name, inbound_nat_rule_name, expand, custom_headers).value!
169
+ response.body unless response.nil?
170
+ end
171
+
172
+ #
173
+ # Gets the specified load balancer inbound nat rule.
174
+ #
175
+ # @param resource_group_name [String] The name of the resource group.
176
+ # @param load_balancer_name [String] The name of the load balancer.
177
+ # @param inbound_nat_rule_name [String] The name of the inbound nat rule.
178
+ # @param expand [String] Expands referenced resources.
179
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
180
+ # will be added to the HTTP request.
181
+ #
182
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
183
+ #
184
+ def get_with_http_info(resource_group_name, load_balancer_name, inbound_nat_rule_name, expand = nil, custom_headers = nil)
185
+ get_async(resource_group_name, load_balancer_name, inbound_nat_rule_name, expand, custom_headers).value!
186
+ end
187
+
188
+ #
189
+ # Gets the specified load balancer inbound nat rule.
190
+ #
191
+ # @param resource_group_name [String] The name of the resource group.
192
+ # @param load_balancer_name [String] The name of the load balancer.
193
+ # @param inbound_nat_rule_name [String] The name of the inbound nat rule.
194
+ # @param expand [String] Expands referenced resources.
195
+ # @param [Hash{String => String}] A hash of custom headers that will be added
196
+ # to the HTTP request.
197
+ #
198
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
199
+ #
200
+ def get_async(resource_group_name, load_balancer_name, inbound_nat_rule_name, expand = nil, custom_headers = nil)
201
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
202
+ fail ArgumentError, 'load_balancer_name is nil' if load_balancer_name.nil?
203
+ fail ArgumentError, 'inbound_nat_rule_name is nil' if inbound_nat_rule_name.nil?
204
+ api_version = '2017-08-01'
205
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
206
+
207
+
208
+ request_headers = {}
209
+
210
+ # Set Headers
211
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
212
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
213
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}'
214
+
215
+ request_url = @base_url || @client.base_url
216
+
217
+ options = {
218
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
219
+ path_params: {'resourceGroupName' => resource_group_name,'loadBalancerName' => load_balancer_name,'inboundNatRuleName' => inbound_nat_rule_name,'subscriptionId' => @client.subscription_id},
220
+ query_params: {'api-version' => api_version,'$expand' => expand},
221
+ headers: request_headers.merge(custom_headers || {}),
222
+ base_url: request_url
223
+ }
224
+ promise = @client.make_request_async(:get, path_template, options)
225
+
226
+ promise = promise.then do |result|
227
+ http_response = result.response
228
+ status_code = http_response.status
229
+ response_content = http_response.body
230
+ unless status_code == 200
231
+ error_model = JSON.load(response_content)
232
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
233
+ end
234
+
235
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
236
+ # Deserialize Response
237
+ if status_code == 200
238
+ begin
239
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
240
+ result_mapper = Azure::ARM::Network::Models::InboundNatRule.mapper()
241
+ result.body = @client.deserialize(result_mapper, parsed_response)
242
+ rescue Exception => e
243
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
244
+ end
245
+ end
246
+
247
+ result
248
+ end
249
+
250
+ promise.execute
251
+ end
252
+
253
+ #
254
+ # Creates or updates a load balancer inbound nat rule.
255
+ #
256
+ # @param resource_group_name [String] The name of the resource group.
257
+ # @param load_balancer_name [String] The name of the load balancer.
258
+ # @param inbound_nat_rule_name [String] The name of the inbound nat rule.
259
+ # @param inbound_nat_rule_parameters [InboundNatRule] Parameters supplied to
260
+ # the create or update inbound nat rule operation.
261
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
262
+ # will be added to the HTTP request.
263
+ #
264
+ # @return [InboundNatRule] operation results.
265
+ #
266
+ def create_or_update(resource_group_name, load_balancer_name, inbound_nat_rule_name, inbound_nat_rule_parameters, custom_headers = nil)
267
+ response = create_or_update_async(resource_group_name, load_balancer_name, inbound_nat_rule_name, inbound_nat_rule_parameters, custom_headers).value!
268
+ response.body unless response.nil?
269
+ end
270
+
271
+ #
272
+ # @param resource_group_name [String] The name of the resource group.
273
+ # @param load_balancer_name [String] The name of the load balancer.
274
+ # @param inbound_nat_rule_name [String] The name of the inbound nat rule.
275
+ # @param inbound_nat_rule_parameters [InboundNatRule] Parameters supplied to
276
+ # the create or update inbound nat rule operation.
277
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
278
+ # will be added to the HTTP request.
279
+ #
280
+ # @return [Concurrent::Promise] promise which provides async access to http
281
+ # response.
282
+ #
283
+ def create_or_update_async(resource_group_name, load_balancer_name, inbound_nat_rule_name, inbound_nat_rule_parameters, custom_headers = nil)
284
+ # Send request
285
+ promise = begin_create_or_update_async(resource_group_name, load_balancer_name, inbound_nat_rule_name, inbound_nat_rule_parameters, custom_headers)
286
+
287
+ promise = promise.then do |response|
288
+ # Defining deserialization method.
289
+ deserialize_method = lambda do |parsed_response|
290
+ result_mapper = Azure::ARM::Network::Models::InboundNatRule.mapper()
291
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
292
+ end
293
+
294
+ # Waiting for response.
295
+ @client.get_long_running_operation_result(response, deserialize_method)
296
+ end
297
+
298
+ promise
299
+ end
300
+
301
+ #
302
+ # Deletes the specified load balancer inbound nat rule.
303
+ #
304
+ # @param resource_group_name [String] The name of the resource group.
305
+ # @param load_balancer_name [String] The name of the load balancer.
306
+ # @param inbound_nat_rule_name [String] The name of the inbound nat rule.
307
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
308
+ # will be added to the HTTP request.
309
+ #
310
+ #
311
+ def begin_delete(resource_group_name, load_balancer_name, inbound_nat_rule_name, custom_headers = nil)
312
+ response = begin_delete_async(resource_group_name, load_balancer_name, inbound_nat_rule_name, custom_headers).value!
313
+ nil
314
+ end
315
+
316
+ #
317
+ # Deletes the specified load balancer inbound nat rule.
318
+ #
319
+ # @param resource_group_name [String] The name of the resource group.
320
+ # @param load_balancer_name [String] The name of the load balancer.
321
+ # @param inbound_nat_rule_name [String] The name of the inbound nat rule.
322
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
323
+ # will be added to the HTTP request.
324
+ #
325
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
326
+ #
327
+ def begin_delete_with_http_info(resource_group_name, load_balancer_name, inbound_nat_rule_name, custom_headers = nil)
328
+ begin_delete_async(resource_group_name, load_balancer_name, inbound_nat_rule_name, custom_headers).value!
329
+ end
330
+
331
+ #
332
+ # Deletes the specified load balancer inbound nat rule.
333
+ #
334
+ # @param resource_group_name [String] The name of the resource group.
335
+ # @param load_balancer_name [String] The name of the load balancer.
336
+ # @param inbound_nat_rule_name [String] The name of the inbound nat rule.
337
+ # @param [Hash{String => String}] A hash of custom headers that will be added
338
+ # to the HTTP request.
339
+ #
340
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
341
+ #
342
+ def begin_delete_async(resource_group_name, load_balancer_name, inbound_nat_rule_name, custom_headers = nil)
343
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
344
+ fail ArgumentError, 'load_balancer_name is nil' if load_balancer_name.nil?
345
+ fail ArgumentError, 'inbound_nat_rule_name is nil' if inbound_nat_rule_name.nil?
346
+ api_version = '2017-08-01'
347
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
348
+
349
+
350
+ request_headers = {}
351
+
352
+ # Set Headers
353
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
354
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
355
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}'
356
+
357
+ request_url = @base_url || @client.base_url
358
+
359
+ options = {
360
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
361
+ path_params: {'resourceGroupName' => resource_group_name,'loadBalancerName' => load_balancer_name,'inboundNatRuleName' => inbound_nat_rule_name,'subscriptionId' => @client.subscription_id},
362
+ query_params: {'api-version' => api_version},
363
+ headers: request_headers.merge(custom_headers || {}),
364
+ base_url: request_url
365
+ }
366
+ promise = @client.make_request_async(:delete, path_template, options)
367
+
368
+ promise = promise.then do |result|
369
+ http_response = result.response
370
+ status_code = http_response.status
371
+ response_content = http_response.body
372
+ unless status_code == 204 || status_code == 202 || status_code == 200
373
+ error_model = JSON.load(response_content)
374
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
375
+ end
376
+
377
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
378
+
379
+ result
380
+ end
381
+
382
+ promise.execute
383
+ end
384
+
385
+ #
386
+ # Creates or updates a load balancer inbound nat rule.
387
+ #
388
+ # @param resource_group_name [String] The name of the resource group.
389
+ # @param load_balancer_name [String] The name of the load balancer.
390
+ # @param inbound_nat_rule_name [String] The name of the inbound nat rule.
391
+ # @param inbound_nat_rule_parameters [InboundNatRule] Parameters supplied to
392
+ # the create or update inbound nat rule operation.
393
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
394
+ # will be added to the HTTP request.
395
+ #
396
+ # @return [InboundNatRule] operation results.
397
+ #
398
+ def begin_create_or_update(resource_group_name, load_balancer_name, inbound_nat_rule_name, inbound_nat_rule_parameters, custom_headers = nil)
399
+ response = begin_create_or_update_async(resource_group_name, load_balancer_name, inbound_nat_rule_name, inbound_nat_rule_parameters, custom_headers).value!
400
+ response.body unless response.nil?
401
+ end
402
+
403
+ #
404
+ # Creates or updates a load balancer inbound nat rule.
405
+ #
406
+ # @param resource_group_name [String] The name of the resource group.
407
+ # @param load_balancer_name [String] The name of the load balancer.
408
+ # @param inbound_nat_rule_name [String] The name of the inbound nat rule.
409
+ # @param inbound_nat_rule_parameters [InboundNatRule] Parameters supplied to
410
+ # the create or update inbound nat rule operation.
411
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
412
+ # will be added to the HTTP request.
413
+ #
414
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
415
+ #
416
+ def begin_create_or_update_with_http_info(resource_group_name, load_balancer_name, inbound_nat_rule_name, inbound_nat_rule_parameters, custom_headers = nil)
417
+ begin_create_or_update_async(resource_group_name, load_balancer_name, inbound_nat_rule_name, inbound_nat_rule_parameters, custom_headers).value!
418
+ end
419
+
420
+ #
421
+ # Creates or updates a load balancer inbound nat rule.
422
+ #
423
+ # @param resource_group_name [String] The name of the resource group.
424
+ # @param load_balancer_name [String] The name of the load balancer.
425
+ # @param inbound_nat_rule_name [String] The name of the inbound nat rule.
426
+ # @param inbound_nat_rule_parameters [InboundNatRule] Parameters supplied to
427
+ # the create or update inbound nat rule operation.
428
+ # @param [Hash{String => String}] A hash of custom headers that will be added
429
+ # to the HTTP request.
430
+ #
431
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
432
+ #
433
+ def begin_create_or_update_async(resource_group_name, load_balancer_name, inbound_nat_rule_name, inbound_nat_rule_parameters, custom_headers = nil)
434
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
435
+ fail ArgumentError, 'load_balancer_name is nil' if load_balancer_name.nil?
436
+ fail ArgumentError, 'inbound_nat_rule_name is nil' if inbound_nat_rule_name.nil?
437
+ fail ArgumentError, 'inbound_nat_rule_parameters is nil' if inbound_nat_rule_parameters.nil?
438
+ api_version = '2017-08-01'
439
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
440
+
441
+
442
+ request_headers = {}
443
+
444
+ # Set Headers
445
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
446
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
447
+
448
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
449
+
450
+ # Serialize Request
451
+ request_mapper = Azure::ARM::Network::Models::InboundNatRule.mapper()
452
+ request_content = @client.serialize(request_mapper, inbound_nat_rule_parameters)
453
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
454
+
455
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}'
456
+
457
+ request_url = @base_url || @client.base_url
458
+
459
+ options = {
460
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
461
+ path_params: {'resourceGroupName' => resource_group_name,'loadBalancerName' => load_balancer_name,'inboundNatRuleName' => inbound_nat_rule_name,'subscriptionId' => @client.subscription_id},
462
+ query_params: {'api-version' => api_version},
463
+ body: request_content,
464
+ headers: request_headers.merge(custom_headers || {}),
465
+ base_url: request_url
466
+ }
467
+ promise = @client.make_request_async(:put, path_template, options)
468
+
469
+ promise = promise.then do |result|
470
+ http_response = result.response
471
+ status_code = http_response.status
472
+ response_content = http_response.body
473
+ unless status_code == 201 || status_code == 200
474
+ error_model = JSON.load(response_content)
475
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
476
+ end
477
+
478
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
479
+ # Deserialize Response
480
+ if status_code == 201
481
+ begin
482
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
483
+ result_mapper = Azure::ARM::Network::Models::InboundNatRule.mapper()
484
+ result.body = @client.deserialize(result_mapper, parsed_response)
485
+ rescue Exception => e
486
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
487
+ end
488
+ end
489
+ # Deserialize Response
490
+ if status_code == 200
491
+ begin
492
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
493
+ result_mapper = Azure::ARM::Network::Models::InboundNatRule.mapper()
494
+ result.body = @client.deserialize(result_mapper, parsed_response)
495
+ rescue Exception => e
496
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
497
+ end
498
+ end
499
+
500
+ result
501
+ end
502
+
503
+ promise.execute
504
+ end
505
+
506
+ #
507
+ # Gets all the inbound nat rules in a load balancer.
508
+ #
509
+ # @param next_page_link [String] The NextLink from the previous successful call
510
+ # to List operation.
511
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
512
+ # will be added to the HTTP request.
513
+ #
514
+ # @return [InboundNatRuleListResult] operation results.
515
+ #
516
+ def list_next(next_page_link, custom_headers = nil)
517
+ response = list_next_async(next_page_link, custom_headers).value!
518
+ response.body unless response.nil?
519
+ end
520
+
521
+ #
522
+ # Gets all the inbound nat rules in a load balancer.
523
+ #
524
+ # @param next_page_link [String] The NextLink from the previous successful call
525
+ # to List operation.
526
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
527
+ # will be added to the HTTP request.
528
+ #
529
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
530
+ #
531
+ def list_next_with_http_info(next_page_link, custom_headers = nil)
532
+ list_next_async(next_page_link, custom_headers).value!
533
+ end
534
+
535
+ #
536
+ # Gets all the inbound nat rules in a load balancer.
537
+ #
538
+ # @param next_page_link [String] The NextLink from the previous successful call
539
+ # to List operation.
540
+ # @param [Hash{String => String}] A hash of custom headers that will be added
541
+ # to the HTTP request.
542
+ #
543
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
544
+ #
545
+ def list_next_async(next_page_link, custom_headers = nil)
546
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
547
+
548
+
549
+ request_headers = {}
550
+
551
+ # Set Headers
552
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
553
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
554
+ path_template = '{nextLink}'
555
+
556
+ request_url = @base_url || @client.base_url
557
+
558
+ options = {
559
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
560
+ skip_encoding_path_params: {'nextLink' => next_page_link},
561
+ headers: request_headers.merge(custom_headers || {}),
562
+ base_url: request_url
563
+ }
564
+ promise = @client.make_request_async(:get, path_template, options)
565
+
566
+ promise = promise.then do |result|
567
+ http_response = result.response
568
+ status_code = http_response.status
569
+ response_content = http_response.body
570
+ unless status_code == 200
571
+ error_model = JSON.load(response_content)
572
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
573
+ end
574
+
575
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
576
+ # Deserialize Response
577
+ if status_code == 200
578
+ begin
579
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
580
+ result_mapper = Azure::ARM::Network::Models::InboundNatRuleListResult.mapper()
581
+ result.body = @client.deserialize(result_mapper, parsed_response)
582
+ rescue Exception => e
583
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
584
+ end
585
+ end
586
+
587
+ result
588
+ end
589
+
590
+ promise.execute
591
+ end
592
+
593
+ #
594
+ # Gets all the inbound nat rules in a load balancer.
595
+ #
596
+ # @param resource_group_name [String] The name of the resource group.
597
+ # @param load_balancer_name [String] The name of the load balancer.
598
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
599
+ # will be added to the HTTP request.
600
+ #
601
+ # @return [InboundNatRuleListResult] which provide lazy access to pages of the
602
+ # response.
603
+ #
604
+ def list_as_lazy(resource_group_name, load_balancer_name, custom_headers = nil)
605
+ response = list_async(resource_group_name, load_balancer_name, custom_headers).value!
606
+ unless response.nil?
607
+ page = response.body
608
+ page.next_method = Proc.new do |next_page_link|
609
+ list_next_async(next_page_link, custom_headers)
610
+ end
611
+ page
612
+ end
613
+ end
614
+
615
+ end
616
+ end