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
@@ -0,0 +1,149 @@
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.
5
+
6
+ module Azure::ARM::Network
7
+ #
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.
12
+ #
13
+ class ExpressRouteServiceProviders
14
+ include Azure::ARM::Network::Models
15
+ include MsRestAzure
16
+
17
+ #
18
+ # Creates and initializes a new instance of the ExpressRouteServiceProviders class.
19
+ # @param client service class for accessing basic functionality.
20
+ #
21
+ def initialize(client)
22
+ @client = client
23
+ end
24
+
25
+ # @return reference to the NetworkManagementClient
26
+ attr_reader :client
27
+
28
+ #
29
+ # The List ExpressRouteServiceProvider opertion retrieves all the available
30
+ # ExpressRouteServiceProviders.
31
+ #
32
+ # @param [Hash{String => String}] The hash of custom headers need to be
33
+ # applied to HTTP request.
34
+ #
35
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
36
+ # response.
37
+ #
38
+ def list(custom_headers = nil)
39
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
40
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
41
+ request_headers = {}
42
+
43
+ # Set Headers
44
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
45
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
46
+ path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteServiceProviders'
47
+ options = {
48
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
49
+ path_params: {'subscriptionId' => @client.subscription_id},
50
+ query_params: {'api-version' => @client.api_version},
51
+ headers: request_headers.merge(custom_headers || {})
52
+ }
53
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
54
+ promise = request.run_promise do |req|
55
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
56
+ end
57
+
58
+ promise = promise.then do |http_response|
59
+ status_code = http_response.status
60
+ response_content = http_response.body
61
+ unless status_code == 200
62
+ error_model = JSON.load(response_content)
63
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
64
+ end
65
+
66
+ # Create Result
67
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
68
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
69
+ # Deserialize Response
70
+ if status_code == 200
71
+ begin
72
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
73
+ unless parsed_response.nil?
74
+ parsed_response = ExpressRouteServiceProviderListResult.deserialize_object(parsed_response)
75
+ end
76
+ result.body = parsed_response
77
+ rescue Exception => e
78
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
79
+ end
80
+ end
81
+
82
+ result
83
+ end
84
+
85
+ promise.execute
86
+ end
87
+
88
+ #
89
+ # The List ExpressRouteServiceProvider opertion retrieves all the available
90
+ # ExpressRouteServiceProviders.
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?
116
+ end
117
+
118
+ promise = promise.then do |http_response|
119
+ status_code = http_response.status
120
+ response_content = http_response.body
121
+ unless status_code == 200
122
+ error_model = JSON.load(response_content)
123
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
124
+ end
125
+
126
+ # Create Result
127
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
128
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
129
+ # Deserialize Response
130
+ if status_code == 200
131
+ begin
132
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
133
+ unless parsed_response.nil?
134
+ parsed_response = ExpressRouteServiceProviderListResult.deserialize_object(parsed_response)
135
+ end
136
+ result.body = parsed_response
137
+ rescue Exception => e
138
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
139
+ end
140
+ end
141
+
142
+ result
143
+ end
144
+
145
+ promise.execute
146
+ end
147
+
148
+ end
149
+ 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
- # LoadBalancers
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 LoadBalancers
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
  # The delete loadbalancer operation deletes the specified loadbalancer.
30
+ #
27
31
  # @param resource_group_name [String] The name of the resource group.
28
32
  # @param load_balancer_name [String] The name of the loadBalancer.
29
33
  # @return [Concurrent::Promise] promise which provides async access to http
@@ -39,7 +43,7 @@ module Azure::ARM::Network
39
43
  end
40
44
 
41
45
  # Waiting for response.
42
- @client.get_post_or_delete_operation_result(response, nil, deserialize_method)
46
+ @client.get_post_or_delete_operation_result(response, deserialize_method)
43
47
  end
44
48
 
45
49
  promise
@@ -47,6 +51,7 @@ module Azure::ARM::Network
47
51
 
48
52
  #
49
53
  # The delete loadbalancer operation deletes the specified loadbalancer.
54
+ #
50
55
  # @param resource_group_name [String] The name of the resource group.
51
56
  # @param load_balancer_name [String] The name of the loadBalancer.
52
57
  # @param [Hash{String => String}] The hash of custom headers need to be
@@ -60,60 +65,33 @@ module Azure::ARM::Network
60
65
  fail ArgumentError, 'load_balancer_name is nil' if load_balancer_name.nil?
