logstash-mixin-aws 4.4.1 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +1 -1
- data/lib/logstash/plugin_mixins/aws_config.rb +0 -9
- data/logstash-mixin-aws.gemspec +1 -2
- data/spec/plugin_mixin/aws_config_spec.rb +0 -84
- metadata +2 -17
- data/lib/logstash/plugin_mixins/aws_config/v1.rb +0 -64
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5f0ffda43078e41e39ca90e34f89a212e95164a3dd40b47b98a141d4c20d4b14
|
|
4
|
+
data.tar.gz: 9d252aad0445ec9f49b78708eccf61d4caff1b0808e5a4f3fa45d634f7b4b2ad
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 45e12f518ddc54c3fa6d9775511ec3fb4f01fe86b7f311858349d5f93a7e307a555edad97b80487de7e73cd5b8ec8508a7baf3adf0a0aaba4256fa761fb322a4
|
|
7
|
+
data.tar.gz: fbf5d5b3dd042b2af41e670126b9b65c5562b0cd84d8f62e5a4bf6baef7f0e72d22f29dac7e9850cc8d6af4c95a1e2e7babea81bda31df1342b2b1e6aa37be76
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Logstash Plugin
|
|
2
2
|
|
|
3
|
-
[](https://travis-ci.com/logstash-plugins/logstash-mixin-aws)
|
|
4
4
|
|
|
5
5
|
This is a plugin for [Logstash](https://github.com/elastic/logstash).
|
|
6
6
|
|
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
require "logstash/config/mixin"
|
|
3
3
|
|
|
4
|
-
# This module provides helper for the `AWS-SDK` v1,
|
|
5
|
-
# and it will be deprecated in the near future, please use the V2 module
|
|
6
|
-
# for any new development.
|
|
7
4
|
module LogStash::PluginMixins::AwsConfig
|
|
8
|
-
require "logstash/plugin_mixins/aws_config/v1"
|
|
9
5
|
require "logstash/plugin_mixins/aws_config/v2"
|
|
10
6
|
|
|
11
7
|
US_EAST_1 = "us-east-1"
|
|
12
|
-
|
|
13
|
-
def self.included(base)
|
|
14
|
-
# Add these methods to the 'base' given.
|
|
15
|
-
base.send(:include, V1)
|
|
16
|
-
end
|
|
17
8
|
end
|
data/logstash-mixin-aws.gemspec
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = 'logstash-mixin-aws'
|
|
3
|
-
s.version = '
|
|
3
|
+
s.version = '5.0.0'
|
|
4
4
|
s.licenses = ['Apache License (2.0)']
|
|
5
5
|
s.summary = "AWS mixins to provide a unified interface for Amazon Webservice"
|
|
6
6
|
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
|
|
@@ -18,7 +18,6 @@ Gem::Specification.new do |s|
|
|
|
18
18
|
# Gem dependencies
|
|
19
19
|
s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99"
|
|
20
20
|
s.add_runtime_dependency 'logstash-codec-plain'
|
|
21
|
-
s.add_runtime_dependency 'aws-sdk-v1', '>= 1.61.0'
|
|
22
21
|
s.add_runtime_dependency 'aws-sdk', '~> 2'
|
|
23
22
|
s.add_development_dependency 'logstash-devutils'
|
|
24
23
|
s.add_development_dependency 'timecop'
|
|
@@ -16,90 +16,6 @@ class DummyInputAwsConfigV2NoRegionMethod < LogStash::Inputs::Base
|
|
|
16
16
|
include LogStash::PluginMixins::AwsConfig::V2
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
class DummyInputAwsConfigV1 < LogStash::Inputs::Base
|
|
20
|
-
include LogStash::PluginMixins::AwsConfig
|
|
21
|
-
|
|
22
|
-
def aws_service_endpoint(region)
|
|
23
|
-
{ :dummy_input_aws_config_region => "#{region}.awswebservice.local" }
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
describe LogStash::PluginMixins::AwsConfig do
|
|
28
|
-
let(:settings) { {} }
|
|
29
|
-
|
|
30
|
-
subject { DummyInputAwsConfigV1.new(settings).aws_options_hash }
|
|
31
|
-
|
|
32
|
-
describe 'config credential' do
|
|
33
|
-
|
|
34
|
-
context 'in credential file' do
|
|
35
|
-
let(:settings) { { 'aws_credentials_file' => File.join(File.dirname(__FILE__), '..', 'fixtures/aws_credentials_file_sample_test.yml') } }
|
|
36
|
-
|
|
37
|
-
it 'should support reading configuration from a yaml file' do
|
|
38
|
-
expect(subject).to include(:access_key_id => "1234", :secret_access_key => "secret")
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
context 'inline' do
|
|
43
|
-
context 'temporary credential' do
|
|
44
|
-
let(:settings) { { 'access_key_id' => '1234', 'secret_access_key' => 'secret', 'session_token' => 'session_token' } }
|
|
45
|
-
|
|
46
|
-
it "should support passing as key, value, and session_token" do
|
|
47
|
-
expect(subject[:access_key_id]).to eq(settings["access_key_id"])
|
|
48
|
-
expect(subject[:secret_access_key]).to_not eq(settings["secret_access_key"])
|
|
49
|
-
expect(subject[:secret_access_key].value).to eq(settings["secret_access_key"])
|
|
50
|
-
expect(subject[:session_token]).to_not eq(settings["session_token"])
|
|
51
|
-
expect(subject[:session_token].value).to eq(settings["session_token"])
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
context 'normal credential' do
|
|
56
|
-
let(:settings) { { 'access_key_id' => '1234', 'secret_access_key' => 'secret' } }
|
|
57
|
-
|
|
58
|
-
it 'should support passing credentials as key, value' do
|
|
59
|
-
expect(subject[:access_key_id]).to eq(settings['access_key_id'])
|
|
60
|
-
expect(subject[:secret_access_key]).to_not eq(settings['secret_access_key'])
|
|
61
|
-
expect(subject[:secret_access_key].value).to eq(settings['secret_access_key'])
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
describe 'config region' do
|
|
68
|
-
context 'region provided' do
|
|
69
|
-
let(:settings) { { 'access_key_id' => '1234', 'secret_access_key' => 'secret', 'region' => 'us-west-2' } }
|
|
70
|
-
|
|
71
|
-
it 'should use provided region to generate the endpoint configuration' do
|
|
72
|
-
expect(subject[:dummy_input_aws_config_region]).to eq("us-west-2.awswebservice.local")
|
|
73
|
-
end
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
context "region not provided" do
|
|
77
|
-
let(:settings) { { 'access_key_id' => '1234', 'secret_access_key' => 'secret'} }
|
|
78
|
-
|
|
79
|
-
it 'should use default region to generate the endpoint configuration' do
|
|
80
|
-
expect(subject[:dummy_input_aws_config_region]).to eq("us-east-1.awswebservice.local")
|
|
81
|
-
end
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
describe 'config endpoint' do
|
|
86
|
-
context "endpoint provided" do
|
|
87
|
-
let(:settings) { { 'access_key_id' => '1234', 'secret_access_key' => 'secret', 'endpoint' => 'http://localhost'} }
|
|
88
|
-
|
|
89
|
-
it 'should use specified endpoint' do
|
|
90
|
-
expect(subject[:endpoint]).to eq("http://localhost")
|
|
91
|
-
end
|
|
92
|
-
end
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
context 'when we arent providing credentials' do
|
|
96
|
-
let(:settings) { {} }
|
|
97
|
-
it 'should always return a hash' do
|
|
98
|
-
expect(subject).to eq({ :use_ssl => true, :dummy_input_aws_config_region => "us-east-1.awswebservice.local" })
|
|
99
|
-
end
|
|
100
|
-
end
|
|
101
|
-
end
|
|
102
|
-
|
|
103
19
|
describe LogStash::PluginMixins::AwsConfig::V2 do
|
|
104
20
|
let(:settings) { {} }
|
|
105
21
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: logstash-mixin-aws
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 5.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Elastic
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-04-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -44,20 +44,6 @@ dependencies:
|
|
|
44
44
|
- - ">="
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
46
|
version: '0'
|
|
47
|
-
- !ruby/object:Gem::Dependency
|
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
|
49
|
-
requirements:
|
|
50
|
-
- - ">="
|
|
51
|
-
- !ruby/object:Gem::Version
|
|
52
|
-
version: 1.61.0
|
|
53
|
-
name: aws-sdk-v1
|
|
54
|
-
prerelease: false
|
|
55
|
-
type: :runtime
|
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
-
requirements:
|
|
58
|
-
- - ">="
|
|
59
|
-
- !ruby/object:Gem::Version
|
|
60
|
-
version: 1.61.0
|
|
61
47
|
- !ruby/object:Gem::Dependency
|
|
62
48
|
requirement: !ruby/object:Gem::Requirement
|
|
63
49
|
requirements:
|
|
@@ -116,7 +102,6 @@ files:
|
|
|
116
102
|
- README.md
|
|
117
103
|
- lib/logstash/plugin_mixins/aws_config.rb
|
|
118
104
|
- lib/logstash/plugin_mixins/aws_config/generic.rb
|
|
119
|
-
- lib/logstash/plugin_mixins/aws_config/v1.rb
|
|
120
105
|
- lib/logstash/plugin_mixins/aws_config/v2.rb
|
|
121
106
|
- logstash-mixin-aws.gemspec
|
|
122
107
|
- spec/fixtures/aws_credentials_file_sample_test.yml
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
require "logstash/plugin_mixins/aws_config/generic"
|
|
3
|
-
|
|
4
|
-
module LogStash::PluginMixins::AwsConfig::V1
|
|
5
|
-
def self.included(base)
|
|
6
|
-
# Make sure we require the V1 classes when including this module.
|
|
7
|
-
# require 'aws-sdk' will load v2 classes.
|
|
8
|
-
require "aws-sdk-v1"
|
|
9
|
-
base.extend(self)
|
|
10
|
-
base.send(:include, LogStash::PluginMixins::AwsConfig::Generic)
|
|
11
|
-
base.setup_aws_config
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
public
|
|
15
|
-
def setup_aws_config
|
|
16
|
-
# Should we require (true) or disable (false) using SSL for communicating with the AWS API
|
|
17
|
-
# The AWS SDK for Ruby defaults to SSL so we preserve that
|
|
18
|
-
config :use_ssl, :validate => :boolean, :default => true
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
public
|
|
22
|
-
def aws_options_hash
|
|
23
|
-
opts = {}
|
|
24
|
-
|
|
25
|
-
if @role_arn || @role_session_name
|
|
26
|
-
@logger.warn("role_arn and role_session_name settings are not supported in the v1 plugin")
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
if @access_key_id.is_a?(NilClass) ^ @secret_access_key.is_a?(NilClass)
|
|
30
|
-
@logger.warn("Likely config error: Only one of access_key_id or secret_access_key was provided but not both.")
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
if @access_key_id && @secret_access_key
|
|
34
|
-
opts = {
|
|
35
|
-
:access_key_id => @access_key_id,
|
|
36
|
-
:secret_access_key => @secret_access_key
|
|
37
|
-
}
|
|
38
|
-
opts[:session_token] = @session_token if @session_token
|
|
39
|
-
elsif @aws_credentials_file
|
|
40
|
-
opts = YAML.load_file(@aws_credentials_file)
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
opts[:proxy_uri] = @proxy_uri if @proxy_uri
|
|
44
|
-
opts[:use_ssl] = @use_ssl
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
# The AWS SDK for Ruby doesn't know how to make an endpoint hostname from a region
|
|
48
|
-
# for example us-west-1 -> foosvc.us-west-1.amazonaws.com
|
|
49
|
-
# So our plugins need to know how to generate their endpoints from a region
|
|
50
|
-
# Furthermore, they need to know the symbol required to set that value in the AWS SDK
|
|
51
|
-
# Classes using this module must implement aws_service_endpoint(region:string)
|
|
52
|
-
# which must return a hash with one key, the aws sdk for ruby config symbol of the service
|
|
53
|
-
# endpoint, which has a string value of the service endpoint hostname
|
|
54
|
-
# for example, CloudWatch, { :cloud_watch_endpoint => "monitoring.#{region}.amazonaws.com" }
|
|
55
|
-
# For a list, see https://github.com/aws/aws-sdk-ruby/blob/master/lib/aws/core/configuration.rb
|
|
56
|
-
opts.merge!(self.aws_service_endpoint(@region))
|
|
57
|
-
|
|
58
|
-
if !@endpoint.is_a?(NilClass)
|
|
59
|
-
opts[:endpoint] = @endpoint
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
return opts
|
|
63
|
-
end # def aws_options_hash
|
|
64
|
-
end
|