logstash-output-kinesis-iot 0.1.10-java → 0.1.13-java

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: d218142d94d3ecb765e37d578dd6f7099b232c8e04f3d342c8150f1cc09c85ec
4
- data.tar.gz: 43fbc7f3e6e68c6f6f54d085ffd40dfaca91f0663c76fd3c43ac8362d0b187da
3
+ metadata.gz: 2aefc1330b417c621491795797fc727f8e256b0798f0e691697fee98edbf0e73
4
+ data.tar.gz: f20a83ff2d06521eb365c114db765b93467fbcfef0b3e1da3ea0293b8c52d1af
5
5
  SHA512:
6
- metadata.gz: 9a6f3d5db60492b7f404413ef0fd5b3acdcc2b67e8da5a23143840da022f66c9c7e8dd2ba6d78bf1e1c94b3abb47070ee07245caf11d38d5c7337c9cf2ff5f0f
7
- data.tar.gz: 7569522e712b73b45fcadd0981a62f2c1b053f2b2462e05218556db25fbc884daa5b86460c69bf59f5b69024a184239683dc3bc668f1bebbbcc906fde3529260
6
+ metadata.gz: 73e4e56e2cc8c4ce0c24302361d3812e7ce3204fbdd555329d553cff1cc04aa87d93d88ca8b54592f9f6409a3571e8b8038a1160ceaaf2a359be76217cff3565
7
+ data.tar.gz: 5c0a085a2dde0149294197251393837be20810b293892620eec12451822fd12b50fea5da10db23f77c5f1fdeec2c5e64e2e6d81bbdfd3e13b70a7308d440b15e
@@ -90,26 +90,21 @@ class LogStash::Outputs::KinesisIOT < LogStash::Outputs::Base
90
90
 
91
91
  response = http.request(request)
92
92
  result = JSON.parse(response.body)["credentials"]
93
+ @logger.info("Credentials expire at " +Time.parse(result["expiration"]).to_s)
93
94
  return AWSIOTCreds.new(result["accessKeyId"], result["secretAccessKey"], result["sessionToken"],
94
95
  Time.parse(result["expiration"]))
95
96
  end
96
97
 
97
98
  def init_aws
98
- @logger.info("Set AWS Credentials")
99
99
  Aws.config.update({
100
100
  region: @region,
101
101
  credentials: Aws::Credentials.new(@creds.accessKeyId, @creds.secretAccessKey, @creds.sessionToken)
102
102
  })
103
103
  # Initialize Kinesis client
104
+ @logger.info("Set AWS Credentials")
104
105
  @kinesis = Aws::Kinesis::Client.new
105
106
  # send data to kinesis
106
107
  end
107
- def renew_aws
108
- @logger.info("Renewing AWS Credentials")
109
- @creds = getIotAccess()
110
- Aws.config.update({ credentials: Aws::Credentials.new(@creds.accessKeyId, @creds.secretAccessKey, @creds.sessionToken)})
111
-
112
- end
113
108
 
114
109
 
115
110
  public
@@ -150,8 +145,15 @@ class LogStash::Outputs::KinesisIOT < LogStash::Outputs::Base
150
145
  end
151
146
  end
152
147
  def send_record(event, payload)
148
+ if @creds.expiration >= Time.now() + 1
149
+ @logger.debug("Token still valid at " + (Time.now() +1 ).to_s)
150
+ else
151
+ @logger.debug("Invalid token, renewing")
152
+ @creds = getIotAccess()
153
+ init_aws()
154
+ end
153
155
  begin
154
- renew_aws() unless @creds.expiration < Time.now() + 1
156
+ init_aws() unless @creds.expiration >= Time.now() + 1
155
157
  response = @kinesis.put_record({
156
158
  stream_name: @stream_name,
157
159
  data: payload,
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-kinesis-iot'
3
- s.version = '0.1.10'
3
+ s.version = '0.1.13'
4
4
  s.licenses = ['Apache-2.0']
5
5
  s.summary = "Sends data to a AWS kinesis, "
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"
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.email = "jeremy@frandon.net"
9
9
  s.homepage = "http://www.elastic.co/guide/en/logstash/current/index.html"
10
10
  s.require_paths = ["lib"]
11
- s.platform = Gem::Platform::JAVA #if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
11
+ s.platform = "java" #if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
12
12
  # Files
13
13
  s.files = Dir['lib/**/*','spec/**/*','vendor/**/*','*.gemspec','*.md','CONTRIBUTORS','Gemfile','LICENSE','NOTICE.TXT']
14
14
  # Tests
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-kinesis-iot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.13
5
5
  platform: java
6
6
  authors:
7
7
  - Jeremy Frandon