61
66
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
62
67
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
63
- # Construct URL
64
- path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}"
65
- path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
66
- path['{loadBalancerName}'] = ERB::Util.url_encode(load_balancer_name) if path.include?('{loadBalancerName}')
67
- path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
68
- url = URI.join(@client.base_url, path)
69
- properties = {}
70
- properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
71
- unless url.query.nil?
72
- url.query.split('&').each do |url_item|
73
- url_items_parts = url_item.split('=')
74
- properties[url_items_parts[0]] = url_items_parts[1]
75
- end
76
- end
77
- properties.reject!{ |key, value| value.nil? }
78
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
79
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
80
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
81
- url = URI.parse(corrected_url)
82
-
83
- connection = Faraday.new(:url => url) do |faraday|
84
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
85
- faraday.use :cookie_jar
86
- faraday.adapter Faraday.default_adapter
87
- end
88
- request_headers = Hash.new
68
+ request_headers = {}
89
69
 
90
70
  # Set Headers
91
71
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
92
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
93
-
94
- unless custom_headers.nil?
95
- custom_headers.each do |key, value|
96
- request_headers[key] = value
97
- end
98
- end
99
-
100
- # Send Request
101
- promise = Concurrent::Promise.new do
102
- connection.delete do |request|
103
- request.headers = request_headers
104
- @client.credentials.sign_request(request) unless @client.credentials.nil?
105
- end
72
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
73
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}'
74
+ options = {
75
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
76
+ path_params: {'resourceGroupName' => resource_group_name,'loadBalancerName' => load_balancer_name,'subscriptionId' => @client.subscription_id},
77
+ query_params: {'api-version' => @client.api_version},
78
+ headers: request_headers.merge(custom_headers || {})
79
+ }
80
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :delete, options)
81
+ promise = request.run_promise do |req|
82
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
106
83
  end
107
84
 
108
85
  promise = promise.then do |http_response|
109
86
  status_code = http_response.status
110
87
  response_content = http_response.body
111
- unless (status_code == 200 || status_code == 204 || status_code == 202)
112
- fail MsRestAzure::AzureOperationError.new(connection, http_response)
88
+ unless status_code == 204 || status_code == 202 || status_code == 200
89
+ error_model = JSON.load(response_content)
90
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
113
91
  end
114
92
 
115
93
  # Create Result
116
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
94
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
117
95
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
118
96
 
119
97
  result
@@ -125,85 +103,59 @@ module Azure::ARM::Network
125
103
  #
126
104
  # The Get ntework interface operation retreives information about the
127
105
  # specified network interface.
106
+ #
128
107
  # @param resource_group_name [String] The name of the resource group.
129
108
  # @param load_balancer_name [String] The name of the loadBalancer.
109
+ # @param expand [String] expand references resources.
130
110
  # @param [Hash{String => String}] The hash of custom headers need to be
131
111
  # applied to HTTP request.
132
112
  #
133
113
  # @return [Concurrent::Promise] Promise object which allows to get HTTP
134
114
  # response.
135
115
  #
136
- def get(resource_group_name, load_balancer_name, custom_headers = nil)
116
+ def get(resource_group_name, load_balancer_name, expand = nil, custom_headers = nil)
137
117
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
138
118
  fail ArgumentError, 'load_balancer_name is nil' if load_balancer_name.nil?
139
119
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
140
120
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
141
- # Construct URL
142
- path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}"
143
- path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
144
- path['{loadBalancerName}'] = ERB::Util.url_encode(load_balancer_name) if path.include?('{loadBalancerName}')
145
- path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
146
- url = URI.join(@client.base_url, path)
147
- properties = {}
148
- properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
149
- unless url.query.nil?
150
- url.query.split('&').each do |url_item|
151
- url_items_parts = url_item.split('=')
152
- properties[url_items_parts[0]] = url_items_parts[1]
153
- end
154
- end
155
- properties.reject!{ |key, value| value.nil? }
156
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
157
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
158
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
159
- url = URI.parse(corrected_url)
160
-
161
- connection = Faraday.new(:url => url) do |faraday|
162
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
163
- faraday.use :cookie_jar
164
- faraday.adapter Faraday.default_adapter
165
- end
166
- request_headers = Hash.new
121
+ request_headers = {}
167
122
 
168
123
  # Set Headers
