Skip to content

Commit

Permalink
Merge pull request fog#61 from fog/application_gateway_fog
Browse files Browse the repository at this point in the history
Application gateway fog implementation
  • Loading branch information
zeeshan-arshad-confiz authored Jun 10, 2016
2 parents 3e9872f + b100edf commit 60ff6b5
Show file tree
Hide file tree
Showing 30 changed files with 2,165 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
Gemfile.lock
.arcconfig
coverage
*/.DS_Store
456 changes: 456 additions & 0 deletions lib/fog/azurerm/models/network/application_gateway.rb

Large diffs are not rendered by default.

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
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
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
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
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
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 lib/fog/azurerm/models/network/application_gateway_probe.rb
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
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
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 lib/fog/azurerm/models/network/application_gateway_url_path_map.rb
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
27 changes: 27 additions & 0 deletions lib/fog/azurerm/models/network/application_gateways.rb
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
30 changes: 30 additions & 0 deletions lib/fog/azurerm/models/network/path_rule.rb
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
16 changes: 16 additions & 0 deletions lib/fog/azurerm/network.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ class AzureRM < Fog::Service
request :create_network_security_group
request :delete_network_security_group
request :list_network_security_groups
request :create_application_gateway
request :delete_application_gateway
request :list_application_gateways
request :create_traffic_manager_profile
request :get_traffic_manager_profile
request :delete_traffic_manager_profile
Expand All @@ -56,6 +59,19 @@ class AzureRM < Fog::Service
model :network_security_group
collection :network_security_groups
model :network_security_rule
model :application_gateway
collection :application_gateways
model :application_gateway_backend_address_pool
model :application_gateway_backend_http_setting
model :application_gateway_frontend_ip_configuration
model :application_gateway_frontend_port
model :application_gateway_ip_configuration
model :application_gateway_http_listener
model :path_rule
model :application_gateway_probe
model :application_gateway_request_routing_rule
model :application_gateway_ssl_certificate
model :application_gateway_url_path_map
model :traffic_manager_profile
collection :traffic_manager_profiles
model :traffic_manager_end_point
Expand Down
Loading

0 comments on commit 60ff6b5

Please sign in to comment.