Sha256: dca13cf237f6f364d2c2520bfac407eb8ac863deb2396d88a0b4437d4ac41ea3

Contents?: true

Size: 1.72 KB

Versions: 12

Compression:

Stored size: 1.72 KB

Contents

module Fog
  module Compute
    class Cloudstack
      class SecurityGroup < Fog::Model
        identity  :id,            :aliases => 'id'
        attribute :name,                                     :type => :string
        attribute :description,                              :type => :string
        attribute :account,                                  :type => :string
        attribute :domain_id,     :aliases => "domainid",    :type => :string
        attribute :domain_name,   :aliases => "domain",      :type => :string
        attribute :project_id,    :aliases => "projectid",   :type => :string
        attribute :project_name,  :aliases => "project",     :type => :string
        attribute :ingress_rules, :aliases => "ingressrule", :type => :array
        attribute :egress_rules,  :aliases => "egressrule",  :type => :array

        def destroy
          requires :id
          connection.delete_security_group('id' => self.id)
          true
        end

        def egress_rules
          attributes[:egress_rules] || []
        end

        def ingress_rules
          attributes[:ingress_rules] || []
        end

        def save
          requires :name

          options = {
            'name'        => self.name,
            'account'     => self.account,
            'description' => self.description,
            'projectid'   => self.project_id,
            'domainid'    => self.domain_id,
          }
          data = connection.create_security_group(options)
          merge_attributes(data['createsecuritygroupresponse']['securitygroup'])
        end

        def rules
          connection.security_group_rules.all("security_group_id" => self.id)
        end
      end # SecurityGroup
    end # Cloudstack
  end # Compute
end # Fog

Version data entries

12 entries across 12 versions & 7 rubygems

Version Path
fog-nirvanix-1.8.2 lib/fog/cloudstack/models/compute/security_group.rb
fog-nirvanix-1.8.1 lib/fog/cloudstack/models/compute/security_group.rb
fog-parser-fix-1.6.1 lib/fog/cloudstack/models/compute/security_group.rb
fog-test-again-1.6.0 lib/fog/cloudstack/models/compute/security_group.rb
fog-parser-fix-1.6.0 lib/fog/cloudstack/models/compute/security_group.rb
ey-vendored-backup-3.0.27 vendor/gems/fog/lib/fog/cloudstack/models/compute/security_group.rb
fog-sgonyea-1.8.1 lib/fog/cloudstack/models/compute/security_group.rb
fog-1.8.0 lib/fog/cloudstack/models/compute/security_group.rb
fog-maestrodev-1.7.0.20121114190951 lib/fog/cloudstack/models/compute/security_group.rb
fog-1.7.0 lib/fog/cloudstack/models/compute/security_group.rb
fog-1.6.0 lib/fog/cloudstack/models/compute/security_group.rb
fog-1.5.0 lib/fog/cloudstack/models/compute/security_group.rb