Class: Fog::Compute::Ovirt::Real
- Inherits:
-
Object
- Object
- Fog::Compute::Ovirt::Real
- Includes:
- Shared
- Defined in:
- lib/fog/ovirt/compute.rb,
lib/fog/ovirt/requests/compute/create_vm.rb,
lib/fog/ovirt/requests/compute/update_vm.rb,
lib/fog/ovirt/requests/compute/vm_action.rb,
lib/fog/ovirt/requests/compute/destroy_vm.rb,
lib/fog/ovirt/requests/compute/datacenters.rb,
lib/fog/ovirt/requests/compute/get_cluster.rb,
lib/fog/ovirt/requests/compute/get_template.rb,
lib/fog/ovirt/requests/compute/list_clusters.rb,
lib/fog/ovirt/requests/compute/list_templates.rb,
lib/fog/ovirt/requests/compute/storage_domains.rb,
lib/fog/ovirt/requests/compute/get_virtual_machine.rb,
lib/fog/ovirt/requests/compute/list_virtual_machines.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #create_vm(attrs) ⇒ Object
- #datacenters(filter = {}) ⇒ Object
- #destroy_vm(options = {}) ⇒ Object
- #get_cluster(id) ⇒ Object
- #get_template(id) ⇒ Object
- #get_virtual_machine(id) ⇒ Object
-
#initialize(options = {}) ⇒ Real
constructor
A new instance of Real.
- #list_clusters(filters = {}) ⇒ Object
- #list_templates(filters = {}) ⇒ Object
- #list_virtual_machines(filters = {}) ⇒ Object
- #storage_domains(filter = {}) ⇒ Object
- #update_vm(attrs) ⇒ Object
- #vm_action(options = {}) ⇒ Object
Methods included from Shared
Constructor Details
#initialize(options = {}) ⇒ Real
Returns a new instance of Real.
78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/fog/ovirt/compute.rb', line 78 def initialize(={}) require 'rbovirt' username = [:ovirt_username] password = [:ovirt_password] server = [:ovirt_server] port = [:ovirt_port] || 8080 api_path = [:ovirt_api_path] || '/api' url = [:ovirt_url] || "#{@scheme}://#{server}:#{port}#{api_path}" datacenter = [:ovirt_datacenter] @client = OVIRT::Client.new(username, password, url, datacenter) end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
76 77 78 |
# File 'lib/fog/ovirt/compute.rb', line 76 def client @client end |
Instance Method Details
#create_vm(attrs) ⇒ Object
6 7 8 |
# File 'lib/fog/ovirt/requests/compute/create_vm.rb', line 6 def create_vm(attrs) client.create_vm(attrs) end |
#datacenters(filter = {}) ⇒ Object
6 7 8 |
# File 'lib/fog/ovirt/requests/compute/datacenters.rb', line 6 def datacenters filter={} client.datacenters(filter).map {|ovirt_obj| ovirt_attrs ovirt_obj} end |
#destroy_vm(options = {}) ⇒ Object
6 7 8 9 |
# File 'lib/fog/ovirt/requests/compute/destroy_vm.rb', line 6 def destroy_vm( = {}) raise ArgumentError, "instance id is a required parameter" unless .has_key? :id client.destroy_vm([:id]) end |
#get_cluster(id) ⇒ Object
5 6 7 |
# File 'lib/fog/ovirt/requests/compute/get_cluster.rb', line 5 def get_cluster(id) ovirt_attrs client.cluster(id) end |
#get_template(id) ⇒ Object
5 6 7 |
# File 'lib/fog/ovirt/requests/compute/get_template.rb', line 5 def get_template(id) ovirt_attrs client.template(id) end |
#get_virtual_machine(id) ⇒ Object
5 6 7 |
# File 'lib/fog/ovirt/requests/compute/get_virtual_machine.rb', line 5 def get_virtual_machine(id) ovirt_attrs client.vm(id) end |
#list_clusters(filters = {}) ⇒ Object
5 6 7 |
# File 'lib/fog/ovirt/requests/compute/list_clusters.rb', line 5 def list_clusters(filters = {}) client.clusters(filters).map {|ovirt_obj| ovirt_attrs ovirt_obj} end |
#list_templates(filters = {}) ⇒ Object
5 6 7 |
# File 'lib/fog/ovirt/requests/compute/list_templates.rb', line 5 def list_templates(filters = {}) client.templates(filters).map {|ovirt_obj| ovirt_attrs ovirt_obj} end |
#list_virtual_machines(filters = {}) ⇒ Object
5 6 7 |
# File 'lib/fog/ovirt/requests/compute/list_virtual_machines.rb', line 5 def list_virtual_machines(filters = {}) client.vms(filters).map {|ovirt_obj| ovirt_attrs ovirt_obj} end |
#storage_domains(filter = {}) ⇒ Object
6 7 8 |
# File 'lib/fog/ovirt/requests/compute/storage_domains.rb', line 6 def storage_domains filter={} client.storagedomains(filter).map {|ovirt_obj| ovirt_attrs ovirt_obj} end |
#update_vm(attrs) ⇒ Object
6 7 8 |
# File 'lib/fog/ovirt/requests/compute/update_vm.rb', line 6 def update_vm(attrs) client.update_vm(attrs) end |
#vm_action(options = {}) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/fog/ovirt/requests/compute/vm_action.rb', line 6 def vm_action( = {}) raise ArgumentError, "instance id is a required parameter" unless .has_key? :id raise ArgumentError, "action is a required parameter" unless .has_key? :action client.vm_action [:id], [:action] end |