Class: Fluent::Plugin::TeamsOutput
- Inherits:
-
Output
- Object
- Output
- Fluent::Plugin::TeamsOutput
- Defined in:
- lib/fluent/plugin/out_teams.rb
Constant Summary collapse
- DEFAULT_BUFFER_TYPE =
'memory'.freeze
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.
25 26 27 |
# File 'lib/fluent/plugin/out_teams.rb', line 25 def initialize super end |
Instance Method Details
#build_payload(args = {}) ⇒ Object
71 72 73 74 75 76 77 78 |
# File 'lib/fluent/plugin/out_teams.rb', line 71 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
29 30 31 |
# File 'lib/fluent/plugin/out_teams.rb', line 29 def configure(conf) super end |
#format(tag, time, record) ⇒ Object
41 42 43 |
# File 'lib/fluent/plugin/out_teams.rb', line 41 def format(tag, time, record) [time, record].to_msgpack end |
#formatted_to_msgpack_binary? ⇒ Boolean
45 46 47 |
# File 'lib/fluent/plugin/out_teams.rb', line 45 def formatted_to_msgpack_binary? true end |
#post_message(args = {}) ⇒ Object
66 67 68 69 |
# File 'lib/fluent/plugin/out_teams.rb', line 66 def (args = {}) payload = build_payload(args) RestClient.post(@webhook_url, payload.to_json, content_type: :json) end |
#prefer_buffered_processing ⇒ Object
49 50 51 |
# File 'lib/fluent/plugin/out_teams.rb', line 49 def prefer_buffered_processing @buffered end |
#process(tag, es) ⇒ Object
53 54 55 56 57 |
# File 'lib/fluent/plugin/out_teams.rb', line 53 def process(tag, es) es.each do |time, record| (tag: tag, time: time, record: record) end end |
#shutdown ⇒ Object
37 38 39 |
# File 'lib/fluent/plugin/out_teams.rb', line 37 def shutdown super end |
#start ⇒ Object
33 34 35 |
# File 'lib/fluent/plugin/out_teams.rb', line 33 def start super end |
#write(chunk) ⇒ Object
59 60 61 62 63 64 |
# File 'lib/fluent/plugin/out_teams.rb', line 59 def write(chunk) tag = chunk..tag chunk.msgpack_each do |time, record| (tag: tag, time: time, record: record) end end |