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