Sha256: 17e1e1cb8ed4239835fa34e59d00db00e0dd10d104e23a503df8870b42e30f5e

Contents?: true

Size: 1.04 KB

Versions: 5

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

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

    #
    # get_block_public_access_configuration
    #
    @client.get_block_public_access_configuration.each do |response|
      log(response.context.operation_name)

      struct = OpenStruct.new(response.block_public_access_configuration.to_h)
      struct.type = 'configuration'
      struct.arn = "arn:aws:emr:#{@region}:#{@account}/block_public_access_configuration"

      resources.push(struct.to_h)
    end

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

      response.clusters.each do |cluster|
        log(response.context.operation_name, cluster.id)

        struct = OpenStruct.new(@client.describe_cluster({ cluster_id: cluster.id }).cluster.to_h)
        struct.type = 'cluster'
        struct.arn = cluster.cluster_arn

        resources.push(struct.to_h)
      end
    end

    resources
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
aws_recon-0.3.3 lib/aws_recon/collectors/emr.rb
aws_recon-0.3.2 lib/aws_recon/collectors/emr.rb
aws_recon-0.3.1 lib/aws_recon/collectors/emr.rb
aws_recon-0.3.0 lib/aws_recon/collectors/emr.rb
aws_recon-0.2.36 lib/aws_recon/collectors/emr.rb