Module: Hijiki::DcmgrResource::V1203::InstanceMethods::ClassMethods
- Defined in:
- lib/hijiki/dcmgr_resource/12.03/instance.rb
Instance Method Summary collapse
- #create(params) ⇒ Object
- #destroy(instance_id) ⇒ Object
- #reboot(instance_id) ⇒ Object
- #start(instance_id) ⇒ Object
- #stop(instance_id) ⇒ Object
Instance Method Details
#create(params) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/hijiki/dcmgr_resource/12.03/instance.rb', line 9 def 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
22 23 24 |
# File 'lib/hijiki/dcmgr_resource/12.03/instance.rb', line 22 def destroy(instance_id) self.delete(instance_id).body end |
#reboot(instance_id) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/hijiki/dcmgr_resource/12.03/instance.rb', line 26 def 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 |
#start(instance_id) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/hijiki/dcmgr_resource/12.03/instance.rb', line 34 def 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
42 43 44 45 46 47 48 |
# File 'lib/hijiki/dcmgr_resource/12.03/instance.rb', line 42 def 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 |