Sha256: 731050ab8221a122d5ff4e120ada2b677732451efe0c35a9e34c967a38b6eb83

Contents?: true

Size: 1.29 KB

Versions: 4

Compression:

Stored size: 1.29 KB

Contents

module Outliers
  module Resources
    module Aws
      module Ec2
        class Instance < Resource
          def self.key
            'instance_id'
          end

          def classic?
            !vpc?
          end

          def running?
            logger.debug "Verifying '#{status}' equals 'running'."
            status == :running
          end

          def source_dest_check?
            unless vpc?
              logger.debug "Instance must be in a VPC to validate source_dest_check. Returning false."
              return false
            end
            source_dest_check == true
          end

          def valid_image_id?(args)
            image_ids = Array(args[:image_ids])

            logger.debug "Verifying Image ID '#{image_id}' is one of '#{image_ids.join(', ')}'."
            image_ids.include? image_id
          end

          def vpc?
            !source.vpc_id.nil?
          end

          private

          def tags
            @tags ||= source.tags
          end

          def image_id
            @image_id ||= source.image_id
          end

          def instance_type
            @instance_type ||= source.instance_type
          end

          def source_dest_check
            @source_dest_check ||= source.source_dest_check
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
outliers-0.3.3 lib/outliers/resources/aws/ec2/instance.rb
outliers-0.3.2 lib/outliers/resources/aws/ec2/instance.rb
outliers-0.3.1 lib/outliers/resources/aws/ec2/instance.rb
outliers-0.3.0 lib/outliers/resources/aws/ec2/instance.rb