Class: Api::V1::SubnetsController

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

Direct Known Subclasses

Api::V2::SubnetsController

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

#createObject


41
42
43
44
# File 'app/controllers/api/v1/subnets_controller.rb', line 41

def create
  @subnet = Subnet.new(params[:subnet])
  process_response @subnet.save
end

#destroyObject


71
72
73
# File 'app/controllers/api/v1/subnets_controller.rb', line 71

def destroy
  process_response @subnet.destroy
end

#indexObject


13
14
15
16
# File 'app/controllers/api/v1/subnets_controller.rb', line 13

def index
  @subnets = Subnet.includes(:tftp, :dhcp, :dns).
    search_for(*search_options).paginate(paginate_options)
end

#showObject


21
22
# File 'app/controllers/api/v1/subnets_controller.rb', line 21

def show
end

#updateObject


64
65
66
# File 'app/controllers/api/v1/subnets_controller.rb', line 64

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