Class: LogStash::Inputs::CloudStorage::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/logstash/inputs/cloud_storage/client.rb

Overview

Client provides all the required transport and authentication setup for the plugin.

Instance Method Summary collapse

Constructor Details

#initialize(bucket, json_key_path, logger) ⇒ Client

Returns a new instance of Client.



13
14
15
16
17
18
19
# File 'lib/logstash/inputs/cloud_storage/client.rb', line 13

def initialize(bucket, json_key_path, logger)
  @logger = logger
  @bucket = bucket

  # create client
  @storage = initialize_storage json_key_path
end

Instance Method Details

#list_blobsObject



21
22
23
24
25
26
27
# File 'lib/logstash/inputs/cloud_storage/client.rb', line 21

def list_blobs
  @storage.list(@bucket).iterateAll().each do |blobname|
    yield LogStash::Inputs::CloudStorage::BlobAdapter.new(blobname)
  end
rescue Java::ComGoogleCloudStorage::StorageException => e
  raise "Error listing bucket contents: #{e}"
end