169
124
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
170
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
171
-
172
- unless custom_headers.nil?
173
- custom_headers.each do |key, value|
174
- request_headers[key] = value
175
- end
176
- end
177
-
178
- # Send Request
179
- promise = Concurrent::Promise.new do
180
- connection.get do |request|
181
- request.headers = request_headers
182
- @client.credentials.sign_request(request) unless @client.credentials.nil?
183
- end
125
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
126
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}'
127
+ options = {
128
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
129
+ path_params: {'resourceGroupName' => resource_group_name,'loadBalancerName' => load_balancer_name,'subscriptionId' => @client.subscription_id},
130
+ query_params: {'api-version' => @client.api_version,'$expand' => expand},
131
+ headers: request_headers.merge(custom_headers || {})
132
+ }
133
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
134
+ promise = request.run_promise do |req|
135
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
184
136
  end
185
137
 
186
138
  promise = promise.then do |http_response|
187
139
  status_code = http_response.status
188
140
  response_content = http_response.body
189
- unless (status_code == 200)
141
+ unless status_code == 200
190
142
  error_model = JSON.load(response_content)
191
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
143
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
192
144
  end
193
145
 
194
146
  # Create Result
195
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
147
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
196
148
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
197
149
  # Deserialize Response
198
150
  if status_code == 200
199
151
  begin
200
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
152
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
201
153
  unless parsed_response.nil?
202
154
  parsed_response = LoadBalancer.deserialize_object(parsed_response)
203
155
  end
204
156
  result.body = parsed_response
205
157
  rescue Exception => e
206
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
158
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
207
159
  end
208
160
  end
209
161
 
@@ -215,6 +167,7 @@ module Azure::ARM::Network
215
167
 
216
168
  #
217
169
  # The Put LoadBalancer operation creates/updates a LoadBalancer
170
+ #
218
171
  # @param resource_group_name [String] The name of the resource group.
219
172
  # @param load_balancer_name [String] The name of the loadBalancer.
220
173
  # @param parameters [LoadBalancer] Parameters supplied to the create/delete
@@ -242,7 +195,7 @@ module Azure::ARM::Network
242
195
  end
243
196
 
244
197
  # Waiting for response.
245
- @client.get_put_operation_result(response, custom_headers, deserialize_method)
198
+ @client.get_put_operation_result(response, deserialize_method)
246
199
  end
247
200
 
248
201
  promise
@@ -250,6 +203,7 @@ module Azure::ARM::Network
250
203
 
251
204
  #
252
205
  # The Put LoadBalancer operation creates/updates a LoadBalancer
206
+ #
253
207
  # @param resource_group_name [String] The name of the resource group.
254
208
  # @param load_balancer_name [String] The name of the loadBalancer.
255
209
  # @param parameters [LoadBalancer] Parameters supplied to the create/delete
@@ -267,92 +221,64 @@ module Azure::ARM::Network
267
221
  parameters.validate unless parameters.nil?
268
222
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
269
223
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
270
- # Construct URL
271
- path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}"
272
- path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
273
- path['{loadBalancerName}'] = ERB::Util.url_encode(load_balancer_name) if path.include?('{loadBalancerName}')
274
- path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
275
- url = URI.join(@client.base_url, path)
276
- properties = {}
277
- properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
278
- unless url.query.nil?
279
- url.query.split('&').each do |url_item|
280
- url_items_parts = url_item.split('=')
281
- properties[url_items_parts[0]] = url_items_parts[1]
282
- end
283
- end
284
- properties.reject!{ |key, value| value.nil? }
285
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
286
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
287
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
288
- url = URI.parse(corrected_url)
289
-
290
- connection = Faraday.new(:url => url) do |faraday|
291
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
292
- faraday.use :cookie_jar
293
- faraday.adapter Faraday.default_adapter
294
- end
295
- request_headers = Hash.new
224
+ request_headers = {}
296
225
 
297
226
  # Set Headers
298
227
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
299
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
300
-
301
- unless custom_headers.nil?
302
- custom_headers.each do |key, value|
303
- request_headers[key] = value
304
- end
305
- end
228
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
306
229
 
307
230
  # Serialize Request
308
- request_headers['Content-Type'] = 'application/json'
231
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
309
232
  unless parameters.nil?
310
233
  parameters = LoadBalancer.serialize_object(parameters)
311
234
  end
312
235
  request_content = JSON.generate(parameters, quirks_mode: true)
