Class: RedhatAccess::TelemetryConfigurationsController

Inherits:
ApplicationController show all
Includes:
RedhatAccess::Telemetry::LookUps
Defined in:
app/controllers/redhat_access/telemetry_configurations_controller.rb

Instance Method Summary collapse

Methods included from RedhatAccess::Telemetry::LookUps

#can_mask_rules, #can_unregister_system, #current_organization, #disconnected_org?, #get_basic_auth_options, #get_branch_id_for_org, #get_branch_id_for_uuid, #get_content_host, #get_content_hosts, #get_default_ssl_ca_file, #get_http_options, #get_http_user_agent, #get_leaf_id, #get_mutual_tls_auth_options, #get_organization, #get_plugin_parent_name, #get_plugin_parent_version, #get_portal_http_proxy, #get_rha_plugin_name, #get_rha_plugin_rpm_name, #get_rha_plugin_version, #get_ssl_options_for_org, #get_ssl_options_for_uuid, #get_telemetry_config, #is_org_selected?, #is_susbcribed_to_redhat?, #telemetry_enabled?, #telemetry_enabled_for_uuid?, #use_basic_auth?, #user_login_to_hash

Instance Method Details

#showObject



6
7
8
9
10
# File 'app/controllers/redhat_access/telemetry_configurations_controller.rb', line 6

def show
   #TODO require current ORG
  conf = get_telemetry_config(Organization.current)
  render json:  conf.to_json(:except => [ :id, :created_at, :portal_password ,:updated_at])
end

#updateObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/controllers/redhat_access/telemetry_configurations_controller.rb', line 12

def update
  #TODO require current ORG
  conf = get_telemetry_config(Organization.current)
  if conf
    begin
      if conf.update_attributes(telemetry_configuration_params)
      render json: {:message => "config updated"}
    else
      render json: {:error=>"Invalid parameters"}.to_json, status: 400
    end
      rescue=>e
      Rails.logger.info(e)
      render json: {:error=>"Error processing update"}.to_json, status: 500
    end
  else
    render json: {:error=>"Configurationnotfound"}.to_json, status: 404
  end
end