Sha256: 07f4969c279dbdf9bea02ac19d721b0d6cc24f7ff91f0e928bebd5bd63ec440e

Contents?: true

Size: 1.64 KB

Versions: 32

Compression:

Stored size: 1.64 KB

Contents

require 'fog/core/model'

module Fog
  module Compute
    class Brightbox

      class FirewallPolicy < Fog::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 identity
          options = {
            :server_group => server_group_id,
            :name => name,
            :description => description
          }.delete_if {|k,v| v.nil? || v == "" }
          data = connection.create_firewall_policy(options)
          merge_attributes(data)
          true
        end

        def apply_to(server_group_id)
          requires :identity
          options = {
            :server_group => server_group_id
          }
          data = connection.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 = connection.remove_firewall_policy(identity, options)
          merge_attributes(data)
          true
        end

        def destroy
          requires :identity
          data = connection.destroy_firewall_policy(identity)
          true
        end

      end

    end
  end
end

Version data entries

32 entries across 32 versions & 12 rubygems

Version Path
fog-nirvanix-1.8.2 lib/fog/brightbox/models/compute/firewall_policy.rb
fog-nirvanix-1.8.1 lib/fog/brightbox/models/compute/firewall_policy.rb
fog-parser-fix-1.6.1 lib/fog/brightbox/models/compute/firewall_policy.rb
fog-test-again-1.6.0 lib/fog/brightbox/models/compute/firewall_policy.rb
fog-parser-fix-1.6.0 lib/fog/brightbox/models/compute/firewall_policy.rb
ey-vendored-backup-3.0.27 vendor/gems/fog/lib/fog/brightbox/models/compute/firewall_policy.rb
fog-sgonyea-1.8.1 lib/fog/brightbox/models/compute/firewall_policy.rb
fog-1.8.0 lib/fog/brightbox/models/compute/firewall_policy.rb
fog-maestrodev-1.7.0.20121114190951 lib/fog/brightbox/models/compute/firewall_policy.rb
fog-1.7.0 lib/fog/brightbox/models/compute/firewall_policy.rb
fog-1.6.0 lib/fog/brightbox/models/compute/firewall_policy.rb
fog-1.5.0 lib/fog/brightbox/models/compute/firewall_policy.rb
fog-1.4.0 lib/fog/brightbox/models/compute/firewall_policy.rb
brightbox-cli-0.18.1 lib/brightbox-cli/vendor/fog/lib/fog/brightbox/models/compute/firewall_policy.rb
michiels-fog-1.3.1 lib/fog/brightbox/models/compute/firewall_policy.rb
ftl-0.2.0 vendor/bundle/gems/fog-1.3.1/lib/fog/brightbox/models/compute/firewall_policy.rb
brightbox-cli-0.18.0 lib/brightbox-cli/vendor/fog/lib/fog/brightbox/models/compute/firewall_policy.rb
fog-1.3.1 lib/fog/brightbox/models/compute/firewall_policy.rb
fog-1.3.0 lib/fog/brightbox/models/compute/firewall_policy.rb
brightbox-cli-0.17.5 lib/brightbox-cli/vendor/fog/lib/fog/brightbox/models/compute/firewall_policy.rb