mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[stormondemand|compute] Add Firewall APIs
This commit is contained in:
parent
128f819896
commit
186c8f4c43
7 changed files with 123 additions and 0 deletions
|
@ -24,6 +24,8 @@ module Fog
|
||||||
collection :network_ips
|
collection :network_ips
|
||||||
model :private_ip
|
model :private_ip
|
||||||
collection :private_ips
|
collection :private_ips
|
||||||
|
model :firewall
|
||||||
|
collection :firewalls
|
||||||
model :stat
|
model :stat
|
||||||
collection :stats
|
collection :stats
|
||||||
model :template
|
model :template
|
||||||
|
@ -87,6 +89,11 @@ module Fog
|
||||||
request :remove_ip_from_server
|
request :remove_ip_from_server
|
||||||
request :request_new_ips
|
request :request_new_ips
|
||||||
|
|
||||||
|
request :get_firewall
|
||||||
|
request :get_firewall_basic_options
|
||||||
|
request :get_firewall_rules
|
||||||
|
request :update_firewall
|
||||||
|
|
||||||
class Mock
|
class Mock
|
||||||
|
|
||||||
def self.data
|
def self.data
|
||||||
|
|
20
lib/fog/storm_on_demand/models/compute/firewall.rb
Normal file
20
lib/fog/storm_on_demand/models/compute/firewall.rb
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
require 'fog/core/model'
|
||||||
|
|
||||||
|
module Fog
|
||||||
|
module Compute
|
||||||
|
class StormOnDemand
|
||||||
|
|
||||||
|
class Firewall < Fog::Model
|
||||||
|
attribute :allow
|
||||||
|
attribute :rules
|
||||||
|
attribute :ruleset
|
||||||
|
attribute :type
|
||||||
|
|
||||||
|
def initialize(attributes={})
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
32
lib/fog/storm_on_demand/models/compute/firewalls.rb
Normal file
32
lib/fog/storm_on_demand/models/compute/firewalls.rb
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
require 'fog/core/collections'
|
||||||
|
require 'fog/storm_on_demand/models/compute/firewall'
|
||||||
|
|
||||||
|
module Fog
|
||||||
|
module Compute
|
||||||
|
class StormOnDemand
|
||||||
|
class Firewalls < Fog::Collection
|
||||||
|
model Fog::Compute::StormOnDemand::Firewall
|
||||||
|
|
||||||
|
def get(server_id)
|
||||||
|
data = service.get_firewall(:uniq_id => server_id).body
|
||||||
|
new(data)
|
||||||
|
end
|
||||||
|
|
||||||
|
def basic_options(server_id)
|
||||||
|
res = service.get_firewall_basic_options(:uniq_id => server_id).body
|
||||||
|
res[:options]
|
||||||
|
end
|
||||||
|
|
||||||
|
def rules(server_id)
|
||||||
|
service.get_firewall_rules(:uniq_id => server_id).body[:rules]
|
||||||
|
end
|
||||||
|
|
||||||
|
def update(options)
|
||||||
|
service.update_firewall(options)
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
16
lib/fog/storm_on_demand/requests/compute/get_firewall.rb
Normal file
16
lib/fog/storm_on_demand/requests/compute/get_firewall.rb
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
module Fog
|
||||||
|
module Compute
|
||||||
|
class StormOnDemand
|
||||||
|
class Real
|
||||||
|
|
||||||
|
def get_firewall(options={})
|
||||||
|
request(
|
||||||
|
:path => '/Network/Firewall/details',
|
||||||
|
:body => Fog::JSON.encode(:params => options)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,16 @@
|
||||||
|
module Fog
|
||||||
|
module Compute
|
||||||
|
class StormOnDemand
|
||||||
|
class Real
|
||||||
|
|
||||||
|
def get_firewall_basic_options(options={})
|
||||||
|
request(
|
||||||
|
:path => '/Network/Firewall/getBasicOptions',
|
||||||
|
:body => Fog::JSON.encode(:params => options)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,16 @@
|
||||||
|
module Fog
|
||||||
|
module Compute
|
||||||
|
class StormOnDemand
|
||||||
|
class Real
|
||||||
|
|
||||||
|
def get_firewall_rules(options={})
|
||||||
|
request(
|
||||||
|
:path => '/Network/Firewall/rules',
|
||||||
|
:body => Fog::JSON.encode(:params => options)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
16
lib/fog/storm_on_demand/requests/compute/update_firewall.rb
Normal file
16
lib/fog/storm_on_demand/requests/compute/update_firewall.rb
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
module Fog
|
||||||
|
module Compute
|
||||||
|
class StormOnDemand
|
||||||
|
class Real
|
||||||
|
|
||||||
|
def update_firewalls(options={})
|
||||||
|
request(
|
||||||
|
:path => '/Network/Firewall/update',
|
||||||
|
:body => Fog::JSON.encode(:params => options)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Reference in a new issue