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,113 @@
|
|
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
|
+
# Usages
|
9
|
+
#
|
10
|
+
class Usages
|
11
|
+
include Azure::ARM::Network::Models
|
12
|
+
include MsRestAzure
|
13
|
+
|
14
|
+
#
|
15
|
+
# Creates and initializes a new instance of the Usages 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
|
+
# Lists compute usages for a subscription.
|
27
|
+
# @param location [String] The location upon which resource usage is queried.
|
28
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
29
|
+
# applied to HTTP request.
|
30
|
+
#
|
31
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
32
|
+
# response.
|
33
|
+
#
|
34
|
+
def list(location, custom_headers = nil)
|
35
|
+
fail ArgumentError, 'location is nil' if location.nil?
|
36
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
37
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
38
|
+
# Construct URL
|
39
|
+
path = "/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/usages"
|
40
|
+
path['{location}'] = ERB::Util.url_encode(location) if path.include?('{location}')
|
41
|
+
path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
|
42
|
+
url = URI.join(@client.base_url, path)
|
43
|
+
properties = {}
|
44
|
+
properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
|
45
|
+
unless url.query.nil?
|
46
|
+
url.query.split('&').each do |url_item|
|
47
|
+
url_items_parts = url_item.split('=')
|
48
|
+
properties[url_items_parts[0]] = url_items_parts[1]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
properties.reject!{ |key, value| value.nil? }
|
52
|
+
url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
|
53
|
+
fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
|
54
|
+
corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
|
55
|
+
url = URI.parse(corrected_url)
|
56
|
+
|
57
|
+
connection = Faraday.new(:url => url) do |faraday|
|
58
|
+
faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
|
59
|
+
faraday.use :cookie_jar
|
60
|
+
faraday.adapter Faraday.default_adapter
|
61
|
+
end
|
62
|
+
request_headers = Hash.new
|
63
|
+
|
64
|
+
# Set Headers
|
65
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
66
|
+
request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
|
67
|
+
|
68
|
+
unless custom_headers.nil?
|
69
|
+
custom_headers.each do |key, value|
|
70
|
+
request_headers[key] = value
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# Send Request
|
75
|
+
promise = Concurrent::Promise.new do
|
76
|
+
connection.get do |request|
|
77
|
+
request.headers = request_headers
|
78
|
+
@client.credentials.sign_request(request) unless @client.credentials.nil?
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
promise = promise.then do |http_response|
|
83
|
+
status_code = http_response.status
|
84
|
+
response_content = http_response.body
|
85
|
+
unless (status_code == 200)
|
86
|
+
error_model = JSON.load(response_content)
|
87
|
+
fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
|
88
|
+
end
|
89
|
+
|
90
|
+
# Create Result
|
91
|
+
result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
|
92
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
93
|
+
# Deserialize Response
|
94
|
+
if status_code == 200
|
95
|
+
begin
|
96
|
+
parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
|
97
|
+
unless parsed_response.nil?
|
98
|
+
parsed_response = UsagesListResult.deserialize_object(parsed_response)
|
99
|
+
end
|
100
|
+
result.body = parsed_response
|
101
|
+
rescue Exception => e
|
102
|
+
fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
result
|
107
|
+
end
|
108
|
+
|
109
|
+
promise.execute
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
113
|
+
end
|
@@ -0,0 +1,945 @@
|
|
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
|
+
# VirtualNetworkGatewayConnections
|
9
|
+
#
|
10
|
+
class VirtualNetworkGatewayConnections
|
11
|
+
include Azure::ARM::Network::Models
|
12
|
+
include MsRestAzure
|
13
|
+
|
14
|
+
#
|
15
|
+
# Creates and initializes a new instance of the VirtualNetworkGatewayConnections 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 VirtualNetworkGatewayConnection operation creates/updates a virtual
|
27
|
+
# network gateway connection in the specified resource group through Network
|
28
|
+
# resource provider.
|
29
|
+
# @param resource_group_name [String] The name of the resource group.
|
30
|
+
# @param virtual_network_gateway_connection_name [String] The name of the
|
31
|
+
# virtual network gateway conenction.
|
32
|
+
# @param parameters [VirtualNetworkGatewayConnection] Parameters supplied to
|
33
|
+
# the Begin Create or update Virtual Network Gateway connection operation
|
34
|
+
# through Network resource provider.
|
35
|
+
# @param @client.api_version [String] Client Api Version.
|
36
|
+
# @param @client.subscription_id [String] Gets subscription credentials which
|
37
|
+
# uniquely identify Microsoft Azure subscription. The subscription ID forms
|
38
|
+
# part of the URI for every service call.
|
39
|
+
# @param @client.accept_language [String] Gets or sets the preferred language
|
40
|
+
# for the response.
|
41
|
+
#
|
42
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
43
|
+
# response.
|
44
|
+
#
|
45
|
+
def create_or_update(resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers = nil)
|
46
|
+
# Send request
|
47
|
+
promise = begin_create_or_update(resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers)
|
48
|
+
|
49
|
+
promise = promise.then do |response|
|
50
|
+
# Defining deserialization method.
|
51
|
+
deserialize_method = lambda do |parsed_response|
|
52
|
+
unless parsed_response.nil?
|
53
|
+
parsed_response = VirtualNetworkGatewayConnection.deserialize_object(parsed_response)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# Waiting for response.
|
58
|
+
@client.get_put_operation_result(response, custom_headers, deserialize_method)
|
59
|
+
end
|
60
|
+
|
61
|
+
promise
|
62
|
+
end
|
63
|
+
|
64
|
+
#
|
65
|
+
# The Put VirtualNetworkGatewayConnection operation creates/updates a virtual
|
66
|
+
# network gateway connection in the specified resource group through Network
|
67
|
+
# resource provider.
|
68
|
+
# @param resource_group_name [String] The name of the resource group.
|
69
|
+
# @param virtual_network_gateway_connection_name [String] The name of the
|
70
|
+
# virtual network gateway conenction.
|
71
|
+
# @param parameters [VirtualNetworkGatewayConnection] Parameters supplied to
|
72
|
+
# the Begin Create or update Virtual Network Gateway connection operation
|
73
|
+
# through Network resource provider.
|
74
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
75
|
+
# applied to HTTP request.
|
76
|
+
#
|
77
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
78
|
+
# response.
|
79
|
+
#
|
80
|
+
def begin_create_or_update(resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers = nil)
|
81
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
82
|
+
fail ArgumentError, 'virtual_network_gateway_connection_name is nil' if virtual_network_gateway_connection_name.nil?
|
83
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
84
|
+
parameters.validate unless parameters.nil?
|
85
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
86
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
87
|
+
# Construct URL
|
88
|
+
path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}"
|
89
|
+
path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
|
90
|
+
path['{virtualNetworkGatewayConnectionName}'] = ERB::Util.url_encode(virtual_network_gateway_connection_name) if path.include?('{virtualNetworkGatewayConnectionName}')
|
91
|
+
path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
|
92
|
+
url = URI.join(@client.base_url, path)
|
93
|
+
properties = {}
|
94
|
+
properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
|
95
|
+
unless url.query.nil?
|
96
|
+
url.query.split('&').each do |url_item|
|
97
|
+
url_items_parts = url_item.split('=')
|
98
|
+
properties[url_items_parts[0]] = url_items_parts[1]
|
99
|
+
end
|
100
|
+
end
|
101
|
+
properties.reject!{ |key, value| value.nil? }
|
102
|
+
url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
|
103
|
+
fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
|
104
|
+
corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
|
105
|
+
url = URI.parse(corrected_url)
|
106
|
+
|
107
|
+
connection = Faraday.new(:url => url) do |faraday|
|
108
|
+
faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
|
109
|
+
faraday.use :cookie_jar
|
110
|
+
faraday.adapter Faraday.default_adapter
|
111
|
+
end
|
112
|
+
request_headers = Hash.new
|
113
|
+
|
114
|
+
# Set Headers
|
115
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
116
|
+
request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
|
117
|
+
|
118
|
+
unless custom_headers.nil?
|
119
|
+
custom_headers.each do |key, value|
|
120
|
+
request_headers[key] = value
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
# Serialize Request
|
125
|
+
request_headers['Content-Type'] = 'application/json'
|
126
|
+
unless parameters.nil?
|
127
|
+
parameters = VirtualNetworkGatewayConnection.serialize_object(parameters)
|
128
|
+
end
|
129
|
+
request_content = JSON.generate(parameters, quirks_mode: true)
|
130
|
+
|
131
|
+
# Send Request
|
132
|
+
promise = Concurrent::Promise.new do
|
133
|
+
connection.put do |request|
|
134
|
+
request.headers = request_headers
|
135
|
+
request.body = request_content
|
136
|
+
@client.credentials.sign_request(request) unless @client.credentials.nil?
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
promise = promise.then do |http_response|
|
141
|
+
status_code = http_response.status
|
142
|
+
response_content = http_response.body
|
143
|
+
unless (status_code == 200 || status_code == 201)
|
144
|
+
error_model = JSON.load(response_content)
|
145
|
+
fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
|
146
|
+
end
|
147
|
+
|
148
|
+
# Create Result
|
149
|
+
result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
|
150
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
151
|
+
# Deserialize Response
|
152
|
+
if status_code == 200
|
153
|
+
begin
|
154
|
+
parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
|
155
|
+
unless parsed_response.nil?
|
156
|
+
parsed_response = VirtualNetworkGatewayConnection.deserialize_object(parsed_response)
|
157
|
+
end
|
158
|
+
result.body = parsed_response
|
159
|
+
rescue Exception => e
|
160
|
+
fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
|
161
|
+
end
|
162
|
+
end
|
163
|
+
# Deserialize Response
|
164
|
+
if status_code == 201
|
165
|
+
begin
|
166
|
+
parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
|
167
|
+
unless parsed_response.nil?
|
168
|
+
parsed_response = VirtualNetworkGatewayConnection.deserialize_object(parsed_response)
|
169
|
+
end
|
170
|
+
result.body = parsed_response
|
171
|
+
rescue Exception => e
|
172
|
+
fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
result
|
177
|
+
end
|
178
|
+
|
179
|
+
promise.execute
|
180
|
+
end
|
181
|
+
|
182
|
+
#
|
183
|
+
# The Get VirtualNetworkGatewayConnection operation retrieves information
|
184
|
+
# about the specified virtual network gateway connection through Network
|
185
|
+
# resource provider.
|
186
|
+
# @param resource_group_name [String] The name of the resource group.
|
187
|
+
# @param virtual_network_gateway_connection_name [String] The name of the
|
188
|
+
# virtual network gateway connection.
|
189
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
190
|
+
# applied to HTTP request.
|
191
|
+
#
|
192
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
193
|
+
# response.
|
194
|
+
#
|
195
|
+
def get(resource_group_name, virtual_network_gateway_connection_name, custom_headers = nil)
|
196
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
197
|
+
fail ArgumentError, 'virtual_network_gateway_connection_name is nil' if virtual_network_gateway_connection_name.nil?
|
198
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
199
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
200
|
+
# Construct URL
|
201
|
+
path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}"
|
202
|
+
path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
|
203
|
+
path['{virtualNetworkGatewayConnectionName}'] = ERB::Util.url_encode(virtual_network_gateway_connection_name) if path.include?('{virtualNetworkGatewayConnectionName}')
|
204
|
+
path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
|
205
|
+
url = URI.join(@client.base_url, path)
|
206
|
+
properties = {}
|
207
|
+
properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
|
208
|
+
unless url.query.nil?
|
209
|
+
url.query.split('&').each do |url_item|
|
210
|
+
url_items_parts = url_item.split('=')
|
211
|
+
properties[url_items_parts[0]] = url_items_parts[1]
|
212
|
+
end
|
213
|
+
end
|
214
|
+
properties.reject!{ |key, value| value.nil? }
|
215
|
+
url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
|
216
|
+
fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
|
217
|
+
corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
|
218
|
+
url = URI.parse(corrected_url)
|
219
|
+
|
220
|
+
connection = Faraday.new(:url => url) do |faraday|
|
221
|
+
faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
|
222
|
+
faraday.use :cookie_jar
|
223
|
+
faraday.adapter Faraday.default_adapter
|
224
|
+
end
|
225
|
+
request_headers = Hash.new
|
226
|
+
|
227
|
+
# Set Headers
|
228
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
229
|
+
request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
|
230
|
+
|
231
|
+
unless custom_headers.nil?
|
232
|
+
custom_headers.each do |key, value|
|
233
|
+
request_headers[key] = value
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
# Send Request
|
238
|
+
promise = Concurrent::Promise.new do
|
239
|
+
connection.get do |request|
|
240
|
+
request.headers = request_headers
|
241
|
+
@client.credentials.sign_request(request) unless @client.credentials.nil?
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
promise = promise.then do |http_response|
|
246
|
+
status_code = http_response.status
|
247
|
+
response_content = http_response.body
|
248
|
+
unless (status_code == 200)
|
249
|
+
error_model = JSON.load(response_content)
|
250
|
+
fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
|
251
|
+
end
|
252
|
+
|
253
|
+
# Create Result
|
254
|
+
result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
|
255
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
256
|
+
# Deserialize Response
|
257
|
+
if status_code == 200
|
258
|
+
begin
|
259
|
+
parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
|
260
|
+
unless parsed_response.nil?
|
261
|
+
parsed_response = VirtualNetworkGatewayConnection.deserialize_object(parsed_response)
|
262
|
+
end
|
263
|
+
result.body = parsed_response
|
264
|
+
rescue Exception => e
|
265
|
+
fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
269
|
+
result
|
270
|
+
end
|
271
|
+
|
272
|
+
promise.execute
|
273
|
+
end
|
274
|
+
|
275
|
+
#
|
276
|
+
# The Delete VirtualNetworkGatewayConnection operation deletes the specifed
|
277
|
+
# virtual network Gateway connection through Network resource provider.
|
278
|
+
# @param resource_group_name [String] The name of the resource group.
|
279
|
+
# @param virtual_network_gateway_connection_name [String] The name of the
|
280
|
+
# virtual network gateway connection.
|
281
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
282
|
+
# response.
|
283
|
+
#
|
284
|
+
def delete(resource_group_name, virtual_network_gateway_connection_name, custom_headers = nil)
|
285
|
+
# Send request
|
286
|
+
promise = begin_delete(resource_group_name, virtual_network_gateway_connection_name, custom_headers)
|
287
|
+
|
288
|
+
promise = promise.then do |response|
|
289
|
+
# Defining deserialization method.
|
290
|
+
deserialize_method = lambda do |parsed_response|
|
291
|
+
end
|
292
|
+
|
293
|
+
# Waiting for response.
|
294
|
+
@client.get_post_or_delete_operation_result(response, nil, deserialize_method)
|
295
|
+
end
|
296
|
+
|
297
|
+
promise
|
298
|
+
end
|
299
|
+
|
300
|
+
#
|
301
|
+
# The Delete VirtualNetworkGatewayConnection operation deletes the specifed
|
302
|
+
# virtual network Gateway connection through Network resource provider.
|
303
|
+
# @param resource_group_name [String] The name of the resource group.
|
304
|
+
# @param virtual_network_gateway_connection_name [String] The name of the
|
305
|
+
# virtual network gateway connection.
|
306
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
307
|
+
# applied to HTTP request.
|
308
|
+
#
|
309
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
310
|
+
# response.
|
311
|
+
#
|
312
|
+
def begin_delete(resource_group_name, virtual_network_gateway_connection_name, custom_headers = nil)
|
313
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
314
|
+
fail ArgumentError, 'virtual_network_gateway_connection_name is nil' if virtual_network_gateway_connection_name.nil?
|
315
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
316
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
317
|
+
# Construct URL
|
318
|
+
path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/"
|
319
|
+
path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
|
320
|
+
path['{virtualNetworkGatewayConnectionName}'] = ERB::Util.url_encode(virtual_network_gateway_connection_name) if path.include?('{virtualNetworkGatewayConnectionName}')
|
321
|
+
path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
|
322
|
+
url = URI.join(@client.base_url, path)
|
323
|
+
properties = {}
|
324
|
+
properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
|
325
|
+
unless url.query.nil?
|
326
|
+
url.query.split('&').each do |url_item|
|
327
|
+
url_items_parts = url_item.split('=')
|
328
|
+
properties[url_items_parts[0]] = url_items_parts[1]
|
329
|
+
end
|
330
|
+
end
|
331
|
+
properties.reject!{ |key, value| value.nil? }
|
332
|
+
url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
|
333
|
+
fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
|
334
|
+
corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
|
335
|
+
url = URI.parse(corrected_url)
|
336
|
+
|
337
|
+
connection = Faraday.new(:url => url) do |faraday|
|
338
|
+
faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
|
339
|
+
faraday.use :cookie_jar
|
340
|
+
faraday.adapter Faraday.default_adapter
|
341
|
+
end
|
342
|
+
request_headers = Hash.new
|
343
|
+
|
344
|
+
# Set Headers
|
345
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
346
|
+
request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
|
347
|
+
|
348
|
+
unless custom_headers.nil?
|
349
|
+
custom_headers.each do |key, value|
|
350
|
+
request_headers[key] = value
|
351
|
+
end
|
352
|
+
end
|
353
|
+
|
354
|
+
# Send Request
|
355
|
+
promise = Concurrent::Promise.new do
|
356
|
+
connection.delete do |request|
|
357
|
+
request.headers = request_headers
|
358
|
+
@client.credentials.sign_request(request) unless @client.credentials.nil?
|
359
|
+
end
|
360
|
+
end
|
361
|
+
|
362
|
+
promise = promise.then do |http_response|
|
363
|
+
status_code = http_response.status
|
364
|
+
response_content = http_response.body
|
365
|
+
unless (status_code == 200 || status_code == 202 || status_code == 204)
|
366
|
+
fail MsRestAzure::AzureOperationError.new(connection, http_response)
|
367
|
+
end
|
368
|
+
|
369
|
+
# Create Result
|
370
|
+
result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
|
371
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
372
|
+
|
373
|
+
result
|
374
|
+
end
|
375
|
+
|
376
|
+
promise.execute
|
377
|
+
end
|
378
|
+
|
379
|
+
#
|
380
|
+
# The Get VirtualNetworkGatewayConnectionSharedKey operation retrieves
|
381
|
+
# information about the specified virtual network gateway connection shared
|
382
|
+
# key through Network resource provider.
|
383
|
+
# @param resource_group_name [String] The name of the resource group.
|
384
|
+
# @param virtual_network_gateway_connection_name [String] The virtual network
|
385
|
+
# gateway connection shared key name.
|
386
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
387
|
+
# applied to HTTP request.
|
388
|
+
#
|
389
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
390
|
+
# response.
|
391
|
+
#
|
392
|
+
def get_shared_key(resource_group_name, virtual_network_gateway_connection_name, custom_headers = nil)
|
393
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
394
|
+
fail ArgumentError, 'virtual_network_gateway_connection_name is nil' if virtual_network_gateway_connection_name.nil?
|
395
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
396
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
397
|
+
# Construct URL
|
398
|
+
path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey"
|
399
|
+
path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
|
400
|
+
path['{virtualNetworkGatewayConnectionName}'] = ERB::Util.url_encode(virtual_network_gateway_connection_name) if path.include?('{virtualNetworkGatewayConnectionName}')
|
401
|
+
path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
|
402
|
+
url = URI.join(@client.base_url, path)
|
403
|
+
properties = {}
|
404
|
+
properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
|
405
|
+
unless url.query.nil?
|
406
|
+
url.query.split('&').each do |url_item|
|
407
|
+
url_items_parts = url_item.split('=')
|
408
|
+
properties[url_items_parts[0]] = url_items_parts[1]
|
409
|
+
end
|
410
|
+
end
|
411
|
+
properties.reject!{ |key, value| value.nil? }
|
412
|
+
url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
|
413
|
+
fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
|
414
|
+
corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
|
415
|
+
url = URI.parse(corrected_url)
|
416
|
+
|
417
|
+
connection = Faraday.new(:url => url) do |faraday|
|
418
|
+
faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
|
419
|
+
faraday.use :cookie_jar
|
420
|
+
faraday.adapter Faraday.default_adapter
|
421
|
+
end
|
422
|
+
request_headers = Hash.new
|
423
|
+
|
424
|
+
# Set Headers
|
425
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
426
|
+
request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
|
427
|
+
|
428
|
+
unless custom_headers.nil?
|
429
|
+
custom_headers.each do |key, value|
|
430
|
+
request_headers[key] = value
|
431
|
+
end
|
432
|
+
end
|
433
|
+
|
434
|
+
# Send Request
|
435
|
+
promise = Concurrent::Promise.new do
|
436
|
+
connection.get do |request|
|
437
|
+
request.headers = request_headers
|
438
|
+
@client.credentials.sign_request(request) unless @client.credentials.nil?
|
439
|
+
end
|
440
|
+
end
|
441
|
+
|
442
|
+
promise = promise.then do |http_response|
|
443
|
+
status_code = http_response.status
|
444
|
+
response_content = http_response.body
|
445
|
+
unless (status_code == 200)
|
446
|
+
error_model = JSON.load(response_content)
|
447
|
+
fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
|
448
|
+
end
|
449
|
+
|
450
|
+
# Create Result
|
451
|
+
result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
|
452
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
453
|
+
# Deserialize Response
|
454
|
+
if status_code == 200
|
455
|
+
begin
|
456
|
+
parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
|
457
|
+
unless parsed_response.nil?
|
458
|
+
parsed_response = ConnectionSharedKey.deserialize_object(parsed_response)
|
459
|
+
end
|
460
|
+
result.body = parsed_response
|
461
|
+
rescue Exception => e
|
462
|
+
fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
|
463
|
+
end
|
464
|
+
end
|
465
|
+
|
466
|
+
result
|
467
|
+
end
|
468
|
+
|
469
|
+
promise.execute
|
470
|
+
end
|
471
|
+
|
472
|
+
#
|
473
|
+
# The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual
|
474
|
+
# network gateway connection shared key for passed virtual network gateway
|
475
|
+
# connection in the specified resource group through Network resource
|
476
|
+
# provider.
|
477
|
+
# @param resource_group_name [String] The name of the resource group.
|
478
|
+
# @param virtual_network_gateway_connection_name [String] The virtual network
|
479
|
+
# gateway connection name.
|
480
|
+
# @param parameters [ConnectionSharedKey] Parameters supplied to the Begin Set
|
481
|
+
# Virtual Network Gateway conection Shared key operation throughNetwork
|
482
|
+
# resource provider.
|
483
|
+
# @param @client.api_version [String] Client Api Version.
|
484
|
+
# @param @client.subscription_id [String] Gets subscription credentials which
|
485
|
+
# uniquely identify Microsoft Azure subscription. The subscription ID forms
|
486
|
+
# part of the URI for every service call.
|
487
|
+
# @param @client.accept_language [String] Gets or sets the preferred language
|
488
|
+
# for the response.
|
489
|
+
#
|
490
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
491
|
+
# response.
|
492
|
+
#
|
493
|
+
def set_shared_key(resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers = nil)
|
494
|
+
# Send request
|
495
|
+
promise = begin_set_shared_key(resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers)
|
496
|
+
|
497
|
+
promise = promise.then do |response|
|
498
|
+
# Defining deserialization method.
|
499
|
+
deserialize_method = lambda do |parsed_response|
|
500
|
+
unless parsed_response.nil?
|
501
|
+
parsed_response = ConnectionSharedKey.deserialize_object(parsed_response)
|
502
|
+
end
|
503
|
+
end
|
504
|
+
|
505
|
+
# Waiting for response.
|
506
|
+
@client.get_put_operation_result(response, custom_headers, deserialize_method)
|
507
|
+
end
|
508
|
+
|
509
|
+
promise
|
510
|
+
end
|
511
|
+
|
512
|
+
#
|
513
|
+
# The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual
|
514
|
+
# network gateway connection shared key for passed virtual network gateway
|
515
|
+
# connection in the specified resource group through Network resource
|
516
|
+
# provider.
|
517
|
+
# @param resource_group_name [String] The name of the resource group.
|
518
|
+
# @param virtual_network_gateway_connection_name [String] The virtual network
|
519
|
+
# gateway connection name.
|
520
|
+
# @param parameters [ConnectionSharedKey] Parameters supplied to the Begin Set
|
521
|
+
# Virtual Network Gateway conection Shared key operation throughNetwork
|
522
|
+
# resource provider.
|
523
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
524
|
+
# applied to HTTP request.
|
525
|
+
#
|
526
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
527
|
+
# response.
|
528
|
+
#
|
529
|
+
def begin_set_shared_key(resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers = nil)
|
530
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
531
|
+
fail ArgumentError, 'virtual_network_gateway_connection_name is nil' if virtual_network_gateway_connection_name.nil?
|
532
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
533
|
+
parameters.validate unless parameters.nil?
|
534
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
535
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
536
|
+
# Construct URL
|
537
|
+
path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey"
|
538
|
+
path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
|
539
|
+
path['{virtualNetworkGatewayConnectionName}'] = ERB::Util.url_encode(virtual_network_gateway_connection_name) if path.include?('{virtualNetworkGatewayConnectionName}')
|
540
|
+
path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
|
541
|
+
url = URI.join(@client.base_url, path)
|
542
|
+
properties = {}
|
543
|
+
properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
|
544
|
+
unless url.query.nil?
|
545
|
+
url.query.split('&').each do |url_item|
|
546
|
+
url_items_parts = url_item.split('=')
|
547
|
+
properties[url_items_parts[0]] = url_items_parts[1]
|
548
|
+
end
|
549
|
+
end
|
550
|
+
properties.reject!{ |key, value| value.nil? }
|
551
|
+
url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
|
552
|
+
fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
|
553
|
+
corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
|
554
|
+
url = URI.parse(corrected_url)
|
555
|
+
|
556
|
+
connection = Faraday.new(:url => url) do |faraday|
|
557
|
+
faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
|
558
|
+
faraday.use :cookie_jar
|
559
|
+
faraday.adapter Faraday.default_adapter
|
560
|
+
end
|
561
|
+
request_headers = Hash.new
|
562
|
+
|
563
|
+
# Set Headers
|
564
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
565
|
+
request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
|
566
|
+
|
567
|
+
unless custom_headers.nil?
|
568
|
+
custom_headers.each do |key, value|
|
569
|
+
request_headers[key] = value
|
570
|
+
end
|
571
|
+
end
|
572
|
+
|
573
|
+
# Serialize Request
|
574
|
+
request_headers['Content-Type'] = 'application/json'
|
575
|
+
unless parameters.nil?
|
576
|
+
parameters = ConnectionSharedKey.serialize_object(parameters)
|
577
|
+
end
|
578
|
+
request_content = JSON.generate(parameters, quirks_mode: true)
|
579
|
+
|
580
|
+
# Send Request
|
581
|
+
promise = Concurrent::Promise.new do
|
582
|
+
connection.put do |request|
|
583
|
+
request.headers = request_headers
|
584
|
+
request.body = request_content
|
585
|
+
@client.credentials.sign_request(request) unless @client.credentials.nil?
|
586
|
+
end
|
587
|
+
end
|
588
|
+
|
589
|
+
promise = promise.then do |http_response|
|
590
|
+
status_code = http_response.status
|
591
|
+
response_content = http_response.body
|
592
|
+
unless (status_code == 200 || status_code == 201)
|
593
|
+
error_model = JSON.load(response_content)
|
594
|
+
fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
|
595
|
+
end
|
596
|
+
|
597
|
+
# Create Result
|
598
|
+
result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
|
599
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
600
|
+
# Deserialize Response
|
601
|
+
if status_code == 200
|
602
|
+
begin
|
603
|
+
parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
|
604
|
+
unless parsed_response.nil?
|
605
|
+
parsed_response = ConnectionSharedKey.deserialize_object(parsed_response)
|
606
|
+
end
|
607
|
+
result.body = parsed_response
|
608
|
+
rescue Exception => e
|
609
|
+
fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
|
610
|
+
end
|
611
|
+
end
|
612
|
+
# Deserialize Response
|
613
|
+
if status_code == 201
|
614
|
+
begin
|
615
|
+
parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
|
616
|
+
unless parsed_response.nil?
|
617
|
+
parsed_response = ConnectionSharedKey.deserialize_object(parsed_response)
|
618
|
+
end
|
619
|
+
result.body = parsed_response
|
620
|
+
rescue Exception => e
|
621
|
+
fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
|
622
|
+
end
|
623
|
+
end
|
624
|
+
|
625
|
+
result
|
626
|
+
end
|
627
|
+
|
628
|
+
promise.execute
|
629
|
+
end
|
630
|
+
|
631
|
+
#
|
632
|
+
# The List VirtualNetworkGatewayConnections operation retrieves all the
|
633
|
+
# virtual network gateways connections created.
|
634
|
+
# @param resource_group_name [String] The name of the resource group.
|
635
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
636
|
+
# applied to HTTP request.
|
637
|
+
#
|
638
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
639
|
+
# response.
|
640
|
+
#
|
641
|
+
def list(resource_group_name, custom_headers = nil)
|
642
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
643
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
644
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
645
|
+
# Construct URL
|
646
|
+
path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections"
|
647
|
+
path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
|
648
|
+
path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
|
649
|
+
url = URI.join(@client.base_url, path)
|
650
|
+
properties = {}
|
651
|
+
properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
|
652
|
+
unless url.query.nil?
|
653
|
+
url.query.split('&').each do |url_item|
|
654
|
+
url_items_parts = url_item.split('=')
|
655
|
+
properties[url_items_parts[0]] = url_items_parts[1]
|
656
|
+
end
|
657
|
+
end
|
658
|
+
properties.reject!{ |key, value| value.nil? }
|
659
|
+
url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
|
660
|
+
fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
|
661
|
+
corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
|
662
|
+
url = URI.parse(corrected_url)
|
663
|
+
|
664
|
+
connection = Faraday.new(:url => url) do |faraday|
|
665
|
+
faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
|
666
|
+
faraday.use :cookie_jar
|
667
|
+
faraday.adapter Faraday.default_adapter
|
668
|
+
end
|
669
|
+
request_headers = Hash.new
|
670
|
+
|
671
|
+
# Set Headers
|
672
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
673
|
+
request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
|
674
|
+
|
675
|
+
unless custom_headers.nil?
|
676
|
+
custom_headers.each do |key, value|
|
677
|
+
request_headers[key] = value
|
678
|
+
end
|
679
|
+
end
|
680
|
+
|
681
|
+
# Send Request
|
682
|
+
promise = Concurrent::Promise.new do
|
683
|
+
connection.get do |request|
|
684
|
+
request.headers = request_headers
|
685
|
+
@client.credentials.sign_request(request) unless @client.credentials.nil?
|
686
|
+
end
|
687
|
+
end
|
688
|
+
|
689
|
+
promise = promise.then do |http_response|
|
690
|
+
status_code = http_response.status
|
691
|
+
response_content = http_response.body
|
692
|
+
unless (status_code == 200)
|
693
|
+
error_model = JSON.load(response_content)
|
694
|
+
fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
|
695
|
+
end
|
696
|
+
|
697
|
+
# Create Result
|
698
|
+
result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
|
699
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
700
|
+
# Deserialize Response
|
701
|
+
if status_code == 200
|
702
|
+
begin
|
703
|
+
parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
|
704
|
+
unless parsed_response.nil?
|
705
|
+
parsed_response = VirtualNetworkGatewayConnectionListResult.deserialize_object(parsed_response)
|
706
|
+
end
|
707
|
+
result.body = parsed_response
|
708
|
+
rescue Exception => e
|
709
|
+
fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
|
710
|
+
end
|
711
|
+
end
|
712
|
+
|
713
|
+
result
|
714
|
+
end
|
715
|
+
|
716
|
+
promise.execute
|
717
|
+
end
|
718
|
+
|
719
|
+
#
|
720
|
+
# The VirtualNetworkGatewayConnectionResetSharedKey operation resets the
|
721
|
+
# virtual network gateway connection shared key for passed virtual network
|
722
|
+
# gateway connection in the specified resource group through Network resource
|
723
|
+
# provider.
|
724
|
+
# @param resource_group_name [String] The name of the resource group.
|
725
|
+
# @param virtual_network_gateway_connection_name [String] The virtual network
|
726
|
+
# gateway connection reset shared key Name.
|
727
|
+
# @param parameters [ConnectionResetSharedKey] Parameters supplied to the
|
728
|
+
# Begin Reset Virtual Network Gateway connection shared key operation through
|
729
|
+
# Network resource provider.
|
730
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
731
|
+
# response.
|
732
|
+
#
|
733
|
+
def reset_shared_key(resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers = nil)
|
734
|
+
# Send request
|
735
|
+
promise = begin_reset_shared_key(resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers)
|
736
|
+
|
737
|
+
promise = promise.then do |response|
|
738
|
+
# Defining deserialization method.
|
739
|
+
deserialize_method = lambda do |parsed_response|
|
740
|
+
unless parsed_response.nil?
|
741
|
+
parsed_response = ConnectionResetSharedKey.deserialize_object(parsed_response)
|
742
|
+
end
|
743
|
+
end
|
744
|
+
|
745
|
+
# Waiting for response.
|
746
|
+
@client.get_post_or_delete_operation_result(response, nil, deserialize_method)
|
747
|
+
end
|
748
|
+
|
749
|
+
promise
|
750
|
+
end
|
751
|
+
|
752
|
+
#
|
753
|
+
# The VirtualNetworkGatewayConnectionResetSharedKey operation resets the
|
754
|
+
# virtual network gateway connection shared key for passed virtual network
|
755
|
+
# gateway connection in the specified resource group through Network resource
|
756
|
+
# provider.
|
757
|
+
# @param resource_group_name [String] The name of the resource group.
|
758
|
+
# @param virtual_network_gateway_connection_name [String] The virtual network
|
759
|
+
# gateway connection reset shared key Name.
|
760
|
+
# @param parameters [ConnectionResetSharedKey] Parameters supplied to the
|
761
|
+
# Begin Reset Virtual Network Gateway connection shared key operation through
|
762
|
+
# Network resource provider.
|
763
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
764
|
+
# applied to HTTP request.
|
765
|
+
#
|
766
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
767
|
+
# response.
|
768
|
+
#
|
769
|
+
def begin_reset_shared_key(resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers = nil)
|
770
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
771
|
+
fail ArgumentError, 'virtual_network_gateway_connection_name is nil' if virtual_network_gateway_connection_name.nil?
|
772
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
773
|
+
parameters.validate unless parameters.nil?
|
774
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
775
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
776
|
+
# Construct URL
|
777
|
+
path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey/reset"
|
778
|
+
path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
|
779
|
+
path['{virtualNetworkGatewayConnectionName}'] = ERB::Util.url_encode(virtual_network_gateway_connection_name) if path.include?('{virtualNetworkGatewayConnectionName}')
|
780
|
+
path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
|
781
|
+
url = URI.join(@client.base_url, path)
|
782
|
+
properties = {}
|
783
|
+
properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
|
784
|
+
unless url.query.nil?
|
785
|
+
url.query.split('&').each do |url_item|
|
786
|
+
url_items_parts = url_item.split('=')
|
787
|
+
properties[url_items_parts[0]] = url_items_parts[1]
|
788
|
+
end
|
789
|
+
end
|
790
|
+
properties.reject!{ |key, value| value.nil? }
|
791
|
+
url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
|
792
|
+
fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
|
793
|
+
corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
|
794
|
+
url = URI.parse(corrected_url)
|
795
|
+
|
796
|
+
connection = Faraday.new(:url => url) do |faraday|
|
797
|
+
faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
|
798
|
+
faraday.use :cookie_jar
|
799
|
+
faraday.adapter Faraday.default_adapter
|
800
|
+
end
|
801
|
+
request_headers = Hash.new
|
802
|
+
|
803
|
+
# Set Headers
|
804
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
805
|
+
request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
|
806
|
+
|
807
|
+
unless custom_headers.nil?
|
808
|
+
custom_headers.each do |key, value|
|
809
|
+
request_headers[key] = value
|
810
|
+
end
|
811
|
+
end
|
812
|
+
|
813
|
+
# Serialize Request
|
814
|
+
request_headers['Content-Type'] = 'application/json'
|
815
|
+
unless parameters.nil?
|
816
|
+
parameters = ConnectionResetSharedKey.serialize_object(parameters)
|
817
|
+
end
|
818
|
+
request_content = JSON.generate(parameters, quirks_mode: true)
|
819
|
+
|
820
|
+
# Send Request
|
821
|
+
promise = Concurrent::Promise.new do
|
822
|
+
connection.post do |request|
|
823
|
+
request.headers = request_headers
|
824
|
+
request.body = request_content
|
825
|
+
@client.credentials.sign_request(request) unless @client.credentials.nil?
|
826
|
+
end
|
827
|
+
end
|
828
|
+
|
829
|
+
promise = promise.then do |http_response|
|
830
|
+
status_code = http_response.status
|
831
|
+
response_content = http_response.body
|
832
|
+
unless (status_code == 200 || status_code == 202)
|
833
|
+
error_model = JSON.load(response_content)
|
834
|
+
fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
|
835
|
+
end
|
836
|
+
|
837
|
+
# Create Result
|
838
|
+
result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
|
839
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
840
|
+
# Deserialize Response
|
841
|
+
if status_code == 200
|
842
|
+
begin
|
843
|
+
parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
|
844
|
+
unless parsed_response.nil?
|
845
|
+
parsed_response = ConnectionResetSharedKey.deserialize_object(parsed_response)
|
846
|
+
end
|
847
|
+
result.body = parsed_response
|
848
|
+
rescue Exception => e
|
849
|
+
fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
|
850
|
+
end
|
851
|
+
end
|
852
|
+
|
853
|
+
result
|
854
|
+
end
|
855
|
+
|
856
|
+
promise.execute
|
857
|
+
end
|
858
|
+
|
859
|
+
#
|
860
|
+
# The List VirtualNetworkGatewayConnections operation retrieves all the
|
861
|
+
# virtual network gateways connections created.
|
862
|
+
# @param next_page_link [String] The NextLink from the previous successful
|
863
|
+
# call to List operation.
|
864
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
865
|
+
# applied to HTTP request.
|
866
|
+
#
|
867
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
868
|
+
# response.
|
869
|
+
#
|
870
|
+
def list_next(next_page_link, custom_headers = nil)
|
871
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
872
|
+
# Construct URL
|
873
|
+
path = "{nextLink}"
|
874
|
+
path['{nextLink}'] = next_page_link if path.include?('{nextLink}')
|
875
|
+
url = URI.parse(path)
|
876
|
+
properties = {}
|
877
|
+
unless url.query.nil?
|
878
|
+
url.query.split('&').each do |url_item|
|
879
|
+
url_items_parts = url_item.split('=')
|
880
|
+
properties[url_items_parts[0]] = url_items_parts[1]
|
881
|
+
end
|
882
|
+
end
|
883
|
+
properties.reject!{ |key, value| value.nil? }
|
884
|
+
url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
|
885
|
+
fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
|
886
|
+
corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
|
887
|
+
url = URI.parse(corrected_url)
|
888
|
+
|
889
|
+
connection = Faraday.new(:url => url) do |faraday|
|
890
|
+
faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
|
891
|
+
faraday.use :cookie_jar
|
892
|
+
faraday.adapter Faraday.default_adapter
|
893
|
+
end
|
894
|
+
request_headers = Hash.new
|
895
|
+
|
896
|
+
# Set Headers
|
897
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
898
|
+
request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
|
899
|
+
|
900
|
+
unless custom_headers.nil?
|
901
|
+
custom_headers.each do |key, value|
|
902
|
+
request_headers[key] = value
|
903
|
+
end
|
904
|
+
end
|
905
|
+
|
906
|
+
# Send Request
|
907
|
+
promise = Concurrent::Promise.new do
|
908
|
+
connection.get do |request|
|
909
|
+
request.headers = request_headers
|
910
|
+
@client.credentials.sign_request(request) unless @client.credentials.nil?
|
911
|
+
end
|
912
|
+
end
|
913
|
+
|
914
|
+
promise = promise.then do |http_response|
|
915
|
+
status_code = http_response.status
|
916
|
+
response_content = http_response.body
|
917
|
+
unless (status_code == 200)
|
918
|
+
error_model = JSON.load(response_content)
|
919
|
+
fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
|
920
|
+
end
|
921
|
+
|
922
|
+
# Create Result
|
923
|
+
result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
|
924
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
925
|
+
# Deserialize Response
|
926
|
+
if status_code == 200
|
927
|
+
begin
|
928
|
+
parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
|
929
|
+
unless parsed_response.nil?
|
930
|
+
parsed_response = VirtualNetworkGatewayConnectionListResult.deserialize_object(parsed_response)
|
931
|
+
end
|
932
|
+
result.body = parsed_response
|
933
|
+
rescue Exception => e
|
934
|
+
fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
|
935
|
+
end
|
936
|
+
end
|
937
|
+
|
938
|
+
result
|
939
|
+
end
|
940
|
+
|
941
|
+
promise.execute
|
942
|
+
end
|
943
|
+
|
944
|
+
end
|
945
|
+
end
|