azure_mgmt_network 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (185) hide show
  1. checksums.yaml +4 -4
  2. data/azure_mgmt_network.gemspec +4 -9
  3. data/lib/azure_mgmt_network.rb +100 -39
  4. data/lib/azure_mgmt_network/application_gateways.rb +175 -401
  5. data/lib/azure_mgmt_network/express_route_circuit_authorizations.rb +429 -0
  6. data/lib/azure_mgmt_network/express_route_circuit_peerings.rb +427 -0
  7. data/lib/azure_mgmt_network/express_route_circuits.rb +911 -0
  8. data/lib/azure_mgmt_network/express_route_service_providers.rb +149 -0
  9. data/lib/azure_mgmt_network/load_balancers.rb +139 -314
  10. data/lib/azure_mgmt_network/local_network_gateways.rb +102 -228
  11. data/lib/azure_mgmt_network/models/address_space.rb +1 -3
  12. data/lib/azure_mgmt_network/models/application_gateway.rb +7 -9
  13. data/lib/azure_mgmt_network/models/application_gateway_backend_address.rb +1 -3
  14. data/lib/azure_mgmt_network/models/application_gateway_backend_address_pool.rb +1 -3
  15. data/lib/azure_mgmt_network/models/application_gateway_backend_address_pool_properties_format.rb +16 -18
  16. data/lib/azure_mgmt_network/models/application_gateway_backend_http_settings.rb +1 -3
  17. data/lib/azure_mgmt_network/models/application_gateway_backend_http_settings_properties_format.rb +32 -8
  18. data/lib/azure_mgmt_network/models/application_gateway_cookie_based_affinity.rb +1 -1
  19. data/lib/azure_mgmt_network/models/{application_gateway_frontend_ip_configuration.rb → application_gateway_frontend_ipconfiguration.rb} +7 -9
  20. data/lib/azure_mgmt_network/models/{application_gateway_frontend_ip_configuration_properties_format.rb → application_gateway_frontend_ipconfiguration_properties_format.rb} +12 -15
  21. data/lib/azure_mgmt_network/models/application_gateway_frontend_port.rb +1 -3
  22. data/lib/azure_mgmt_network/models/application_gateway_frontend_port_properties_format.rb +1 -3
  23. data/lib/azure_mgmt_network/models/application_gateway_http_listener.rb +1 -3
  24. data/lib/azure_mgmt_network/models/application_gateway_http_listener_properties_format.rb +34 -17
  25. data/lib/azure_mgmt_network/models/{application_gateway_ip_configuration.rb → application_gateway_ipconfiguration.rb} +7 -9
  26. data/lib/azure_mgmt_network/models/{application_gateway_ip_configuration_properties_format.rb → application_gateway_ipconfiguration_properties_format.rb} +6 -8
  27. data/lib/azure_mgmt_network/models/application_gateway_list_result.rb +4 -6
  28. data/lib/azure_mgmt_network/models/application_gateway_operational_state.rb +1 -1
  29. data/lib/azure_mgmt_network/models/application_gateway_path_rule.rb +88 -0
  30. data/lib/azure_mgmt_network/models/application_gateway_path_rule_properties_format.rb +101 -0
  31. data/lib/azure_mgmt_network/models/application_gateway_probe.rb +88 -0
  32. data/lib/azure_mgmt_network/models/application_gateway_probe_properties_format.rb +118 -0
  33. data/lib/azure_mgmt_network/models/application_gateway_properties_format.rb +151 -81
  34. data/lib/azure_mgmt_network/models/application_gateway_protocol.rb +1 -1
  35. data/lib/azure_mgmt_network/models/application_gateway_request_routing_rule.rb +1 -3
  36. data/lib/azure_mgmt_network/models/application_gateway_request_routing_rule_properties_format.rb +26 -11
  37. data/lib/azure_mgmt_network/models/application_gateway_request_routing_rule_type.rb +2 -1
  38. data/lib/azure_mgmt_network/models/application_gateway_sku.rb +6 -8
  39. data/lib/azure_mgmt_network/models/application_gateway_sku_name.rb +1 -1
  40. data/lib/azure_mgmt_network/models/application_gateway_ssl_certificate.rb +1 -3
  41. data/lib/azure_mgmt_network/models/application_gateway_ssl_certificate_properties_format.rb +1 -3
  42. data/lib/azure_mgmt_network/models/application_gateway_tier.rb +1 -1
  43. data/lib/azure_mgmt_network/models/application_gateway_url_path_map.rb +88 -0
  44. data/lib/azure_mgmt_network/models/application_gateway_url_path_map_properties_format.rb +122 -0
  45. data/lib/azure_mgmt_network/models/authorization_list_result.rb +87 -0
  46. data/lib/azure_mgmt_network/models/authorization_properties_format.rb +79 -0
  47. data/lib/azure_mgmt_network/models/authorization_use_status.rb +16 -0
  48. data/lib/azure_mgmt_network/models/azure_async_operation_result.rb +5 -7
  49. data/lib/azure_mgmt_network/models/backend_address_pool.rb +1 -3
  50. data/lib/azure_mgmt_network/models/backend_address_pool_properties_format.rb +30 -15
  51. data/lib/azure_mgmt_network/models/connection_reset_shared_key.rb +10 -16
  52. data/lib/azure_mgmt_network/models/connection_shared_key.rb +1 -3
  53. data/lib/azure_mgmt_network/models/{connection_reset_shared_key_properties_format.rb → connection_shared_key_result.rb} +11 -15
  54. data/lib/azure_mgmt_network/models/dhcp_options.rb +1 -3
  55. data/lib/azure_mgmt_network/models/dns_name_availability_result.rb +1 -3
  56. data/lib/azure_mgmt_network/models/error.rb +4 -6
  57. data/lib/azure_mgmt_network/models/error_details.rb +1 -3
  58. data/lib/azure_mgmt_network/models/express_route_circuit.rb +118 -0
  59. data/lib/azure_mgmt_network/models/express_route_circuit_arp_table.rb +65 -0
  60. data/lib/azure_mgmt_network/models/express_route_circuit_authorization.rb +88 -0
  61. data/lib/azure_mgmt_network/models/express_route_circuit_list_result.rb +86 -0
  62. data/lib/azure_mgmt_network/models/express_route_circuit_peering.rb +88 -0
  63. data/lib/azure_mgmt_network/models/express_route_circuit_peering_advertised_public_prefix_state.rb +18 -0
  64. data/lib/azure_mgmt_network/models/express_route_circuit_peering_config.rb +92 -0
  65. data/lib/azure_mgmt_network/models/express_route_circuit_peering_list_result.rb +87 -0
  66. data/lib/azure_mgmt_network/models/express_route_circuit_peering_properties_format.rb +194 -0
  67. data/lib/azure_mgmt_network/models/express_route_circuit_peering_state.rb +16 -0
  68. data/lib/azure_mgmt_network/models/express_route_circuit_peering_type.rb +17 -0
  69. data/lib/azure_mgmt_network/models/express_route_circuit_properties_format.rb +179 -0
  70. data/lib/azure_mgmt_network/models/express_route_circuit_routes_table.rb +89 -0
  71. data/lib/azure_mgmt_network/models/express_route_circuit_service_provider_properties.rb +76 -0
  72. data/lib/azure_mgmt_network/models/express_route_circuit_sku.rb +83 -0
  73. data/lib/azure_mgmt_network/models/express_route_circuit_sku_family.rb +16 -0
  74. data/lib/azure_mgmt_network/models/express_route_circuit_sku_tier.rb +16 -0
  75. data/lib/azure_mgmt_network/models/express_route_circuit_stats.rb +67 -0
  76. data/lib/azure_mgmt_network/models/express_route_circuits_arp_table_list_result.rb +85 -0
  77. data/lib/azure_mgmt_network/models/express_route_circuits_routes_table_list_result.rb +88 -0
  78. data/lib/azure_mgmt_network/models/express_route_circuits_stats_list_result.rb +85 -0
  79. data/lib/azure_mgmt_network/models/express_route_service_provider.rb +92 -0
  80. data/lib/azure_mgmt_network/models/express_route_service_provider_bandwidths_offered.rb +67 -0
  81. data/lib/azure_mgmt_network/models/express_route_service_provider_list_result.rb +86 -0
  82. data/lib/azure_mgmt_network/models/express_route_service_provider_properties_format.rb +97 -0
  83. data/lib/azure_mgmt_network/models/{frontend_ip_configuration.rb → frontend_ipconfiguration.rb} +7 -9
  84. data/lib/azure_mgmt_network/models/{frontend_ip_configuration_properties_format.rb → frontend_ipconfiguration_properties_format.rb} +133 -77
  85. data/lib/azure_mgmt_network/models/inbound_nat_pool.rb +88 -0
  86. data/lib/azure_mgmt_network/models/inbound_nat_pool_properties_format.rb +134 -0
  87. data/lib/azure_mgmt_network/models/inbound_nat_rule.rb +1 -3
  88. data/lib/azure_mgmt_network/models/inbound_nat_rule_properties_format.rb +11 -12
  89. data/lib/azure_mgmt_network/models/{ip_allocation_method.rb → ipallocation_method.rb} +3 -3
  90. data/lib/azure_mgmt_network/models/ipconfiguration.rb +88 -0
  91. data/lib/azure_mgmt_network/models/ipconfiguration_properties_format.rb +113 -0
  92. data/lib/azure_mgmt_network/models/load_balancer.rb +7 -9
  93. data/lib/azure_mgmt_network/models/load_balancer_list_result.rb +4 -6
  94. data/lib/azure_mgmt_network/models/load_balancer_properties_format.rb +103 -35
  95. data/lib/azure_mgmt_network/models/load_balancing_rule.rb +1 -3
  96. data/lib/azure_mgmt_network/models/load_balancing_rule_properties_format.rb +30 -30
  97. data/lib/azure_mgmt_network/models/load_distribution.rb +1 -1
  98. data/lib/azure_mgmt_network/models/local_network_gateway.rb +7 -9
  99. data/lib/azure_mgmt_network/models/local_network_gateway_list_result.rb +4 -6
  100. data/lib/azure_mgmt_network/models/local_network_gateway_properties_format.rb +11 -3
  101. data/lib/azure_mgmt_network/models/network_interface.rb +7 -9
  102. data/lib/azure_mgmt_network/models/network_interface_dns_settings.rb +1 -3
  103. data/lib/azure_mgmt_network/models/{network_interface_ip_configuration.rb → network_interface_ipconfiguration.rb} +7 -9
  104. data/lib/azure_mgmt_network/models/{network_interface_ip_configuration_properties_format.rb → network_interface_ipconfiguration_properties_format.rb} +70 -76
  105. data/lib/azure_mgmt_network/models/network_interface_list_result.rb +4 -6
  106. data/lib/azure_mgmt_network/models/network_interface_properties_format.rb +32 -14
  107. data/lib/azure_mgmt_network/models/{operation_status.rb → network_operation_status.rb} +3 -3
  108. data/lib/azure_mgmt_network/models/network_security_group.rb +7 -9
  109. data/lib/azure_mgmt_network/models/network_security_group_list_result.rb +4 -6
  110. data/lib/azure_mgmt_network/models/network_security_group_properties_format.rb +30 -22
  111. data/lib/azure_mgmt_network/models/outbound_nat_rule.rb +88 -0
  112. data/lib/azure_mgmt_network/models/outbound_nat_rule_properties_format.rb +117 -0
  113. data/lib/azure_mgmt_network/models/probe.rb +1 -3
  114. data/lib/azure_mgmt_network/models/probe_properties_format.rb +25 -26
  115. data/lib/azure_mgmt_network/models/probe_protocol.rb +1 -1
  116. data/lib/azure_mgmt_network/models/processor_architecture.rb +16 -0
  117. data/lib/azure_mgmt_network/models/{public_ip_address.rb → public_ipaddress.rb} +13 -15
  118. data/lib/azure_mgmt_network/models/{public_ip_address_dns_settings.rb → public_ipaddress_dns_settings.rb} +4 -6
  119. data/lib/azure_mgmt_network/models/{public_ip_address_list_result.rb → public_ipaddress_list_result.rb} +10 -12
  120. data/lib/azure_mgmt_network/models/{public_ip_address_properties_format.rb → public_ipaddress_properties_format.rb} +25 -19
  121. data/lib/azure_mgmt_network/models/route.rb +88 -0
  122. data/lib/azure_mgmt_network/models/route_list_result.rb +85 -0
  123. data/lib/azure_mgmt_network/models/route_next_hop_type.rb +19 -0
  124. data/lib/azure_mgmt_network/models/route_properties_format.rb +94 -0
  125. data/lib/azure_mgmt_network/models/route_table.rb +102 -0
  126. data/lib/azure_mgmt_network/models/route_table_list_result.rb +86 -0
  127. data/lib/azure_mgmt_network/models/route_table_properties_format.rb +116 -0
  128. data/lib/azure_mgmt_network/models/security_rule.rb +1 -3
  129. data/lib/azure_mgmt_network/models/security_rule_access.rb +1 -1
  130. data/lib/azure_mgmt_network/models/security_rule_direction.rb +1 -1
  131. data/lib/azure_mgmt_network/models/security_rule_list_result.rb +4 -6
  132. data/lib/azure_mgmt_network/models/security_rule_properties_format.rb +50 -48
  133. data/lib/azure_mgmt_network/models/security_rule_protocol.rb +1 -1
  134. data/lib/azure_mgmt_network/models/service_provider_provisioning_state.rb +18 -0
  135. data/lib/azure_mgmt_network/models/subnet.rb +1 -3
  136. data/lib/azure_mgmt_network/models/subnet_list_result.rb +4 -6
  137. data/lib/azure_mgmt_network/models/subnet_properties_format.rb +28 -13
  138. data/lib/azure_mgmt_network/models/transport_protocol.rb +1 -1
  139. data/lib/azure_mgmt_network/models/usage.rb +7 -5
  140. data/lib/azure_mgmt_network/models/usage_name.rb +1 -3
  141. data/lib/azure_mgmt_network/models/usage_unit.rb +1 -1
  142. data/lib/azure_mgmt_network/models/usages_list_result.rb +4 -6
  143. data/lib/azure_mgmt_network/models/virtual_network.rb +7 -9
  144. data/lib/azure_mgmt_network/models/virtual_network_gateway.rb +7 -9
  145. data/lib/azure_mgmt_network/models/virtual_network_gateway_connection.rb +7 -9
  146. data/lib/azure_mgmt_network/models/virtual_network_gateway_connection_list_result.rb +4 -6
  147. data/lib/azure_mgmt_network/models/virtual_network_gateway_connection_properties_format.rb +74 -6
  148. data/lib/azure_mgmt_network/models/virtual_network_gateway_connection_status.rb +18 -0
  149. data/lib/azure_mgmt_network/models/virtual_network_gateway_connection_type.rb +1 -1
  150. data/lib/azure_mgmt_network/models/{virtual_network_gateway_ip_configuration.rb → virtual_network_gateway_ipconfiguration.rb} +7 -9
  151. data/lib/azure_mgmt_network/models/{virtual_network_gateway_ip_configuration_properties_format.rb → virtual_network_gateway_ipconfiguration_properties_format.rb} +14 -17
  152. data/lib/azure_mgmt_network/models/virtual_network_gateway_list_result.rb +4 -6
  153. data/lib/azure_mgmt_network/models/virtual_network_gateway_properties_format.rb +76 -13
  154. data/lib/azure_mgmt_network/models/virtual_network_gateway_sku.rb +86 -0
  155. data/lib/azure_mgmt_network/models/virtual_network_gateway_sku_name.rb +17 -0
  156. data/lib/azure_mgmt_network/models/virtual_network_gateway_sku_tier.rb +17 -0
  157. data/lib/azure_mgmt_network/models/virtual_network_gateway_type.rb +2 -1
  158. data/lib/azure_mgmt_network/models/virtual_network_list_result.rb +4 -6
  159. data/lib/azure_mgmt_network/models/virtual_network_properties_format.rb +14 -6
  160. data/lib/azure_mgmt_network/models/vpn_client_configuration.rb +125 -0
  161. data/lib/azure_mgmt_network/models/vpn_client_parameters.rb +60 -0
  162. data/lib/azure_mgmt_network/models/vpn_client_revoked_certificate.rb +88 -0
  163. data/lib/azure_mgmt_network/models/vpn_client_revoked_certificate_properties_format.rb +69 -0
  164. data/lib/azure_mgmt_network/models/vpn_client_root_certificate.rb +88 -0
  165. data/lib/azure_mgmt_network/models/vpn_client_root_certificate_properties_format.rb +66 -0
  166. data/lib/azure_mgmt_network/models/vpn_type.rb +1 -1
  167. data/lib/azure_mgmt_network/module_definition.rb +5 -3
  168. data/lib/azure_mgmt_network/network_interfaces.rb +451 -304
  169. data/lib/azure_mgmt_network/{network_resource_provider_client.rb → network_management_client.rb} +61 -57
  170. data/lib/azure_mgmt_network/network_security_groups.rb +139 -314
  171. data/lib/azure_mgmt_network/public_ipaddresses.rb +536 -0
  172. data/lib/azure_mgmt_network/route_tables.rb +532 -0
  173. data/lib/azure_mgmt_network/routes.rb +423 -0
  174. data/lib/azure_mgmt_network/security_rules.rb +102 -232
  175. data/lib/azure_mgmt_network/subnets.rb +104 -233
  176. data/lib/azure_mgmt_network/usages.rb +79 -43
  177. data/lib/azure_mgmt_network/version.rb +5 -3
  178. data/lib/azure_mgmt_network/virtual_network_gateway_connections.rb +262 -467
  179. data/lib/azure_mgmt_network/virtual_network_gateways.rb +204 -280
  180. data/lib/azure_mgmt_network/virtual_networks.rb +139 -314
  181. metadata +92 -106
  182. data/.gitignore +0 -10
  183. data/.travis.yml +0 -3
  184. data/Gemfile +0 -15
  185. data/lib/azure_mgmt_network/public_ip_addresses.rb +0 -711
