Sha256: 5821e3e0a2948325fdde60104cca6c474336f55c11379ce4068dcde0ab04faef

Contents?: true

Size: 807 Bytes

Versions: 19

Compression:

Stored size: 807 Bytes

Contents

class GuardDuty < Mapper
  #
  # Returns an array of resources.
  #
  # TODO: test live
  #
  def collect
    resources = []

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

      response.detector_ids.each do |detector|
        log(response.context.operation_name, 'get_detector', detector)

        # get_detector
        struct = OpenStruct.new(@client.get_detector({ detector_id: detector }).to_h)
        struct.type = 'detector'
        struct.arn = "arn:aws:guardduty:#{@region}:detector/#{detector}"

        # get_master_account
        struct.master_account = @client.get_master_account({ detector_id: detector }).to_h

        resources.push(struct.to_h)
      end
    end

    resources
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
aws_recon-0.2.19 lib/aws_recon/collectors/guardduty.rb
aws_recon-0.2.18 lib/aws_recon/collectors/guardduty.rb
aws_recon-0.2.17 lib/aws_recon/collectors/guardduty.rb
aws_recon-0.2.16 lib/aws_recon/collectors/guardduty.rb
aws_recon-0.2.15 lib/aws_recon/collectors/guardduty.rb
aws_recon-0.2.14 lib/aws_recon/collectors/guardduty.rb
aws_recon-0.2.13 lib/aws_recon/collectors/guardduty.rb
aws_recon-0.2.12 lib/aws_recon/collectors/guardduty.rb
aws_recon-0.2.11 lib/aws_recon/collectors/guardduty.rb
aws_recon-0.2.10 lib/aws_recon/collectors/guardduty.rb
aws_recon-0.2.9 lib/aws_recon/collectors/guardduty.rb
aws_recon-0.2.8 lib/aws_recon/collectors/guardduty.rb
aws_recon-0.2.7 lib/aws_recon/collectors/guardduty.rb
aws_recon-0.2.6 lib/aws_recon/collectors/guardduty.rb
aws_recon-0.2.5 lib/aws_recon/collectors/guardduty.rb
aws_recon-0.2.4 lib/aws_recon/collectors/guardduty.rb
aws_recon-0.2.3 lib/aws_recon/collectors/guardduty.rb
aws_recon-0.2.2 lib/aws_recon/collectors/guardduty.rb
aws_recon-0.2.1 lib/aws_recon/collectors/guardduty.rb