Class: DcmgrResource::Instance

Inherits:
Base
  • Object
show all
Defined in:
app/models/dcmgr_resource/instance.rb

Class Method Summary collapse

Methods inherited from Base

get_resource_state_count, set_debug, total_resource

Class Method Details

.create(params) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/models/dcmgr_resource/instance.rb', line 11

def self.create(params)
  instance = self.new
  instance.image_id = params[:image_id]
  instance.instance_spec_id = params[:instance_spec_id]
  instance.host_pool_id = params[:host_pool_id]
  instance.host_name = params[:host_name]
  instance.user_data = params[:user_data]
  instance.nf_group = params[:nf_group]
  instance.ssh_key = params[:ssh_key]
  instance.save
  instance
end

.destroy(instance_id) ⇒ Object



24
25
26
# File 'app/models/dcmgr_resource/instance.rb', line 24

def self.destroy(instance_id)
  self.delete(instance_id).body
end

.list(params = {}) ⇒ Object



3
4
5
# File 'app/models/dcmgr_resource/instance.rb', line 3

def self.list(params = {})
  self.find(:all,:params => params)
end

.reboot(instance_id) ⇒ Object



28
29
30
31
32
33
34
# File 'app/models/dcmgr_resource/instance.rb', line 28

def self.reboot(instance_id)
  @collection ||= self.collection_name
  self.collection_name = File.join(@collection,instance_id)
  result = self.put(:reboot)
  self.collection_name = @collection
  result.body
end

.show(instance_id) ⇒ Object



7
8
9
# File 'app/models/dcmgr_resource/instance.rb', line 7

def self.show(instance_id)
  self.get(instance_id)
end