Class: Fog::Network::AzureRM::ApplicationGateway
- Inherits:
-
Model
- Object
- Model
- Fog::Network::AzureRM::ApplicationGateway
- Defined in:
- lib/fog/azurerm/models/network/application_gateway.rb
Overview
Application Gateway model class for Network Service
Class Method Summary collapse
Instance Method Summary collapse
- #destroy ⇒ Object
- #save ⇒ Object
- #validate_backend_address_pool_params(backend_address_pool) ⇒ Object
- #validate_backend_address_pools(backend_address_pools) ⇒ Object
- #validate_backend_http_settings_list(backend_http_settings_list) ⇒ Object
- #validate_backend_http_settings_params(backend_http_settings) ⇒ Object
- #validate_frontend_ip_configuration_params(frontend_ip_configuration) ⇒ Object
- #validate_frontend_ip_configurations(frontend_ip_configurations) ⇒ Object
- #validate_frontend_port_params(frontend_port) ⇒ Object
- #validate_frontend_ports(frontend_ports) ⇒ Object
- #validate_gateway_ip_configuration_params(gateway_ip_configuration) ⇒ Object
- #validate_gateway_ip_configurations(gateway_ip_configurations) ⇒ Object
- #validate_http_listener_params(http_listener) ⇒ Object
- #validate_http_listeners(http_listeners) ⇒ Object
- #validate_probe_params(probe) ⇒ Object
- #validate_probes(probes) ⇒ Object
- #validate_request_routing_rule_params(request_routing_rule) ⇒ Object
- #validate_request_routing_rules(request_routing_rules) ⇒ Object
- #validate_ssl_certificate_params(ssl_certificate) ⇒ Object
- #validate_ssl_certificates(ssl_certificates) ⇒ Object
- #validate_url_path_map_params(url_path_map) ⇒ Object
- #validate_url_path_maps(url_path_maps) ⇒ Object
Class Method Details
.parse(gateway) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/fog/azurerm/models/network/application_gateway.rb', line 26 def self.parse(gateway) gateway_properties = gateway['properties'] hash = {} hash['name'] = gateway['name'] hash['id'] = gateway['id'] hash['location'] = gateway['location'] hash['resource_group'] = gateway['id'].split('/')[4] unless gateway_properties.nil? hash['provisioning_state'] = gateway_properties['provisioningState'] unless gateway_properties['sku'].nil? hash['sku_name'] = gateway_properties['sku']['name'] hash['sku_tier'] = gateway_properties['sku']['tier'] hash['sku_capacity'] = gateway_properties['sku']['capacity'] end hash['operational_state'] = gateway_properties['operationalState'] hash['gateway_ip_configurations'] = [] gateway_properties['gatewayIpConfigurations'].each do |ip_configuration| gateway_ip_configuration = Fog::Network::AzureRM::ApplicationGatewayIPConfiguration.new hash['gateway_ip_configurations'] << gateway_ip_configuration.merge_attributes(Fog::Network::AzureRM::ApplicationGatewayIPConfiguration.parse(ip_configuration)) end unless gateway_properties['gatewayIpConfigurations'].nil? hash['ssl_certificates'] = [] gateway_properties['sslCertificates'].each do |certificate| ssl_certificate = Fog::Network::AzureRM::ApplicationGatewaySslCertificate.new hash['ssl_certificates'] << ssl_certificate.merge_attributes(Fog::Network::AzureRM::ApplicationGatewaySslCertificate.parse(certificate)) end unless gateway_properties['sslCertificates'].nil? hash['frontend_ip_configurations'] = [] gateway_properties['frontendIpConfigurations'].each do |frontend_ip_config| frontend_ip_configuration = Fog::Network::AzureRM::ApplicationGatewayFrontendIPConfiguration.new hash['frontend_ip_configurations'] << frontend_ip_configuration.merge_attributes(Fog::Network::AzureRM::ApplicationGatewayFrontendIPConfiguration.parse(frontend_ip_config)) end unless gateway_properties['frontendIpConfigurations'].nil? hash['frontend_ports'] = [] gateway_properties['frontendPorts'].each do |port| frontend_port = Fog::Network::AzureRM::ApplicationGatewayFrontendPort.new hash['frontend_ports'] << frontend_port.merge_attributes(Fog::Network::AzureRM::ApplicationGatewayFrontendPort.parse(port)) end unless gateway_properties['frontendPorts'].nil? hash['probes'] = [] gateway_properties['probes'].each do |probe| gateway_probe = Fog::Network::AzureRM::ApplicationGatewayProbe.new hash['probes'] << gateway_probe.merge_attributes(Fog::Network::AzureRM::ApplicationGatewayProbe.parse(probe)) end unless gateway_properties['probes'].nil? hash['backend_address_pools'] = [] gateway_properties['backendAddressPools'].each do |address| backend_address_pool = Fog::Network::AzureRM::ApplicationGatewayBackendAddressPool.new hash['backend_address_pools'] << backend_address_pool.merge_attributes(Fog::Network::AzureRM::ApplicationGatewayBackendAddressPool.parse(address)) end unless gateway_properties['backendAddressPools'].nil? hash['backend_http_settings_list'] = [] gateway_properties['backendHttpSettingsCollection'].each do |http_setting| backend_http_setting = Fog::Network::AzureRM::ApplicationGatewayBackendHttpSetting.new hash['backend_http_settings_list'] << backend_http_setting.merge_attributes(Fog::Network::AzureRM::ApplicationGatewayBackendHttpSetting.parse(http_setting)) end unless gateway_properties['backendHttpSettingsCollection'].nil? hash['http_listeners'] = [] gateway_properties['httpListeners'].each do |listener| http_listener = Fog::Network::AzureRM::ApplicationGatewayHttpListener.new hash['http_listeners'] << http_listener.merge_attributes(Fog::Network::AzureRM::ApplicationGatewayHttpListener.parse(listener)) end unless gateway_properties['httpListeners'].nil? hash['url_path_maps'] = [] gateway_properties['urlPathMaps'].each do |map| url_path_map = Fog::Network::AzureRM::ApplicationGatewayUrlPathMap.new hash['url_path_maps'] << url_path_map.merge_attributes(Fog::Network::AzureRM::ApplicationGatewayUrlPathMap.parse(map)) end unless gateway_properties['urlPathMaps'].nil? hash['request_routing_rules'] = [] gateway_properties['requestRoutingRules'].each do |rule| request_routing_rule = Fog::Network::AzureRM::ApplicationGatewayRequestRoutingRule.new hash['request_routing_rules'] << request_routing_rule.merge_attributes(Fog::Network::AzureRM::ApplicationGatewayRequestRoutingRule.parse(rule)) end unless gateway_properties['requestRoutingRules'].nil? end hash end |
Instance Method Details
#destroy ⇒ Object
450 451 452 |
# File 'lib/fog/azurerm/models/network/application_gateway.rb', line 450 def destroy service.delete_application_gateway(resource_group, name) end |
#save ⇒ Object
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/fog/azurerm/models/network/application_gateway.rb', line 106 def save requires :name, :location, :resource_group, :sku_name, :sku_tier, :sku_capacity, :gateway_ip_configurations, :frontend_ip_configurations, :frontend_ports, :backend_address_pools, :backend_http_settings_list, :http_listeners, :request_routing_rules validate_gateway_ip_configurations(gateway_ip_configurations) unless gateway_ip_configurations.nil? validate_ssl_certificates(ssl_certificates) unless ssl_certificates.nil? validate_frontend_ip_configurations(frontend_ip_configurations) unless frontend_ip_configurations.nil? validate_frontend_ports(frontend_ports) unless frontend_ports.nil? validate_probes(probes) unless probes.nil? validate_backend_address_pools(backend_address_pools) unless backend_address_pools.nil? validate_backend_http_settings_list(backend_http_settings_list) unless backend_http_settings_list.nil? validate_http_listeners(http_listeners) unless http_listeners.nil? validate_url_path_maps(url_path_maps) unless url_path_maps.nil? validate_request_routing_rules(request_routing_rules) unless request_routing_rules.nil? gateway = service.create_application_gateway(name, location, resource_group, sku_name, sku_tier, sku_capacity, gateway_ip_configurations, ssl_certificates, frontend_ip_configurations, frontend_ports, probes, backend_address_pools, backend_http_settings_list, http_listeners, url_path_maps, request_routing_rules) merge_attributes(Fog::Network::AzureRM::ApplicationGateway.parse(gateway)) end |
#validate_backend_address_pool_params(backend_address_pool) ⇒ Object
306 307 308 309 310 311 312 313 314 315 316 317 |
# File 'lib/fog/azurerm/models/network/application_gateway.rb', line 306 def validate_backend_address_pool_params(backend_address_pool) required_params = [ :name, :ip_addresses ] missing = required_params.select { |p| p unless backend_address_pool.key?(p) } if missing.length == 1 raise(ArgumentError, "#{missing.first} is required for this operation") elsif missing.any? raise(ArgumentError, "#{missing[0...-1].join(', ')} and #{missing[-1]} are required for this operation") end end |
#validate_backend_address_pools(backend_address_pools) ⇒ Object
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
# File 'lib/fog/azurerm/models/network/application_gateway.rb', line 288 def validate_backend_address_pools(backend_address_pools) if backend_address_pools.is_a?(Array) if backend_address_pools.any? backend_address_pools.each do |backend_address_pool| if backend_address_pool.is_a?(Hash) validate_backend_address_pool_params(backend_address_pool) else raise(ArgumentError, ':backend_address_pools must be an Array of Hashes') end end else raise(ArgumentError, ':backend_address_pools must not be an empty Array') end else raise(ArgumentError, ':backend_address_pools must be an Array') end end |
#validate_backend_http_settings_list(backend_http_settings_list) ⇒ Object
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 |
# File 'lib/fog/azurerm/models/network/application_gateway.rb', line 319 def validate_backend_http_settings_list(backend_http_settings_list) if backend_http_settings_list.is_a?(Array) if backend_http_settings_list.any? backend_http_settings_list.each do |backend_http_settings| if backend_http_settings.is_a?(Hash) validate_backend_http_settings_params(backend_http_settings) else raise(ArgumentError, ':backend_http_settings_list must be an Array of Hashes') end end else raise(ArgumentError, ':backend_http_settings_list must not be an empty Array') end else raise(ArgumentError, ':backend_http_settings_list must be an Array') end end |
#validate_backend_http_settings_params(backend_http_settings) ⇒ Object
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 |
# File 'lib/fog/azurerm/models/network/application_gateway.rb', line 337 def validate_backend_http_settings_params(backend_http_settings) required_params = [ :name, :port, :protocol, :cookie_based_affinity, :request_timeout ] missing = required_params.select { |p| p unless backend_http_settings.key?(p) } if missing.length == 1 raise(ArgumentError, "#{missing.first} is required for this operation") elsif missing.any? raise(ArgumentError, "#{missing[0...-1].join(', ')} and #{missing[-1]} are required for this operation") end end |
#validate_frontend_ip_configuration_params(frontend_ip_configuration) ⇒ Object
206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/fog/azurerm/models/network/application_gateway.rb', line 206 def validate_frontend_ip_configuration_params(frontend_ip_configuration) required_params = [ :name, :public_ip_address_id, :private_ip_allocation_method, :private_ip_address ] missing = required_params.select { |p| p unless frontend_ip_configuration.key?(p) } if missing.length == 1 raise(ArgumentError, "#{missing.first} is required for this operation") elsif missing.any? raise(ArgumentError, "#{missing[0...-1].join(', ')} and #{missing[-1]} are required for this operation") end end |
#validate_frontend_ip_configurations(frontend_ip_configurations) ⇒ Object
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/fog/azurerm/models/network/application_gateway.rb', line 188 def validate_frontend_ip_configurations(frontend_ip_configurations) if frontend_ip_configurations.is_a?(Array) if frontend_ip_configurations.any? frontend_ip_configurations.each do |frontend_ip_configuration| if frontend_ip_configuration.is_a?(Hash) validate_frontend_ip_configuration_params(frontend_ip_configuration) else raise(ArgumentError, ':frontend_ip_configurations must be an Array of Hashes') end end else raise(ArgumentError, ':frontend_ip_configurations must not be an empty Array') end else raise(ArgumentError, ':frontend_ip_configurations must be an Array') end end |
#validate_frontend_port_params(frontend_port) ⇒ Object
239 240 241 242 243 244 245 246 247 248 249 250 |
# File 'lib/fog/azurerm/models/network/application_gateway.rb', line 239 def validate_frontend_port_params(frontend_port) required_params = [ :name, :port ] missing = required_params.select { |p| p unless frontend_port.key?(p) } if missing.length == 1 raise(ArgumentError, "#{missing.first} is required for this operation") elsif missing.any? raise(ArgumentError, "#{missing[0...-1].join(', ')} and #{missing[-1]} are required for this operation") end end |
#validate_frontend_ports(frontend_ports) ⇒ Object
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 |
# File 'lib/fog/azurerm/models/network/application_gateway.rb', line 221 def validate_frontend_ports(frontend_ports) if frontend_ports.is_a?(Array) if frontend_ports.any? frontend_ports.each do |frontend_port| if frontend_port.is_a?(Hash) validate_frontend_port_params(frontend_port) else raise(ArgumentError, ':frontend_ports must be an Array of Hashes') end end else raise(ArgumentError, ':frontend_ports must not be an empty Array') end else raise(ArgumentError, ':frontend_ports must be an Array') end end |
#validate_gateway_ip_configuration_params(gateway_ip_configuration) ⇒ Object
142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/fog/azurerm/models/network/application_gateway.rb', line 142 def validate_gateway_ip_configuration_params(gateway_ip_configuration) required_params = [ :name, :subnet_id ] missing = required_params.select { |p| p unless gateway_ip_configuration.key?(p) } if missing.length == 1 raise(ArgumentError, "#{missing.first} is required for this operation") elsif missing.any? raise(ArgumentError, "#{missing[0...-1].join(', ')} and #{missing[-1]} are required for this operation") end end |
#validate_gateway_ip_configurations(gateway_ip_configurations) ⇒ Object
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/fog/azurerm/models/network/application_gateway.rb', line 124 def validate_gateway_ip_configurations(gateway_ip_configurations) if gateway_ip_configurations.is_a?(Array) if gateway_ip_configurations.any? gateway_ip_configurations.each do |gateway_ip_configuration| if gateway_ip_configuration.is_a?(Hash) validate_gateway_ip_configuration_params(gateway_ip_configuration) else raise(ArgumentError, ':gateway_ip_configurations must be an Array of Hashes') end end else raise(ArgumentError, ':gateway_ip_configurations must not be an empty Array') end else raise(ArgumentError, ':gateway_ip_configurations must be an Array') end end |
#validate_http_listener_params(http_listener) ⇒ Object
371 372 373 374 375 376 377 378 379 380 381 382 383 384 |
# File 'lib/fog/azurerm/models/network/application_gateway.rb', line 371 def validate_http_listener_params(http_listener) required_params = [ :name, :frontend_ip_config_id, :frontend_port_id, :protocol ] missing = required_params.select { |p| p unless http_listener.key?(p) } if missing.length == 1 raise(ArgumentError, "#{missing.first} is required for this operation") elsif missing.any? raise(ArgumentError, "#{missing[0...-1].join(', ')} and #{missing[-1]} are required for this operation") end end |
#validate_http_listeners(http_listeners) ⇒ Object
353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 |
# File 'lib/fog/azurerm/models/network/application_gateway.rb', line 353 def validate_http_listeners(http_listeners) if http_listeners.is_a?(Array) if http_listeners.any? http_listeners.each do |http_listener| if http_listener.is_a?(Hash) validate_http_listener_params(http_listener) else raise(ArgumentError, ':http_listeners must be an Array of Hashes') end end else raise(ArgumentError, ':http_listeners must not be an empty Array') end else raise(ArgumentError, ':http_listeners must be an Array') end end |
#validate_probe_params(probe) ⇒ Object
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
# File 'lib/fog/azurerm/models/network/application_gateway.rb', line 270 def validate_probe_params(probe) required_params = [ :name, :protocol, :host, :path, :interval, :timeout, :unhealthy_threshold ] missing = required_params.select { |p| p unless probe.key?(p) } if missing.length == 1 raise(ArgumentError, "#{missing.first} is required for this operation") elsif missing.any? raise(ArgumentError, "#{missing[0...-1].join(', ')} and #{missing[-1]} are required for this operation") end end |
#validate_probes(probes) ⇒ Object
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 |
# File 'lib/fog/azurerm/models/network/application_gateway.rb', line 252 def validate_probes(probes) if probes.is_a?(Array) if probes.any? probes.each do |probe| if probe.is_a?(Hash) validate_probe_params(probe) else raise(ArgumentError, ':probes must be an Array of Hashes') end end else raise(ArgumentError, ':probes must not be an empty Array') end else raise(ArgumentError, ':probes must be an Array') end end |
#validate_request_routing_rule_params(request_routing_rule) ⇒ Object
437 438 439 440 441 442 443 444 445 446 447 448 |
# File 'lib/fog/azurerm/models/network/application_gateway.rb', line 437 def validate_request_routing_rule_params(request_routing_rule) required_params = [ :type, :http_listener_id ] missing = required_params.select { |p| p unless request_routing_rule.key?(p) } if missing.length == 1 raise(ArgumentError, "#{missing.first} is required for this operation") elsif missing.any? raise(ArgumentError, "#{missing[0...-1].join(', ')} and #{missing[-1]} are required for this operation") end end |
#validate_request_routing_rules(request_routing_rules) ⇒ Object
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 |
# File 'lib/fog/azurerm/models/network/application_gateway.rb', line 419 def validate_request_routing_rules(request_routing_rules) if request_routing_rules.is_a?(Array) if request_routing_rules.any? request_routing_rules.each do |request_routing_rule| if request_routing_rule.is_a?(Hash) validate_request_routing_rule_params(request_routing_rule) else raise(ArgumentError, ':request_routing_rules must be an Array of Hashes') end end else raise(ArgumentError, ':request_routing_rules must not be an empty Array') end else raise(ArgumentError, ':request_routing_rules must be an Array') end end |
#validate_ssl_certificate_params(ssl_certificate) ⇒ Object
173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/fog/azurerm/models/network/application_gateway.rb', line 173 def validate_ssl_certificate_params(ssl_certificate) required_params = [ :name, :data, :password, :public_cert_data ] missing = required_params.select { |p| p unless ssl_certificate.key?(p) } if missing.length == 1 raise(ArgumentError, "#{missing.first} is required for this operation") elsif missing.any? raise(ArgumentError, "#{missing[0...-1].join(', ')} and #{missing[-1]} are required for this operation") end end |
#validate_ssl_certificates(ssl_certificates) ⇒ Object
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/fog/azurerm/models/network/application_gateway.rb', line 155 def validate_ssl_certificates(ssl_certificates) if ssl_certificates.is_a?(Array) if ssl_certificates.any? ssl_certificates.each do |ssl_certificate| if ssl_certificate.is_a?(Hash) validate_ssl_certificate_params(ssl_certificate) else raise(ArgumentError, ':ssl_certificates must be an Array of Hashes') end end else raise(ArgumentError, ':ssl_certificates must not be an empty Array') end else raise(ArgumentError, ':ssl_certificates must be an Array') end end |
#validate_url_path_map_params(url_path_map) ⇒ Object
404 405 406 407 408 409 410 411 412 413 414 415 416 417 |
# File 'lib/fog/azurerm/models/network/application_gateway.rb', line 404 def validate_url_path_map_params(url_path_map) required_params = [ :name, :default_backend_address_pool_id, :default_backend_http_settings_id, :path_rules ] missing = required_params.select { |p| p unless url_path_map.key?(p) } if missing.length == 1 raise(ArgumentError, "#{missing.first} is required for this operation") elsif missing.any? raise(ArgumentError, "#{missing[0...-1].join(', ')} and #{missing[-1]} are required for this operation") end end |
#validate_url_path_maps(url_path_maps) ⇒ Object
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 |
# File 'lib/fog/azurerm/models/network/application_gateway.rb', line 386 def validate_url_path_maps(url_path_maps) if url_path_maps.is_a?(Array) if url_path_maps.any? url_path_maps.each do |url_path_map| if url_path_map.is_a?(Hash) validate_url_path_map_params(url_path_map) else raise(ArgumentError, ':url_path_maps must be an Array of Hashes') end end else raise(ArgumentError, ':url_path_maps must not be an empty Array') end else raise(ArgumentError, ':url_path_maps must be an Array') end end |