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,423 @@
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 Routes
14
+ include Azure::ARM::Network::Models
15
+ include MsRestAzure
16
+
17
+ #
18
+ # Creates and initializes a new instance of the Routes 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 delete route operation deletes the specified route from a route table.
30
+ #
31
+ # @param resource_group_name [String] The name of the resource group.
32
+ # @param route_table_name [String] The name of the route table.
33
+ # @param route_name [String] The name of the route.
34
+ # @return [Concurrent::Promise] promise which provides async access to http
35
+ # response.
36
+ #
37
+ def delete(resource_group_name, route_table_name, route_name, custom_headers = nil)
38
+ # Send request
39
+ promise = begin_delete(resource_group_name, route_table_name, route_name, custom_headers)
40
+
41
+ promise = promise.then do |response|
42
+ # Defining deserialization method.
43
+ deserialize_method = lambda do |parsed_response|
44
+ end
45
+
46
+ # Waiting for response.
47
+ @client.get_post_or_delete_operation_result(response, deserialize_method)
48
+ end
49
+
50
+ promise
51
+ end
52
+
53
+ #
54
+ # The delete route operation deletes the specified route from a route table.
55
+ #
56
+ # @param resource_group_name [String] The name of the resource group.
57
+ # @param route_table_name [String] The name of the route table.
58
+ # @param route_name [String] The name of the route.
59
+ # @param [Hash{String => String}] The hash of custom headers need to be
60
+ # applied to HTTP request.
61
+ #
62
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
63
+ # response.
64
+ #
65
+ def begin_delete(resource_group_name, route_table_name, route_name, custom_headers = nil)
66
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
67
+ fail ArgumentError, 'route_table_name is nil' if route_table_name.nil?
68
+ fail ArgumentError, 'route_name is nil' if route_name.nil?
69
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
70
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
71
+ request_headers = {}
72
+
73
+ # Set Headers
74
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
75
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
76
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}'
77
+ options = {
78
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
79
+ path_params: {'resourceGroupName' => resource_group_name,'routeTableName' => route_table_name,'routeName' => route_name,'subscriptionId' => @client.subscription_id},
80
+ query_params: {'api-version' => @client.api_version},
81
+ headers: request_headers.merge(custom_headers || {})
82
+ }
83
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :delete, options)
84
+ promise = request.run_promise do |req|
85
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
86
+ end
87
+
88
+ promise = promise.then do |http_response|
89
+ status_code = http_response.status
90
+ response_content = http_response.body
91
+ unless status_code == 202 || status_code == 200 || status_code == 204
92
+ error_model = JSON.load(response_content)
93
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
94
+ end
95
+
96
+ # Create Result
97
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
98
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
99
+
100
+ result
101
+ end
102
+
103
+ promise.execute
104
+ end
105
+
106
+ #
107
+ # The Get route operation retreives information about the specified route from
108
+ # the route table.
109
+ #
110
+ # @param resource_group_name [String] The name of the resource group.
111
+ # @param route_table_name [String] The name of the route table.
112
+ # @param route_name [String] The name of the route.
113
+ # @param [Hash{String => String}] The hash of custom headers need to be
114
+ # applied to HTTP request.
115
+ #
116
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
117
+ # response.
118
+ #
119
+ def get(resource_group_name, route_table_name, route_name, custom_headers = nil)
120
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
121
+ fail ArgumentError, 'route_table_name is nil' if route_table_name.nil?
122
+ fail ArgumentError, 'route_name is nil' if route_name.nil?
123
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
124
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
125
+ request_headers = {}
126
+
127
+ # Set Headers
128
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
129
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
130
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}'
131
+ options = {
132
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
133
+ path_params: {'resourceGroupName' => resource_group_name,'routeTableName' => route_table_name,'routeName' => route_name,'subscriptionId' => @client.subscription_id},
134
+ query_params: {'api-version' => @client.api_version},
135
+ headers: request_headers.merge(custom_headers || {})
136
+ }
137
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
138
+ promise = request.run_promise do |req|
139
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
140
+ end
141
+
142
+ promise = promise.then do |http_response|
143
+ status_code = http_response.status
144
+ response_content = http_response.body
145
+ unless status_code == 200
146
+ error_model = JSON.load(response_content)
147
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
148
+ end
149
+
150
+ # Create Result
151
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
152
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
153
+ # Deserialize Response
154
+ if status_code == 200
155
+ begin
156
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
157
+ unless parsed_response.nil?
158
+ parsed_response = Route.deserialize_object(parsed_response)
159
+ end
160
+ result.body = parsed_response
161
+ rescue Exception => e
162
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
163
+ end
164
+ end
165
+
166
+ result
167
+ end
168
+
169
+ promise.execute
170
+ end
171
+
172
+ #
173
+ # The Put route operation creates/updates a route in the specified route table
174
+ #
175
+ # @param resource_group_name [String] The name of the resource group.
176
+ # @param route_table_name [String] The name of the route table.
177
+ # @param route_name [String] The name of the route.
178
+ # @param route_parameters [Route] Parameters supplied to the create/update
179
+ # routeoperation
180
+ # @param @client.api_version [String] Client Api Version.
181
+ # @param @client.subscription_id [String] Gets subscription credentials which
182
+ # uniquely identify Microsoft Azure subscription. The subscription ID forms
183
+ # part of the URI for every service call.
184
+ # @param @client.accept_language [String] Gets or sets the preferred language
185
+ # for the response.
186
+ #
187
+ # @return [Concurrent::Promise] promise which provides async access to http
188
+ # response.
189
+ #
190
+ def create_or_update(resource_group_name, route_table_name, route_name, route_parameters, custom_headers = nil)
191
+ # Send request
192
+ promise = begin_create_or_update(resource_group_name, route_table_name, route_name, route_parameters, custom_headers)
193
+
194
+ promise = promise.then do |response|
195
+ # Defining deserialization method.
196
+ deserialize_method = lambda do |parsed_response|
197
+ unless parsed_response.nil?
198
+ parsed_response = Route.deserialize_object(parsed_response)
199
+ end
200
+ end
201
+
202
+ # Waiting for response.
203
+ @client.get_put_operation_result(response, deserialize_method)
204
+ end
205
+
206
+ promise
207
+ end
208
+
209
+ #
210
+ # The Put route operation creates/updates a route in the specified route table
211
+ #
212
+ # @param resource_group_name [String] The name of the resource group.
213
+ # @param route_table_name [String] The name of the route table.
214
+ # @param route_name [String] The name of the route.
215
+ # @param route_parameters [Route] Parameters supplied to the create/update
216
+ # routeoperation
217
+ # @param [Hash{String => String}] The hash of custom headers need to be
218
+ # applied to HTTP request.
219
+ #
220
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
221
+ # response.
222
+ #
223
+ def begin_create_or_update(resource_group_name, route_table_name, route_name, route_parameters, custom_headers = nil)
224
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
225
+ fail ArgumentError, 'route_table_name is nil' if route_table_name.nil?
226
+ fail ArgumentError, 'route_name is nil' if route_name.nil?
227
+ fail ArgumentError, 'route_parameters is nil' if route_parameters.nil?
228
+ route_parameters.validate unless route_parameters.nil?
229
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
230
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
231
+ request_headers = {}
232
+
233
+ # Set Headers
234
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
235
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
236
+
237
+ # Serialize Request
238
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
239
+ unless route_parameters.nil?
240
+ route_parameters = Route.serialize_object(route_parameters)
241
+ end
242
+ request_content = JSON.generate(route_parameters, quirks_mode: true)
243
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}'
244
+ options = {
245
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
246
+ path_params: {'resourceGroupName' => resource_group_name,'routeTableName' => route_table_name,'routeName' => route_name,'subscriptionId' => @client.subscription_id},
247
+ query_params: {'api-version' => @client.api_version},
248
+ body: request_content,
249
+ headers: request_headers.merge(custom_headers || {})
250
+ }
251
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :put, options)
252
+ promise = request.run_promise do |req|
253
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
254
+ end
255
+
256
+ promise = promise.then do |http_response|
257
+ status_code = http_response.status
258
+ response_content = http_response.body
259
+ unless status_code == 200 || status_code == 201
260
+ error_model = JSON.load(response_content)
261
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
262
+ end
263
+
264
+ # Create Result
265
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
266
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
267
+ # Deserialize Response
268
+ if status_code == 200
269
+ begin
270
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
271
+ unless parsed_response.nil?
272
+ parsed_response = Route.deserialize_object(parsed_response)
273
+ end
274
+ result.body = parsed_response
275
+ rescue Exception => e
276
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
277
+ end
278
+ end
279
+ # Deserialize Response
280
+ if status_code == 201
281
+ begin
282
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
283
+ unless parsed_response.nil?
284
+ parsed_response = Route.deserialize_object(parsed_response)
285
+ end
286
+ result.body = parsed_response
287
+ rescue Exception => e
288
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
289
+ end
290
+ end
291
+
292
+ result
293
+ end
294
+
295
+ promise.execute
296
+ end
297
+
298
+ #
299
+ # The List network security rule opertion retrieves all the routes in a route
300
+ # table.
301
+ #
302
+ # @param resource_group_name [String] The name of the resource group.
303
+ # @param route_table_name [String] The name of the route table.
304
+ # @param [Hash{String => String}] The hash of custom headers need to be
305
+ # applied to HTTP request.
306
+ #
307
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
308
+ # response.
309
+ #
310
+ def list(resource_group_name, route_table_name, custom_headers = nil)
311
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
312
+ fail ArgumentError, 'route_table_name is nil' if route_table_name.nil?
313
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
314
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
315
+ request_headers = {}
316
+
317
+ # Set Headers
318
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
319
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
320
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes'
321
+ options = {
322
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
323
+ path_params: {'resourceGroupName' => resource_group_name,'routeTableName' => route_table_name,'subscriptionId' => @client.subscription_id},
324
+ query_params: {'api-version' => @client.api_version},
325
+ headers: request_headers.merge(custom_headers || {})
326
+ }
327
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
328
+ promise = request.run_promise do |req|
329
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
330
+ end
331
+
332
+ promise = promise.then do |http_response|
333
+ status_code = http_response.status
334
+ response_content = http_response.body
335
+ unless status_code == 200
336
+ error_model = JSON.load(response_content)
337
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
338
+ end
339
+
340
+ # Create Result
341
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
342
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
343
+ # Deserialize Response
344
+ if status_code == 200
345
+ begin
346
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
347
+ unless parsed_response.nil?
348
+ parsed_response = RouteListResult.deserialize_object(parsed_response)
349
+ end
350
+ result.body = parsed_response
351
+ rescue Exception => e
352
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
353
+ end
354
+ end
355
+
356
+ result
357
+ end
358
+
359
+ promise.execute
360
+ end
361
+
362
+ #
363
+ # The List network security rule opertion retrieves all the routes in a route
364
+ # table.
365
+ #
366
+ # @param next_page_link [String] The NextLink from the previous successful
367
+ # call to List operation.
368
+ # @param [Hash{String => String}] The hash of custom headers need to be
369
+ # applied to HTTP request.
370
+ #
371
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
372
+ # response.
373
+ #
374
+ def list_next(next_page_link, custom_headers = nil)
375
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
376
+ request_headers = {}
377
+
378
+ # Set Headers
379
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
380
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
381
+ path_template = '{nextLink}'
382
+ options = {
383
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
384
+ skip_encoding_path_params: {'nextLink' => next_page_link},
385
+ headers: request_headers.merge(custom_headers || {})
386
+ }
387
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
388
+ promise = request.run_promise do |req|
389
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
390
+ end
391
+
392
+ promise = promise.then do |http_response|
393
+ status_code = http_response.status
394
+ response_content = http_response.body
395
+ unless status_code == 200
396
+ error_model = JSON.load(response_content)
397
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
398
+ end
399
+
400
+ # Create Result
401
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
402
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
403
+ # Deserialize Response
404
+ if status_code == 200
405
+ begin
406
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
407
+ unless parsed_response.nil?
408
+ parsed_response = RouteListResult.deserialize_object(parsed_response)
409
+ end
410
+ result.body = parsed_response
411
+ rescue Exception => e
412
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
413
+ end
414
+ end
415
+
416
+ result
417
+ end
418
+
419
+ promise.execute
420
+ end
421
+
422
+ end
423
+ 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
- # SecurityRules
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 SecurityRules
11
14
  include Azure::ARM::Network::Models
