azure_mgmt_network 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.rspec +3 -0
  4. data/.travis.yml +3 -0
  5. data/Gemfile +15 -0
  6. data/LICENSE.txt +21 -0
  7. data/README.md +131 -0
  8. data/Rakefile +5 -0
  9. data/azure_mgmt_network.gemspec +39 -0
  10. data/lib/azure_mgmt_network.rb +139 -0
  11. data/lib/azure_mgmt_network/Models/address_space.rb +60 -0
  12. data/lib/azure_mgmt_network/Models/application_gateway.rb +104 -0
  13. data/lib/azure_mgmt_network/Models/application_gateway_backend_address.rb +67 -0
  14. data/lib/azure_mgmt_network/Models/application_gateway_backend_address_pool.rb +90 -0
  15. data/lib/azure_mgmt_network/Models/application_gateway_backend_address_pool_properties_format.rb +121 -0
  16. data/lib/azure_mgmt_network/Models/application_gateway_backend_http_settings.rb +90 -0
  17. data/lib/azure_mgmt_network/Models/application_gateway_backend_http_settings_properties_format.rb +98 -0
  18. data/lib/azure_mgmt_network/Models/application_gateway_cookie_based_affinity.rb +16 -0
  19. data/lib/azure_mgmt_network/Models/application_gateway_frontend_ip_configuration.rb +91 -0
  20. data/lib/azure_mgmt_network/Models/application_gateway_frontend_ip_configuration_properties_format.rb +117 -0
  21. data/lib/azure_mgmt_network/Models/application_gateway_frontend_port.rb +90 -0
  22. data/lib/azure_mgmt_network/Models/application_gateway_frontend_port_properties_format.rb +70 -0
  23. data/lib/azure_mgmt_network/Models/application_gateway_http_listener.rb +90 -0
  24. data/lib/azure_mgmt_network/Models/application_gateway_http_listener_properties_format.rb +124 -0
  25. data/lib/azure_mgmt_network/Models/application_gateway_ip_configuration.rb +90 -0
  26. data/lib/azure_mgmt_network/Models/application_gateway_ip_configuration_properties_format.rb +77 -0
  27. data/lib/azure_mgmt_network/Models/application_gateway_list_result.rb +88 -0
  28. data/lib/azure_mgmt_network/Models/application_gateway_operational_state.rb +18 -0
  29. data/lib/azure_mgmt_network/Models/application_gateway_properties_format.rb +338 -0
  30. data/lib/azure_mgmt_network/Models/application_gateway_protocol.rb +16 -0
  31. data/lib/azure_mgmt_network/Models/application_gateway_request_routing_rule.rb +90 -0
  32. data/lib/azure_mgmt_network/Models/application_gateway_request_routing_rule_properties_format.rb +124 -0
  33. data/lib/azure_mgmt_network/Models/application_gateway_request_routing_rule_type.rb +15 -0
  34. data/lib/azure_mgmt_network/Models/application_gateway_sku.rb +88 -0
  35. data/lib/azure_mgmt_network/Models/application_gateway_sku_name.rb +17 -0
  36. data/lib/azure_mgmt_network/Models/application_gateway_ssl_certificate.rb +90 -0
  37. data/lib/azure_mgmt_network/Models/application_gateway_ssl_certificate_properties_format.rb +87 -0
  38. data/lib/azure_mgmt_network/Models/application_gateway_tier.rb +15 -0
  39. data/lib/azure_mgmt_network/Models/azure_async_operation_result.rb +85 -0
  40. data/lib/azure_mgmt_network/Models/backend_address_pool.rb +90 -0
  41. data/lib/azure_mgmt_network/Models/backend_address_pool_properties_format.rb +120 -0
  42. data/lib/azure_mgmt_network/Models/connection_reset_shared_key.rb +64 -0
  43. data/lib/azure_mgmt_network/Models/connection_reset_shared_key_properties_format.rb +60 -0
  44. data/lib/azure_mgmt_network/Models/connection_shared_key.rb +58 -0
  45. data/lib/azure_mgmt_network/Models/dhcp_options.rb +60 -0
  46. data/lib/azure_mgmt_network/Models/dns_name_availability_result.rb +58 -0
  47. data/lib/azure_mgmt_network/Models/error.rb +114 -0
  48. data/lib/azure_mgmt_network/Models/error_details.rb +76 -0
  49. data/lib/azure_mgmt_network/Models/frontend_ip_configuration.rb +90 -0
  50. data/lib/azure_mgmt_network/Models/frontend_ip_configuration_properties_format.rb +181 -0
  51. data/lib/azure_mgmt_network/Models/inbound_nat_rule.rb +90 -0
  52. data/lib/azure_mgmt_network/Models/inbound_nat_rule_properties_format.rb +163 -0
  53. data/lib/azure_mgmt_network/Models/ip_allocation_method.rb +16 -0
  54. data/lib/azure_mgmt_network/Models/load_balancer.rb +104 -0
  55. data/lib/azure_mgmt_network/Models/load_balancer_list_result.rb +88 -0
  56. data/lib/azure_mgmt_network/Models/load_balancer_properties_format.rb +210 -0
  57. data/lib/azure_mgmt_network/Models/load_balancing_rule.rb +90 -0
  58. data/lib/azure_mgmt_network/Models/load_balancing_rule_properties_format.rb +195 -0
  59. data/lib/azure_mgmt_network/Models/load_distribution.rb +17 -0
  60. data/lib/azure_mgmt_network/Models/local_network_gateway.rb +104 -0
  61. data/lib/azure_mgmt_network/Models/local_network_gateway_list_result.rb +88 -0
  62. data/lib/azure_mgmt_network/Models/local_network_gateway_properties_format.rb +83 -0
  63. data/lib/azure_mgmt_network/Models/network_interface.rb +104 -0
  64. data/lib/azure_mgmt_network/Models/network_interface_dns_settings.rb +89 -0
  65. data/lib/azure_mgmt_network/Models/network_interface_ip_configuration.rb +90 -0
  66. data/lib/azure_mgmt_network/Models/network_interface_ip_configuration_properties_format.rb +179 -0
  67. data/lib/azure_mgmt_network/Models/network_interface_list_result.rb +88 -0
  68. data/lib/azure_mgmt_network/Models/network_interface_properties_format.rb +158 -0
  69. data/lib/azure_mgmt_network/Models/network_security_group.rb +104 -0
  70. data/lib/azure_mgmt_network/Models/network_security_group_list_result.rb +88 -0
  71. data/lib/azure_mgmt_network/Models/network_security_group_properties_format.rb +181 -0
  72. data/lib/azure_mgmt_network/Models/operation_status.rb +17 -0
  73. data/lib/azure_mgmt_network/Models/probe.rb +90 -0
  74. data/lib/azure_mgmt_network/Models/probe_properties_format.rb +157 -0
  75. data/lib/azure_mgmt_network/Models/probe_protocol.rb +16 -0
  76. data/lib/azure_mgmt_network/Models/public_ip_address.rb +104 -0
  77. data/lib/azure_mgmt_network/Models/public_ip_address_dns_settings.rb +85 -0
  78. data/lib/azure_mgmt_network/Models/public_ip_address_list_result.rb +88 -0
  79. data/lib/azure_mgmt_network/Models/public_ip_address_properties_format.rb +126 -0
  80. data/lib/azure_mgmt_network/Models/security_rule.rb +90 -0
  81. data/lib/azure_mgmt_network/Models/security_rule_access.rb +16 -0
  82. data/lib/azure_mgmt_network/Models/security_rule_direction.rb +16 -0
  83. data/lib/azure_mgmt_network/Models/security_rule_list_result.rb +89 -0
  84. data/lib/azure_mgmt_network/Models/security_rule_properties_format.rb +174 -0
  85. data/lib/azure_mgmt_network/Models/security_rule_protocol.rb +17 -0
  86. data/lib/azure_mgmt_network/Models/subnet.rb +90 -0
  87. data/lib/azure_mgmt_network/Models/subnet_list_result.rb +88 -0
  88. data/lib/azure_mgmt_network/Models/subnet_properties_format.rb +115 -0
  89. data/lib/azure_mgmt_network/Models/transport_protocol.rb +16 -0
  90. data/lib/azure_mgmt_network/Models/usage.rb +98 -0
  91. data/lib/azure_mgmt_network/Models/usage_name.rb +68 -0
  92. data/lib/azure_mgmt_network/Models/usage_unit.rb +15 -0
  93. data/lib/azure_mgmt_network/Models/usages_list_result.rb +78 -0
  94. data/lib/azure_mgmt_network/Models/virtual_network.rb +104 -0
  95. data/lib/azure_mgmt_network/Models/virtual_network_gateway.rb +104 -0
  96. data/lib/azure_mgmt_network/Models/virtual_network_gateway_connection.rb +104 -0
  97. data/lib/azure_mgmt_network/Models/virtual_network_gateway_connection_list_result.rb +89 -0
  98. data/lib/azure_mgmt_network/Models/virtual_network_gateway_connection_properties_format.rb +141 -0
  99. data/lib/azure_mgmt_network/Models/virtual_network_gateway_connection_type.rb +18 -0
  100. data/lib/azure_mgmt_network/Models/virtual_network_gateway_ip_configuration.rb +90 -0
  101. data/lib/azure_mgmt_network/Models/virtual_network_gateway_ip_configuration_properties_format.rb +117 -0
  102. data/lib/azure_mgmt_network/Models/virtual_network_gateway_list_result.rb +88 -0
  103. data/lib/azure_mgmt_network/Models/virtual_network_gateway_properties_format.rb +126 -0
  104. data/lib/azure_mgmt_network/Models/virtual_network_gateway_type.rb +15 -0
  105. data/lib/azure_mgmt_network/Models/virtual_network_list_result.rb +88 -0
  106. data/lib/azure_mgmt_network/Models/virtual_network_properties_format.rb +123 -0
  107. data/lib/azure_mgmt_network/Models/vpn_type.rb +16 -0
  108. data/lib/azure_mgmt_network/application_gateways.rb +915 -0
  109. data/lib/azure_mgmt_network/load_balancers.rb +709 -0
  110. data/lib/azure_mgmt_network/local_network_gateways.rb +550 -0
  111. data/lib/azure_mgmt_network/module_definition.rb +6 -0
  112. data/lib/azure_mgmt_network/network_interfaces.rb +709 -0
  113. data/lib/azure_mgmt_network/network_resource_provider_client.rb +195 -0
  114. data/lib/azure_mgmt_network/network_security_groups.rb +718 -0
  115. data/lib/azure_mgmt_network/public_ip_addresses.rb +711 -0
  116. data/lib/azure_mgmt_network/security_rules.rb +563 -0
  117. data/lib/azure_mgmt_network/subnets.rb +552 -0
  118. data/lib/azure_mgmt_network/usages.rb +113 -0
  119. data/lib/azure_mgmt_network/version.rb +6 -0
  120. data/lib/azure_mgmt_network/virtual_network_gateway_connections.rb +945 -0
  121. data/lib/azure_mgmt_network/virtual_network_gateways.rb +686 -0
  122. data/lib/azure_mgmt_network/virtual_networks.rb +707 -0
  123. metadata +311 -0
