class Fluent::Plugin::TeamsOutput

Constants

DEFAULT_BUFFER_TYPE

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_teams.rb, line 25
def initialize
  super
end

Public Instance Methods

build_payload(args = {}) click to toggle source
# 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) click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_teams.rb, line 29
def configure(conf)
  super
end
format(tag, time, record) click to toggle source
# File lib/fluent/plugin/out_teams.rb, line 41
def format(tag, time, record)
  [time, record].to_msgpack
end
formatted_to_msgpack_binary?() click to toggle source
# File lib/fluent/plugin/out_teams.rb, line 45
def formatted_to_msgpack_binary?
  true
end
post_message(args = {}) click to toggle source
# File lib/fluent/plugin/out_teams.rb, line 66
def post_message(args = {})
  payload = build_payload(args)
  RestClient.post(@webhook_url, payload.to_json, content_type: :json)
end
prefer_buffered_processing() click to toggle source
# File lib/fluent/plugin/out_teams.rb, line 49
def prefer_buffered_processing
  @buffered
end
process(tag, es) click to toggle source
# File lib/fluent/plugin/out_teams.rb, line 53
def process(tag, es)
  es.each do |time, record|
    post_message(tag: tag, time: time, record: record)
  end
end
shutdown() click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_teams.rb, line 37
def shutdown
  super
end
start() click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_teams.rb, line 33
def start
  super
end
write(chunk) click to toggle source
# File lib/fluent/plugin/out_teams.rb, line 59
def write(chunk)
  tag = chunk.metadata.tag
  chunk.msgpack_each do |time, record|
    post_message(tag: tag, time: time, record: record)
  end
end