@@ -19,12 +22,13 @@ module Azure::ARM::Network
19
22
  @client = client
20
23
  end
21
24
 
22
- # @return reference to the NetworkResourceProviderClient
25
+ # @return reference to the NetworkManagementClient
23
26
  attr_reader :client
24
27
 
25
28
  #
26
29
  # The delete network security rule operation deletes the specified network
27
30
  # security rule.
31
+ #
28
32
  # @param resource_group_name [String] The name of the resource group.
29
33
  # @param network_security_group_name [String] The name of the network security
30
34
  # group.
@@ -42,7 +46,7 @@ module Azure::ARM::Network
42
46
  end
43
47
 
44
48
  # Waiting for response.
45
- @client.get_post_or_delete_operation_result(response, nil, deserialize_method)
49
+ @client.get_post_or_delete_operation_result(response, deserialize_method)
46
50
  end
47
51
 
48
52
  promise
@@ -51,6 +55,7 @@ module Azure::ARM::Network
51
55
  #
52
56
  # The delete network security rule operation deletes the specified network
53
57
  # security rule.
58
+ #
54
59
  # @param resource_group_name [String] The name of the resource group.
55
60
  # @param network_security_group_name [String] The name of the network security
56
61
  # group.
@@ -67,61 +72,33 @@ module Azure::ARM::Network
67
72
  fail ArgumentError, 'security_rule_name is nil' if security_rule_name.nil?