@@ -1,11 +1,14 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
6
6
  module Azure::ARM::Network
7
7
  #
8
- # VirtualNetworkGateways
8
+ # The Microsoft Azure Network management API provides a RESTful set of web
9
+ # services that interact with Microsoft Azure Networks service to manage
10
+ # your network resrources. The API has entities that capture the
11
+ # relationship between an end user and the Microsoft Azure Networks service.
9
12
  #
10
13
  class VirtualNetworkGateways
11
14
  include Azure::ARM::Network::Models
@@ -19,12 +22,13 @@ module Azure::ARM::Network
19
22
  @client = client
20
23
  end
21
24
 
22
- # @return reference to the NetworkResourceProviderClient
25
+ # @return reference to the NetworkManagementClient
23
26
  attr_reader :client
24
27
 
25
28
  #
26
29
  # The Put VirtualNetworkGateway operation creates/updates a virtual network
27
30
  # gateway in the specified resource group through Network resource provider.
31
+ #
28
32
  # @param resource_group_name [String] The name of the resource group.
29
33
  # @param virtual_network_gateway_name [String] The name of the virtual network
30
34
  # gateway.
@@ -54,7 +58,7 @@ module Azure::ARM::Network
54
58
  end
55
59
 
56
60
  # Waiting for response.
