Sha256: c24d379f31dd7720b3a568c0a6389c43e757555e5ca445015562252e12adc352

Contents?: true

Size: 869 Bytes

Versions: 56

Compression:

Stored size: 869 Bytes

Contents

# frozen_string_literal: true

#
# Collect Lightsail resources
#
class Lightsail < Mapper
  #
  # Returns an array of resources.
  #
  def collect
    resources = []

    #
    # get_instances
    #
    @client.get_instances.each_with_index do |response, page|
      log(response.context.operation_name, page)

      response.instances.each do |instance|
        struct = OpenStruct.new(instance.to_h)
        struct.type = 'instance'

        resources.push(struct.to_h)
      end
    end

    #
    # get_load_balancers
    #
    @client.get_load_balancers.each_with_index do |response, page|
      log(response.context.operation_name, page)

      response.load_balancers.each do |load_balancer|
        struct = OpenStruct.new(load_balancer.to_h)
        struct.type = 'load_balancer'

        resources.push(struct.to_h)
      end
    end

    resources
  end
end

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
aws_recon-0.5.33 lib/aws_recon/collectors/lightsail.rb
aws_recon-0.5.32 lib/aws_recon/collectors/lightsail.rb
aws_recon-0.5.31 lib/aws_recon/collectors/lightsail.rb
aws_recon-0.5.30 lib/aws_recon/collectors/lightsail.rb
aws_recon-0.5.29 lib/aws_recon/collectors/lightsail.rb
aws_recon-0.5.28 lib/aws_recon/collectors/lightsail.rb
aws_recon-0.5.27 lib/aws_recon/collectors/lightsail.rb
aws_recon-0.5.26 lib/aws_recon/collectors/lightsail.rb
aws_recon-0.5.25 lib/aws_recon/collectors/lightsail.rb
aws_recon-0.5.24 lib/aws_recon/collectors/lightsail.rb
aws_recon-0.5.23 lib/aws_recon/collectors/lightsail.rb
aws_recon-0.5.22 lib/aws_recon/collectors/lightsail.rb
aws_recon-0.5.21 lib/aws_recon/collectors/lightsail.rb
aws_recon-0.5.20 lib/aws_recon/collectors/lightsail.rb
aws_recon-0.5.19 lib/aws_recon/collectors/lightsail.rb
aws_recon-0.5.18 lib/aws_recon/collectors/lightsail.rb
aws_recon-0.5.17 lib/aws_recon/collectors/lightsail.rb
aws_recon-0.5.16 lib/aws_recon/collectors/lightsail.rb
aws_recon-0.5.15 lib/aws_recon/collectors/lightsail.rb
aws_recon-0.5.14 lib/aws_recon/collectors/lightsail.rb