Sha256: 9ae69d2a363279a8a0bc96b2d92fa692423baf5b54fb0709f387d060d473ea4b

Contents?: true

Size: 1.43 KB

Versions: 16

Compression:

Stored size: 1.43 KB

Contents

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

16 entries across 14 versions & 3 rubygems

Version Path
fog-brightbox-1.0.0.rc1 lib/fog/brightbox/models/compute/firewall_rule.rb
fog-brightbox-0.16.1 lib/fog/brightbox/models/compute/firewall_rule.rb
fog-brightbox-0.16.0 lib/fog/brightbox/models/compute/firewall_rule.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-brightbox-0.15.0/lib/fog/brightbox/models/compute/firewall_rule.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-brightbox-0.15.0/lib/fog/brightbox/models/compute/firewall_rule.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-brightbox-0.15.0/lib/fog/brightbox/models/compute/firewall_rule.rb
fog-brightbox-0.15.0 lib/fog/brightbox/models/compute/firewall_rule.rb
fog-brightbox-0.14.0 lib/fog/brightbox/models/compute/firewall_rule.rb
fog-brightbox-0.13.0 lib/fog/brightbox/models/compute/firewall_rule.rb
fog-brightbox-0.12.0 lib/fog/brightbox/models/compute/firewall_rule.rb
fog-brightbox-0.11.0 lib/fog/brightbox/models/compute/firewall_rule.rb
fog-brightbox-0.10.1 lib/fog/brightbox/models/compute/firewall_rule.rb
fog-brightbox-0.10.0 lib/fog/brightbox/models/compute/firewall_rule.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-brightbox-0.9.0/lib/fog/brightbox/models/compute/firewall_rule.rb
fog-brightbox-0.9.0 lib/fog/brightbox/models/compute/firewall_rule.rb
fog-brightbox-0.8.0 lib/fog/brightbox/models/compute/firewall_rule.rb