Class: DcmgrResource::Instance
- Inherits:
-
Base
- Object
- ActiveResource::Base
- Base
- DcmgrResource::Instance
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.security_groups = params[:security_groups]
instance.ssh_key_id = 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
|
.start(instance_id) ⇒ Object
36
37
38
39
40
41
42
|
# File 'app/models/dcmgr_resource/instance.rb', line 36
def self.start(instance_id)
@collection ||= self.collection_name
self.collection_name = File.join(@collection,instance_id)
result = self.put(:start)
self.collection_name = @collection
result.body
end
|
.stop(instance_id) ⇒ Object
44
45
46
47
48
49
50
|
# File 'app/models/dcmgr_resource/instance.rb', line 44
def self.stop(instance_id)
@collection ||= self.collection_name
self.collection_name = File.join(@collection,instance_id)
result = self.put(:stop)
self.collection_name = @collection
result.body
end
|