logstash-input-sqs 3.2.0 → 3.3.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 158aeb4fe9c539fec6aa37fc449f7264b3acf332ab5f293ec9477799db8674d8
4
- data.tar.gz: d74f739c840c20613f2d3ed76a7fb2dd6984febf1a48bbbe081b24c89b72449c
3
+ metadata.gz: 79ba2db92a818593ac16a65b8e874542ea5049544ad7a4184be3702d139db455
4
+ data.tar.gz: e57d59a19505bf9ee25f285005f52480b6c798001a43325081e9d6524cc7d720
5
5
  SHA512:
6
- metadata.gz: 9e1138ef62e78b84569a7175542e943cb0cc8a8caed401a3495f95c48b627be4461fc9c252ddb0032d50fa42f4789dfbbf210508d8a08e80d2baf09ba5175dff
7
- data.tar.gz: 3aacc4f45c68b0226d2e863b25be47544c50e5f24346c066ec728fd3c245405af379f413bd896c80ed65e4e07b7807ae374f0e0fe5cb3dac736ce36a2ae17c12
6
+ metadata.gz: df78305299bc96a29f092d3ad70480637d30698d8b0364dddcfbb937d298ca9b5884620f321e54c3ce9930942beaca9871abd9f0953ac08961723e57b770f499
7
+ data.tar.gz: 8a5b86e165300c5213786ea80b4a80474ae02e38a5dbc17848f69fd28d5d1bdf38449330d4de76eb96d8f60960b8e56e27bc28e056ed7177696d8c4692fa088c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 3.3.2
2
+ - Fix an issue that prevented timely shutdown when subscribed to an inactive queue
3
+
4
+ ## 3.3.1
5
+ - Refactoring: used logstash-mixin-aws to leverage shared code to manage `additional_settings` [#64](https://github.com/logstash-plugins/logstash-input-sqs/pull/64)
6
+
7
+ ## 3.3.0
8
+ - Feature: Add `additional_settings` option to fine-grain configuration of AWS client [#61](https://github.com/logstash-plugins/logstash-input-sqs/pull/61)
9
+
1
10
  ## 3.2.0
2
11
  - Feature: Add `queue_owner_aws_account_id` parameter for cross-account queues [#60](https://github.com/logstash-plugins/logstash-input-sqs/pull/60)
3
12
 
data/docs/index.asciidoc CHANGED
@@ -85,6 +85,7 @@ This plugin supports the following configuration options plus the <<plugins-{typ
85
85
  |=======================================================================
86
86
  |Setting |Input type|Required
87
87
  | <<plugins-{type}s-{plugin}-access_key_id>> |<<string,string>>|No
88
+ | <<plugins-{type}s-{plugin}-additional_settings>> |<<hash,hash>>|No
88
89
  | <<plugins-{type}s-{plugin}-aws_credentials_file>> |<<string,string>>|No
89
90
  | <<plugins-{type}s-{plugin}-endpoint>> |<<string,string>>|No
90
91
  | <<plugins-{type}s-{plugin}-id_field>> |<<string,string>>|No
@@ -121,6 +122,28 @@ This plugin uses the AWS SDK and supports several ways to get credentials, which
121
122
  4. Environment variables `AMAZON_ACCESS_KEY_ID` and `AMAZON_SECRET_ACCESS_KEY`
122
123
  5. IAM Instance Profile (available when running inside EC2)
123
124
 
125
+ [id="plugins-{type}s-{plugin}-additional_settings"]
126
+ ===== `additional_settings`
127
+
128
+ * Value type is <<hash,hash>>
129
+ * Default value is `{}`
130
+
131
+ Key-value pairs of settings and corresponding values used to parametrize
132
+ the connection to SQS. See full list in https://docs.aws.amazon.com/sdk-for-ruby/v2/api/Aws/SQS/Client.html[the AWS SDK documentation]. Example:
133
+
134
+ [source,ruby]
135
+ input {
136
+ sqs {
137
+ access_key_id => "1234"
138
+ secret_access_key => "secret"
139
+ queue => "logstash-test-queue"
140
+ additional_settings => {
141
+ force_path_style => true
142
+ follow_redirects => false
143
+ }
144
+ }
145
+ }
146
+
124
147
  [id="plugins-{type}s-{plugin}-aws_credentials_file"]
125
148
  ===== `aws_credentials_file`
126
149
 
@@ -80,6 +80,8 @@ class LogStash::Inputs::SQS < LogStash::Inputs::Threadable
80
80
 
81
81
  default :codec, "json"
82
82
 
83
+ config :additional_settings, :validate => :hash, :default => {}
84
+
83
85
  # Name of the SQS Queue name to pull messages from. Note that this is just the name of the queue, not the URL or ARN.
84
86
  config :queue, :validate => :string, :required => true
85
87
 
@@ -116,8 +118,11 @@ class LogStash::Inputs::SQS < LogStash::Inputs::Threadable
116
118
  end
117
119
 
118
120
  def setup_queue
119
- aws_sqs_client = Aws::SQS::Client.new(aws_options_hash)
120
- @poller = Aws::SQS::QueuePoller.new(queue_url(aws_sqs_client), :client => aws_sqs_client)
121
+ aws_sqs_client = Aws::SQS::Client.new(aws_options_hash || {})
122
+ poller = Aws::SQS::QueuePoller.new(queue_url(aws_sqs_client), :client => aws_sqs_client)
123
+ poller.before_request { |stats| throw :stop_polling if stop? }
124
+
125
+ @poller = poller
121
126
  rescue Aws::SQS::Errors::ServiceError, Seahorse::Client::NetworkingError => e
122
127
  @logger.error("Cannot establish connection to Amazon SQS", exception_details(e))
123
128
  raise LogStash::ConfigurationError, "Verify the SQS queue name and your credentials"
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-input-sqs'
3
- s.version = '3.2.0'
4
- s.licenses = ['Apache License (2.0)']
3
+ s.version = '3.3.2'
4
+ s.licenses = ['Apache-2.0']
5
5
  s.summary = "Pulls events from an Amazon Web Services Simple Queue Service queue"
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"
7
7
  s.authors = ["Elastic"]
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
22
22
  s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99"
23
23
 
24
24
  s.add_runtime_dependency 'logstash-codec-json'
25
- s.add_runtime_dependency 'logstash-mixin-aws', '>= 4.3.0'
25
+ s.add_runtime_dependency 'logstash-mixin-aws', '>= 5.1.0'
26
26
 
27
27
  s.add_development_dependency 'logstash-devutils'
28
28
  s.add_development_dependency "logstash-codec-json_lines"
@@ -67,6 +67,41 @@ describe LogStash::Inputs::SQS do
67
67
  end
68
68
  end
69
69
 
70
+ describe "additional_settings" do
71
+ context "supported settings" do
72
+ let(:config) {
73
+ {
74
+ "additional_settings" => { "force_path_style" => 'true', "ssl_verify_peer" => 'false', "profile" => 'logstash' },
75
+ "queue" => queue_name
76
+ }
77
+ }
78
+
79
+ it 'should instantiate Aws::SQS clients with force_path_style set' do
80
+ expect(Aws::SQS::Client).to receive(:new).and_return(mock_sqs)
81
+ # mock a remote call to retrieve the queue URL
82
+ expect(mock_sqs).to receive(:get_queue_url).with({ :queue_name => queue_name }).and_return({:queue_url => queue_url })
83
+
84
+ expect(subject.aws_options_hash).to include({:force_path_style => true, :ssl_verify_peer => false, :profile => 'logstash'})
85
+
86
+ expect { subject.register }.not_to raise_error
87
+ end
88
+ end
89
+
90
+ context "unsupported settings" do
91
+ let(:config) {
92
+ {
93
+ "additional_settings" => { "stub_responses" => 'true', "invalid_option" => "invalid" },
94
+ "queue" => queue_name
95
+ }
96
+ }
97
+
98
+ it 'must fail with ArgumentError' do
99
+ expect {subject.register}.to raise_error(ArgumentError, /invalid_option/)
100
+ end
101
+ end
102
+
103
+ end
104
+
70
105
  context "when interrupting the plugin" do
71
106
  before do
72
107
  expect(Aws::SQS::Client).to receive(:new).and_return(mock_sqs)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-sqs
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-29 00:00:00.000000000 Z
11
+ date: 2022-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -49,7 +49,7 @@ dependencies:
49
49
  requirements:
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
- version: 4.3.0
52
+ version: 5.1.0
53
53
  name: logstash-mixin-aws
54
54
  prerelease: false
55
55
  type: :runtime
@@ -57,7 +57,7 @@ dependencies:
57
57
  requirements:
58
58
  - - ">="
59
59
  - !ruby/object:Gem::Version
60
- version: 4.3.0
60
+ version: 5.1.0
61
61
  - !ruby/object:Gem::Dependency
62
62
  requirement: !ruby/object:Gem::Requirement
63
63
  requirements:
@@ -110,7 +110,7 @@ files:
110
110
  - spec/support/helpers.rb
111
111
  homepage: http://www.elastic.co/guide/en/logstash/current/index.html
112
112
  licenses:
113
- - Apache License (2.0)
113
+ - Apache-2.0
114
114
  metadata:
115
115
  logstash_plugin: 'true'
116
116
  logstash_group: input