68
73
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
69
74
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
70
- # Construct URL
71
- path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}"
72
- path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
73
- path['{networkSecurityGroupName}'] = ERB::Util.url_encode(network_security_group_name) if path.include?('{networkSecurityGroupName}')
74
- path['{securityRuleName}'] = ERB::Util.url_encode(security_rule_name) if path.include?('{securityRuleName}')
75
- path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
76
- url = URI.join(@client.base_url, path)
77
- properties = {}
78
- properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
79
- unless url.query.nil?
80
- url.query.split('&').each do |url_item|
81
- url_items_parts = url_item.split('=')
82
- properties[url_items_parts[0]] = url_items_parts[1]
83
- end
84
- end
85
- properties.reject!{ |key, value| value.nil? }
86
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
87
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
88
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
89
- url = URI.parse(corrected_url)
90
-
91
- connection = Faraday.new(:url => url) do |faraday|
92
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
93
- faraday.use :cookie_jar
94
- faraday.adapter Faraday.default_adapter
95
- end
96
- request_headers = Hash.new
75
+ request_headers = {}
97
76
 
98
77
  # Set Headers
99
78
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
100
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
101
-
102
- unless custom_headers.nil?
103
- custom_headers.each do |key, value|
104
- request_headers[key] = value
105
- end
106
- end
107
-
108
- # Send Request
109
- promise = Concurrent::Promise.new do
110
- connection.delete do |request|
111
- request.headers = request_headers
112
- @client.credentials.sign_request(request) unless @client.credentials.nil?
113
- end
79
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
80
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}'
81
+ options = {
82
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
83
+ path_params: {'resourceGroupName' => resource_group_name,'networkSecurityGroupName' => network_security_group_name,'securityRuleName' => security_rule_name,'subscriptionId' => @client.subscription_id},
84
+ query_params: {'api-version' => @client.api_version},
85
+ headers: request_headers.merge(custom_headers || {})
86
+ }
87
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :delete, options)
88
+ promise = request.run_promise do |req|
89
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
114
90
  end
