Class: DescriptorsController

Inherits:
BaseController show all
Defined in:
app/controllers/descriptors_controller.rb

Constant Summary

Constants inherited from BaseController

BaseController::API_VERSION, BaseController::SUPPORTED_API_VERSIONS

Instance Method Summary collapse

Methods included from UserActionLogger

#get_action_logger, #log_action

Instance Method Details

#showObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/descriptors_controller.rb', line 5

def show
  domain_id = params[:domain_id]
  application_id = params[:application_id]
  
  domain = Domain.get(@cloud_user, domain_id)
  return render_error(:not_found, "Domain #{domain_id} not found", 127,
                      "SHOW_DESCRIPTOR") if !domain || !domain.hasAccess?(@cloud_user)

  @domain_name = domain.namespace
  application = Application.find(@cloud_user,application_id)
  return render_error(:not_found, "Application '#{application_id}' not found for domain '#{domain_id}'",
                      101, "SHOW_DESCRIPTOR") unless application
  
  @application_name = application.name
  @application_uuid = application.uuid
  render_success(:ok, "descriptor", application.to_descriptor.to_yaml, "SHOW_DESCRIPTOR",
                 "Show descriptor for application '#{application_id}' for domain '#{domain_id}'")
end