Sha256: af9acd56031d609020539b00563bcf20b8b5d5f26a41aa1bfc57721d553d6fd8

Contents?: true

Size: 709 Bytes

Versions: 2

Compression:

Stored size: 709 Bytes

Contents

require 'aws-sdk'

module AwsDump
  class SecurityGroup < Hash
    def initialize(parent, security_group)
      @parent = parent
      @security_group = security_group
      self[:name] = security_group.name
      self[:id] = security_group.id
      self[:ingress_rules] = ingress_rules.sort
      self[:egress_rules] = egress_rules.sort
    end

    def <=>(other)
      self[:name] <=> other[:name]
    end

    def ingress_rules
      @security_group.ingress_ip_permissions.collect do |ingress|
        IpPermission.new(self, ingress)
      end
    end

    def egress_rules
      @security_group.egress_ip_permissions.collect do |egress|
        IpPermission.new(self, egress)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aws_dump-0.0.2 lib/aws_dump/security_group.rb
aws_dump-0.0.1 lib/aws_dump/security_group.rb