115
91
 
116
92
  promise = promise.then do |http_response|
117
93
  status_code = http_response.status
118
94
  response_content = http_response.body
119
- unless (status_code == 202 || status_code == 200 || status_code == 204)
120
- fail MsRestAzure::AzureOperationError.new(connection, http_response)
95
+ unless status_code == 204 || status_code == 202 || status_code == 200
96
+ error_model = JSON.load(response_content)
97
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
121
98
  end
122
99
 
123
100
  # Create Result
124
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
101
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
125
102
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
126
103
 
127
104
  result
@@ -133,6 +110,7 @@ module Azure::ARM::Network
133
110
  #
134
111
  # The Get NetworkSecurityRule operation retreives information about the
135
112
  # specified network security rule.
113
+ #
136
114
  # @param resource_group_name [String] The name of the resource group.
137
115
  # @param network_security_group_name [String] The name of the network security
138
116
  # group.
@@ -149,73 +127,44 @@ module Azure::ARM::Network
149
127
  fail ArgumentError, 'security_rule_name is nil' if security_rule_name.nil?
150
128
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
151
129
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
152
- # Construct URL
153
- path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}"
154
- path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
155
- path['{networkSecurityGroupName}'] = ERB::Util.url_encode(network_security_group_name) if path.include?('{networkSecurityGroupName}')
156
- path['{securityRuleName}'] = ERB::Util.url_encode(security_rule_name) if path.include?('{securityRuleName}')
157
- path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
158
- url = URI.join(@client.base_url, path)
159
- properties = {}
160
- properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
161
- unless url.query.nil?
162
- url.query.split('&').each do |url_item|
163
- url_items_parts = url_item.split('=')
164
- properties[url_items_parts[0]] = url_items_parts[1]
165
- end
166
- end
167
- properties.reject!{ |key, value| value.nil? }
168
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
169
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
170
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
171
- url = URI.parse(corrected_url)
172
-
173
- connection = Faraday.new(:url => url) do |faraday|
174
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
175
- faraday.use :cookie_jar
176
- faraday.adapter Faraday.default_adapter
177
- end
178
- request_headers = Hash.new
130
+ request_headers = {}
179
131
 
