Class: Fog::Compute::Cloudstack::Server
- Defined in:
- lib/fog/cloudstack/models/compute/server.rb
Instance Attribute Summary collapse
-
#disk_offering_id ⇒ Object
Returns the value of attribute disk_offering_id.
-
#ip_address ⇒ Object
Returns the value of attribute ip_address.
-
#ip_to_network_list ⇒ Object
Returns the value of attribute ip_to_network_list.
-
#network_ids ⇒ Object
Returns the value of attribute network_ids.
Attributes inherited from Model
Instance Method Summary collapse
- #addresses ⇒ Object
- #destroy ⇒ Object
- #flavor ⇒ Object
- #ready? ⇒ Boolean
- #reboot ⇒ Object
- #save ⇒ Object
Methods inherited from Server
#private_key=, #scp, #scp_download, #ssh, #ssh_port, #sshable?
Methods inherited from Model
#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one
Constructor Details
This class inherits a constructor from Fog::Model
Instance Attribute Details
#disk_offering_id ⇒ Object
Returns the value of attribute disk_offering_id.
39 40 41 |
# File 'lib/fog/cloudstack/models/compute/server.rb', line 39 def disk_offering_id @disk_offering_id end |
#ip_address ⇒ Object
Returns the value of attribute ip_address.
39 40 41 |
# File 'lib/fog/cloudstack/models/compute/server.rb', line 39 def ip_address @ip_address end |
#ip_to_network_list ⇒ Object
Returns the value of attribute ip_to_network_list.
39 40 41 |
# File 'lib/fog/cloudstack/models/compute/server.rb', line 39 def ip_to_network_list @ip_to_network_list end |
#network_ids ⇒ Object
Returns the value of attribute network_ids.
39 40 41 |
# File 'lib/fog/cloudstack/models/compute/server.rb', line 39 def network_ids @network_ids end |
Instance Method Details
#addresses ⇒ Object
76 77 78 |
# File 'lib/fog/cloudstack/models/compute/server.rb', line 76 def addresses nics.map{|nic| Address.new(nic)} end |
#destroy ⇒ Object
84 85 86 87 88 |
# File 'lib/fog/cloudstack/models/compute/server.rb', line 84 def destroy requires :id connection.destroy_virtual_machine(:id => id) true end |
#flavor ⇒ Object
80 81 82 |
# File 'lib/fog/cloudstack/models/compute/server.rb', line 80 def flavor connection.flavors.get(self.flavor_id) end |
#ready? ⇒ Boolean
41 42 43 |
# File 'lib/fog/cloudstack/models/compute/server.rb', line 41 def ready? state == 'Running' end |
#reboot ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/fog/cloudstack/models/compute/server.rb', line 45 def reboot requires :id data = connection.reboot_virtual_machine('id' => self.id) # FIXME: does this ever fail? job = Job.new(data["rebootvirtualmachineresponse"]) job.connection= self.connection job end |
#save ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/fog/cloudstack/models/compute/server.rb', line 53 def save requires :image_id, :flavor_id, :zone_id = { 'templateid' => image_id, 'serviceofferingid' => flavor_id, 'zoneid' => zone_id, 'networkids' => network_ids, 'diskofferingid' => disk_offering_id, 'displayname' => display_name, 'domainid' => domain_id, 'hostid' => host_id, 'ipaddress' => ip_address, 'iptonetworklist' => ip_to_network_list, 'projectid' => project_id } .merge!('networkids' => network_ids) if network_ids data = connection.deploy_virtual_machine() merge_attributes(data['deployvirtualmachineresponse']) end |