Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move CloudWatch to v2 of AWS SDK #32

Merged
merged 3 commits into from
Jun 14, 2018
Merged

Conversation

robbavey
Copy link
Contributor

Use v2 of CloudWatch API -

enables use of more standard options from the AWS mixin
fixes #30 (includes rudimentary IT to test correct behavior with
password types)

Thanks for contributing to Logstash! If you haven't already signed our CLA, here's a handy link: https://www.elastic.co/contributor-agreement/

robbavey added 3 commits June 14, 2018 11:57
Use v2 of CloudWatch API -

  enables use of more standard options from the AWS mixin
  fixes logstash-plugins#30 (includes rudimentary IT to test correct behavior with
   password types)
Also fixes license identifier in gemspec to be valid SPDX identifier
@jakelandis
Copy link
Contributor

LGTM

Copy link

@webmat webmat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Got 2 optional suggestions.

Thread.abort_on_exception = true
end

describe '#register' do
let(:config) {
{
'access_key_id' => '1234',
'secret_access_key' => 'secret',
'secret_access_key' => LogStash::Util::Password.new('secret'),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

cls = AWS.const_get(namespace)
client_hash[namespace] = cls::Client.new(aws_options_hash)
cls = Aws.const_get(namespace)
# TODO: Move logger configuration into mixin.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgotten TODO?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a reminder for later - I'm planning on moving the logger config to the mixin (ideally in the integration plugin), so it will be the same across all AWS plugins


let(:settings) { { "access_key_id" => ENV['AWS_ACCESS_KEY_ID'],
"secret_access_key" => LogStash::Util::Password.new(ENV['AWS_SECRET_ACCESS_KEY']),
"region" => ENV["AWS_REGION"] || "us-east-1",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps raise an explicit exception with specific instructions to set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY if they're nil?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is actually valid for these values to be nil - there are a bunch of different ways that access_keys and secret_access_keys can be set in the AWS plugins. The underlying library will raise an error if none of those methods have been set.

This test is for the specific failure when the secret_access_key was set using in the configuration, which prior to this commit would cause the plugin not to work correctly.

s.version = '2.1.1'
s.licenses = ['Apache License (2.0)']
s.version = '2.2.0'
s.licenses = ['Apache-2.0']
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'm trying to fix these whenever I encounter them

@robbavey robbavey merged commit 601ad77 into logstash-plugins:master Jun 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error: no implicit conversion of LogStash::Util::Password into String
4 participants