Class: Fog::Compute::Cloudstack::Real
- Inherits:
-
Object
- Object
- Fog::Compute::Cloudstack::Real
- Defined in:
- lib/fog/cloudstack/compute.rb,
lib/fog/cloudstack/requests/compute/list_isos.rb,
lib/fog/cloudstack/requests/compute/list_pods.rb,
lib/fog/cloudstack/requests/compute/list_hosts.rb,
lib/fog/cloudstack/requests/compute/list_users.rb,
lib/fog/cloudstack/requests/compute/list_zones.rb,
lib/fog/cloudstack/requests/compute/create_user.rb,
lib/fog/cloudstack/requests/compute/delete_user.rb,
lib/fog/cloudstack/requests/compute/enable_user.rb,
lib/fog/cloudstack/requests/compute/list_alerts.rb,
lib/fog/cloudstack/requests/compute/list_events.rb,
lib/fog/cloudstack/requests/compute/update_user.rb,
lib/fog/cloudstack/requests/compute/disable_user.rb,
lib/fog/cloudstack/requests/compute/list_domains.rb,
lib/fog/cloudstack/requests/compute/list_volumes.rb,
lib/fog/cloudstack/requests/compute/attach_volume.rb,
lib/fog/cloudstack/requests/compute/create_domain.rb,
lib/fog/cloudstack/requests/compute/create_volume.rb,
lib/fog/cloudstack/requests/compute/delete_domain.rb,
lib/fog/cloudstack/requests/compute/delete_volume.rb,
lib/fog/cloudstack/requests/compute/detach_volume.rb,
lib/fog/cloudstack/requests/compute/list_accounts.rb,
lib/fog/cloudstack/requests/compute/list_capacity.rb,
lib/fog/cloudstack/requests/compute/list_clusters.rb,
lib/fog/cloudstack/requests/compute/list_networks.rb,
lib/fog/cloudstack/requests/compute/list_os_types.rb,
lib/fog/cloudstack/requests/compute/update_domain.rb,
lib/fog/cloudstack/requests/compute/create_account.rb,
lib/fog/cloudstack/requests/compute/create_network.rb,
lib/fog/cloudstack/requests/compute/delete_account.rb,
lib/fog/cloudstack/requests/compute/enable_account.rb,
lib/fog/cloudstack/requests/compute/list_snapshots.rb,
lib/fog/cloudstack/requests/compute/list_templates.rb,
lib/fog/cloudstack/requests/compute/update_account.rb,
lib/fog/cloudstack/requests/compute/create_snapshot.rb,
lib/fog/cloudstack/requests/compute/delete_snapshot.rb,
lib/fog/cloudstack/requests/compute/disable_account.rb,
lib/fog/cloudstack/requests/compute/get_vm_password.rb,
lib/fog/cloudstack/requests/compute/list_async_jobs.rb,
lib/fog/cloudstack/requests/compute/list_hypervisors.rb,
lib/fog/cloudstack/requests/compute/list_capabilities.rb,
lib/fog/cloudstack/requests/compute/acquire_ip_address.rb,
lib/fog/cloudstack/requests/compute/list_os_categories.rb,
lib/fog/cloudstack/requests/compute/list_ssh_key_pairs.rb,
lib/fog/cloudstack/requests/compute/list_storage_pools.rb,
lib/fog/cloudstack/requests/compute/list_usage_records.rb,
lib/fog/cloudstack/requests/compute/register_user_keys.rb,
lib/fog/cloudstack/requests/compute/create_ssh_key_pair.rb,
lib/fog/cloudstack/requests/compute/delete_ssh_key_pair.rb,
lib/fog/cloudstack/requests/compute/list_configurations.rb,
lib/fog/cloudstack/requests/compute/list_disk_offerings.rb,
lib/fog/cloudstack/requests/compute/list_domain_children.rb,
lib/fog/cloudstack/requests/compute/list_instance_groups.rb,
lib/fog/cloudstack/requests/compute/list_resource_limits.rb,
lib/fog/cloudstack/requests/compute/list_security_groups.rb,
lib/fog/cloudstack/requests/compute/stop_virtual_machine.rb,
lib/fog/cloudstack/requests/compute/create_security_group.rb,
lib/fog/cloudstack/requests/compute/delete_security_group.rb,
lib/fog/cloudstack/requests/compute/list_virtual_machines.rb,
lib/fog/cloudstack/requests/compute/register_ssh_key_pair.rb,
lib/fog/cloudstack/requests/compute/start_virtual_machine.rb,
lib/fog/cloudstack/requests/compute/update_resource_count.rb,
lib/fog/cloudstack/requests/compute/create_snapshot_policy.rb,
lib/fog/cloudstack/requests/compute/deploy_virtual_machine.rb,
lib/fog/cloudstack/requests/compute/generate_usage_records.rb,
lib/fog/cloudstack/requests/compute/list_network_offerings.rb,
lib/fog/cloudstack/requests/compute/list_service_offerings.rb,
lib/fog/cloudstack/requests/compute/list_snapshot_policies.rb,
lib/fog/cloudstack/requests/compute/query_async_job_result.rb,
lib/fog/cloudstack/requests/compute/reboot_virtual_machine.rb,
lib/fog/cloudstack/requests/compute/update_virtual_machine.rb,
lib/fog/cloudstack/requests/compute/destroy_virtual_machine.rb,
lib/fog/cloudstack/requests/compute/list_external_firewalls.rb,
lib/fog/cloudstack/requests/compute/migrate_virtual_machine.rb,
lib/fog/cloudstack/requests/compute/recover_virtual_machine.rb,
lib/fog/cloudstack/requests/compute/delete_snapshot_policies.rb,
lib/fog/cloudstack/requests/compute/list_load_balancer_rules.rb,
lib/fog/cloudstack/requests/compute/list_public_ip_addresses.rb,
lib/fog/cloudstack/requests/compute/create_load_balancer_rule.rb,
lib/fog/cloudstack/requests/compute/delete_load_balancer_rule.rb,
lib/fog/cloudstack/requests/compute/list_port_forwarding_rules.rb,
lib/fog/cloudstack/requests/compute/create_port_forwarding_rule.rb,
lib/fog/cloudstack/requests/compute/delete_port_forwarding_rule.rb,
lib/fog/cloudstack/requests/compute/assign_to_load_balancer_rule.rb,
lib/fog/cloudstack/requests/compute/list_external_load_balancers.rb,
lib/fog/cloudstack/requests/compute/revoke_security_group_ingress.rb,
lib/fog/cloudstack/requests/compute/remove_from_load_balancer_rule.rb,
lib/fog/cloudstack/requests/compute/authorize_security_group_ingress.rb,
lib/fog/cloudstack/requests/compute/list_load_balancer_rule_instances.rb,
lib/fog/cloudstack/requests/compute/change_service_for_virtual_machine.rb,
lib/fog/cloudstack/requests/compute/reset_password_for_virtual_machine.rb
Instance Method Summary collapse
-
#acquire_ip_address(options = {}) ⇒ Object
Creates an account.
-
#assign_to_load_balancer_rule(id, virtualmachineids = []) ⇒ Object
Assigns virtual machine or a list of virtual machines to a load balancer rule.
-
#attach_volume(id, virtualmachineid, deviceid = nil) ⇒ Object
Attaches a disk volume to a virtual machine.
-
#authorize_security_group_ingress(options = {}) ⇒ Object
Creates an account.
-
#change_service_for_virtual_machine(options = {}) ⇒ Object
Changes the service offering for a virtual machine.
-
#create_account(options = {}) ⇒ Object
Creates an account.
-
#create_domain(options = {}) ⇒ Object
Creates a domain.
-
#create_load_balancer_rule(options = {}) ⇒ Object
Creates a load balancer rule.
-
#create_network(options = {}) ⇒ Object
Creates an network.
-
#create_port_forwarding_rule(options = {}) ⇒ Object
Creates a domain.
-
#create_security_group(options = {}) ⇒ Object
Creates an account.
-
#create_snapshot(options = {}) ⇒ Object
Creates a snapshot for an account that already exists.
-
#create_snapshot_policy(options = {}) ⇒ Object
Creates an account.
-
#create_ssh_key_pair(name, options = {}) ⇒ Object
Creates a new SSH key pair..
-
#create_user(options = {}) ⇒ Object
Creates a user for an account that already exists.
-
#create_volume(options = {}) ⇒ Object
Creates a volume for an account that already exists.
-
#delete_account(options = {}) ⇒ Object
Deletes a account, and all users associated with this account.
-
#delete_domain(options = {}) ⇒ Object
Deletes a specified domain.
-
#delete_load_balancer_rule(options = {}) ⇒ Object
Creates a domain.
-
#delete_port_forwarding_rule(options = {}) ⇒ Object
Creates a domain.
-
#delete_security_group(options = {}) ⇒ Object
Creates an account.
-
#delete_snapshot(options = {}) ⇒ Object
Deletes a specified user.
-
#delete_snapshot_policy(options = {}) ⇒ Object
Deletes a specified user.
-
#delete_ssh_key_pair(name, options = {}) ⇒ Object
Deletes a keypair by name.
-
#delete_user(options = {}) ⇒ Object
Deletes a specified user.
-
#delete_volume(options = {}) ⇒ Object
Deletes a specified user.
-
#deploy_virtual_machine(options = {}) ⇒ Object
Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.
-
#destroy_virtual_machine(options = {}) ⇒ Object
Updates account information for the authenticated user.
-
#detach_volume(id) ⇒ Object
Deletes a specified domain.
-
#disable_account(options = {}) ⇒ Object
Disables an account.
-
#disable_user(options = {}) ⇒ Object
Disables a user account.
-
#enable_account(options = {}) ⇒ Object
Enables an account.
-
#enable_user(options = {}) ⇒ Object
Enables a user account.
-
#generate_usage_records(options = {}) ⇒ Object
Lists all available networks.
-
#get_vm_password(id) ⇒ Object
Returns an encrypted password for the VM.
-
#initialize(options = {}) ⇒ Real
constructor
A new instance of Real.
-
#list_accounts(options = {}) ⇒ Object
Lists accounts and provides detailed account information for listed accounts.
-
#list_alerts(options = {}) ⇒ Object
Lists all alerts.
-
#list_async_jobs(options = {}) ⇒ Object
Lists all pending asynchronous jobs for the account.
-
#list_capabilities(options = {}) ⇒ Object
Lists configurations and provides detailed account information for listed configurations.
-
#list_capacity(options = {}) ⇒ Object
Lists domains and provides detailed information for listed domains.
-
#list_clusters(options = {}) ⇒ Object
Lists configurations and provides detailed account information for listed configurations.
-
#list_configurations(options = {}) ⇒ Object
Lists configurations and provides detailed account information for listed configurations.
-
#list_disk_offerings(options = {}) ⇒ Object
Lists all available disk offerings.
-
#list_domain_children(options = {}) ⇒ Object
Lists all children domains belonging to a specified domain.
-
#list_domains(options = {}) ⇒ Object
Lists domains and provides detailed information for listed domains.
-
#list_events(options = {}) ⇒ Object
A command to list events.
-
#list_external_firewalls(options = {}) ⇒ Object
List external firewall appliances.
-
#list_external_load_balancers(options = {}) ⇒ Object
List external load balancer appliances.
-
#list_hosts(options = {}) ⇒ Object
Lists hosts.
-
#list_hypervisors(options = {}) ⇒ Object
Lists hypervisors.
-
#list_instance_groups(options = {}) ⇒ Object
Lists VM groups.
-
#list_isos(options = {}) ⇒ Object
Lists all available ISO files.
-
#list_load_balancer_rule_instances(load_balancer_rule_id, options = {}) ⇒ Object
Lists resource limits.
-
#list_load_balancer_rules(options = {}) ⇒ Object
Lists resource limits.
-
#list_network_offerings(options = {}) ⇒ Object
Lists all available network offerings.
-
#list_networks(options = {}) ⇒ Object
Lists all available networks.
-
#list_os_categories(options = {}) ⇒ Object
Lists all supported OS categories for this cloud.
-
#list_os_types(options = {}) ⇒ Object
Lists all supported OS types for this cloud.
-
#list_pods(options = {}) ⇒ Object
Lists all Pods.
-
#list_port_forwarding_rules(options = {}) ⇒ Object
Lists resource limits.
-
#list_public_ip_addresses(options = {}) ⇒ Object
Lists resource limits.
-
#list_resource_limits(options = {}) ⇒ Object
Lists resource limits.
-
#list_security_groups(options = {}) ⇒ Object
Lists security groups.
-
#list_service_offerings(options = {}) ⇒ Object
Lists all available service offerings.
-
#list_snapshot_policies(options = {}) ⇒ Object
Lists domains and provides detailed information for listed domains.
-
#list_snapshots(options = {}) ⇒ Object
Lists all available snapshots for the account.
-
#list_ssh_key_pairs(options = {}) ⇒ Object
List registered keypairs.
-
#list_storage_pools(options = {}) ⇒ Object
Lists storage pools.
-
#list_templates(options = {}) ⇒ Object
List all public, private, and privileged templates.
-
#list_usage_records(options = {}) ⇒ Object
Lists usage records for accounts.
-
#list_users(options = {}) ⇒ Object
Lists user accounts.
-
#list_virtual_machines(options = {}) ⇒ Object
List the virtual machines owned by the account.
-
#list_volumes(options = {}) ⇒ Object
Lists all volumes.
-
#list_zones(options = {}) ⇒ Object
Lists zones.
- #login(username, password, domain) ⇒ Object
-
#migrate_virtual_machine(options = {}) ⇒ Object
Attempts Migration of a virtual machine to the host specified.
-
#query_async_job_result(options = {}) ⇒ Object
Creates a domain.
-
#reboot_virtual_machine(options = {}) ⇒ Object
Updates account information for the authenticated user.
-
#recover_virtual_machine(options = {}) ⇒ Object
Recovers a virtual machine.
-
#register_ssh_key_pair(options = {}) ⇒ Object
Registers an SSH key pair..
-
#register_user_keys(options = {}) ⇒ Object
Enables a user account.
- #reload ⇒ Object
-
#remove_from_load_balancer_rule(id, virtualmachineids = []) ⇒ Object
Removes a virtual machine or a list of virtual machines from a load balancer rule.
- #request(params) ⇒ Object
-
#reset_password_for_virtual_machine(id) ⇒ Object
Returns an encrypted password for the VM.
-
#revoke_security_group_ingress(options = {}) ⇒ Object
Creates an account.
-
#start_virtual_machine(options = {}) ⇒ Object
Updates account information for the authenticated user.
-
#stop_virtual_machine(options = {}) ⇒ Object
Updates account information for the authenticated user.
-
#update_account(options = {}) ⇒ Object
Updates account information for the authenticated user.
-
#update_domain(options = {}) ⇒ Object
Updates a domain with a new name.
-
#update_resource_count(options = {}) ⇒ Object
Updates a user account.
-
#update_user(options = {}) ⇒ Object
Updates a user account.
-
#update_virtual_machine(options = {}) ⇒ Object
Updates account information for the authenticated user.
Constructor Details
#initialize(options = {}) ⇒ Real
Returns a new instance of Real.
137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/fog/cloudstack/compute.rb', line 137 def initialize(={}) require 'multi_json' @cloudstack_api_key = [:cloudstack_api_key] @cloudstack_secret_access_key = [:cloudstack_secret_access_key] @cloudstack_session_id = [:cloudstack_session_id] @cloudstack_session_key = [:cloudstack_session_key] @host = [:cloudstack_host] @path = [:cloudstack_path] || '/client/api' @port = [:cloudstack_port] || 443 @scheme = [:cloudstack_scheme] || 'https' @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", [:cloudstack_persistent], {:ssl_verify_peer => false}) end |
Instance Method Details
#acquire_ip_address(options = {}) ⇒ Object
Creates an account.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/acquire_ip_address.rb', line 9 def acquire_ip_address(={}) .merge!( 'command' => 'associateIpAddress' ) request() end |
#assign_to_load_balancer_rule(id, virtualmachineids = []) ⇒ Object
Assigns virtual machine or a list of virtual machines to a load balancer rule.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/fog/cloudstack/requests/compute/assign_to_load_balancer_rule.rb', line 9 def assign_to_load_balancer_rule(id,virtualmachineids=[]) virtualmachineids = [*virtualmachineids] = { 'command' => 'assignToLoadBalancerRule', 'id' => id, 'virtualmachineids' => virtualmachineids.join(',') } request() end |
#attach_volume(id, virtualmachineid, deviceid = nil) ⇒ Object
Attaches a disk volume to a virtual machine.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/fog/cloudstack/requests/compute/attach_volume.rb', line 9 def attach_volume(id,virtualmachineid,deviceid=nil) = { 'command' => 'attachVolume', 'id' => id, 'virtualmachineid' => virtualmachineid, 'deviceid' => deviceid } request() end |
#authorize_security_group_ingress(options = {}) ⇒ Object
Creates an account.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/authorize_security_group_ingress.rb', line 9 def (={}) .merge!( 'command' => 'authorizeSecurityGroupIngress' ) request() end |
#change_service_for_virtual_machine(options = {}) ⇒ Object
Changes the service offering for a virtual machine. The virtual machine must be in a “Stopped” state for this command to take effect.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/change_service_for_virtual_machine.rb', line 9 def change_service_for_virtual_machine(={}) .merge!( 'command' => 'changeServiceForVirtualMachine' ) request() end |
#create_account(options = {}) ⇒ Object
Creates an account.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/create_account.rb', line 9 def create_account(={}) .merge!( 'command' => 'createAccount' ) request() end |
#create_domain(options = {}) ⇒ Object
Creates a domain.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/create_domain.rb', line 9 def create_domain(={}) .merge!( 'command' => 'createDomain' ) request() end |
#create_load_balancer_rule(options = {}) ⇒ Object
Creates a load balancer rule
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/create_load_balancer_rule.rb', line 9 def create_load_balancer_rule(={}) .merge!( 'command' => 'createLoadBalancerRule' ) request() end |
#create_network(options = {}) ⇒ Object
Creates an network.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/create_network.rb', line 9 def create_network(={}) .merge!( 'command' => 'createNetwork' ) request() end |
#create_port_forwarding_rule(options = {}) ⇒ Object
Creates a domain.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/create_port_forwarding_rule.rb', line 9 def create_port_forwarding_rule(={}) .merge!( 'command' => 'createPortForwardingRule' ) request() end |
#create_security_group(options = {}) ⇒ Object
Creates an account.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/create_security_group.rb', line 9 def create_security_group(={}) .merge!( 'command' => 'createSecurityGroup' ) request() end |
#create_snapshot(options = {}) ⇒ Object
Creates a snapshot for an account that already exists.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/create_snapshot.rb', line 9 def create_snapshot(={}) .merge!( 'command' => 'createSnapshot' ) request() end |
#create_snapshot_policy(options = {}) ⇒ Object
Creates an account.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/create_snapshot_policy.rb', line 9 def create_snapshot_policy(={}) .merge!( 'command' => 'createSnapshotPolicy' ) request() end |
#create_ssh_key_pair(name, options = {}) ⇒ Object
Creates a new SSH key pair..
9 10 11 12 13 14 15 16 |
# File 'lib/fog/cloudstack/requests/compute/create_ssh_key_pair.rb', line 9 def create_ssh_key_pair(name,={}) .merge!( 'command' => 'createSSHKeyPair', 'name' => name ) request() end |
#create_user(options = {}) ⇒ Object
Creates a user for an account that already exists.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/create_user.rb', line 9 def create_user(={}) .merge!( 'command' => 'createUser' ) request() end |
#create_volume(options = {}) ⇒ Object
Creates a volume for an account that already exists.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/create_volume.rb', line 9 def create_volume(={}) .merge!( 'command' => 'createVolume' ) request() end |
#delete_account(options = {}) ⇒ Object
Deletes a account, and all users associated with this account.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/delete_account.rb', line 9 def delete_account(={}) .merge!( 'command' => 'deleteAccount' ) request() end |
#delete_domain(options = {}) ⇒ Object
Deletes a specified domain.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/delete_domain.rb', line 9 def delete_domain(={}) .merge!( 'command' => 'deleteDomain' ) request() end |
#delete_load_balancer_rule(options = {}) ⇒ Object
Creates a domain.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/delete_load_balancer_rule.rb', line 9 def delete_load_balancer_rule(={}) .merge!( 'command' => 'deleteLoadBalancerRule' ) request() end |
#delete_port_forwarding_rule(options = {}) ⇒ Object
Creates a domain.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/delete_port_forwarding_rule.rb', line 9 def delete_port_forwarding_rule(={}) .merge!( 'command' => 'deletePortForwardingRule' ) request() end |
#delete_security_group(options = {}) ⇒ Object
Creates an account.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/delete_security_group.rb', line 9 def delete_security_group(={}) .merge!( 'command' => 'deleteSecurityGroup' ) request() end |
#delete_snapshot(options = {}) ⇒ Object
Deletes a specified user.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/delete_snapshot.rb', line 9 def delete_snapshot(={}) .merge!( 'command' => 'deleteSnapshot' ) request() end |
#delete_snapshot_policy(options = {}) ⇒ Object
Deletes a specified user.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/delete_snapshot_policies.rb', line 9 def delete_snapshot_policy(={}) .merge!( 'command' => 'deleteSnapshotPolicies' ) request() end |
#delete_ssh_key_pair(name, options = {}) ⇒ Object
Deletes a keypair by name
9 10 11 12 13 14 15 16 |
# File 'lib/fog/cloudstack/requests/compute/delete_ssh_key_pair.rb', line 9 def delete_ssh_key_pair(name,={}) .merge!( 'command' => 'deleteSSHKeyPair', 'name' => name ) request() end |
#delete_user(options = {}) ⇒ Object
Deletes a specified user.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/delete_user.rb', line 9 def delete_user(={}) .merge!( 'command' => 'deleteUser' ) request() end |
#delete_volume(options = {}) ⇒ Object
Deletes a specified user.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/delete_volume.rb', line 9 def delete_volume(={}) .merge!( 'command' => 'deleteVolume' ) request() end |
#deploy_virtual_machine(options = {}) ⇒ Object
Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fog/cloudstack/requests/compute/deploy_virtual_machine.rb', line 9 def deploy_virtual_machine(={}) .merge!( 'command' => 'deployVirtualMachine' ) if ( securitygroupids = .delete('securitygroupids') ).is_a?(Array) .merge!('securitygroupids' => securitygroupids.join(',')) end if ( securitygroupnames = .delete('securitygroupnames') ).is_a?(Array) .merge!('securitygroupnames' => securitygroupnames.join(',')) end if ( networkids = .delete('networkids') ).is_a?(Array) .merge!('networkids' => networkids.join(',')) end request() end |
#destroy_virtual_machine(options = {}) ⇒ Object
Updates account information for the authenticated user.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/destroy_virtual_machine.rb', line 9 def destroy_virtual_machine(={}) .merge!( 'command' => 'destroyVirtualMachine' ) request() end |
#detach_volume(id) ⇒ Object
Deletes a specified domain.
9 10 11 12 13 14 15 16 |
# File 'lib/fog/cloudstack/requests/compute/detach_volume.rb', line 9 def detach_volume(id) = { 'command' => 'detachVolume', 'id' => id } request() end |
#disable_account(options = {}) ⇒ Object
Disables an account.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/disable_account.rb', line 9 def disable_account(={}) .merge!( 'command' => 'disableAccount' ) request() end |
#disable_user(options = {}) ⇒ Object
Disables a user account.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/disable_user.rb', line 9 def disable_user(={}) .merge!( 'command' => 'disableUser' ) request() end |
#enable_account(options = {}) ⇒ Object
Enables an account.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/enable_account.rb', line 9 def enable_account(={}) .merge!( 'command' => 'enableAccount' ) request() end |
#enable_user(options = {}) ⇒ Object
Enables a user account.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/enable_user.rb', line 9 def enable_user(={}) .merge!( 'command' => 'enableUser' ) request() end |
#generate_usage_records(options = {}) ⇒ Object
Lists all available networks.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/fog/cloudstack/requests/compute/generate_usage_records.rb', line 9 def generate_usage_records(={}) .merge!( 'command' => 'generateUsageRecords' ) if startdate = .delete('startdate') .merge!('startdate' => startdate.strftime('%Y-%m-%d')) end if enddate = .delete('enddate') .merge!('enddate' => enddate.strftime('%Y-%m-%d')) end request() end |
#get_vm_password(id) ⇒ Object
Returns an encrypted password for the VM
9 10 11 12 13 14 15 16 |
# File 'lib/fog/cloudstack/requests/compute/get_vm_password.rb', line 9 def get_vm_password(id) = { 'command' => 'getVMPassword', 'id' => id } request() end |
#list_accounts(options = {}) ⇒ Object
Lists accounts and provides detailed account information for listed accounts.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_accounts.rb', line 9 def list_accounts(={}) .merge!( 'command' => 'listAccounts' ) request() end |
#list_alerts(options = {}) ⇒ Object
Lists all alerts.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_alerts.rb', line 9 def list_alerts(={}) .merge!( 'command' => 'listAlerts' ) request() end |
#list_async_jobs(options = {}) ⇒ Object
Lists all pending asynchronous jobs for the account.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_async_jobs.rb', line 9 def list_async_jobs(={}) .merge!( 'command' => 'listAsyncJobs' ) request() end |
#list_capabilities(options = {}) ⇒ Object
Lists configurations and provides detailed account information for listed configurations.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_capabilities.rb', line 9 def list_capabilities(={}) .merge!( 'command' => 'listCapabilities' ) request() end |
#list_capacity(options = {}) ⇒ Object
Lists domains and provides detailed information for listed domains.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_capacity.rb', line 9 def list_capacity(={}) .merge!( 'command' => 'listCapacity' ) request() end |
#list_clusters(options = {}) ⇒ Object
Lists configurations and provides detailed account information for listed configurations.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_clusters.rb', line 9 def list_clusters(={}) .merge!( 'command' => 'listClusters' ) request() end |
#list_configurations(options = {}) ⇒ Object
Lists configurations and provides detailed account information for listed configurations.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_configurations.rb', line 9 def list_configurations(={}) .merge!( 'command' => 'listConfigurations' ) request() end |
#list_disk_offerings(options = {}) ⇒ Object
Lists all available disk offerings.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_disk_offerings.rb', line 9 def list_disk_offerings(={}) .merge!( 'command' => 'listDiskOfferings' ) request() end |
#list_domain_children(options = {}) ⇒ Object
Lists all children domains belonging to a specified domain.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_domain_children.rb', line 9 def list_domain_children(={}) .merge!( 'command' => 'listDomainChildren' ) request() end |
#list_domains(options = {}) ⇒ Object
Lists domains and provides detailed information for listed domains.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_domains.rb', line 9 def list_domains(={}) .merge!( 'command' => 'listDomains' ) request() end |
#list_events(options = {}) ⇒ Object
A command to list events.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_events.rb', line 9 def list_events(={}) .merge!( 'command' => 'listEvents' ) request() end |
#list_external_firewalls(options = {}) ⇒ Object
List external firewall appliances.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_external_firewalls.rb', line 9 def list_external_firewalls(={}) .merge!( 'command' => 'listExternalFirewalls' ) request() end |
#list_external_load_balancers(options = {}) ⇒ Object
List external load balancer appliances.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_external_load_balancers.rb', line 9 def list_external_load_balancers(={}) .merge!( 'command' => 'listExternalLoadBalancers' ) request() end |
#list_hosts(options = {}) ⇒ Object
Lists hosts.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_hosts.rb', line 9 def list_hosts(={}) .merge!( 'command' => 'listHosts' ) request() end |
#list_hypervisors(options = {}) ⇒ Object
Lists hypervisors.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_hypervisors.rb', line 9 def list_hypervisors(={}) .merge!( 'command' => 'listHypervisors' ) request() end |
#list_instance_groups(options = {}) ⇒ Object
Lists VM groups.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_instance_groups.rb', line 9 def list_instance_groups(={}) .merge!( 'command' => 'listInstanceGroups' ) request() end |
#list_isos(options = {}) ⇒ Object
Lists all available ISO files.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_isos.rb', line 9 def list_isos(={}) .merge!( 'command' => 'listIsos' ) request() end |
#list_load_balancer_rule_instances(load_balancer_rule_id, options = {}) ⇒ Object
Lists resource limits.
9 10 11 12 13 14 15 16 |
# File 'lib/fog/cloudstack/requests/compute/list_load_balancer_rule_instances.rb', line 9 def list_load_balancer_rule_instances(load_balancer_rule_id,={}) .merge!( 'command' => 'listLoadBalancerRuleInstances', 'id' => load_balancer_rule_id ) request() end |
#list_load_balancer_rules(options = {}) ⇒ Object
Lists resource limits.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_load_balancer_rules.rb', line 9 def list_load_balancer_rules(={}) .merge!( 'command' => 'listLoadBalancerRules' ) request() end |
#list_network_offerings(options = {}) ⇒ Object
Lists all available network offerings.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_network_offerings.rb', line 9 def list_network_offerings(={}) .merge!( 'command' => 'listNetworkOfferings' ) request() end |
#list_networks(options = {}) ⇒ Object
Lists all available networks.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_networks.rb', line 9 def list_networks(={}) .merge!( 'command' => 'listNetworks' ) request() end |
#list_os_categories(options = {}) ⇒ Object
Lists all supported OS categories for this cloud.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_os_categories.rb', line 9 def list_os_categories(={}) .merge!( 'command' => 'listOsCategories' ) request() end |
#list_os_types(options = {}) ⇒ Object
Lists all supported OS types for this cloud.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_os_types.rb', line 9 def list_os_types(={}) .merge!( 'command' => 'listOsTypes' ) request() end |
#list_pods(options = {}) ⇒ Object
Lists all Pods.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_pods.rb', line 9 def list_pods(={}) .merge!( 'command' => 'listPods' ) request() end |
#list_port_forwarding_rules(options = {}) ⇒ Object
Lists resource limits.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_port_forwarding_rules.rb', line 9 def list_port_forwarding_rules(={}) .merge!( 'command' => 'listPortForwardingRules' ) request() end |
#list_public_ip_addresses(options = {}) ⇒ Object
Lists resource limits.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_public_ip_addresses.rb', line 9 def list_public_ip_addresses(={}) .merge!( 'command' => 'listPublicIpAddresses' ) request() end |
#list_resource_limits(options = {}) ⇒ Object
Lists resource limits.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_resource_limits.rb', line 9 def list_resource_limits(={}) .merge!( 'command' => 'listResourceLimits' ) request() end |
#list_security_groups(options = {}) ⇒ Object
Lists security groups.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_security_groups.rb', line 9 def list_security_groups(={}) .merge!( 'command' => 'listSecurityGroups' ) request() end |
#list_service_offerings(options = {}) ⇒ Object
Lists all available service offerings.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_service_offerings.rb', line 9 def list_service_offerings(={}) .merge!( 'command' => 'listServiceOfferings' ) request() end |
#list_snapshot_policies(options = {}) ⇒ Object
Lists domains and provides detailed information for listed domains.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_snapshot_policies.rb', line 9 def list_snapshot_policies(={}) .merge!( 'command' => 'listSnapshotPolicies' ) request() end |
#list_snapshots(options = {}) ⇒ Object
Lists all available snapshots for the account.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_snapshots.rb', line 9 def list_snapshots(={}) .merge!( 'command' => 'listSnapshots' ) request() end |
#list_ssh_key_pairs(options = {}) ⇒ Object
List registered keypairs.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_ssh_key_pairs.rb', line 9 def list_ssh_key_pairs(={}) .merge!( 'command' => 'listSSHKeyPairs' ) request() end |
#list_storage_pools(options = {}) ⇒ Object
Lists storage pools.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_storage_pools.rb', line 9 def list_storage_pools(={}) .merge!( 'command' => 'listStoragePools' ) request() end |
#list_templates(options = {}) ⇒ Object
List all public, private, and privileged templates.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_templates.rb', line 9 def list_templates(={}) .merge!( 'command' => 'listTemplates' ) request() end |
#list_usage_records(options = {}) ⇒ Object
Lists usage records for accounts.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/fog/cloudstack/requests/compute/list_usage_records.rb', line 9 def list_usage_records(={}) .merge!( 'command' => 'listUsageRecords' ) if startdate = .delete('startdate') .merge!('startdate' => startdate.strftime('%Y-%m-%d')) end if enddate = .delete('enddate') .merge!('enddate' => enddate.strftime('%Y-%m-%d')) end request() end |
#list_users(options = {}) ⇒ Object
Lists user accounts.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_users.rb', line 9 def list_users(={}) .merge!( 'command' => 'listUsers' ) request() end |
#list_virtual_machines(options = {}) ⇒ Object
List the virtual machines owned by the account.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_virtual_machines.rb', line 9 def list_virtual_machines(={}) .merge!( 'command' => 'listVirtualMachines' ) request() end |
#list_volumes(options = {}) ⇒ Object
Lists all volumes.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_volumes.rb', line 9 def list_volumes(={}) .merge!( 'command' => 'listVolumes' ) request() end |
#list_zones(options = {}) ⇒ Object
Lists zones.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/list_zones.rb', line 9 def list_zones(={}) .merge!( 'command' => 'listZones' ) request() end |
#login(username, password, domain) ⇒ Object
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/fog/cloudstack/compute.rb', line 154 def login(username,password,domain) response = issue_request({ 'response' => 'json', 'command' => 'login', 'username' => username, 'password' => Digest::MD5.hexdigest(password), 'domain' => domain }) # Parse response cookies to retrive JSESSIONID token = CGI::Cookie.parse(response.headers['Set-Cookie']) sessionid = ['JSESSIONID'].first # Decode the login response response = MultiJson.decode(response.body) user = response['loginresponse'] user.merge!('sessionid' => sessionid) @cloudstack_session_id = user['sessionid'] @cloudstack_session_key = user['sessionkey'] user end |
#migrate_virtual_machine(options = {}) ⇒ Object
Attempts Migration of a virtual machine to the host specified
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/migrate_virtual_machine.rb', line 9 def migrate_virtual_machine(={}) .merge!( 'command' => 'migrateVirtualMachine' ) request() end |
#query_async_job_result(options = {}) ⇒ Object
Creates a domain.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/query_async_job_result.rb', line 9 def query_async_job_result(={}) .merge!( 'command' => 'queryAsyncJobResult' ) request() end |
#reboot_virtual_machine(options = {}) ⇒ Object
Updates account information for the authenticated user.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/reboot_virtual_machine.rb', line 9 def reboot_virtual_machine(={}) .merge!( 'command' => 'rebootVirtualMachine' ) request() end |
#recover_virtual_machine(options = {}) ⇒ Object
Recovers a virtual machine.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/recover_virtual_machine.rb', line 9 def recover_virtual_machine(={}) .merge!( 'command' => 'recoverVirtualMachine' ) request() end |
#register_ssh_key_pair(options = {}) ⇒ Object
Registers an SSH key pair..
9 10 11 12 13 14 |
# File 'lib/fog/cloudstack/requests/compute/register_ssh_key_pair.rb', line 9 def register_ssh_key_pair(={}) .merge!( 'command' => 'registerSSHKeyPair' ) request() end |
#register_user_keys(options = {}) ⇒ Object
Enables a user account.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/register_user_keys.rb', line 9 def register_user_keys(={}) .merge!( 'command' => 'registerUserKeys' ) request() end |
#reload ⇒ Object
150 151 152 |
# File 'lib/fog/cloudstack/compute.rb', line 150 def reload @connection.reset end |
#remove_from_load_balancer_rule(id, virtualmachineids = []) ⇒ Object
Removes a virtual machine or a list of virtual machines from a load balancer rule.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/fog/cloudstack/requests/compute/remove_from_load_balancer_rule.rb', line 9 def remove_from_load_balancer_rule(id,virtualmachineids=[]) virtualmachineids = [*virtualmachineids] = { 'command' => 'removeFromLoadBalancerRule', 'id' => id, 'virtualmachineids' => virtualmachineids.join(',') } request() end |
#request(params) ⇒ Object
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
# File 'lib/fog/cloudstack/compute.rb', line 179 def request(params) params.reject!{|k,v| v.nil?} params.merge!('response' => 'json') if has_session? params, headers = (params) elsif has_keys? params, headers = (params) end response = issue_request(params,headers) response = MultiJson.decode(response.body) unless response.body.empty? response end |
#reset_password_for_virtual_machine(id) ⇒ Object
Returns an encrypted password for the VM
9 10 11 12 13 14 15 16 |
# File 'lib/fog/cloudstack/requests/compute/reset_password_for_virtual_machine.rb', line 9 def reset_password_for_virtual_machine(id) = { 'command' => 'resetPasswordForVirtualMachine', 'id' => id } request() end |
#revoke_security_group_ingress(options = {}) ⇒ Object
Creates an account.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/revoke_security_group_ingress.rb', line 9 def revoke_security_group_ingress(={}) .merge!( 'command' => 'revokeSecurityGroupIngress' ) request() end |
#start_virtual_machine(options = {}) ⇒ Object
Updates account information for the authenticated user.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/start_virtual_machine.rb', line 9 def start_virtual_machine(={}) .merge!( 'command' => 'startVirtualMachine' ) request() end |
#stop_virtual_machine(options = {}) ⇒ Object
Updates account information for the authenticated user.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/stop_virtual_machine.rb', line 9 def stop_virtual_machine(={}) .merge!( 'command' => 'stopVirtualMachine' ) request() end |
#update_account(options = {}) ⇒ Object
Updates account information for the authenticated user.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/update_account.rb', line 9 def update_account(={}) .merge!( 'command' => 'updateAccount' ) request() end |
#update_domain(options = {}) ⇒ Object
Updates a domain with a new name.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/update_domain.rb', line 9 def update_domain(={}) .merge!( 'command' => 'updateDomain' ) request() end |
#update_resource_count(options = {}) ⇒ Object
Updates a user account.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/update_resource_count.rb', line 9 def update_resource_count(={}) .merge!( 'command' => 'updateResourceCount' ) request() end |
#update_user(options = {}) ⇒ Object
Updates a user account.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/update_user.rb', line 9 def update_user(={}) .merge!( 'command' => 'updateUser' ) request() end |
#update_virtual_machine(options = {}) ⇒ Object
Updates account information for the authenticated user.
9 10 11 12 13 14 15 |
# File 'lib/fog/cloudstack/requests/compute/update_virtual_machine.rb', line 9 def update_virtual_machine(={}) .merge!( 'command' => 'updateVirtualMachine' ) request() end |