180
132
  # Set Headers
181
133
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
182
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
183
-
184
- unless custom_headers.nil?
185
- custom_headers.each do |key, value|
186
- request_headers[key] = value
187
- end
188
- end
189
-
190
- # Send Request
191
- promise = Concurrent::Promise.new do
192
- connection.get do |request|
193
- request.headers = request_headers
194
- @client.credentials.sign_request(request) unless @client.credentials.nil?
195
- end
134
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
135
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}'
136
+ options = {
137
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
138
+ path_params: {'resourceGroupName' => resource_group_name,'networkSecurityGroupName' => network_security_group_name,'securityRuleName' => security_rule_name,'subscriptionId' => @client.subscription_id},
139
+ query_params: {'api-version' => @client.api_version},
140
+ headers: request_headers.merge(custom_headers || {})
141
+ }
142
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
143
+ promise = request.run_promise do |req|
144
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
196
145
  end
197
146
 
198
147
  promise = promise.then do |http_response|
199
148
  status_code = http_response.status
200
149
  response_content = http_response.body
201
- unless (status_code == 200)
150
+ unless status_code == 200
202
151
  error_model = JSON.load(response_content)
203
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
152
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
204
153
  end
205
154
 
206
155
  # Create Result
207
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
156
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
208
157
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
209
158
  # Deserialize Response
210
159
  if status_code == 200
211
160
  begin
212
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
161
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
213
162
  unless parsed_response.nil?
214
163
  parsed_response = SecurityRule.deserialize_object(parsed_response)
215
164
  end
216
165
  result.body = parsed_response
217
166
  rescue Exception => e
218
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
167
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
219
168
  end
220
169
  end
221
170
 
@@ -228,6 +177,7 @@ module Azure::ARM::Network
228
177
  #
229
178
  # The Put network security rule operation creates/updates a security rule in
230
179
  # the specified network security group
180
+ #
231
181
  # @param resource_group_name [String] The name of the resource group.
232
182
  # @param network_security_group_name [String] The name of the network security
233
183
  # group.
@@ -257,7 +207,7 @@ module Azure::ARM::Network
257
207
  end
258
208
 
259
209
  # Waiting for response.
260
- @client.get_put_operation_result(response, custom_headers, deserialize_method)
210
+ @client.get_put_operation_result(response, deserialize_method)
261
211
  end
262
212
 
263
213
  promise
@@ -266,6 +216,7 @@ module Azure::ARM::Network
266
216
  #
267
217
  # The Put network security rule operation creates/updates a security rule in
268
218
  # the specified network security group
219
+ #
269
220
  # @param resource_group_name [String] The name of the resource group.
270
221
  # @param network_security_group_name [String] The name of the network security
271
222
  # group.
@@ -286,93 +237,64 @@ module Azure::ARM::Network
286
237
  security_rule_parameters.validate unless security_rule_parameters.nil?
287
238
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
288
239
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
289
- # Construct URL
290
- path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}"
291
- path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
292
- path['{networkSecurityGroupName}'] = ERB::Util.url_encode(network_security_group_name) if path.include?('{networkSecurityGroupName}')
293
- path['{securityRuleName}'] = ERB::Util.url_encode(security_rule_name) if path.include?('{securityRuleName}')
294
- path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
295
- url = URI.join(@client.base_url, path)
296
- properties = {}
297
- properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
298
- unless url.query.nil?
299
- url.query.split('&').each do |url_item|
300
- url_items_parts = url_item.split('=')
301
- properties[url_items_parts[0]] = url_items_parts[1]
302
- end
303
- end
304
- properties.reject!{ |key, value| value.nil? }
305
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
306
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
307
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
308
- url = URI.parse(corrected_url)
309
-
310
- connection = Faraday.new(:url => url) do |faraday|
311
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
312
- faraday.use :cookie_jar
313
- faraday.adapter Faraday.default_adapter
314
- end
315
- request_headers = Hash.new
240
+ request_headers = {}
316
241
 
