mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Merge pull request #2145 from fred-secludit/cloudsigma_fwplicies
CloudSigma Firewall Policies
This commit is contained in:
commit
55488ec46e
5 changed files with 86 additions and 0 deletions
lib/fog/cloudsigma
|
@ -52,6 +52,11 @@ module Fog
|
|||
request :get_vlan
|
||||
request :update_vlan
|
||||
|
||||
model :rule
|
||||
model :fwpolicy
|
||||
collection :fwpolicies
|
||||
request :list_fwpolicies
|
||||
|
||||
model :subscription
|
||||
collection :subscriptions
|
||||
request :list_subscriptions
|
||||
|
|
21
lib/fog/cloudsigma/models/fwpolicies.rb
Normal file
21
lib/fog/cloudsigma/models/fwpolicies.rb
Normal file
|
@ -0,0 +1,21 @@
|
|||
require 'fog/core/collection'
|
||||
require 'fog/cloudsigma/models/fwpolicy'
|
||||
|
||||
module Fog
|
||||
module Compute
|
||||
class CloudSigma
|
||||
class Fwpolicies < Fog::Collection
|
||||
model Fog::Compute::CloudSigma::FWPolicy
|
||||
|
||||
def all
|
||||
resp = service.list_fwpolicies
|
||||
data = resp.body['objects']
|
||||
load(data)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
21
lib/fog/cloudsigma/models/fwpolicy.rb
Normal file
21
lib/fog/cloudsigma/models/fwpolicy.rb
Normal file
|
@ -0,0 +1,21 @@
|
|||
require 'fog/cloudsigma/nested_model'
|
||||
require 'fog/core/collection'
|
||||
require 'fog/cloudsigma/models/rule'
|
||||
|
||||
module Fog
|
||||
module Compute
|
||||
class CloudSigma
|
||||
class FWPolicy < Fog::CloudSigma::CloudsigmaModel
|
||||
identity :uuid
|
||||
attribute :name, :type => :string
|
||||
attribute :meta
|
||||
attribute :owner
|
||||
attribute :resource_uri, :type => :string
|
||||
attribute :servers, :type => :array
|
||||
model_attribute_array :rules, Rule
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
21
lib/fog/cloudsigma/models/rule.rb
Normal file
21
lib/fog/cloudsigma/models/rule.rb
Normal file
|
@ -0,0 +1,21 @@
|
|||
require 'fog/cloudsigma/nested_model'
|
||||
|
||||
module Fog
|
||||
module Compute
|
||||
class CloudSigma
|
||||
class Rule < Fog::CloudSigma::CloudsigmaModel
|
||||
attribute :action, :type => :string
|
||||
attribute :comment, :type => :string
|
||||
attribute :direction, :type => :string
|
||||
attribute :dst_ip, :type => :string
|
||||
attribute :dst_port, :type => :integer
|
||||
attribute :ip_proto, :type => :string
|
||||
attribute :src_ip, :type => :string
|
||||
attribute :src_port, :type => :string
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
18
lib/fog/cloudsigma/requests/list_fwpolicies.rb
Normal file
18
lib/fog/cloudsigma/requests/list_fwpolicies.rb
Normal file
|
@ -0,0 +1,18 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class CloudSigma
|
||||
class Real
|
||||
def list_fwpolicies
|
||||
list_request('fwpolicies/detail/')
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
def list_fwpolicies
|
||||
Fog::Mock.not_implemented
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Reference in a new issue