Sha256: f798026754d1fb277b50e0063beb0f13f68c3823857a0e2243229e43cae1c6e3

Contents?: true

Size: 860 Bytes

Versions: 6

Compression:

Stored size: 860 Bytes

Contents

class KafkaConnect
  def initialize(host, connector_name)
    uri = URI(host)
    @http = Net::HTTP.new(uri.host, uri.port)
    @connector_name = connector_name
  end

  def configure(config)
    request = Net::HTTP::Put.new("/connectors/#{@connector_name}/config")
    request.body = config.to_json
    request.content_type = "application/json"
    @http.request(request)
  end

  def delete
    request = Net::HTTP::Delete.new("/connectors/#{@connector_name}")
    @http.request(request)
  end

  def info
    request = Net::HTTP::Get.new("/connectors/#{@connector_name}")
    response = @http.request(request)
    JSON.parse(response.body, symbolize_names: true)
  end

  def status
    request = Net::HTTP::Get.new("/connectors/#{@connector_name}/status")
    response = @http.request(request)
    JSON.parse(response.body, symbolize_names: true)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
nulogy_message_bus_producer-3.3.0 spec/support/kafka_connect.rb
nulogy_message_bus_producer-3.2.1 spec/support/kafka_connect.rb
nulogy_message_bus_producer-3.2.0 spec/support/kafka_connect.rb
nulogy_message_bus_producer-3.1.1 spec/support/kafka_connect.rb
nulogy_message_bus_producer-2.1.1 spec/support/kafka_connect.rb
nulogy_message_bus_producer-2.1.0 spec/support/kafka_connect.rb