forked from fog/fog-azure-rm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request fog#61 from fog/application_gateway_fog
Application gateway fog implementation
- Loading branch information
Showing
30 changed files
with
2,165 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
Gemfile.lock | ||
.arcconfig | ||
coverage | ||
*/.DS_Store |
Large diffs are not rendered by default.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
lib/fog/azurerm/models/network/application_gateway_backend_address_pool.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module Fog | ||
module Network | ||
class AzureRM | ||
# Backend Address Pool model class for Network Service | ||
class ApplicationGatewayBackendAddressPool < Fog::Model | ||
identity :name | ||
attribute :ip_addresses | ||
|
||
def self.parse(backend_address_pool) | ||
hash = {} | ||
unless backend_address_pool['properties'].nil? | ||
backend_addresses = backend_address_pool['properties']['backendAddresses'] | ||
hash['name'] = backend_address_pool['name'] | ||
hash['ip_addresses'] = [] | ||
backend_addresses.each do |ip_address| | ||
hash['ip_addresses'] << ip_address | ||
end unless backend_addresses.nil? | ||
end | ||
hash | ||
end | ||
end | ||
end | ||
end | ||
end |
30 changes: 30 additions & 0 deletions
30
lib/fog/azurerm/models/network/application_gateway_backend_http_setting.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
module Fog | ||
module Network | ||
class AzureRM | ||
# Backend Http Settings model class for Network Service | ||
class ApplicationGatewayBackendHttpSetting < Fog::Model | ||
identity :name | ||
attribute :port | ||
attribute :protocol | ||
attribute :cookie_based_affinity | ||
attribute :request_timeout | ||
attribute :probe | ||
|
||
def self.parse(backend_http_setting) | ||
backend_http_setting_properties = backend_http_setting['properties'] | ||
|
||
hash = {} | ||
hash['name'] = backend_http_setting['name'] | ||
unless backend_http_setting_properties.nil? | ||
hash['port'] = backend_http_setting_properties['port'] | ||
hash['protocol'] = backend_http_setting_properties['protocol'] | ||
hash['cookie_based_affinity'] = backend_http_setting_properties['cookieBasedAffinity'] | ||
hash['request_timeout'] = backend_http_setting_properties['requestTimeout'] | ||
hash['probe'] = backend_http_setting_properties['probe'] | ||
hash | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
30 changes: 30 additions & 0 deletions
30
lib/fog/azurerm/models/network/application_gateway_frontend_ip_configuration.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
module Fog | ||
module Network | ||
class AzureRM | ||
# Frontend IP Configuration model class for Network Service | ||
class ApplicationGatewayFrontendIPConfiguration < Fog::Model | ||
identity :name | ||
attribute :public_ip_address_id | ||
attribute :private_ip_allocation_method | ||
attribute :private_ip_address | ||
def self.parse(frontend_ip_configuration) | ||
frontend_ip_configuration_properties = frontend_ip_configuration['properties'] | ||
|
||
hash = {} | ||
hash['name'] = frontend_ip_configuration['name'] | ||
unless frontend_ip_configuration_properties.nil? | ||
unless frontend_ip_configuration_properties['publicIPAddress'].nil? | ||
hash['public_ip_address_id'] = frontend_ip_configuration_properties['publicIPAddress']['id'] | ||
end | ||
hash['private_ip_allocation_method'] = frontend_ip_configuration_properties['privateIPAllocationMethod'] | ||
private_ip_address = frontend_ip_configuration_properties['privateIPAddress'] | ||
unless private_ip_address.nil? | ||
hash['private_ip_address'] = private_ip_address | ||
end | ||
end | ||
hash | ||
end | ||
end | ||
end | ||
end | ||
end |
22 changes: 22 additions & 0 deletions
22
lib/fog/azurerm/models/network/application_gateway_frontend_port.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module Fog | ||
module Network | ||
class AzureRM | ||
# Frontenf Port model class for Network Service | ||
class ApplicationGatewayFrontendPort < Fog::Model | ||
identity :name | ||
attribute :port | ||
|
||
def self.parse(frontend_port) | ||
frontend_port_properties = frontend_port['properties'] | ||
|
||
hash = {} | ||
hash['name'] = frontend_port['name'] | ||
unless frontend_port_properties['port'].nil? | ||
hash['port'] = frontend_port_properties['port'] | ||
end | ||
hash | ||
end | ||
end | ||
end | ||
end | ||
end |
37 changes: 37 additions & 0 deletions
37
lib/fog/azurerm/models/network/application_gateway_http_listener.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
module Fog | ||
module Network | ||
class AzureRM | ||
# Http Listener class for Network Service | ||
class ApplicationGatewayHttpListener < Fog::Model | ||
identity :name | ||
attribute :frontend_ip_config_id | ||
attribute :frontend_port_id | ||
attribute :protocol | ||
attribute :host_name | ||
attribute :ssl_certificate_id | ||
attribute :require_server_name_indication | ||
|
||
def self.parse(http_listener) | ||
http_listener_properties = http_listener['properties'] | ||
hash = {} | ||
hash['name'] = http_listener['name'] | ||
unless http_listener_properties.nil? | ||
unless http_listener_properties['frontendIPConfiguration'].nil? | ||
hash['frontend_ip_config_id'] = http_listener_properties['frontendIPConfiguration']['id'] | ||
end | ||
unless http_listener_properties['frontendPort'].nil? | ||
hash['frontend_port_id'] = http_listener_properties['frontendPort']['id'] | ||
end | ||
hash['protocol'] = http_listener_properties['protocol'] | ||
hash['host_name'] = http_listener_properties['hostName'] | ||
unless http_listener_properties['sslCertificate'].nil? | ||
hash['ssl_certificate_id'] = http_listener_properties['sslCertificate']['id'] | ||
hash['require_server_name_indication'] = http_listener_properties['sslCertificate']['requireServerNameIndication'] | ||
end | ||
end | ||
hash | ||
end | ||
end | ||
end | ||
end | ||
end |
21 changes: 21 additions & 0 deletions
21
lib/fog/azurerm/models/network/application_gateway_ip_configuration.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module Fog | ||
module Network | ||
class AzureRM | ||
# GatewayIPConfiguration model class for Network Service | ||
class ApplicationGatewayIPConfiguration < Fog::Model | ||
identity :name | ||
attribute :subnet_id | ||
|
||
def self.parse(gateway_ip_configuration) | ||
hash = {} | ||
hash['name'] = gateway_ip_configuration['name'] | ||
gateway_ip_configuration_prop = gateway_ip_configuration['properties'] | ||
unless gateway_ip_configuration_prop['subnet'].nil? | ||
hash['subnet_id'] = gateway_ip_configuration_prop['subnet']['id'] | ||
end | ||
hash | ||
end | ||
end | ||
end | ||
end | ||
end |
32 changes: 32 additions & 0 deletions
32
lib/fog/azurerm/models/network/application_gateway_probe.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
module Fog | ||
module Network | ||
class AzureRM | ||
# Probe model class for Network Service | ||
class ApplicationGatewayProbe < Fog::Model | ||
identity :name | ||
attribute :protocol | ||
attribute :host | ||
attribute :path | ||
attribute :interval | ||
attribute :timeout | ||
attribute :unhealthy_threshold | ||
|
||
def self.parse(probe) | ||
probe_properties = probe['properties'] | ||
|
||
hash = {} | ||
hash['name'] = probe['name'] | ||
unless probe_properties.nil? | ||
hash['protocol'] = probe_properties['protocol'] | ||
hash['host'] = probe_properties['host'] | ||
hash['path'] = probe_properties['path'] | ||
hash['interval'] = probe_properties['interval'] | ||
hash['timeout'] = probe_properties['timeout'] | ||
hash['unhealthy_threshold'] = probe_properties['unhealthyThreshold'] | ||
end | ||
hash | ||
end | ||
end | ||
end | ||
end | ||
end |
35 changes: 35 additions & 0 deletions
35
lib/fog/azurerm/models/network/application_gateway_request_routing_rule.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
module Fog | ||
module Network | ||
class AzureRM | ||
# Request Routing Rule model class for Network Service | ||
class ApplicationGatewayRequestRoutingRule < Fog::Model | ||
identity :name | ||
attribute :type | ||
attribute :http_listener_id | ||
attribute :backend_address_pool_id | ||
attribute :backend_http_settings_id | ||
attribute :url_path_map | ||
|
||
def self.parse(request_routing_rule) | ||
request_routing_rule_properties = request_routing_rule['properties'] | ||
|
||
hash = {} | ||
hash['name'] = request_routing_rule['name'] | ||
unless request_routing_rule_properties.nil? | ||
hash['type'] = request_routing_rule_properties['ruleType'] | ||
unless request_routing_rule_properties['httpListener'].nil? | ||
hash['http_listener_id'] = request_routing_rule_properties['httpListener']['id'] | ||
end | ||
unless request_routing_rule_properties['backendAddressPool'].nil? | ||
hash['backend_address_pool_id'] = request_routing_rule_properties['backendAddressPool']['id'] | ||
end | ||
unless request_routing_rule_properties['backendHttpSettings'].nil? | ||
hash['backend_http_settings_id'] = request_routing_rule_properties['backendHttpSettings']['id'] | ||
end | ||
end | ||
hash | ||
end | ||
end | ||
end | ||
end | ||
end |
26 changes: 26 additions & 0 deletions
26
lib/fog/azurerm/models/network/application_gateway_ssl_certificate.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
module Fog | ||
module Network | ||
class AzureRM | ||
# SSL Certificate model class for Network Service | ||
class ApplicationGatewaySslCertificate < Fog::Model | ||
identity :name | ||
attribute :data | ||
attribute :password | ||
attribute :public_cert_data | ||
|
||
def self.parse(ssl_certificate) | ||
ssl_certificate_properties = ssl_certificate['properties'] | ||
|
||
hash = {} | ||
hash['name'] = ssl_certificate['name'] | ||
unless ssl_certificate_properties.nil? | ||
hash['data'] = ssl_certificate_properties['data'] | ||
hash['password'] = ssl_certificate_properties['password'] | ||
hash['public_cert_data'] = ssl_certificate_properties['publicCertData'] | ||
end | ||
hash | ||
end | ||
end | ||
end | ||
end | ||
end |
32 changes: 32 additions & 0 deletions
32
lib/fog/azurerm/models/network/application_gateway_url_path_map.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
module Fog | ||
module Network | ||
class AzureRM | ||
# URL Path Map model class for Network Service | ||
class ApplicationGatewayUrlPathMap < Fog::Model | ||
identity :name | ||
attribute :default_backend_address_pool_id | ||
attribute :default_backend_http_settings_id | ||
attribute :path_rules | ||
|
||
def self.parse(url_path_map) | ||
url_path_map_properties = url_path_map['properties'] | ||
|
||
hash = {} | ||
hash['name'] = url_path_map['name'] | ||
unless url_path_map_properties.nil? | ||
hash['default_backend_address_pool_id'] = url_path_map_properties['defaultBackendAddressPool']['id'] | ||
hash['default_backend_http_settings_id'] = url_path_map_properties['defaultBackendHttpSettings']['id'] | ||
|
||
path_rules = url_path_map_properties['pathRules'] | ||
hash['path_rules'] = [] | ||
path_rules.each do |rule| | ||
path_rule = Fog::Network::AzureRM::PathRule.new | ||
hash['path_rules'] << path_rule.merge_attributes(Fog::Network::AzureRM::PathRule.parse(rule)) | ||
end unless path_rules.nil? | ||
end | ||
hash | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
require 'fog/core/collection' | ||
require 'fog/azurerm/models/network/application_gateway' | ||
|
||
module Fog | ||
module Network | ||
class AzureRM | ||
# Application Gateway collection class for Network Service | ||
class ApplicationGateways < Fog::Collection | ||
model Fog::Network::AzureRM::ApplicationGateway | ||
attribute :resource_group | ||
|
||
def all | ||
requires :resource_group | ||
application_gateways = [] | ||
service.list_application_gateways(resource_group).each do |gateway| | ||
application_gateways << Fog::Network::AzureRM::ApplicationGateway.parse(gateway) | ||
end | ||
load(application_gateways) | ||
end | ||
|
||
def get(identity) | ||
all.find { |f| f.name == identity } | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
module Fog | ||
module Network | ||
class AzureRM | ||
# Path Rule model class for Network Service | ||
class PathRule < Fog::Model | ||
attribute :paths | ||
attribute :backend_address_pool_id | ||
attribute :backend_http_settings_id | ||
|
||
def self.parse(path_rule) | ||
paths = path_rule['paths'] | ||
|
||
hash = {} | ||
hash['paths'] = [] | ||
paths.each do |path| | ||
hash['paths'] << path | ||
end unless paths.nil? | ||
|
||
unless path_rule['backendAddressPool'].nil? | ||
hash['backend_address_pool_id'] = path_rule['backendAddressPool']['id'] | ||
end | ||
unless path_rule['backendHttpsettings'].nil? | ||
hash['backend_http_settings_id'] = path_rule['backendHttpsettings']['id'] | ||
end | ||
hash | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.