Sha256: 4327508e0612944973cf0c2a0eda5667fc4b0e1f72e9780a95554eaaec4f9ef3

Contents?: true

Size: 959 Bytes

Versions: 52

Compression:

Stored size: 959 Bytes

Contents

require 'fog/core/model'

module Fog
  module Compute
    class OpenStack

      class SecurityGroup < Fog::Model

        identity  :id

        attribute :name
        attribute :description
        attribute :rules
        attribute :tenant_id


        def save
          requires :name, :description
          data = service.create_security_group(name, description)
          merge_attributes(data.body['security_group'])
          true
        end


        def destroy
          requires :id
          service.delete_security_group(id)
          true
        end

        def create_security_group_rule(min, max, ip_protocol = "tcp", cidr = "0.0.0.0/0", group_id = nil)
          requires :id
          service.create_security_group_rule(id, ip_protocol, min, max, cidr, group_id)
        end

        def delete_security_group_rule(rule_id)
          service.delete_security_group_rule(rule_id)
          true
        end

      end
    end
  end
end

Version data entries

52 entries across 52 versions & 7 rubygems

Version Path
cifrado-0.2.1 vendor/fog/lib/fog/openstack/models/compute/security_group.rb
cifrado-0.2.0 vendor/fog/lib/fog/openstack/models/compute/security_group.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/openstack/models/compute/security_group.rb
fog-maestrodev-1.18.0.20131209090811 lib/fog/openstack/models/compute/security_group.rb
fog-maestrodev-1.18.0.20131206115947 lib/fog/openstack/models/compute/security_group.rb
fog-maestrodev-1.18.0.20131205181604 lib/fog/openstack/models/compute/security_group.rb
fog-maestrodev-1.18.0.20131127194823 lib/fog/openstack/models/compute/security_group.rb
fog-maestrodev-1.18.0.20131126183714 lib/fog/openstack/models/compute/security_group.rb
fog-maestrodev-1.18.0.20131126122111 lib/fog/openstack/models/compute/security_group.rb
fog-maestrodev-1.18.0.20131125111730 lib/fog/openstack/models/compute/security_group.rb
fog-maestrodev-1.18.0.20131125083406 lib/fog/openstack/models/compute/security_group.rb
fog-maestrodev-1.18.0.20131123105121 lib/fog/openstack/models/compute/security_group.rb
fog-maestrodev-1.18.0.20131122203507 lib/fog/openstack/models/compute/security_group.rb
fog-maestrodev-1.18.0.20131121075022 lib/fog/openstack/models/compute/security_group.rb
fog-maestrodev-1.18.0.20131118164830 lib/fog/openstack/models/compute/security_group.rb
fog-maestrodev-1.18.0.20131115184302 lib/fog/openstack/models/compute/security_group.rb
fog-maestrodev-1.18.0.20131114200144 lib/fog/openstack/models/compute/security_group.rb
gapinc-fog-1.12.1.2.1 lib/fog/openstack/models/compute/security_group.rb
fog-maestrodev-1.18.0.20131112185232 lib/fog/openstack/models/compute/security_group.rb
fog-maestrodev-1.18.0.20131111203459 lib/fog/openstack/models/compute/security_group.rb