57
- @client.get_put_operation_result(response, custom_headers, deserialize_method)
61
+ @client.get_put_operation_result(response, deserialize_method)
58
62
  end
59
63
 
60
64
  promise
@@ -63,6 +67,7 @@ module Azure::ARM::Network
63
67
  #
64
68
  # The Put VirtualNetworkGateway operation creates/updates a virtual network
65
69
  # gateway in the specified resource group through Network resource provider.
70
+ #
66
71
  # @param resource_group_name [String] The name of the resource group.
67
72
  # @param virtual_network_gateway_name [String] The name of the virtual network
68
73
  # gateway.
@@ -82,92 +87,64 @@ module Azure::ARM::Network
82
87
  parameters.validate unless parameters.nil?
83
88
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
84
89
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
85
- # Construct URL
86
- path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualnetworkgateways/{virtualNetworkGatewayName}"
87
- path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
88
- path['{virtualNetworkGatewayName}'] = ERB::Util.url_encode(virtual_network_gateway_name) if path.include?('{virtualNetworkGatewayName}')
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
90
+ request_headers = {}
111
91
 
112
92
  # Set Headers
113
93
  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
94
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
121
95
 
122
96
  # Serialize Request
123
- request_headers['Content-Type'] = 'application/json'
97
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
124
98
  unless parameters.nil?
