Sha256: 937093a1b167b84856bf76373e2b12439d95bfb7abced12f0cb998c8d69564f9

Contents?: true

Size: 913 Bytes

Versions: 3

Compression:

Stored size: 913 Bytes

Contents

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

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

        # get_pipeline
        response.pipelines.each do |pipeline|
          resp = @client.get_pipeline(name: pipeline.name)
          struct = OpenStruct.new(resp.pipeline.to_h)
          struct.type = 'pipeline'
          struct.arn = resp.metadata.pipeline_arn

          resources.push(struct.to_h)
        end
      end
    rescue Aws::CodePipeline::Errors::ServiceError => e
      log_error(e.code)

      unless suppressed_errors.include?(e.code) && !@options.quit_on_exception
        raise e
      end
    end

    resources
  end

  private

  # not an error
  def suppressed_errors
    %w[
      AccessDeniedException
    ]
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
aws_recon-0.2.27 lib/aws_recon/collectors/codepipeline.rb
aws_recon-0.2.26 lib/aws_recon/collectors/codepipeline.rb
aws_recon-0.2.25 lib/aws_recon/collectors/codepipeline.rb