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
fog-maestrodev-1.18.0.20131219022322 lib/fog/openstack/models/compute/security_group_rule.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/openstack/models/compute/security_group_rule.rb