@@ -0,0 +1,711 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.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
+ # PublicIpAddresses
9
+ #
10
+ class PublicIpAddresses
11
+ include Azure::ARM::Network::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the PublicIpAddresses class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return reference to the NetworkResourceProviderClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # The delete publicIpAddress operation deletes the specified publicIpAddress.
27
+ # @param resource_group_name [String] The name of the resource group.
28
+ # @param public_ip_address_name [String] The name of the subnet.
29
+ # @return [Concurrent::Promise] promise which provides async access to http
30
+ # response.
31
+ #
32
+ def delete(resource_group_name, public_ip_address_name, custom_headers = nil)
33
+ # Send request
34
+ promise = begin_delete(resource_group_name, public_ip_address_name, custom_headers)
35
+
36
+ promise = promise.then do |response|
37
+ # Defining deserialization method.
38
+ deserialize_method = lambda do |parsed_response|
39
+ end
40
+
41
+ # Waiting for response.
42
+ @client.get_post_or_delete_operation_result(response, nil, deserialize_method)
43
+ end
44
+
45
+ promise
46
+ end
47
+
48
+ #
49
+ # The delete publicIpAddress operation deletes the specified publicIpAddress.
50
+ # @param resource_group_name [String] The name of the resource group.
51
+ # @param public_ip_address_name [String] The name of the subnet.
52
+ # @param [Hash{String => String}] The hash of custom headers need to be
53
+ # applied to HTTP request.
54
+ #
55
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
56
+ # response.
57
+ #
58
+ def begin_delete(resource_group_name, public_ip_address_name, custom_headers = nil)
59
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
60
+ fail ArgumentError, 'public_ip_address_name is nil' if public_ip_address_name.nil?
61
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
62
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
63
+ # Construct URL
64
+ path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}/"
65
+ path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
66
+ path['{publicIpAddressName}'] = ERB::Util.url_encode(public_ip_address_name) if path.include?('{publicIpAddressName}')
67
+ path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
68
+ url = URI.join(@client.base_url, path)
69
+ properties = {}
70
+ properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
71
+ unless url.query.nil?
72
+ url.query.split('&').each do |url_item|
73
+ url_items_parts = url_item.split('=')
74
+ properties[url_items_parts[0]] = url_items_parts[1]
75
+ end
76
+ end
77
+ properties.reject!{ |key, value| value.nil? }
78
+ url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
79
+ fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
80
+ corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
81
+ url = URI.parse(corrected_url)
82
+
83
+ connection = Faraday.new(:url => url) do |faraday|
84
+ faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
85
+ faraday.use :cookie_jar
86
+ faraday.adapter Faraday.default_adapter
87
+ end
88
+ request_headers = Hash.new
89
+
90
+ # Set Headers
91
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
92
+ request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
93
+
94
+ unless custom_headers.nil?
95
+ custom_headers.each do |key, value|
96
+ request_headers[key] = value
97
+ end
98
+ end
99
+
100
+ # Send Request
101
+ promise = Concurrent::Promise.new do
102
+ connection.delete do |request|
103
+ request.headers = request_headers
104
+ @client.credentials.sign_request(request) unless @client.credentials.nil?
105
+ end
106
+ end
107
+
108
+ promise = promise.then do |http_response|
109
+ status_code = http_response.status
110
+ response_content = http_response.body
111
+ unless (status_code == 202 || status_code == 204 || status_code == 200)
112
+ fail MsRestAzure::AzureOperationError.new(connection, http_response)
113
+ end
114
+
115
+ # Create Result
116
+ result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
117
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
118
+
119
+ result
120
+ end
121
+
122
+ promise.execute
123
+ end
124
+
125
+ #
126
+ # The Get publicIpAddress operation retreives information about the specified
127
+ # pubicIpAddress
128
+ # @param resource_group_name [String] The name of the resource group.
129
+ # @param public_ip_address_name [String] The name of the subnet.
130
+ # @param [Hash{String => String}] The hash of custom headers need to be
131
+ # applied to HTTP request.
132
+ #
133
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
134
+ # response.
135
+ #
136
+ def get(resource_group_name, public_ip_address_name, custom_headers = nil)
137
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
138
+ fail ArgumentError, 'public_ip_address_name is nil' if public_ip_address_name.nil?
139
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
140
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
141
+ # Construct URL
142
+ path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}/"
143
+ path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
144
+ path['{publicIpAddressName}'] = ERB::Util.url_encode(public_ip_address_name) if path.include?('{publicIpAddressName}')
145
+ path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
146
+ url = URI.join(@client.base_url, path)
147
+ properties = {}
148
+ properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
149
+ unless url.query.nil?
150
+ url.query.split('&').each do |url_item|
151
+ url_items_parts = url_item.split('=')
152
+ properties[url_items_parts[0]] = url_items_parts[1]
153
+ end
154
+ end
155
+ properties.reject!{ |key, value| value.nil? }
156
+ url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
157
+ fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
158
+ corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
159
+ url = URI.parse(corrected_url)
160
+
161
+ connection = Faraday.new(:url => url) do |faraday|
162
+ faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
163
+ faraday.use :cookie_jar
164
+ faraday.adapter Faraday.default_adapter
165
+ end
166
+ request_headers = Hash.new
167
+
168
+ # Set Headers
169
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
170
+ request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
171
+
172
+ unless custom_headers.nil?
173
+ custom_headers.each do |key, value|
174
+ request_headers[key] = value
175
+ end
176
+ end
177
+
178
+ # Send Request
179
+ promise = Concurrent::Promise.new do
180
+ connection.get do |request|
181
+ request.headers = request_headers
182
+ @client.credentials.sign_request(request) unless @client.credentials.nil?
183
+ end
184
+ end
185
+
186
+ promise = promise.then do |http_response|
187
+ status_code = http_response.status
188
+ response_content = http_response.body
189
+ unless (status_code == 200)
190
+ error_model = JSON.load(response_content)
191
+ fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
192
+ end
193
+
194
+ # Create Result
195
+ result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
196
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
197
+ # Deserialize Response
198
+ if status_code == 200
199
+ begin
200
+ parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
201
+ unless parsed_response.nil?
202
+ parsed_response = PublicIpAddress.deserialize_object(parsed_response)
203
+ end
204
+ result.body = parsed_response
205
+ rescue Exception => e
206
+ fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
207
+ end
208
+ end
209
+
210
+ result
211
+ end
212
+
213
+ promise.execute
214
+ end
215
+
216
+ #
217
+ # The Put PublicIPAddress operation creates/updates a stable/dynamic PublicIP
218
+ # address
219
+ # @param resource_group_name [String] The name of the resource group.
220
+ # @param public_ip_address_name [String] The name of the publicIpAddress.
221
+ # @param parameters [PublicIpAddress] Parameters supplied to the create/update
222
+ # PublicIPAddress operation
223
+ # @param @client.api_version [String] Client Api Version.
224
+ # @param @client.subscription_id [String] Gets subscription credentials which
225
+ # uniquely identify Microsoft Azure subscription. The subscription ID forms
226
+ # part of the URI for every service call.
227
+ # @param @client.accept_language [String] Gets or sets the preferred language
228
+ # for the response.
229
+ #
230
+ # @return [Concurrent::Promise] promise which provides async access to http
231
+ # response.
232
+ #
233
+ def create_or_update(resource_group_name, public_ip_address_name, parameters, custom_headers = nil)
234
+ # Send request
235
+ promise = begin_create_or_update(resource_group_name, public_ip_address_name, parameters, custom_headers)
236
+
237
+ promise = promise.then do |response|
238
+ # Defining deserialization method.
239
+ deserialize_method = lambda do |parsed_response|
240
+ unless parsed_response.nil?
241
+ parsed_response = PublicIpAddress.deserialize_object(parsed_response)
242
+ end
243
+ end
244
+
245
+ # Waiting for response.
246
+ @client.get_put_operation_result(response, custom_headers, deserialize_method)
247
+ end
248
+
249
+ promise
250
+ end
251
+
252
+ #
253
+ # The Put PublicIPAddress operation creates/updates a stable/dynamic PublicIP
254
+ # address
255
+ # @param resource_group_name [String] The name of the resource group.
256
+ # @param public_ip_address_name [String] The name of the publicIpAddress.
257
+ # @param parameters [PublicIpAddress] Parameters supplied to the create/update
258
+ # PublicIPAddress operation
259
+ # @param [Hash{String => String}] The hash of custom headers need to be
260
+ # applied to HTTP request.
261
+ #
262
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
263
+ # response.
264
+ #
265
+ def begin_create_or_update(resource_group_name, public_ip_address_name, parameters, custom_headers = nil)
266
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
267
+ fail ArgumentError, 'public_ip_address_name is nil' if public_ip_address_name.nil?
268
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
269
+ parameters.validate unless parameters.nil?
270
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
271
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
272
+ # Construct URL
273
+ path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}/"
274
+ path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
275
+ path['{publicIpAddressName}'] = ERB::Util.url_encode(public_ip_address_name) if path.include?('{publicIpAddressName}')
276
+ path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
277
+ url = URI.join(@client.base_url, path)
278
+ properties = {}
279
+ properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
280
+ unless url.query.nil?
281
+ url.query.split('&').each do |url_item|
282
+ url_items_parts = url_item.split('=')
283
+ properties[url_items_parts[0]] = url_items_parts[1]
284
+ end
285
+ end
286
+ properties.reject!{ |key, value| value.nil? }
287
+ url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
288
+ fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
289
+ corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
290
+ url = URI.parse(corrected_url)
291
+
292
+ connection = Faraday.new(:url => url) do |faraday|
293
+ faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
294
+ faraday.use :cookie_jar
295
+ faraday.adapter Faraday.default_adapter
296
+ end
297
+ request_headers = Hash.new
298
+
299
+ # Set Headers
300
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
301
+ request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
302
+
303
+ unless custom_headers.nil?
304
+ custom_headers.each do |key, value|
305
+ request_headers[key] = value
306
+ end
307
+ end
308
+
309
+ # Serialize Request
310
+ request_headers['Content-Type'] = 'application/json'
311
+ unless parameters.nil?
312
+ parameters = PublicIpAddress.serialize_object(parameters)
313
+ end
314
+ request_content = JSON.generate(parameters, quirks_mode: true)
315
+
316
+ # Send Request
317
+ promise = Concurrent::Promise.new do
318
+ connection.put do |request|
319
+ request.headers = request_headers
320
+ request.body = request_content
321
+ @client.credentials.sign_request(request) unless @client.credentials.nil?
322
+ end
323
+ end
324
+
325
+ promise = promise.then do |http_response|
326
+ status_code = http_response.status
327
+ response_content = http_response.body
328
+ unless (status_code == 200 || status_code == 201)
329
+ error_model = JSON.load(response_content)
330
+ fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
331
+ end
332
+
333
+ # Create Result
334
+ result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
335
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
336
+ # Deserialize Response
337
+ if status_code == 200
338
+ begin
339
+ parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
340
+ unless parsed_response.nil?
341
+ parsed_response = PublicIpAddress.deserialize_object(parsed_response)
342
+ end
343
+ result.body = parsed_response
344
+ rescue Exception => e
345
+ fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
346
+ end
347
+ end
348
+ # Deserialize Response
349
+ if status_code == 201
350
+ begin
351
+ parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
352
+ unless parsed_response.nil?
353
+ parsed_response = PublicIpAddress.deserialize_object(parsed_response)
354
+ end
355
+ result.body = parsed_response
356
+ rescue Exception => e
357
+ fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
358
+ end
359
+ end
360
+
361
+ result
362
+ end
363
+
364
+ promise.execute
365
+ end
366
+
367
+ #
368
+ # The List publicIpAddress opertion retrieves all the publicIpAddresses in a
369
+ # subscription.
370
+ # @param [Hash{String => String}] The hash of custom headers need to be
371
+ # applied to HTTP request.
372
+ #
373
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
374
+ # response.
375
+ #
376
+ def list_all(custom_headers = nil)
377
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
378
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
379
+ # Construct URL
380
+ path = "/subscriptions/{subscriptionId}/providers/Microsoft.Network/publicIPAddresses"
381
+ path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
382
+ url = URI.join(@client.base_url, path)
383
+ properties = {}
384
+ properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
385
+ unless url.query.nil?
386
+ url.query.split('&').each do |url_item|
387
+ url_items_parts = url_item.split('=')
388
+ properties[url_items_parts[0]] = url_items_parts[1]
389
+ end
390
+ end
391
+ properties.reject!{ |key, value| value.nil? }
392
+ url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
393
+ fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
394
+ corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
395
+ url = URI.parse(corrected_url)
396
+
397
+ connection = Faraday.new(:url => url) do |faraday|
398
+ faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
399
+ faraday.use :cookie_jar
400
+ faraday.adapter Faraday.default_adapter
401
+ end
402
+ request_headers = Hash.new
403
+
404
+ # Set Headers
405
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
406
+ request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
407
+
408
+ unless custom_headers.nil?
409
+ custom_headers.each do |key, value|
410
+ request_headers[key] = value
411
+ end
412
+ end
413
+
414
+ # Send Request
415
+ promise = Concurrent::Promise.new do
416
+ connection.get do |request|
417
+ request.headers = request_headers
418
+ @client.credentials.sign_request(request) unless @client.credentials.nil?
419
+ end
420
+ end
421
+
422
+ promise = promise.then do |http_response|
423
+ status_code = http_response.status
424
+ response_content = http_response.body
425
+ unless (status_code == 200)
426
+ error_model = JSON.load(response_content)
427
+ fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
428
+ end
429
+
430
+ # Create Result
431
+ result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
432
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
433
+ # Deserialize Response
434
+ if status_code == 200
435
+ begin
436
+ parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
437
+ unless parsed_response.nil?
438
+ parsed_response = PublicIpAddressListResult.deserialize_object(parsed_response)
439
+ end
440
+ result.body = parsed_response
441
+ rescue Exception => e
442
+ fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
443
+ end
444
+ end
445
+
446
+ result
447
+ end
448
+
449
+ promise.execute
450
+ end
451
+
452
+ #
453
+ # The List publicIpAddress opertion retrieves all the publicIpAddresses in a
454
+ # resource group.
455
+ # @param resource_group_name [String] The name of the resource group.
456
+ # @param [Hash{String => String}] The hash of custom headers need to be
457
+ # applied to HTTP request.
458
+ #
459
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
460
+ # response.
461
+ #
462
+ def list(resource_group_name, custom_headers = nil)
463
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
464
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
465
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
466
+ # Construct URL
467
+ path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses"
468
+ path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
469
+ path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
470
+ url = URI.join(@client.base_url, path)
471
+ properties = {}
472
+ properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
473
+ unless url.query.nil?
474
+ url.query.split('&').each do |url_item|
475
+ url_items_parts = url_item.split('=')
476
+ properties[url_items_parts[0]] = url_items_parts[1]
477
+ end
478
+ end
479
+ properties.reject!{ |key, value| value.nil? }
480
+ url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
481
+ fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
482
+ corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
483
+ url = URI.parse(corrected_url)
484
+
485
+ connection = Faraday.new(:url => url) do |faraday|
486
+ faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
487
+ faraday.use :cookie_jar
488
+ faraday.adapter Faraday.default_adapter
489
+ end
490
+ request_headers = Hash.new
491
+
492
+ # Set Headers
493
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
494
+ request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
495
+
496
+ unless custom_headers.nil?
497
+ custom_headers.each do |key, value|
498
+ request_headers[key] = value
499
+ end
500
+ end
501
+
502
+ # Send Request
503
+ promise = Concurrent::Promise.new do
504
+ connection.get do |request|
505
+ request.headers = request_headers
506
+ @client.credentials.sign_request(request) unless @client.credentials.nil?
507
+ end
508
+ end
509
+
510
+ promise = promise.then do |http_response|
511
+ status_code = http_response.status
512
+ response_content = http_response.body
513
+ unless (status_code == 200)
514
+ error_model = JSON.load(response_content)
515
+ fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
516
+ end
517
+
518
+ # Create Result
519
+ result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
520
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
521
+ # Deserialize Response
522
+ if status_code == 200
523
+ begin
524
+ parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
525
+ unless parsed_response.nil?
526
+ parsed_response = PublicIpAddressListResult.deserialize_object(parsed_response)
527
+ end
528
+ result.body = parsed_response
529
+ rescue Exception => e
530
+ fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
531
+ end
532
+ end
533
+
534
+ result
535
+ end
536
+
537
+ promise.execute
538
+ end
539
+
540
+ #
541
+ # The List publicIpAddress opertion retrieves all the publicIpAddresses in a
542
+ # subscription.
543
+ # @param next_page_link [String] The NextLink from the previous successful
544
+ # call to List operation.
545
+ # @param [Hash{String => String}] The hash of custom headers need to be
546
+ # applied to HTTP request.
547
+ #
548
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
549
+ # response.
550
+ #
551
+ def list_all_next(next_page_link, custom_headers = nil)
552
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
553
+ # Construct URL
554
+ path = "{nextLink}"
555
+ path['{nextLink}'] = next_page_link if path.include?('{nextLink}')
556
+ url = URI.parse(path)
557
+ properties = {}
558
+ unless url.query.nil?
559
+ url.query.split('&').each do |url_item|
560
+ url_items_parts = url_item.split('=')
561
+ properties[url_items_parts[0]] = url_items_parts[1]
562
+ end
563
+ end
564
+ properties.reject!{ |key, value| value.nil? }
565
+ url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
566
+ fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
567
+ corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
568
+ url = URI.parse(corrected_url)
569
+
570
+ connection = Faraday.new(:url => url) do |faraday|
571
+ faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
572
+ faraday.use :cookie_jar
573
+ faraday.adapter Faraday.default_adapter
574
+ end
575
+ request_headers = Hash.new
576
+
577
+ # Set Headers
578
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
579
+ request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
580
+
581
+ unless custom_headers.nil?
582
+ custom_headers.each do |key, value|
583
+ request_headers[key] = value
584
+ end
585
+ end
586
+
587
+ # Send Request
588
+ promise = Concurrent::Promise.new do
589
+ connection.get do |request|
590
+ request.headers = request_headers
591
+ @client.credentials.sign_request(request) unless @client.credentials.nil?
592
+ end
593
+ end
594
+
595
+ promise = promise.then do |http_response|
596
+ status_code = http_response.status
597
+ response_content = http_response.body
598
+ unless (status_code == 200)
599
+ error_model = JSON.load(response_content)
600
+ fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
601
+ end
602
+
603
+ # Create Result
604
+ result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
605
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
606
+ # Deserialize Response
607
+ if status_code == 200
608
+ begin
609
+ parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
610
+ unless parsed_response.nil?
611
+ parsed_response = PublicIpAddressListResult.deserialize_object(parsed_response)
612
+ end
613
+ result.body = parsed_response
614
+ rescue Exception => e
615
+ fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
616
+ end
617
+ end
618
+
619
+ result
620
+ end
621
+
622
+ promise.execute
623
+ end
624
+
625
+ #
626
+ # The List publicIpAddress opertion retrieves all the publicIpAddresses in a
627
+ # resource group.
628
+ # @param next_page_link [String] The NextLink from the previous successful
629
+ # call to List operation.
630
+ # @param [Hash{String => String}] The hash of custom headers need to be
631
+ # applied to HTTP request.
632
+ #
633
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
634
+ # response.
635
+ #
636
+ def list_next(next_page_link, custom_headers = nil)
637
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
638
+ # Construct URL
639
+ path = "{nextLink}"
640
+ path['{nextLink}'] = next_page_link if path.include?('{nextLink}')
641
+ url = URI.parse(path)
642
+ properties = {}
643
+ unless url.query.nil?
644
+ url.query.split('&').each do |url_item|
645
+ url_items_parts = url_item.split('=')
646
+ properties[url_items_parts[0]] = url_items_parts[1]
647
+ end
648
+ end
649
+ properties.reject!{ |key, value| value.nil? }
650
+ url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
651
+ fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
652
+ corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
653
+ url = URI.parse(corrected_url)
654
+
655
+ connection = Faraday.new(:url => url) do |faraday|
656
+ faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
657
+ faraday.use :cookie_jar
658
+ faraday.adapter Faraday.default_adapter
659
+ end
660
+ request_headers = Hash.new
661
+
662
+ # Set Headers
663
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
664
+ request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
665
+
666
+ unless custom_headers.nil?
667
+ custom_headers.each do |key, value|
668
+ request_headers[key] = value
669
+ end
670
+ end
671
+
672
+ # Send Request
673
+ promise = Concurrent::Promise.new do
674
+ connection.get do |request|
675
+ request.headers = request_headers
676
+ @client.credentials.sign_request(request) unless @client.credentials.nil?
677
+ end
678
+ end
679
+
680
+ promise = promise.then do |http_response|
681
+ status_code = http_response.status
682
+ response_content = http_response.body
683
+ unless (status_code == 200)
684
+ error_model = JSON.load(response_content)
685
+ fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
686
+ end
687
+
688
+ # Create Result
689
+ result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
690
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
691
+ # Deserialize Response
692
+ if status_code == 200
693
+ begin
694
+ parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
695
+ unless parsed_response.nil?
696
+ parsed_response = PublicIpAddressListResult.deserialize_object(parsed_response)
697
+ end
698
+ result.body = parsed_response
699
+ rescue Exception => e
700
+ fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
701
+ end
702
+ end
703
+
704
+ result
705
+ end
706
+
707
+ promise.execute
708
+ end
709
+
710
+ end
711
+ end