Class: Api::V2::RhCloud::CloudRequestController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/api/v2/rh_cloud/cloud_request_controller.rb

Constant Summary collapse

KNOWN_DIRECTIVES =
{
  'playbook-sat' => :handle_run_playbook_request,
  'foreman_rh_cloud' => :handle_run_playbook_request,
}

Instance Method Summary collapse

Instance Method Details

#updateObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/api/v2/rh_cloud/cloud_request_controller.rb', line 10

def update
  handler = KNOWN_DIRECTIVES[directive]

  unless handler
    render json: {
      :message => "No valid handler is found for directive: #{directive}",
    }, status: :bad_request
    return
  end

  send(handler)

  render json: {
    :message => "Handled #{directive} by #{handler}",
  }
end