317
242
  # Set Headers
318
243
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
319
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
320
-
321
- unless custom_headers.nil?
322
- custom_headers.each do |key, value|
323
- request_headers[key] = value
324
- end
325
- end
244
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
326
245
 
327
246
  # Serialize Request
328
- request_headers['Content-Type'] = 'application/json'
247
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
329
248
  unless security_rule_parameters.nil?
330
249
  security_rule_parameters = SecurityRule.serialize_object(security_rule_parameters)
331
250
  end
332
251
  request_content = JSON.generate(security_rule_parameters, quirks_mode: true)
333
-
334
- # Send Request
335
- promise = Concurrent::Promise.new do
336
- connection.put do |request|
337
- request.headers = request_headers
338
- request.body = request_content
339
- @client.credentials.sign_request(request) unless @client.credentials.nil?
340
- end
252
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}'
253
+ options = {
254
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
255
+ path_params: {'resourceGroupName' => resource_group_name,'networkSecurityGroupName' => network_security_group_name,'securityRuleName' => security_rule_name,'subscriptionId' => @client.subscription_id},
256
+ query_params: {'api-version' => @client.api_version},
257
+ body: request_content,
258
+ headers: request_headers.merge(custom_headers || {})
259
+ }
260
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :put, options)
261
+ promise = request.run_promise do |req|
262
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
341
263
  end
342
264
 
343
265
  promise = promise.then do |http_response|
344
266
  status_code = http_response.status
345
267
  response_content = http_response.body
346
- unless (status_code == 200 || status_code == 201)
268
+ unless status_code == 200 || status_code == 201
347
269
  error_model = JSON.load(response_content)
348
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
270
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
349
271
  end
350
272
 
351
273
  # Create Result
352
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
274
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
353
275
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
354
276
  # Deserialize Response
355
277
  if status_code == 200
356
278
  begin
357
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
279
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
358
280
  unless parsed_response.nil?
359
281
  parsed_response = SecurityRule.deserialize_object(parsed_response)
360
282
  end
361
283
  result.body = parsed_response
362
284
  rescue Exception => e
363
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
285
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
364
286
  end
365
287
  end
366
288
  # Deserialize Response
367
289
  if status_code == 201
368
290
  begin
369
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
291
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
370
292
  unless parsed_response.nil?
371
293
  parsed_response = SecurityRule.deserialize_object(parsed_response)
372
294
  end
373
295
  result.body = parsed_response
374
296
  rescue Exception => e
375
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
297
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
376
298
  end
377
299
  end
378
300
 
@@ -385,6 +307,7 @@ module Azure::ARM::Network
385
307
  #
386
308
  # The List network security rule opertion retrieves all the security rules in
387
309
  # a network security group.
310
+ #
388
311
  # @param resource_group_name [String] The name of the resource group.
389
312
  # @param network_security_group_name [String] The name of the network security
390
313
  # group.
@@ -399,72 +322,44 @@ module Azure::ARM::Network
399
322
  fail ArgumentError, 'network_security_group_name is nil' if network_security_group_name.nil?
400
323
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
401
324
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
402
- # Construct URL
403
- path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules"
404
- path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
405
- path['{networkSecurityGroupName}'] = ERB::Util.url_encode(network_security_group_name) if path.include?('{networkSecurityGroupName}')
406
- path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
407
- url = URI.join(@client.base_url, path)
408
- properties = {}
409
- properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
410
- unless url.query.nil?
411
- url.query.split('&').each do |url_item|
412
- url_items_parts = url_item.split('=')
413
- properties[url_items_parts[0]] = url_items_parts[1]
414
- end
415
- end
416
- properties.reject!{ |key, value| value.nil? }
417
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
418
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
419
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
420
- url = URI.parse(corrected_url)
421
-
422
- connection = Faraday.new(:url => url) do |faraday|
423
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
424
- faraday.use :cookie_jar
425
- faraday.adapter Faraday.default_adapter
426
- end
427
- request_headers = Hash.new
325
+ request_headers = {}
428
326
 
429
327
  # Set Headers
