ruboty-lambda 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d5cff1ae0bc80ffe7fc9d4f9d53530ddff7b93c1
4
- data.tar.gz: 12cc6976df184d949561aeb6ffd296f4efba258f
3
+ metadata.gz: 26047e1664fc9710deefe4ee95588bd01f69016c
4
+ data.tar.gz: acaf9269d8e503ae49b50486fd4919ad3690f962
5
5
  SHA512:
6
- metadata.gz: 216b1f6cc9d726ff0bfd2a366c7e39eee9b9bd05f1a86d7c93edb10a106d168c3d487b7f9558fcfa6644fb911f84fc4170c4b4386af9b863c842bac92f92d95b
7
- data.tar.gz: de0ffb1e179269b7c81bc9ec4446eae9afa86cc955d642274adaebf10fcc7ef10bb7129c2dfd2d2b1a67fff98fcd047cbe1b1c0410cf093cdcebbf365d4bb49a
6
+ metadata.gz: 103fc20943a9b24508c124c1a12d08f857c17c9ca50b31e9b23a6a097c165cea97c176bb5c25ab356c53c99b0b03b95ad24e202dd4d7067a3ce69afef816896c
7
+ data.tar.gz: ce8855da2c522c198e96dd6c6219e6c4828787dd7a3d4f9335828362fc1d866bfd7085ba8d6cedf74a4bfa46665f6c28ee8470e9cef388f795babee0f675a6f2
@@ -24,11 +24,39 @@ module Ruboty::Handlers
24
24
  resp = aws_lambda.invoke({
25
25
  function_name: fn,
26
26
  invocation_type: "RequestResponse",
27
+ log_type: "Tail",
27
28
  payload: json,
28
29
  qualifier: "$LATEST",
29
30
  })
30
31
 
31
- message.reply(resp.log_result, code: true)
32
+ result = Base64.decode64(resp.log_result)
33
+ log = []
34
+ attachments = []
35
+
36
+ result.each_line do |line|
37
+ case true
38
+ when line.start_with?('START', 'END')
39
+ next
40
+ when line.start_with?('REPORT')
41
+ line[7..-1].strip.split("\t").map {|f| f.split(':', 2).map(&:strip) }.each do |f|
42
+ attachments << {
43
+ title: f[0],
44
+ text: f[1],
45
+ short: true
46
+ }
47
+ end
48
+ else
49
+ field = line.split("\t")
50
+ log << "#{field[0]} #{field[2]}"
51
+ end
52
+ end
53
+
54
+ payload = resp.payload.read
55
+ attachments << {
56
+ title: "payload",
57
+ text: payload
58
+ }
59
+ message.reply(log.join("\n"), code: true, attachments: attachments)
32
60
  end
33
61
 
34
62
  private
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module Lambda
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruboty-lambda
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sho Kusano