Sha256: d6bb6e5d4d514ae9fdd37efff6ac1ad34b7a1cd9576b884da43739a8f2152664

Contents?: true

Size: 1.6 KB

Versions: 16

Compression:

Stored size: 1.6 KB

Contents

module Fog
  module Compute
    class Brightbox
      class FirewallPolicy < Fog::Brightbox::Model
        identity :id
        attribute :url
        attribute :resource_type

        attribute :name
        attribute :description

        attribute :default

        attribute :server_group_id, :aliases => "server_group", :squash => "id"
        attribute :created_at, :type => :time
        attribute :rules

        # 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?
          options = {
            :server_group => server_group_id,
            :name => name,
            :description => description
          }.delete_if { |_k, v| v.nil? || v == "" }
          data = service.create_firewall_policy(options)
          merge_attributes(data)
          true
        end

        def apply_to(server_group_id)
          requires :identity
          options = {
            :server_group => server_group_id
          }
          data = service.apply_to_firewall_policy(identity, options)
          merge_attributes(data)
          true
        end

        def remove(server_group_id)
          requires :identity
          options = {
            :server_group => server_group_id
          }
          data = service.remove_firewall_policy(identity, options)
          merge_attributes(data)
          true
        end

        def destroy
          requires :identity
          service.destroy_firewall_policy(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_policy.rb
fog-brightbox-0.16.1 lib/fog/brightbox/models/compute/firewall_policy.rb
fog-brightbox-0.16.0 lib/fog/brightbox/models/compute/firewall_policy.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-brightbox-0.15.0/lib/fog/brightbox/models/compute/firewall_policy.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-brightbox-0.15.0/lib/fog/brightbox/models/compute/firewall_policy.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-brightbox-0.15.0/lib/fog/brightbox/models/compute/firewall_policy.rb
fog-brightbox-0.15.0 lib/fog/brightbox/models/compute/firewall_policy.rb
fog-brightbox-0.14.0 lib/fog/brightbox/models/compute/firewall_policy.rb
fog-brightbox-0.13.0 lib/fog/brightbox/models/compute/firewall_policy.rb
fog-brightbox-0.12.0 lib/fog/brightbox/models/compute/firewall_policy.rb
fog-brightbox-0.11.0 lib/fog/brightbox/models/compute/firewall_policy.rb
fog-brightbox-0.10.1 lib/fog/brightbox/models/compute/firewall_policy.rb
fog-brightbox-0.10.0 lib/fog/brightbox/models/compute/firewall_policy.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-brightbox-0.9.0/lib/fog/brightbox/models/compute/firewall_policy.rb
fog-brightbox-0.9.0 lib/fog/brightbox/models/compute/firewall_policy.rb
fog-brightbox-0.8.0 lib/fog/brightbox/models/compute/firewall_policy.rb