Class: ServersController

Inherits:
MVCLI::Controller
  • Object
show all
Defined in:
app/controllers/servers_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



12
13
14
15
16
17
18
19
# File 'app/controllers/servers_controller.rb', line 12

def create
  options = {
    name: generate_name,
    flavor_id: 2,
    image_id: '9922a7c7-5a42-4a56-bc6a-93f857ae2346'
  }
  compute.servers.create options
end

#destroyObject



21
22
23
24
25
# File 'app/controllers/servers_controller.rb', line 21

def destroy
  server.tap do |s|
    s.destroy
  end
end

#indexObject



4
5
6
# File 'app/controllers/servers_controller.rb', line 4

def index
  compute.servers.all
end

#showObject



8
9
10
# File 'app/controllers/servers_controller.rb', line 8

def show
  server
end