From 64891ff35c060e1c1485c88f30a433106734f0af Mon Sep 17 00:00:00 2001 From: Vladislav Syabruk Date: Tue, 3 Oct 2017 21:28:52 +0300 Subject: [PATCH 1/2] Require specific AWS gems for every class --- README.md | 8 ++++++++ lib/logstash-logger/device/aws_stream.rb | 6 +++++- lib/logstash-logger/device/firehose.rb | 7 ++++++- lib/logstash-logger/device/kinesis.rb | 7 ++++++- 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 29a5709..7030209 100644 --- a/README.md +++ b/README.md @@ -568,6 +568,10 @@ config.logstash.backoff = 1 Add the aws-sdk gem to your Gemfile: + # aws-sdk < 3.0 + gem 'aws-sdk-kinesis' + + # aws-sdk >= 3.0 gem 'aws-sdk' ```ruby @@ -592,6 +596,10 @@ config.logstash.aws_secret_access_key = 'ASKASKHLD1234123412341234' Add the aws-sdk gem to your Gemfile: + # aws-sdk < 3.0 + gem 'aws-sdk-firehose' + + # aws-sdk >= 3.0 gem 'aws-sdk' ```ruby diff --git a/lib/logstash-logger/device/aws_stream.rb b/lib/logstash-logger/device/aws_stream.rb index 767e458..e9a4889 100644 --- a/lib/logstash-logger/device/aws_stream.rb +++ b/lib/logstash-logger/device/aws_stream.rb @@ -1,4 +1,8 @@ -require 'aws-sdk' +begin + require 'aws-sdk-core' +rescue LoadError + require 'aws-sdk' +end module LogStashLogger module Device diff --git a/lib/logstash-logger/device/firehose.rb b/lib/logstash-logger/device/firehose.rb index 9df32a1..eb2c071 100644 --- a/lib/logstash-logger/device/firehose.rb +++ b/lib/logstash-logger/device/firehose.rb @@ -1,4 +1,9 @@ -require 'aws-sdk' +begin + require 'aws-sdk-firehose' +rescue LoadError + require 'aws-sdk' +end + require 'logstash-logger/device/aws_stream' module LogStashLogger diff --git a/lib/logstash-logger/device/kinesis.rb b/lib/logstash-logger/device/kinesis.rb index 29b353a..97619f5 100644 --- a/lib/logstash-logger/device/kinesis.rb +++ b/lib/logstash-logger/device/kinesis.rb @@ -1,4 +1,9 @@ -require 'aws-sdk' +begin + require 'aws-sdk-kinesis' +rescue LoadError + require 'aws-sdk' +end + require 'logstash-logger/device/aws_stream' module LogStashLogger From e47f253864a4ecabe362ace8330217ea6cdc822d Mon Sep 17 00:00:00 2001 From: Vladislav Syabruk Date: Wed, 4 Oct 2017 16:30:41 +0300 Subject: [PATCH 2/2] Fix typo in specs --- spec/device/firehose_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/device/firehose_spec.rb b/spec/device/firehose_spec.rb index 6d7a8e2..bef1e89 100644 --- a/spec/device/firehose_spec.rb +++ b/spec/device/firehose_spec.rb @@ -1,6 +1,6 @@ require 'logstash-logger' -describe LogStashLogger::Device::Kinesis do +describe LogStashLogger::Device::Firehose do include_context 'device' let(:client) { double("Aws::Firehose::Client") }