430
328
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
431
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
432
-
433
- unless custom_headers.nil?
434
- custom_headers.each do |key, value|
435
- request_headers[key] = value
436
- end
437
- end
438
-
439
- # Send Request
440
- promise = Concurrent::Promise.new do
441
- connection.get do |request|
442
- request.headers = request_headers
443
- @client.credentials.sign_request(request) unless @client.credentials.nil?
444
- end
329
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
330
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules'
331
+ options = {
332
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
333
+ path_params: {'resourceGroupName' => resource_group_name,'networkSecurityGroupName' => network_security_group_name,'subscriptionId' => @client.subscription_id},
334
+ query_params: {'api-version' => @client.api_version},
335
+ headers: request_headers.merge(custom_headers || {})
336
+ }
337
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
338
+ promise = request.run_promise do |req|
339
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
445
340
  end
446
341
 
447
342
  promise = promise.then do |http_response|
448
343
  status_code = http_response.status
449
344
  response_content = http_response.body
450
- unless (status_code == 200)
345
+ unless status_code == 200
451
346
  error_model = JSON.load(response_content)
452
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
347
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
453
348
  end
454
349
 
455
350
  # Create Result
456
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
351
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
457
352
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
458
353
  # Deserialize Response
459
354
  if status_code == 200
460
355
  begin
461
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
356
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
462
357
  unless parsed_response.nil?
463
358
  parsed_response = SecurityRuleListResult.deserialize_object(parsed_response)
464
359
  end
465
360
  result.body = parsed_response
466
361
  rescue Exception => e
467
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
362
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
468
363
  end
469
364
  end
470
365
 
@@ -477,6 +372,7 @@ module Azure::ARM::Network
477
372
  #
478
373
  # The List network security rule opertion retrieves all the security rules in
479
374
  # a network security group.
375
+ #
480
376
  # @param next_page_link [String] The NextLink from the previous successful
481
377
  # call to List operation.
482
378
  # @param [Hash{String => String}] The hash of custom headers need to be
@@ -487,69 +383,43 @@ module Azure::ARM::Network
487
383
  #
488
384
  def list_next(next_page_link, custom_headers = nil)
489
385
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
490
- # Construct URL
491
- path = "{nextLink}"
492
- path['{nextLink}'] = next_page_link if path.include?('{nextLink}')
493
- url = URI.parse(path)
494
- properties = {}
495
- unless url.query.nil?
496
- url.query.split('&').each do |url_item|
497
- url_items_parts = url_item.split('=')
498
- properties[url_items_parts[0]] = url_items_parts[1]
499
- end
500
- end
501
- properties.reject!{ |key, value| value.nil? }
502
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
503
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
504
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
505
- url = URI.parse(corrected_url)
506
-
507
- connection = Faraday.new(:url => url) do |faraday|
508
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
509
- faraday.use :cookie_jar
510
- faraday.adapter Faraday.default_adapter
511
- end
512
- request_headers = Hash.new
386
+ request_headers = {}
513
387
 
514
388
  # Set Headers
515
389
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
516
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
517
-
518
- unless custom_headers.nil?
519
- custom_headers.each do |key, value|
520
- request_headers[key] = value
521
- end
522
- end
523
-
524
- # Send Request
525
- promise = Concurrent::Promise.new do
526
- connection.get do |request|
527
- request.headers = request_headers
528
- @client.credentials.sign_request(request) unless @client.credentials.nil?
529
- end
390
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
391
+ path_template = '{nextLink}'
392
+ options = {
393
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
394
+ skip_encoding_path_params: {'nextLink' => next_page_link},
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?
530
400
  end
531
401
 
532
402
  promise = promise.then do |http_response|
533
403
  status_code = http_response.status
534
404
  response_content = http_response.body
535
- unless (status_code == 200)
405
+ unless status_code == 200
536
406
  error_model = JSON.load(response_content)
537
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
407
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
538
408
  end
539
409
 
540
410
  # Create Result
541
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
411
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
542
412
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
543
413
  # Deserialize Response
544
414
  if status_code == 200
545
415
  begin
546
- 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)
547
417
  unless parsed_response.nil?
548
418
  parsed_response = SecurityRuleListResult.deserialize_object(parsed_response)
549
419
  end
550
420
  result.body = parsed_response
551
421
  rescue Exception => e
552
- 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)
553
423
  end
554
424
  end
555
425