azure_mgmt_network 0.1.2 → 0.2.0

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