Class: KafkaCommand::BrokersController

Inherits:
ApplicationController show all
Defined in:
app/controllers/kafka_command/brokers_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject

GET /clusters/:cluster_id/brokers



8
9
10
11
12
# File 'app/controllers/kafka_command/brokers_controller.rb', line 8

def index
  @cluster = Cluster.find(params[:cluster_id])
  @brokers = @cluster.brokers
  render_success(@brokers)
end

#showObject

GET /clusters/:cluster_id/brokers/:id



15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/kafka_command/brokers_controller.rb', line 15

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