Sha256: de136de52a7b5784db9f1d298ba59ed58125e8b8947f5060d1729b6c01bd780a

Contents?: true

Size: 812 Bytes

Versions: 42

Compression:

Stored size: 812 Bytes

Contents

require 'fog/core/model'

module Fog
  module Compute
    class OpenStack
      class SecurityGroupRule < Fog::Model
        identity :id

        attribute :from_port
        attribute :group
        attribute :ip_protocol
        attribute :to_port
        attribute :parent_group_id
        attribute :ip_range

        def save
          requires :ip_protocol, :from_port, :to_port, :parent_group_id
          cidr = ip_range && ip_range["cidr"]
          if rule = service.create_security_group_rule(parent_group_id, ip_protocol, from_port, to_port, cidr, group).data[:body]
            merge_attributes(rule["security_group_rule"])
          end
        end

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

Version data entries

42 entries across 42 versions & 5 rubygems

Version Path
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/lib/fog/openstack/models/compute/security_group_rule.rb
fog-1.32.0 lib/fog/openstack/models/compute/security_group_rule.rb
fog-1.31.0 lib/fog/openstack/models/compute/security_group_rule.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/openstack/models/compute/security_group_rule.rb
fog-1.30.0 lib/fog/openstack/models/compute/security_group_rule.rb
fog-1.29.0 lib/fog/openstack/models/compute/security_group_rule.rb
fog-1.28.0 lib/fog/openstack/models/compute/security_group_rule.rb
fog-1.27.0 lib/fog/openstack/models/compute/security_group_rule.rb
fog-1.26.0 lib/fog/openstack/models/compute/security_group_rule.rb
fog-1.25.0 lib/fog/openstack/models/compute/security_group_rule.rb
nsidc-fog-1.24.1 lib/fog/openstack/models/compute/security_group_rule.rb
fog-1.24.0 lib/fog/openstack/models/compute/security_group_rule.rb
ns-fog-1.22.11 lib/fog/openstack/models/compute/security_group_rule.rb
ns-fog-1.22.10 lib/fog/openstack/models/compute/security_group_rule.rb
ns-fog-1.22.9 lib/fog/openstack/models/compute/security_group_rule.rb
ns-fog-1.22.8 lib/fog/openstack/models/compute/security_group_rule.rb
ns-fog-1.22.7 lib/fog/openstack/models/compute/security_group_rule.rb
ns-fog-1.22.6 lib/fog/openstack/models/compute/security_group_rule.rb
fog-1.23.0 lib/fog/openstack/models/compute/security_group_rule.rb
ns-fog-1.22.4 lib/fog/openstack/models/compute/security_group_rule.rb