313
-
314
- # Send Request
315
- promise = Concurrent::Promise.new do
316
- connection.put do |request|
317
- request.headers = request_headers
318
- request.body = request_content
319
- @client.credentials.sign_request(request) unless @client.credentials.nil?
320
- end
236
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}'
237
+ options = {
238
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
239
+ path_params: {'resourceGroupName' => resource_group_name,'loadBalancerName' => load_balancer_name,'subscriptionId' => @client.subscription_id},
240
+ query_params: {'api-version' => @client.api_version},
241
+ body: request_content,
242
+ headers: request_headers.merge(custom_headers || {})
243
+ }
244
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :put, options)
245
+ promise = request.run_promise do |req|
246
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
321
247
  end
322
248
 
323
249
  promise = promise.then do |http_response|
324
250
  status_code = http_response.status
325
251
  response_content = http_response.body
326
- unless (status_code == 201 || status_code == 200)
252
+ unless status_code == 201 || status_code == 200
327
253
  error_model = JSON.load(response_content)
328
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
254
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
329
255
  end
330
256
 
331
257
  # Create Result
332
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
258
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
333
259
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
334
260
  # Deserialize Response
335
261
  if status_code == 201
336
262
  begin
337
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
263
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
338
264
  unless parsed_response.nil?
339
265
  parsed_response = LoadBalancer.deserialize_object(parsed_response)
340
266
  end
341
267
  result.body = parsed_response
342
268
  rescue Exception => e
343
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
269
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
344
270
  end
345
271
  end
346
272
  # Deserialize Response
347
273
  if status_code == 200
348
274
  begin
349
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
275
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
350
276
  unless parsed_response.nil?
351
277
  parsed_response = LoadBalancer.deserialize_object(parsed_response)
352
278
  end
353
279
  result.body = parsed_response
354
280
  rescue Exception => e
355
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
281
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
356
282
  end
357
283
  end
358
284
 
@@ -365,6 +291,7 @@ module Azure::ARM::Network
365
291
  #
366
292
  # The List loadBalancer opertion retrieves all the loadbalancers in a
367
293
  # subscription.
294
+ #
368
295
  # @param [Hash{String => String}] The hash of custom headers need to be
369
296
  # applied to HTTP request.
370
297
  #
@@ -374,70 +301,44 @@ module Azure::ARM::Network
374
301
  def list_all(custom_headers = nil)
375
302
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
376
303
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
377
- # Construct URL
378
- path = "/subscriptions/{subscriptionId}/providers/Microsoft.Network/loadBalancers"
379
- path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
380
- url = URI.join(@client.base_url, path)
381
- properties = {}
382
- properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
383
- unless url.query.nil?
384
- url.query.split('&').each do |url_item|
385
- url_items_parts = url_item.split('=')
386
- properties[url_items_parts[0]] = url_items_parts[1]
387
- end
388
- end
389
- properties.reject!{ |key, value| value.nil? }
390
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
391
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
392
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
393
- url = URI.parse(corrected_url)
394
-
395
- connection = Faraday.new(:url => url) do |faraday|
396
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
397
- faraday.use :cookie_jar
398
- faraday.adapter Faraday.default_adapter
399
- end
400
- request_headers = Hash.new
304
+ request_headers = {}
401
305
 
402
306
  # Set Headers
403
307
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
404
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
405
-
406
- unless custom_headers.nil?
407
- custom_headers.each do |key, value|
408
- request_headers[key] = value
409
- end
410
- end
411
-
412
- # Send Request
413
- promise = Concurrent::Promise.new do
414
- connection.get do |request|
415
- request.headers = request_headers
416
- @client.credentials.sign_request(request) unless @client.credentials.nil?
417
- end
308
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
309
+ path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Network/loadBalancers'
310
+ options = {
311
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
312
+ path_params: {'subscriptionId' => @client.subscription_id},
313
+ query_params: {'api-version' => @client.api_version},
314
+ headers: request_headers.merge(custom_headers || {})
315
+ }
316
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
317
+ promise = request.run_promise do |req|
318
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
418
319
  end
419
320
 
420
321
  promise = promise.then do |http_response|
421
322
  status_code = http_response.status
422
323
  response_content = http_response.body
423
- unless (status_code == 200)
324
+ unless status_code == 200
424
325
  error_model = JSON.load(response_content)
425
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
326
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
426
327
  end
427
328
 
428
329
  # Create Result
429
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
330
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
430
331
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
431
332
  # Deserialize Response
432
333
  if status_code == 200
433
334
  begin
434
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
335
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
435
336
  unless parsed_response.nil?
