Class: Ocs::Resources::VirtualMachine
- Inherits:
-
Base
- Object
- Base
- Ocs::Resources::VirtualMachine
show all
- Defined in:
- lib/ocs/resources/virtual_machine.rb
Constant Summary
Constants inherited
from Base
Base::BOOLEAN
Instance Attribute Summary
Attributes inherited from Base
#client, #error
Instance Method Summary
collapse
Methods inherited from Base
all, downcased_name, find, inherited, #initialize, list, name, pluralized_name, #reload!, underscored_name, where
#alias_attribute, #define_action, #define_attribute, #delegate_attribute, #delegate_attributes, #has_many, #has_one
Instance Method Details
#add_nic(network:, ipaddress: nil) ⇒ Object
111
112
113
114
115
116
|
# File 'lib/ocs/resources/virtual_machine.rb', line 111
def add_nic(network:, ipaddress: nil)
network_id = network.is_a?(Resources::Base) ? network.id : network
parameters = {networkid: network_id, virtualmachineid: id}
parameters[:ipaddress] = ipaddress if ipaddress
send_and_update("addNicToVirtualMachine", parameters)
end
|
#destroyed? ⇒ Boolean
95
96
97
|
# File 'lib/ocs/resources/virtual_machine.rb', line 95
def destroyed?
state == "Destroyed"
end
|
#remove_nic(nic:) ⇒ Object
118
119
120
121
|
# File 'lib/ocs/resources/virtual_machine.rb', line 118
def remove_nic(nic:)
parameters = {nicid: nic.id, virtualmachineid: id}
send_and_update("removeNicFromVirtualMachine", parameters)
end
|
#running? ⇒ Boolean
99
100
101
|
# File 'lib/ocs/resources/virtual_machine.rb', line 99
def running?
state == "Running"
end
|
#starting? ⇒ Boolean
103
104
105
|
# File 'lib/ocs/resources/virtual_machine.rb', line 103
def starting?
state == "Starting"
end
|
#stopped? ⇒ Boolean
107
108
109
|
# File 'lib/ocs/resources/virtual_machine.rb', line 107
def stopped?
state == "Stopped"
end
|