Revision 63efbbf5
Added by Petr Chalupa almost 12 years ago
- ID 63efbbf53695f64577724f941eb223d96032e5b2
app/controllers/api/v1/operatingsystems_controller.rb | ||
---|---|---|
name 'Operating systems'
|
||
end
|
||
|
||
before_filter :find_by_name, :only => %w{show edit update destroy bootfiles}
|
||
before_filter :find_resource, :only => %w{show edit update destroy bootfiles}
|
||
|
||
api :GET, "/operatingsystems/", "List all operating systems."
|
||
def index
|
||
... | ... | |
|
||
api :POST, "/operatingsystems/", "Create an OS."
|
||
param :operatingsystem, Hash, :required => true do
|
||
param :name, /\A(\S+)\Z/, :required => true
|
||
param :major, String, :required => true
|
||
param :minor, String, :required => true
|
||
param :name, /\A(\S+)\Z/, :required => true
|
||
param :major, String, :required => true
|
||
param :minor, String, :required => true
|
||
end
|
||
def create
|
||
@operatingsystem = Operatingsystem.new(params[:operatingsystem])
|
||
process_response @operatingsystem.save
|
||
end
|
||
end
|
||
|
||
api :PUT, "/operatingsystems/:id/", "Update an OS."
|
||
param :operatingsystem, Hash, :required => true do
|
||
param :name, /\A(\S+)\Z/
|
||
param :major, String
|
||
param :minor, String
|
||
param :name, /\A(\S+)\Z/
|
||
param :major, String
|
||
param :minor, String
|
||
end
|
||
def update
|
||
process_response @operatingsystem.update_attributes(params[:operatingsystem])
|
||
... | ... | |
param :architecture, String
|
||
def bootfiles
|
||
medium = Medium.find_by_name(params[:medium])
|
||
arch = Architecture.find_by_name(params[:architecture])
|
||
arch = Architecture.find_by_name(params[:architecture])
|
||
render :json => @operatingsystem.pxe_files(medium, arch)
|
||
rescue => e
|
||
render :json => e.to_s, :status => :unprocessable_entity
|
Also available in: Unified diff
api v1 - fixing permissions
cleanups in base controller