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