125
99
  parameters = VirtualNetworkGateway.serialize_object(parameters)
126
100
  end
127
101
  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
102
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualnetworkgateways/{virtualNetworkGatewayName}'
103
+ options = {
104
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
105
+ path_params: {'resourceGroupName' => resource_group_name,'virtualNetworkGatewayName' => virtual_network_gateway_name,'subscriptionId' => @client.subscription_id},
106
+ query_params: {'api-version' => @client.api_version},
107
+ body: request_content,
108
+ headers: request_headers.merge(custom_headers || {})
109
+ }
110
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :put, options)
111
+ promise = request.run_promise do |req|
112
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
136
113
  end
137
114
 
138
115
  promise = promise.then do |http_response|
139
116
  status_code = http_response.status
140
117
  response_content = http_response.body
141
- unless (status_code == 201 || status_code == 200)
118
+ unless status_code == 200 || status_code == 201
142
119
  error_model = JSON.load(response_content)
143
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
120
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
144
121
  end
145
122
 
146
123
  # Create Result
147
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
124
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
148
125
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
149
126
  # Deserialize Response
150
- if status_code == 201
127
+ if status_code == 200
151
128
  begin
152
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
129
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
153
130
  unless parsed_response.nil?
154
131
  parsed_response = VirtualNetworkGateway.deserialize_object(parsed_response)