436
337
  parsed_response = LoadBalancerListResult.deserialize_object(parsed_response)
437
338
  end
438
339
  result.body = parsed_response
439
340
  rescue Exception => e
440
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
341
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
441
342
  end
442
343
  end
443
344
 
@@ -450,6 +351,7 @@ module Azure::ARM::Network
450
351
  #
451
352
  # The List loadBalancer opertion retrieves all the loadbalancers in a resource
452
353
  # group.
354
+ #
453
355
  # @param resource_group_name [String] The name of the resource group.
454
356
  # @param [Hash{String => String}] The hash of custom headers need to be
455
357
  # applied to HTTP request.
@@ -461,71 +363,44 @@ module Azure::ARM::Network
461
363
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
462
364
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
463
365
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
464
- # Construct URL
465
- path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers"
466
- path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
467
- path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
468
- url = URI.join(@client.base_url, path)
469
- properties = {}
470
- properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
471
- unless url.query.nil?
472
- url.query.split('&').each do |url_item|
473
- url_items_parts = url_item.split('=')
474
- properties[url_items_parts[0]] = url_items_parts[1]
475
- end
476
- end
477
- properties.reject!{ |key, value| value.nil? }
478
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
479
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
480
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
481
- url = URI.parse(corrected_url)
482
-
483
- connection = Faraday.new(:url => url) do |faraday|
484
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
485
- faraday.use :cookie_jar
486
- faraday.adapter Faraday.default_adapter
487
- end
488
- request_headers = Hash.new
366
+ request_headers = {}
489
367
 
490
368
  # Set Headers
491
369
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
492
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
493
-
494
- unless custom_headers.nil?
495
- custom_headers.each do |key, value|
496
- request_headers[key] = value
497
- end
498
- end
499
-
500
- # Send Request
501
- promise = Concurrent::Promise.new do
502
- connection.get do |request|
503
- request.headers = request_headers
504
- @client.credentials.sign_request(request) unless @client.credentials.nil?
505
- end
370
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
371
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers'
372
+ options = {
373
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
374
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
375
+ query_params: {'api-version' => @client.api_version},
376
+ headers: request_headers.merge(custom_headers || {})
377
+ }
378
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
379
+ promise = request.run_promise do |req|
380
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
506
381
  end
507
382
 
508
383
  promise = promise.then do |http_response|
509
384
  status_code = http_response.status
510
385
  response_content = http_response.body
511
- unless (status_code == 200)
386
+ unless status_code == 200
512
387
  error_model = JSON.load(response_content)
513
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
388
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
514
389
  end
515
390
 
516
391
  # Create Result
517
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
392
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
518
393
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
519
394
  # Deserialize Response
520
395
  if status_code == 200
521
396
  begin
522
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
397
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
523
398
  unless parsed_response.nil?
524
399
  parsed_response = LoadBalancerListResult.deserialize_object(parsed_response)
525
400
  end
526
401
  result.body = parsed_response
527
402
  rescue Exception => e
528
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
403
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
529
404
  end
530
405
  end
531
406
 
@@ -538,6 +413,7 @@ module Azure::ARM::Network
538
413
  #
539
414
  # The List loadBalancer opertion retrieves all the loadbalancers in a
540
415
  # subscription.
416
+ #
541
417
  # @param next_page_link [String] The NextLink from the previous successful
542
418
  # call to List operation.
543
419
  # @param [Hash{String => String}] The hash of custom headers need to be
@@ -548,69 +424,43 @@ module Azure::ARM::Network
548
424
  #
549
425
  def list_all_next(next_page_link, custom_headers = nil)
550
426
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
551
- # Construct URL
552
- path = "{nextLink}"
553
- path['{nextLink}'] = next_page_link if path.include?('{nextLink}')
554
- url = URI.parse(path)
555
- properties = {}
556
- unless url.query.nil?
557
- url.query.split('&').each do |url_item|
558
- url_items_parts = url_item.split('=')
559
- properties[url_items_parts[0]] = url_items_parts[1]
560
- end
561
- end
562
- properties.reject!{ |key, value| value.nil? }
563
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
564
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
565
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
566
- url = URI.parse(corrected_url)
567
-
568
- connection = Faraday.new(:url => url) do |faraday|
569
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
570
- faraday.use :cookie_jar
571
- faraday.adapter Faraday.default_adapter
572
- end
573
- request_headers = Hash.new
427
+ request_headers = {}
574
428
 
