Class: Api::V1::OperatingsystemsController

Inherits:
BaseController show all
Defined in:
app/controllers/api/v1/operatingsystems_controller.rb

Instance Method Summary collapse

Methods included from Api::Version1

#api_version

Methods inherited from BaseController

#get_resource, #resource_class, #resource_name, #resource_scope

Methods included from Foreman::ThreadSession::Cleaner

#clear_thread, included

Instance Method Details

#bootfilesObject


69
70
71
72
73
74
75
# File 'app/controllers/api/v1/operatingsystems_controller.rb', line 69

def bootfiles
  medium = Medium.find_by_name(params[:medium])
  arch   = Architecture.find_by_name(params[:architecture])
  render :json => @operatingsystem.pxe_files(medium, arch)
rescue => e
  render :json => e.to_s, :status => :unprocessable_entity
end

#createObject


38
39
40
41
# File 'app/controllers/api/v1/operatingsystems_controller.rb', line 38

def create
  @operatingsystem = Operatingsystem.new(params[:operatingsystem])
  process_response @operatingsystem.save
end

#destroyObject


60
61
62
# File 'app/controllers/api/v1/operatingsystems_controller.rb', line 60

def destroy
  process_response @operatingsystem.destroy
end

#indexObject


17
18
19
20
21
# File 'app/controllers/api/v1/operatingsystems_controller.rb', line 17

def index
  @operatingsystems = Operatingsystem.
    includes(:media, :architectures, :ptables, :config_templates, :os_default_templates).
    search_for(*search_options).paginate(paginate_options)
end

#showObject


26
27
# File 'app/controllers/api/v1/operatingsystems_controller.rb', line 26

def show
end

#updateObject


53
54
55
# File 'app/controllers/api/v1/operatingsystems_controller.rb', line 53

def update
  process_response @operatingsystem.update_attributes(params[:operatingsystem])
end