155
132
  end
156
133
  result.body = parsed_response
157
134
  rescue Exception => e
158
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
135
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
159
136
  end
160
137
  end
161
138
  # Deserialize Response
162
- if status_code == 200
139
+ if status_code == 201
163
140
  begin
164
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
141
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
165
142
  unless parsed_response.nil?
166
143
  parsed_response = VirtualNetworkGateway.deserialize_object(parsed_response)
167
144
  end
168
145
  result.body = parsed_response
169
146
  rescue Exception => e
170
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
147
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
171
148
  end
172
149
  end
173
150
 
@@ -180,6 +157,7 @@ module Azure::ARM::Network
180
157
  #
181
158
  # The Get VirtualNetworkGateway operation retrieves information about the
182
159
  # specified virtual network gateway through Network resource provider.
160
+ #
183
161
  # @param resource_group_name [String] The name of the resource group.
184
162
  # @param virtual_network_gateway_name [String] The name of the virtual network
185
163
  # gateway.
@@ -194,72 +172,44 @@ module Azure::ARM::Network
194
172
  fail ArgumentError, 'virtual_network_gateway_name is nil' if virtual_network_gateway_name.nil?
195
173
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
196
174
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
197
- # Construct URL
198
- path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualnetworkgateways/{virtualNetworkGatewayName}"
199
- path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
200
- path['{virtualNetworkGatewayName}'] = ERB::Util.url_encode(virtual_network_gateway_name) if path.include?('{virtualNetworkGatewayName}')
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
175
+ request_headers = {}
223
176
 
224
177
  # Set Headers
225
178
  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
179
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
180
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualnetworkgateways/{virtualNetworkGatewayName}'
181
+ options = {
182
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
183
+ path_params: {'resourceGroupName' => resource_group_name,'virtualNetworkGatewayName' => virtual_network_gateway_name,'subscriptionId' => @client.subscription_id},
184
+ query_params: {'api-version' => @client.api_version},
185
+ headers: request_headers.merge(custom_headers || {})
186
+ }
187
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
188
+ promise = request.run_promise do |req|
189
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
240
190
  end
241
191
 
242
192
  promise = promise.then do |http_response|
243
193
  status_code = http_response.status
244
194
  response_content = http_response.body
245
- unless (status_code == 200)
195
+ unless status_code == 200
246
196
  error_model = JSON.load(response_content)
247
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
197
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
248
198
  end
249
199
 
250
200
  # Create Result
251
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
201
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
252
202
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
253
203
  # Deserialize Response
254
204
  if status_code == 200
