Class: Fluent::Plugin::TeamsOutput
- Inherits:
-
Output
- Object
- Output
- Fluent::Plugin::TeamsOutput
- Defined in:
- lib/fluent/plugin/out_teams.rb
Instance Method Summary collapse
- #build_payload(args = {}) ⇒ Object
- #configure(conf) ⇒ Object
- #format(tag, time, record) ⇒ Object
- #formatted_to_msgpack_binary? ⇒ Boolean
-
#initialize ⇒ TeamsOutput
constructor
A new instance of TeamsOutput.
- #post_message(args = {}) ⇒ Object
- #prefer_buffered_processing ⇒ Object
- #process(tag, es) ⇒ Object
- #shutdown ⇒ Object
- #start ⇒ Object
- #write(chunk) ⇒ Object
Constructor Details
#initialize ⇒ TeamsOutput
Returns a new instance of TeamsOutput.
15 16 17 |
# File 'lib/fluent/plugin/out_teams.rb', line 15 def initialize super end |
Instance Method Details
#build_payload(args = {}) ⇒ Object
61 62 63 64 65 66 67 68 |
# File 'lib/fluent/plugin/out_teams.rb', line 61 def build_payload(args = {}) tag = args[:tag] time = args[:time] record = args[:record] text = ERB.new(@text).result(binding).gsub('\\n', "\n") { text: text } end |
#configure(conf) ⇒ Object
19 20 21 |
# File 'lib/fluent/plugin/out_teams.rb', line 19 def configure(conf) super end |
#format(tag, time, record) ⇒ Object
31 32 33 |
# File 'lib/fluent/plugin/out_teams.rb', line 31 def format(tag, time, record) [time, record].to_msgpack end |
#formatted_to_msgpack_binary? ⇒ Boolean
35 36 37 |
# File 'lib/fluent/plugin/out_teams.rb', line 35 def formatted_to_msgpack_binary? true end |
#post_message(args = {}) ⇒ Object
56 57 58 59 |
# File 'lib/fluent/plugin/out_teams.rb', line 56 def (args = {}) payload = build_payload(args) RestClient.post(@webhook_url, payload.to_json, content_type: :json) end |
#prefer_buffered_processing ⇒ Object
39 40 41 |
# File 'lib/fluent/plugin/out_teams.rb', line 39 def prefer_buffered_processing false end |
#process(tag, es) ⇒ Object
43 44 45 46 47 |
# File 'lib/fluent/plugin/out_teams.rb', line 43 def process(tag, es) es.each do |time, record| (tag: tag, time: time, record: record) end end |
#shutdown ⇒ Object
27 28 29 |
# File 'lib/fluent/plugin/out_teams.rb', line 27 def shutdown super end |
#start ⇒ Object
23 24 25 |
# File 'lib/fluent/plugin/out_teams.rb', line 23 def start super end |
#write(chunk) ⇒ Object
49 50 51 52 53 54 |
# File 'lib/fluent/plugin/out_teams.rb', line 49 def write(chunk) tag = chunk..tag chunk.msgpack_each do |time, record| (tag: tag, time: time, record: record) end end |