mirror of
https://github.com/fluent/fluentd-ui.git
synced 2025-08-11 16:57:11 +02:00
27 lines
430 B
Ruby
27 lines
430 B
Ruby
require "httpclient"
|
|
require "addressable/uri"
|
|
|
|
class Fluentd
|
|
class Api
|
|
class Http
|
|
def initialize(endpoint)
|
|
@endpoint = Addressable::URI.parse(endpoint)
|
|
end
|
|
|
|
def config
|
|
request("/api/config.json")
|
|
end
|
|
|
|
private
|
|
|
|
def request(path)
|
|
uri = @endpoint.dup
|
|
uri.path = path
|
|
res = HTTPClient.get(uri)
|
|
JSON.parse res.body
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|