255
205
  begin
256
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
206
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
257
207
  unless parsed_response.nil?
258
208
  parsed_response = VirtualNetworkGateway.deserialize_object(parsed_response)
259
209
  end
260
210
  result.body = parsed_response
261
211
  rescue Exception => e
262
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
212
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
263
213
  end
264
214
  end
265
215
 
@@ -272,6 +222,7 @@ module Azure::ARM::Network
272
222
  #
273
223
  # The Delete VirtualNetworkGateway operation deletes the specifed virtual
274
224
  # network Gateway through Network resource provider.
225
+ #
275
226
  # @param resource_group_name [String] The name of the resource group.
276
227
  # @param virtual_network_gateway_name [String] The name of the virtual network
277
228
  # gateway.
@@ -288,7 +239,7 @@ module Azure::ARM::Network
288
239
  end
289
240
 
290
241
  # Waiting for response.
291
- @client.get_post_or_delete_operation_result(response, nil, deserialize_method)
242
+ @client.get_post_or_delete_operation_result(response, deserialize_method)
292
243
  end
293
244
 
294
245
  promise
@@ -297,6 +248,7 @@ module Azure::ARM::Network
297
248
  #
298
249
  # The Delete VirtualNetworkGateway operation deletes the specifed virtual
299
250
  # network Gateway through Network resource provider.
251
+ #
300
252
  # @param resource_group_name [String] The name of the resource group.
301
253
  # @param virtual_network_gateway_name [String] The name of the virtual network
302
254
  # gateway.
@@ -311,60 +263,33 @@ module Azure::ARM::Network
311
263
  fail ArgumentError, 'virtual_network_gateway_name is nil' if virtual_network_gateway_name.nil?
312
264
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
313
265
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
314
- # Construct URL
315
- path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/"
316
- path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
317
- path['{virtualNetworkGatewayName}'] = ERB::Util.url_encode(virtual_network_gateway_name) if path.include?('{virtualNetworkGatewayName}')
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
266
+ request_headers = {}
340
267
 
341
268
  # Set Headers
342
269
  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
270
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
271
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualnetworkgateways/{virtualNetworkGatewayName}'
272
+ options = {
273
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
274
+ path_params: {'resourceGroupName' => resource_group_name,'virtualNetworkGatewayName' => virtual_network_gateway_name,'subscriptionId' => @client.subscription_id},
275
+ query_params: {'api-version' => @client.api_version},
276
+ headers: request_headers.merge(custom_headers || {})
277
+ }
278
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :delete, options)
279
+ promise = request.run_promise do |req|
280
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
357
281
  end
358
282
 
359
283
  promise = promise.then do |http_response|
360
284
  status_code = http_response.status
361
285
  response_content = http_response.body
362
- unless (status_code == 202 || status_code == 200 || status_code == 204)
363
- fail MsRestAzure::AzureOperationError.new(connection, http_response)
286
+ unless status_code == 204 || status_code == 202 || status_code == 200
287
+ error_model = JSON.load(response_content)
288
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
364
289
  end
365
290
 
366
291
  # Create Result
367
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
292
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
368
293
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
369
294
 
370
295
  result
@@ -376,6 +301,7 @@ module Azure::ARM::Network
376
301
  #
377
302
  # The List VirtualNetworkGateways opertion retrieves all the virtual network
378
303
  # gateways stored.
304
+ #
379
305
  # @param resource_group_name [String] The name of the resource group.
380
306
  # @param [Hash{String => String}] The hash of custom headers need to be
381
307
  # applied to HTTP request.
@@ -387,71 +313,44 @@ module Azure::ARM::Network
387
313
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
388
314
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
389
315
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
390
- # Construct URL
391
- path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways"
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
316
+ request_headers = {}
415
317
 
416
318
  # Set Headers
417
319
  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
320
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
321
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways'
322
+ options = {
323
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
324
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
325
+ query_params: {'api-version' => @client.api_version},
326
+ headers: request_headers.merge(custom_headers || {})
327
+ }
328
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
329
+ promise = request.run_promise do |req|
330
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
432
331
  end
433
332
 
434
333
  promise = promise.then do |http_response|
435
334
  status_code = http_response.status
436
335
  response_content = http_response.body
437
- unless (status_code == 200)
336
+ unless status_code == 200
438
337
  error_model = JSON.load(response_content)
439
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
338
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
440
339
  end
441
340
 
442
341
  # Create Result
443
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
342
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
444
343
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
445
344
  # Deserialize Response
446
345
  if status_code == 200
447
346
  begin
448
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
347
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
449
348
  unless parsed_response.nil?
450
349
  parsed_response = VirtualNetworkGatewayListResult.deserialize_object(parsed_response)
451
350
  end
452
351
  result.body = parsed_response
453
352
  rescue Exception => e
454
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
353
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
455
354
  end
456
355
  end
457
356
 
@@ -463,8 +362,9 @@ module Azure::ARM::Network
463
362
 
464
363
  #
