Sha256: e006e3c49e385c3104dcab499002601abdcb2492f540c14c871696298cabea9d

Contents?: true

Size: 644 Bytes

Versions: 3

Compression:

Stored size: 644 Bytes

Contents

# frozen_string_literal: true

require_dependency 'kafka_command/application_controller'

module KafkaCommand
  class BrokersController < ApplicationController
    # GET /clusters/:cluster_id/brokers
    def index
      @cluster = Cluster.find(params[:cluster_id])
      @brokers = @cluster.brokers
      render_success(@brokers)
    end

    # GET /clusters/:cluster_id/brokers/:id
    def show
      cluster = Cluster.find(params[:cluster_id])
      @broker = cluster.brokers.find { |b| b.node_id == params[:id].to_i }

      if @broker.present?
        render_success(@broker)
      else
        record_not_found
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kafka_command-0.0.3 app/controllers/kafka_command/brokers_controller.rb
kafka_command-0.0.2 app/controllers/kafka_command/brokers_controller.rb
kafka_command-0.0.1 app/controllers/kafka_command/brokers_controller.rb