575
429
  # Set Headers
576
430
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
577
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
578
-
579
- unless custom_headers.nil?
580
- custom_headers.each do |key, value|
581
- request_headers[key] = value
582
- end
583
- end
584
-
585
- # Send Request
586
- promise = Concurrent::Promise.new do
587
- connection.get do |request|
588
- request.headers = request_headers
589
- @client.credentials.sign_request(request) unless @client.credentials.nil?
590
- end
431
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
432
+ path_template = '{nextLink}'
433
+ options = {
434
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
435
+ skip_encoding_path_params: {'nextLink' => next_page_link},
436
+ headers: request_headers.merge(custom_headers || {})
437
+ }
438
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
439
+ promise = request.run_promise do |req|
440
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
591
441
  end
592
442
 
593
443
  promise = promise.then do |http_response|
594
444
  status_code = http_response.status
595
445
  response_content = http_response.body
596
- unless (status_code == 200)
446
+ unless status_code == 200
597
447
  error_model = JSON.load(response_content)
598
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
448
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
599
449
  end
600
450
 
601
451
  # Create Result
602
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
452
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
603
453
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
604
454
  # Deserialize Response
605
455
  if status_code == 200
606
456
  begin
607
- 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)
608
458
  unless parsed_response.nil?
609
459
  parsed_response = LoadBalancerListResult.deserialize_object(parsed_response)
610
460
  end
611
461
  result.body = parsed_response
612
462
  rescue Exception => e
613
- 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)
614
464
  end
615
465
  end
616
466
 
@@ -623,6 +473,7 @@ module Azure::ARM::Network
623
473
  #
624
474
  # The List loadBalancer opertion retrieves all the loadbalancers in a resource
625
475
  # group.
476
+ #
626
477
  # @param next_page_link [String] The NextLink from the previous successful
627
478
  # call to List operation.
628
479
  # @param [Hash{String => String}] The hash of custom headers need to be
@@ -633,69 +484,43 @@ module Azure::ARM::Network
633
484
  #
634
485
  def list_next(next_page_link, custom_headers = nil)
635
486
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
636
- # Construct URL
637
- path = "{nextLink}"
638
- path['{nextLink}'] = next_page_link if path.include?('{nextLink}')
639
- url = URI.parse(path)
640
- properties = {}
641
- unless url.query.nil?
642
- url.query.split('&').each do |url_item|
643
- url_items_parts = url_item.split('=')
644
- properties[url_items_parts[0]] = url_items_parts[1]
645
- end
646
- end
647
- properties.reject!{ |key, value| value.nil? }
648
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
649
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
650
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
651
- url = URI.parse(corrected_url)
652
-
653
- connection = Faraday.new(:url => url) do |faraday|
654
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
655
- faraday.use :cookie_jar
656
- faraday.adapter Faraday.default_adapter
657
- end
658
- request_headers = Hash.new
487
+ request_headers = {}
659
488
 
660
489
  # Set Headers
661
490
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
662
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
663
-
664
- unless custom_headers.nil?
665
- custom_headers.each do |key, value|
666
- request_headers[key] = value
667
- end
668
- end
669
-
670
- # Send Request
671
- promise = Concurrent::Promise.new do
672
- connection.get do |request|
673
- request.headers = request_headers
674
- @client.credentials.sign_request(request) unless @client.credentials.nil?
675
- end
491
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
492
+ path_template = '{nextLink}'
493
+ options = {
494
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
495
+ skip_encoding_path_params: {'nextLink' => next_page_link},
496
+ headers: request_headers.merge(custom_headers || {})
497
+ }
498
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
499
+ promise = request.run_promise do |req|
500
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
676
501
  end
677
502
 
678
503
  promise = promise.then do |http_response|
679
504
  status_code = http_response.status
680
505
  response_content = http_response.body
681
- unless (status_code == 200)
506
+ unless status_code == 200
682
507
  error_model = JSON.load(response_content)
683
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
508
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
684
509
  end
685
510
 
686
511
  # Create Result
687
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
512
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
688
513
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
689
514
  # Deserialize Response
690
515
  if status_code == 200
691
516
  begin
692
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
517
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
693
518
  unless parsed_response.nil?
694
519
  parsed_response = LoadBalancerListResult.deserialize_object(parsed_response)
695
520
  end
696
521
  result.body = parsed_response
697
522
  rescue Exception => e
698
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
523
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
699
524
  end
700
525
  end
701
526