465
364
  # The Reset VirtualNetworkGateway operation resets the primary of the virtual
466
- # network gatewayin the specified resource group through Network resource
365
+ # network gateway in the specified resource group through Network resource
467
366
  # provider.
367
+ #
468
368
  # @param resource_group_name [String] The name of the resource group.
469
369
  # @param virtual_network_gateway_name [String] The name of the virtual network
470
370
  # gateway.
@@ -486,7 +386,7 @@ module Azure::ARM::Network
486
386
  end
487
387
 
488
388
  # Waiting for response.
489
- @client.get_post_or_delete_operation_result(response, nil, deserialize_method)
389
+ @client.get_post_or_delete_operation_result(response, deserialize_method)
490
390
  end
491
391
 
492
392
  promise
@@ -494,8 +394,9 @@ module Azure::ARM::Network
494
394
 
495
395
  #
496
396
  # The Reset VirtualNetworkGateway operation resets the primary of the virtual
497
- # network gatewayin the specified resource group through Network resource
397
+ # network gateway in the specified resource group through Network resource
498
398
  # provider.
399
+ #
499
400
  # @param resource_group_name [String] The name of the resource group.
500
401
  # @param virtual_network_gateway_name [String] The name of the virtual network
501
402
  # gateway.
@@ -514,80 +415,128 @@ module Azure::ARM::Network
514
415
  parameters.validate unless parameters.nil?
515
416
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
516
417
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
517
- # Construct URL
518
- path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualnetworkgateways/{virtualNetworkGatewayName}/reset"
519
- path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
520
- path['{virtualNetworkGatewayName}'] = ERB::Util.url_encode(virtual_network_gateway_name) if path.include?('{virtualNetworkGatewayName}')
521
- path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
522
- url = URI.join(@client.base_url, path)
523
- properties = {}
524
- properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
525
- unless url.query.nil?
526
- url.query.split('&').each do |url_item|
527
- url_items_parts = url_item.split('=')
528
- properties[url_items_parts[0]] = url_items_parts[1]
529
- end
530
- end
531
- properties.reject!{ |key, value| value.nil? }
532
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
533
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
534
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
535
- url = URI.parse(corrected_url)
536
-
537
- connection = Faraday.new(:url => url) do |faraday|
538
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
539
- faraday.use :cookie_jar
540
- faraday.adapter Faraday.default_adapter
541
- end
542
- request_headers = Hash.new
418
+ request_headers = {}
543
419
 
544
420
  # Set Headers
545
421
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
546
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
547
-
548
- unless custom_headers.nil?
549
- custom_headers.each do |key, value|
550
- request_headers[key] = value
551
- end
552
- end
422
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
553
423
 
554
424
  # Serialize Request
555
- request_headers['Content-Type'] = 'application/json'
425
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
556
426
  unless parameters.nil?
557
427
  parameters = VirtualNetworkGateway.serialize_object(parameters)
558
428
  end
559
429
  request_content = JSON.generate(parameters, quirks_mode: true)
560
-
561
- # Send Request
562
- promise = Concurrent::Promise.new do
563
- connection.post do |request|
564
- request.headers = request_headers
565
- request.body = request_content
566
- @client.credentials.sign_request(request) unless @client.credentials.nil?
567
- end
430
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualnetworkgateways/{virtualNetworkGatewayName}/reset'
431
+ options = {
432
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
433
+ path_params: {'resourceGroupName' => resource_group_name,'virtualNetworkGatewayName' => virtual_network_gateway_name,'subscriptionId' => @client.subscription_id},
434
+ query_params: {'api-version' => @client.api_version},
435
+ body: request_content,
436
+ headers: request_headers.merge(custom_headers || {})
437
+ }
438
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
439
+ promise = request.run_promise do |req|
440
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
568
441
  end
569
442
 
570
443
  promise = promise.then do |http_response|
571
444
  status_code = http_response.status
572
445
  response_content = http_response.body
573
- unless (status_code == 202 || status_code == 200)
446
+ unless status_code == 202 || status_code == 200
574
447
  error_model = JSON.load(response_content)
575
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
448
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
576
449
  end
577
450
 
578
451
  # Create Result
579
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
452
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
580
453
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
581
454
  # Deserialize Response
582
455
  if status_code == 200
583
456
  begin
584
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
457
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
585
458
  unless parsed_response.nil?
586
459
  parsed_response = VirtualNetworkGateway.deserialize_object(parsed_response)
587
460
  end
588
461
  result.body = parsed_response
589
462
  rescue Exception => e
