1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[compute|brightbox] Added requests for firewall management

This commit is contained in:
Paul Thornthwaite 2011-08-17 17:04:52 +01:00
parent ae6859ff01
commit 8bce5d165d
10 changed files with 189 additions and 0 deletions

View file

@ -32,14 +32,19 @@ module Fog
request :add_listeners_load_balancer
request :add_nodes_load_balancer
request :add_servers_server_group
request :apply_to_firewall_policy
request :create_api_client
request :create_cloud_ip
request :create_firewall_policy
request :create_firewall_rule
request :create_image
request :create_load_balancer
request :create_server
request :create_server_group
request :destroy_api_client
request :destroy_cloud_ip
request :destroy_firewall_policy
request :destroy_firewall_rule
request :destroy_image
request :destroy_load_balancer
request :destroy_server
@ -47,6 +52,8 @@ module Fog
request :get_account
request :get_api_client
request :get_cloud_ip
request :get_firewall_policy
request :get_firewall_rule
request :get_image
request :get_interface
request :get_load_balancer
@ -57,6 +64,7 @@ module Fog
request :get_zone
request :list_api_clients
request :list_cloud_ips
request :list_firewall_policies
request :list_images
request :list_load_balancers
request :list_server_groups

View file

@ -0,0 +1,14 @@
module Fog
module Compute
class Brightbox
class Real
def apply_to_firewall_policy(identifier, options)
return nil if identifier.nil? || identifier == ""
request("post", "/1.0/firewall_policies/#{identifier}/apply_to", [202], options)
end
end
end
end
end

View file

@ -0,0 +1,13 @@
module Fog
module Compute
class Brightbox
class Real
def create_firewall_policy(options)
request("post", "/1.0/firewall_policies", [201], options)
end
end
end
end
end

View file

@ -0,0 +1,13 @@
module Fog
module Compute
class Brightbox
class Real
def create_firewall_rule(options)
request("post", "/1.0/firewall_rules", [202], options)
end
end
end
end
end

View file

@ -0,0 +1,14 @@
module Fog
module Compute
class Brightbox
class Real
def destroy_firewall_policy(identifier)
return nil if identifier.nil? || identifier == ""
request("delete", "/1.0/firewall_policies/#{identifier}", [202])
end
end
end
end
end

View file

@ -0,0 +1,14 @@
module Fog
module Compute
class Brightbox
class Real
def destroy_firewall_rule(identifier)
return nil if identifier.nil? || identifier == ""
request("delete", "/1.0/firewall_rules/#{identifier}", [202])
end
end
end
end
end

View file

@ -0,0 +1,14 @@
module Fog
module Compute
class Brightbox
class Real
def get_firewall_policy(identifier)
return nil if identifier.nil? || identifier == ""
request("get", "/1.0/firewall_policies/#{identifier}", [200])
end
end
end
end
end

View file

@ -0,0 +1,14 @@
module Fog
module Compute
class Brightbox
class Real
def get_firewall_rule(identifier)
return nil if identifier.nil? || identifier == ""
request("get", "/1.0/firewall_rules/#{identifier}", [200])
end
end
end
end
end

View file

@ -0,0 +1,13 @@
module Fog
module Compute
class Brightbox
class Real
def list_firewall_policies
request("get", "/1.0/firewall_policies", [200])
end
end
end
end
end

View file

@ -79,6 +79,27 @@ class Brightbox
"reverse_dns" => String
}
FIREWALL_POLICY = {
"id" => String,
"resource_type" => String,
"url" => String,
"name" => String,
"default" => Fog::Boolean
}
FIREWALL_RULE = {
"id" => String,
"resource_type" => String,
"url" => String,
"source" => Fog::Nullable::String,
"source_port" => Fog::Nullable::String,
"destination" => Fog::Nullable::String,
"destination_port" => Fog::Nullable::String,
"protocol" => String,
"icmp_type_name" => Fog::Nullable::String,
"description" => Fog::Nullable::String
}
IMAGE = {
"name" => String,
"created_at" => String,
@ -174,6 +195,31 @@ class Brightbox
"server" => Fog::Brightbox::Nullable::Server
}
FIREWALL_POLICY = {
"id" => String,
"resource_type" => String,
"url" => String,
"name" => String,
"description" => Fog::Nullable::String,
"default" => Fog::Boolean,
"server_group" => Brightbox::Compute::Formats::Nested::SERVER_GROUP,
"rules" => [Brightbox::Compute::Formats::Nested::FIREWALL_RULE]
}
FIREWALL_RULE = {
"id" => String,
"resource_type" => String,
"url" => String,
"source" => String,
"source_port" => String,
"destination" => String,
"destination_port" => String,
"protocol" => String,
"icmp_type_name" => String,
"description" => Fog::Nullable::String,
"firewall_policy" => Brightbox::Compute::Formats::Nested::FIREWALL_POLICY
}
IMAGE = {
"name" => String,
"created_at" => String,
@ -333,6 +379,30 @@ class Brightbox
"server" => Fog::Brightbox::Nullable::Server
}
FIREWALL_POLICY = {
"id" => String,
"resource_type" => String,
"url" => String,
"name" => String,
"description" => Fog::Nullable::String,
"default" => Fog::Boolean,
"server_group" => Brightbox::Compute::Formats::Nested::SERVER_GROUP,
"rules" => [Brightbox::Compute::Formats::Nested::FIREWALL_RULE]
}
FIREWALL_RULE = {
"id" => String,
"resource_type" => String,
"url" => String,
"source" => String,
"source_port" => String,
"destination" => String,
"destination_port" => String,
"protocol" => String,
"icmp_type_name" => String,
"description" => Fog::Nullable::String
}
IMAGE = {
"name" => String,
"created_at" => String,
@ -452,6 +522,8 @@ class Brightbox
API_CLIENTS = [Brightbox::Compute::Formats::Collected::API_CLIENT]
CLOUD_IPS = [Brightbox::Compute::Formats::Collected::CLOUD_IP]
IMAGES = [Brightbox::Compute::Formats::Collected::IMAGE]
FIREWALL_POLICIES = [Brightbox::Compute::Formats::Collected::FIREWALL_POLICY]
FIREWALL_RULES = [Brightbox::Compute::Formats::Collected::FIREWALL_RULE]
LOAD_BALANCERS = [Brightbox::Compute::Formats::Collected::LOAD_BALANCER]
SERVERS = [Brightbox::Compute::Formats::Collected::SERVER]
SERVER_GROUPS = [Brightbox::Compute::Formats::Collected::SERVER_GROUP]