Sha256: dffd721cc36029ae19cd861bb7eccaa8febb989cf74cd117675cf16bb981f83c

Contents?: true

Size: 1011 Bytes

Versions: 28

Compression:

Stored size: 1011 Bytes

Contents

def fetch_events(settings)
  queue = []
  s3 = LogStash::Inputs::S3.new(settings)
  s3.register
  s3.process_files(queue)
  queue
end

# delete_files(prefix)
def upload_file(local_file, remote_name)
  bucket = s3object.bucket(ENV['AWS_LOGSTASH_TEST_BUCKET'])
  file = File.expand_path(File.join(File.dirname(__FILE__), local_file))
  bucket.object(remote_name).upload_file(file)
end

def delete_remote_files(prefix)
  bucket = s3object.bucket(ENV['AWS_LOGSTASH_TEST_BUCKET'])
  bucket.objects(:prefix => prefix).each { |object| object.delete }
end

def list_remote_files(prefix, target_bucket = ENV['AWS_LOGSTASH_TEST_BUCKET'])
  bucket = s3object.bucket(target_bucket)
  bucket.objects(:prefix => prefix).collect(&:key)
end

def delete_bucket(name)
  s3object.bucket(name).objects.map(&:delete)
  s3object.bucket(name).delete
end

def s3object
  Aws::S3::Resource.new
end

class TestInfiniteS3Object
  def each
    counter = 1

    loop do
      yield "awesome-#{counter}"
      counter +=1
    end
  end
end

Version data entries

28 entries across 28 versions & 6 rubygems

Version Path
logstash-input-s3-sdk-3-4.0.0 spec/support/helpers.rb
logstash-input-s3-test-4.0.0 spec/support/helpers.rb
logstash-input-s3-3.5.0 spec/support/helpers.rb
logstash-input-s3-3.4.1 spec/support/helpers.rb
logstash-input-s3-3.4.0 spec/support/helpers.rb
logstash-input-s3-3.3.7 spec/support/helpers.rb
logstash-input-s3-3.3.6 spec/support/helpers.rb
logstash-input-s3-local-3.3.5 spec/support/helpers.rb
logstash-input-s3-3.3.5 spec/support/helpers.rb
logstash-input-s3-3.3.4 spec/support/helpers.rb
logstash-input-s3-3.3.3 spec/support/helpers.rb
logstash-input-s3-3.3.2 spec/support/helpers.rb
logstash-input-s3-3.3.1 spec/support/helpers.rb
logstash-input-s3-3.3.0 spec/support/helpers.rb
logstash-input-s3-3.2.0 spec/support/helpers.rb
logstash-input-s3-3.1.9 spec/support/helpers.rb
logstash-input-s3-3.1.8 spec/support/helpers.rb
logstash-input-s3-3.1.7 spec/support/helpers.rb
logstash-input-s3-3.1.6 spec/support/helpers.rb
logstash-input-s3-3.1.5 spec/support/helpers.rb