590
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
463
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
464
+ end
465
+ end
466
+
467
+ result
468
+ end
469
+
470
+ promise.execute
471
+ end
472
+
473
+ #
474
+ # The Generatevpnclientpackage operation generates Vpn client package for P2S
475
+ # client of the virtual network gateway in the specified resource group
476
+ # through Network resource provider.
477
+ #
478
+ # @param resource_group_name [String] The name of the resource group.
479
+ # @param virtual_network_gateway_name [String] The name of the virtual network
480
+ # gateway.
481
+ # @param parameters [VpnClientParameters] Parameters supplied to the Begin
482
+ # Generating Virtual Network Gateway Vpn client package operation through
483
+ # Network resource provider.
484
+ # @param [Hash{String => String}] The hash of custom headers need to be
485
+ # applied to HTTP request.
486
+ #
487
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
488
+ # response.
489
+ #
490
+ def generatevpnclientpackage(resource_group_name, virtual_network_gateway_name, parameters, custom_headers = nil)
491
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
492
+ fail ArgumentError, 'virtual_network_gateway_name is nil' if virtual_network_gateway_name.nil?
493
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
494
+ parameters.validate unless parameters.nil?
495
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
496
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
497
+ request_headers = {}
498
+
499
+ # Set Headers
500
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
501
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
502
+
503
+ # Serialize Request
504
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
505
+ unless parameters.nil?
506
+ parameters = VpnClientParameters.serialize_object(parameters)
507
+ end
508
+ request_content = JSON.generate(parameters, quirks_mode: true)
509
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualnetworkgateways/{virtualNetworkGatewayName}/generatevpnclientpackage'
510
+ options = {
511
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
512
+ path_params: {'resourceGroupName' => resource_group_name,'virtualNetworkGatewayName' => virtual_network_gateway_name,'subscriptionId' => @client.subscription_id},
513
+ query_params: {'api-version' => @client.api_version},
514
+ body: request_content,
515
+ headers: request_headers.merge(custom_headers || {})
516
+ }
517
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
518
+ promise = request.run_promise do |req|
519
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
520
+ end
521
+
522
+ promise = promise.then do |http_response|
523
+ status_code = http_response.status
524
+ response_content = http_response.body
525
+ unless status_code == 202
526
+ error_model = JSON.load(response_content)
527
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
528
+ end
529
+
530
+ # Create Result
531
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
532
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
533
+ # Deserialize Response
534
+ if status_code == 202
535
+ begin
536
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
537
+ result.body = parsed_response
538
+ rescue Exception => e
539
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
591
540
  end
592
541
  end
593
542
 
@@ -600,6 +549,7 @@ module Azure::ARM::Network
600
549
  #
601
550
  # The List VirtualNetworkGateways opertion retrieves all the virtual network
602
551
  # gateways stored.
552
+ #
603
553
  # @param next_page_link [String] The NextLink from the previous successful
604
554
  # call to List operation.
605
555
  # @param [Hash{String => String}] The hash of custom headers need to be
@@ -610,69 +560,43 @@ module Azure::ARM::Network
610
560
  #
611
561
  def list_next(next_page_link, custom_headers = nil)
612
562
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
613
- # Construct URL
614
- path = "{nextLink}"
615
- path['{nextLink}'] = next_page_link if path.include?('{nextLink}')
616
- url = URI.parse(path)
617
- properties = {}
618
- unless url.query.nil?
619
- url.query.split('&').each do |url_item|
620
- url_items_parts = url_item.split('=')
621
- properties[url_items_parts[0]] = url_items_parts[1]
622
- end
623
- end
624
- properties.reject!{ |key, value| value.nil? }
625
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
626
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
627
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
628
- url = URI.parse(corrected_url)
629
-
630
- connection = Faraday.new(:url => url) do |faraday|
631
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
632
- faraday.use :cookie_jar
633
- faraday.adapter Faraday.default_adapter
634
- end
635
- request_headers = Hash.new
563
+ request_headers = {}
636
564
 
637
565
  # Set Headers
638
566
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
639
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
640
-
641
- unless custom_headers.nil?
642
- custom_headers.each do |key, value|
643
- request_headers[key] = value
644
- end
645
- end
646
-
647
- # Send Request
648
- promise = Concurrent::Promise.new do
649
- connection.get do |request|
650
- request.headers = request_headers
651
- @client.credentials.sign_request(request) unless @client.credentials.nil?
652
- end
567
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
568
+ path_template = '{nextLink}'
569
+ options = {
570
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
571
+ skip_encoding_path_params: {'nextLink' => next_page_link},
572
+ headers: request_headers.merge(custom_headers || {})
573
+ }
574
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
575
+ promise = request.run_promise do |req|
576
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
653
577
  end
654
578
 
655
579
  promise = promise.then do |http_response|
656
580
  status_code = http_response.status
657
581
  response_content = http_response.body
658
- unless (status_code == 200)
582
+ unless status_code == 200
659
583
  error_model = JSON.load(response_content)
660
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
584
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
661
585
  end
662
586
 
663
587
  # Create Result
664
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
588
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
665
589
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
666
590
  # Deserialize Response
667
591
  if status_code == 200
668
592
  begin
669
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
593
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
670
594
  unless parsed_response.nil?
671
595
  parsed_response = VirtualNetworkGatewayListResult.deserialize_object(parsed_response)
672
596
  end
673
597
  result.body = parsed_response
674
598
  rescue Exception => e
675
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
599
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
676
600
  end
677
601
  end
678
602