Sha256: 10db0628224c72a27c270496cac65aa4b8cf047923f44057fd8d84d5e2924975
Contents?: true
Size: 1.46 KB
Versions: 4
Compression:
Stored size: 1.46 KB
Contents
require "fog/brightbox/model" module Fog module Compute class Brightbox class FirewallRule < Fog::Brightbox::Model identity :id attribute :url attribute :resource_type attribute :description attribute :source attribute :source_port attribute :destination attribute :destination_port attribute :protocol attribute :icmp_type_name attribute :created_at, :type => :time attribute :firewall_policy_id, :aliases => "firewall_policy", :squash => "id" # Sticking with existing Fog behaviour, save does not update but creates a new resource def save raise Fog::Errors::Error.new("Resaving an existing object may create a duplicate") if persisted? requires :firewall_policy_id options = { :firewall_policy => firewall_policy_id, :protocol => protocol, :description => description, :source => source, :source_port => source_port, :destination => destination, :destination_port => destination_port, :icmp_type_name => icmp_type_name }.delete_if { |_k, v| v.nil? || v == "" } data = service.create_firewall_rule(options) merge_attributes(data) true end def destroy requires :identity service.destroy_firewall_rule(identity) true end end end end end
Version data entries
4 entries across 4 versions & 2 rubygems