In Files

Parent

Methods

Class/Module Index [+]

Quicksearch

Fog::Compute::Cloudstack::Real

Public Class Methods

new(options={}) click to toggle source
# File lib/fog/cloudstack/compute.rb, line 144
def initialize(options={})
  @cloudstack_api_key           = options[:cloudstack_api_key]
  @cloudstack_secret_access_key = options[:cloudstack_secret_access_key]
  @cloudstack_session_id        = options[:cloudstack_session_id]
  @cloudstack_session_key       = options[:cloudstack_session_key]
  @host                         = options[:cloudstack_host]
  @path                         = options[:cloudstack_path]    || '/client/api'
  @port                         = options[:cloudstack_port]    || 443
  @scheme                       = options[:cloudstack_scheme]  || 'https'
  @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", options[:cloudstack_persistent], {:ssl_verify_peer => false})
end

Public Instance Methods

acquire_ip_address(options={}) click to toggle source

Creates an account.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/acquire_ip_address.rb, line 9
def acquire_ip_address(options={})
  options.merge!(
    'command' => 'associateIpAddress'
  )

  request(options)
end
assign_to_load_balancer_rule(id,virtualmachineids=[]) click to toggle source

Assigns virtual machine or a list of virtual machines to a load balancer rule.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/assign_to_load_balancer_rule.rb, line 9
def assign_to_load_balancer_rule(id,virtualmachineids=[])
  virtualmachineids = [*virtualmachineids]
  
  options = {
    'command' => 'assignToLoadBalancerRule',
    'id' => id,
    'virtualmachineids' => virtualmachineids.join(',')
  }

  request(options)
end
assign_virtual_machine(options={}) click to toggle source
# File lib/fog/cloudstack/requests/compute/assign_virtual_machine.rb, line 5
def assign_virtual_machine(options={})
  options.merge!('command' => 'assignVirtualMachine')

  request(options)
end
attach_volume(options={}) click to toggle source

Attaches a disk volume to a virtual machine.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/attach_volume.rb, line 9
def attach_volume(options={})
  options.merge!(
    'command' => 'attachVolume'
  )

  request(options)
end
authorize_security_group_egress(options={}) click to toggle source
# File lib/fog/cloudstack/requests/compute/authorize_security_group_egress.rb, line 5
def authorize_security_group_egress(options={})
  options.merge!(
    'command' => 'authorizeSecurityGroupEgress'
  )

  request(options)
end
authorize_security_group_ingress(options={}) click to toggle source
# File lib/fog/cloudstack/requests/compute/authorize_security_group_ingress.rb, line 6
def authorize_security_group_ingress(options={})
  options.merge!(
    'command' => 'authorizeSecurityGroupIngress'
  )

  request(options)
end
change_service_for_virtual_machine(options={}) click to toggle source

Changes the service offering for a virtual machine. The virtual machine must be in a "Stopped" state for this command to take effect.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/change_service_for_virtual_machine.rb, line 9
def change_service_for_virtual_machine(options={})
  options.merge!(
    'command' => 'changeServiceForVirtualMachine'
  )

  request(options)
end
create_account(options={}) click to toggle source

Creates an account.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/create_account.rb, line 9
def create_account(options={})
  options.merge!(
    'command' => 'createAccount'
  )

  request(options)
end
create_disk_offering(options={}) click to toggle source

Creates a disk offering.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/create_disk_offering.rb, line 9
def create_disk_offering(options={})
  options.merge!(
    'command' => 'createDiskOffering'
  )
  request(options)
end
create_domain(options={}) click to toggle source

Creates a domain.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/create_domain.rb, line 9
def create_domain(options={})
  options.merge!(
    'command' => 'createDomain'
  )

  request(options)
end
create_load_balancer_rule(options={}) click to toggle source

Creates a load balancer rule

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/create_load_balancer_rule.rb, line 9
def create_load_balancer_rule(options={})
  options.merge!(
    'command' => 'createLoadBalancerRule'
  )

  request(options)
end
create_network(options={}) click to toggle source

Creates an network.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/create_network.rb, line 9
def create_network(options={})
  options.merge!(
    'command' => 'createNetwork'
  )

  request(options)
end
create_port_forwarding_rule(options={}) click to toggle source

Creates a domain.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/create_port_forwarding_rule.rb, line 9
def create_port_forwarding_rule(options={})
  options.merge!(
    'command' => 'createPortForwardingRule'
  )

  request(options)
end
create_security_group(options={}) click to toggle source
# File lib/fog/cloudstack/requests/compute/create_security_group.rb, line 5
def create_security_group(options={})
  options.merge!(
    'command' => 'createSecurityGroup'
  )

  request(options)
end
create_snapshot(options={}) click to toggle source

Creates a snapshot for an account that already exists.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/create_snapshot.rb, line 9
def create_snapshot(options={})
  options.merge!(
    'command' => 'createSnapshot'
  )

  request(options)
end
create_snapshot_policy(options={}) click to toggle source

Creates an account.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/create_snapshot_policy.rb, line 9
def create_snapshot_policy(options={})
  options.merge!(
    'command' => 'createSnapshotPolicy'
  )

  request(options)
end
create_ssh_key_pair(name,options={}) click to toggle source

Creates a new SSH key pair..

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/create_ssh_key_pair.rb, line 9
def create_ssh_key_pair(name,options={})
  options.merge!(
    'command' => 'createSSHKeyPair',
    'name' => name
  )

  request(options)
end
create_user(options={}) click to toggle source

Creates a user for an account that already exists.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/create_user.rb, line 9
def create_user(options={})
  options.merge!(
    'command' => 'createUser'
  )

  request(options)
end
create_volume(options={}) click to toggle source

Creates a volume for an account that already exists.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/create_volume.rb, line 9
def create_volume(options={})
  options.merge!(
    'command' => 'createVolume'
  )

  request(options)
end
create_zone(options={}) click to toggle source

Lists zones.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/create_zone.rb, line 9
def create_zone(options={})
  options.merge!(
    'command' => 'createZone'
  )

  request(options)
end
delete_account(options={}) click to toggle source

Deletes a account, and all users associated with this account.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/delete_account.rb, line 9
def delete_account(options={})
  options.merge!(
    'command' => 'deleteAccount'
  )

  request(options)
end
delete_disk_offering(options={}) click to toggle source

Updates a disk offering.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/delete_disk_offering.rb, line 9
def delete_disk_offering(options={})
  options.merge!(
    'command' => 'deleteDiskOffering'
  )
  request(options)
end
delete_domain(options={}) click to toggle source

Deletes a specified domain.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/delete_domain.rb, line 9
def delete_domain(options={})
  options.merge!(
    'command' => 'deleteDomain'
  )

  request(options)
end
delete_load_balancer_rule(options={}) click to toggle source

Creates a domain.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/delete_load_balancer_rule.rb, line 9
def delete_load_balancer_rule(options={})
  options.merge!(
    'command' => 'deleteLoadBalancerRule'
  )

  request(options)
end
delete_port_forwarding_rule(options={}) click to toggle source

Creates a domain.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/delete_port_forwarding_rule.rb, line 9
def delete_port_forwarding_rule(options={})
  options.merge!(
    'command' => 'deletePortForwardingRule'
  )

  request(options)
end
delete_security_group(options={}) click to toggle source

Creates an account.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/delete_security_group.rb, line 9
def delete_security_group(options={})
  options.merge!(
    'command' => 'deleteSecurityGroup'
  )

  request(options)
end
delete_snapshot(options={}) click to toggle source

Deletes a specified snapshot.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/delete_snapshot.rb, line 9
def delete_snapshot(options={})
  options.merge!(
    'command' => 'deleteSnapshot'
  )

  request(options)
end
delete_snapshot_policy(options={}) click to toggle source

Deletes a specified user.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/delete_snapshot_policies.rb, line 9
def delete_snapshot_policy(options={})
  options.merge!(
    'command' => 'deleteSnapshotPolicies'
  )

  request(options)
end
delete_ssh_key_pair(name,options={}) click to toggle source

Deletes a keypair by name

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/delete_ssh_key_pair.rb, line 9
def delete_ssh_key_pair(name,options={})
  options.merge!(
    'command' => 'deleteSSHKeyPair',
    'name' => name
  )

  request(options)
end
delete_template(options={}) click to toggle source

Deletes a specified template.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/delete_template.rb, line 9
def delete_template(options={})
  options.merge!(
    'command' => 'deleteTemplate'
  )

  request(options)
end
delete_user(options={}) click to toggle source

Deletes a specified user.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/delete_user.rb, line 9
def delete_user(options={})
  options.merge!(
    'command' => 'deleteUser'
  )

  request(options)
end
delete_volume(options={}) click to toggle source

Deletes a specified user.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/delete_volume.rb, line 9
def delete_volume(options={})
  options.merge!(
    'command' => 'deleteVolume'
  )

  request(options)
end
deploy_virtual_machine(options={}) click to toggle source

Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/deploy_virtual_machine.rb, line 9
def deploy_virtual_machine(options={})
  options.merge!(
    'command' => 'deployVirtualMachine'
  )

  if security_group_ids = options.delete('securitygroupids')
    options.merge!('securitygroupids' => Array(security_group_ids).join(','))
  end

  if security_group_names = options.delete('securitygroupnames')
    options.merge!('securitygroupnames' => Array(security_group_names).join(','))
  end

  if network_ids = options.delete('networkids')
    options.merge!('networkids' => Array(network_ids).join(','))
  end

  request(options)
end
destroy_virtual_machine(options={}) click to toggle source

Updates account information for the authenticated user.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/destroy_virtual_machine.rb, line 9
def destroy_virtual_machine(options={})
  options.merge!(
    'command' => 'destroyVirtualMachine'
  )

  request(options)
end
detach_volume(options={}) click to toggle source

Deletes a specified domain.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/detach_volume.rb, line 9
def detach_volume(options={})
  options.merge!(
    'command' => 'detachVolume'
  )

  request(options)
end
disable_account(options={}) click to toggle source

Disables an account.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/disable_account.rb, line 9
def disable_account(options={})
  options.merge!(
    'command' => 'disableAccount'
  )

  request(options)
end
disable_user(options={}) click to toggle source

Disables a user account.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/disable_user.rb, line 9
def disable_user(options={})
  options.merge!(
    'command' => 'disableUser'
  )

  request(options)
end
enable_account(options={}) click to toggle source

Enables an account.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/enable_account.rb, line 9
def enable_account(options={})
  options.merge!(
    'command' => 'enableAccount'
  )

  request(options)
end
enable_user(options={}) click to toggle source

Enables a user account.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/enable_user.rb, line 9
def enable_user(options={})
  options.merge!(
    'command' => 'enableUser'
  )

  request(options)
end
generate_usage_records(options={}) click to toggle source

Lists all available networks.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/generate_usage_records.rb, line 9
def generate_usage_records(options={})
  options.merge!(
    'command' => 'generateUsageRecords'
  )
  
  if startdate = options.delete('startdate')
    options.merge!('startdate' => startdate.strftime('%Y-%m-%d'))
  end
  
  if enddate = options.delete('enddate')
    options.merge!('enddate' => enddate.strftime('%Y-%m-%d'))
  end
  
  request(options)
end
get_vm_password(id) click to toggle source

Returns an encrypted password for the VM

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/get_vm_password.rb, line 9
def get_vm_password(id)
  options = {
    'command' => 'getVMPassword',
    'id' => id
  }
  
  request(options)
end
list_accounts(options={}) click to toggle source

Lists accounts and provides detailed account information for listed accounts.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_accounts.rb, line 9
def list_accounts(options={})
  options.merge!(
    'command' => 'listAccounts'
  )
  
  request(options)
end
list_alerts(options={}) click to toggle source

Lists all alerts.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_alerts.rb, line 9
def list_alerts(options={})
  options.merge!(
    'command' => 'listAlerts'
  )
  
  request(options)
end
list_async_jobs(options={}) click to toggle source

Lists all pending asynchronous jobs for the account.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_async_jobs.rb, line 9
def list_async_jobs(options={})
  options.merge!(
    'command' => 'listAsyncJobs'
  )

  request(options)
end
list_capabilities(options={}) click to toggle source

Lists configurations and provides detailed account information for listed configurations.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_capabilities.rb, line 9
def list_capabilities(options={})
  options.merge!(
    'command' => 'listCapabilities'
  )

  request(options)
end
list_capacity(options={}) click to toggle source

Lists domains and provides detailed information for listed domains.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_capacity.rb, line 9
def list_capacity(options={})
  options.merge!(
    'command' => 'listCapacity'
  )
  
  request(options)
end
list_clusters(options={}) click to toggle source

Lists configurations and provides detailed account information for listed configurations.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_clusters.rb, line 9
def list_clusters(options={})
  options.merge!(
    'command' => 'listClusters'
  )
  
  request(options)
end
list_configurations(options={}) click to toggle source

Lists configurations and provides detailed account information for listed configurations.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_configurations.rb, line 9
def list_configurations(options={})
  options.merge!(
    'command' => 'listConfigurations'
  )
  
  request(options)
end
list_disk_offerings(options={}) click to toggle source

Lists all available disk offerings.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_disk_offerings.rb, line 9
def list_disk_offerings(options={})
  options.merge!(
    'command' => 'listDiskOfferings'
  )
  
  request(options)
end
list_domain_children(options={}) click to toggle source

Lists all children domains belonging to a specified domain.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_domain_children.rb, line 9
def list_domain_children(options={})
  options.merge!(
    'command' => 'listDomainChildren'
  )
  
  request(options)
end
list_domains(options={}) click to toggle source

Lists domains and provides detailed information for listed domains.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_domains.rb, line 9
def list_domains(options={})
  options.merge!(
    'command' => 'listDomains'
  )
  
  request(options)
end
list_events(options={}) click to toggle source

A command to list events.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_events.rb, line 9
def list_events(options={})
  options.merge!(
    'command' => 'listEvents'
  )
  
  request(options)
end
list_external_firewalls(options={}) click to toggle source

List external firewall appliances.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_external_firewalls.rb, line 9
def list_external_firewalls(options={})
  options.merge!(
    'command' => 'listExternalFirewalls'
  )
  
  request(options)
end
list_external_load_balancers(options={}) click to toggle source

List external load balancer appliances.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_external_load_balancers.rb, line 9
def list_external_load_balancers(options={})
  options.merge!(
    'command' => 'listExternalLoadBalancers'
  )
  
  request(options)
end
list_firewall_rules(options={}) click to toggle source
# File lib/fog/cloudstack/requests/compute/list_firewall_rules.rb, line 5
def list_firewall_rules(options={})
  options.merge!(
    'command' => 'listFirewallRules'
  )
  request(options)
end
list_hosts(options={}) click to toggle source

Lists hosts.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_hosts.rb, line 9
def list_hosts(options={})
  options.merge!(
    'command' => 'listHosts'
  )
  
  request(options)
end
list_hypervisors(options={}) click to toggle source

Lists hypervisors.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_hypervisors.rb, line 9
def list_hypervisors(options={})
  options.merge!(
    'command' => 'listHypervisors'
  )
  
  request(options)
end
list_instance_groups(options={}) click to toggle source

Lists VM groups.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_instance_groups.rb, line 9
def list_instance_groups(options={})
  options.merge!(
    'command' => 'listInstanceGroups'
  )
  
  request(options)
end
list_isos(options={}) click to toggle source

Lists all available ISO files.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_isos.rb, line 9
def list_isos(options={})
  options.merge!(
    'command' => 'listIsos'
  )
  
  request(options)
end
list_load_balancer_rule_instances(load_balancer_rule_id,options={}) click to toggle source

Lists resource limits.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_load_balancer_rule_instances.rb, line 9
def list_load_balancer_rule_instances(load_balancer_rule_id,options={})
  options.merge!(
    'command' => 'listLoadBalancerRuleInstances',
    'id' => load_balancer_rule_id
  )
  
  request(options)
end
list_load_balancer_rules(options={}) click to toggle source

Lists resource limits.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_load_balancer_rules.rb, line 9
def list_load_balancer_rules(options={})
  options.merge!(
    'command' => 'listLoadBalancerRules'
  )
  
  request(options)
end
list_network_offerings(options={}) click to toggle source

Lists all available network offerings.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_network_offerings.rb, line 9
def list_network_offerings(options={})
  options.merge!(
    'command' => 'listNetworkOfferings'
  )
  
  request(options)
end
list_networks(options={}) click to toggle source

Lists all available networks.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_networks.rb, line 9
def list_networks(options={})
  options.merge!(
    'command' => 'listNetworks'
  )
  
  request(options)
end
list_os_categories(options={}) click to toggle source

Lists all supported OS categories for this cloud.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_os_categories.rb, line 9
def list_os_categories(options={})
  options.merge!(
    'command' => 'listOsCategories'
  )
  
  request(options)
end
list_os_types(options={}) click to toggle source

Lists all supported OS types for this cloud.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_os_types.rb, line 9
def list_os_types(options={})
  options.merge!(
    'command' => 'listOsTypes'
  )
  
  request(options)
end
list_pods(options={}) click to toggle source

Lists all Pods.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_pods.rb, line 9
def list_pods(options={})
  options.merge!(
    'command' => 'listPods'
  )
  
  request(options)
end
list_port_forwarding_rules(options={}) click to toggle source

Lists resource limits.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_port_forwarding_rules.rb, line 9
def list_port_forwarding_rules(options={})
  options.merge!(
    'command' => 'listPortForwardingRules'
  )
  
  request(options)
end
list_public_ip_addresses(options={}) click to toggle source

Lists resource limits.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_public_ip_addresses.rb, line 9
def list_public_ip_addresses(options={})
  options.merge!(
    'command' => 'listPublicIpAddresses'
  )
  
  request(options)
end
list_resource_limits(options={}) click to toggle source

Lists resource limits.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_resource_limits.rb, line 9
def list_resource_limits(options={})
  options.merge!(
    'command' => 'listResourceLimits'
  )
  
  request(options)
end
list_security_groups(options={}) click to toggle source
# File lib/fog/cloudstack/requests/compute/list_security_groups.rb, line 6
def list_security_groups(options={})
  options.merge!(
    'command' => 'listSecurityGroups'
  )

  request(options)
end
list_service_offerings(options={}) click to toggle source

Lists all available service offerings.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_service_offerings.rb, line 9
def list_service_offerings(options={})
  options.merge!(
    'command' => 'listServiceOfferings'
  )

  request(options)
end
list_snapshot_policies(options={}) click to toggle source

Lists domains and provides detailed information for listed domains.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_snapshot_policies.rb, line 9
def list_snapshot_policies(options={})
  options.merge!(
    'command' => 'listSnapshotPolicies'
  )
  
  request(options)
end
list_snapshots(options={}) click to toggle source

Lists all available snapshots for the account.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_snapshots.rb, line 9
def list_snapshots(options={})
  options.merge!(
    'command' => 'listSnapshots'
  )
  
  request(options)
end
list_ssh_key_pairs(options={}) click to toggle source

List registered keypairs.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_ssh_key_pairs.rb, line 9
def list_ssh_key_pairs(options={})
  options.merge!(
    'command' => 'listSSHKeyPairs'
  )
  
  request(options)
end
list_storage_pools(options={}) click to toggle source

Lists storage pools.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_storage_pools.rb, line 9
def list_storage_pools(options={})
  options.merge!(
    'command' => 'listStoragePools'
  )
  
  request(options)
end
list_templates(options={}) click to toggle source

List all public, private, and privileged templates.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_templates.rb, line 9
def list_templates(options={})
  options.merge!(
    'command' => 'listTemplates'
  )

  request(options)
end
list_usage_records(options={}) click to toggle source

Lists usage records for accounts.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_usage_records.rb, line 9
def list_usage_records(options={})
  options.merge!(
    'command' => 'listUsageRecords'
  )
  
  if startdate = options.delete('startdate')
    options.merge!('startdate' => startdate.strftime('%Y-%m-%d'))
  end
  
  if enddate = options.delete('enddate')
    options.merge!('enddate' => enddate.strftime('%Y-%m-%d'))
  end
  
  request(options)
end
list_users(options={}) click to toggle source

Lists user accounts.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_users.rb, line 9
def list_users(options={})
  options.merge!(
    'command' => 'listUsers'
  )
  
  request(options)
end
list_virtual_machines(options={}) click to toggle source

List the virtual machines owned by the account.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_virtual_machines.rb, line 9
def list_virtual_machines(options={})
  options.merge!(
    'command' => 'listVirtualMachines'
  )

  request(options)
end
list_volumes(options={}) click to toggle source

Lists all volumes.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_volumes.rb, line 9
def list_volumes(options={})
  options.merge!(
    'command' => 'listVolumes'
  )

  request(options)
end
list_zones(options={}) click to toggle source

Lists zones.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/list_zones.rb, line 9
def list_zones(options={})
  options.merge!(
    'command' => 'listZones'
  )

  request(options)
end
login(username,password,domain) click to toggle source
# File lib/fog/cloudstack/compute.rb, line 160
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
  cookies   = CGI::Cookie.parse(response.headers['Set-Cookie'])
  sessionid = cookies['JSESSIONID'].first

  # Decode the login response
  response   = Fog::JSON.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={}) click to toggle source

Attempts Migration of a virtual machine to the host specified

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/migrate_virtual_machine.rb, line 9
def migrate_virtual_machine(options={})
  options.merge!(
    'command' => 'migrateVirtualMachine'
  )

  request(options)
end
query_async_job_result(options={}) click to toggle source
# File lib/fog/cloudstack/requests/compute/query_async_job_result.rb, line 6
def query_async_job_result(options={})
  options.merge!(
    'command' => 'queryAsyncJobResult'
  )

  request(options)
end
reboot_virtual_machine(options={}) click to toggle source

Updates account information for the authenticated user.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/reboot_virtual_machine.rb, line 9
def reboot_virtual_machine(options={})
  options.merge!(
    'command' => 'rebootVirtualMachine'
  )

  request(options)
end
recover_virtual_machine(options={}) click to toggle source

Recovers a virtual machine.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/recover_virtual_machine.rb, line 9
def recover_virtual_machine(options={})
  options.merge!(
    'command' => 'recoverVirtualMachine'
  )

  request(options)
end
register_ssh_key_pair(options={}) click to toggle source

Registers an SSH key pair..

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/register_ssh_key_pair.rb, line 9
def register_ssh_key_pair(options={})
  options.merge!(
    'command' => 'registerSSHKeyPair'
  )
  request(options)
end
register_template(options={}) click to toggle source

Registers an existing template into the cloud.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/register_template.rb, line 9
def register_template(options={})
  options.merge!(
      'command' => 'registerTemplate'
  )

  request(options)
end
register_user_keys(options={}) click to toggle source

Enables a user account.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/register_user_keys.rb, line 9
def register_user_keys(options={})
  options.merge!(
    'command' => 'registerUserKeys'
  )

  request(options)
end
reload() click to toggle source
# File lib/fog/cloudstack/compute.rb, line 156
def reload
  @connection.reset
end
remove_from_load_balancer_rule(id,virtualmachineids=[]) click to toggle source

Removes a virtual machine or a list of virtual machines from a load balancer rule.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/remove_from_load_balancer_rule.rb, line 9
def remove_from_load_balancer_rule(id,virtualmachineids=[])
  virtualmachineids = [*virtualmachineids]
  
  options = {
    'command' => 'removeFromLoadBalancerRule',
    'id' => id,
    'virtualmachineids' => virtualmachineids.join(',')
  }

  request(options)
end
request(params) click to toggle source
# File lib/fog/cloudstack/compute.rb, line 185
def request(params)
  params.reject!{|k,v| v.nil?}

  params.merge!('response' => 'json')

  if has_session?
    params, headers = authorize_session(params)
  elsif has_keys?
    params, headers = authorize_api_keys(params)
  end

  response = issue_request(params,headers)
  response = Fog::JSON.decode(response.body) unless response.body.empty?
  response
end
reset_password_for_virtual_machine(id) click to toggle source

Returns an encrypted password for the VM

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/reset_password_for_virtual_machine.rb, line 9
def reset_password_for_virtual_machine(id)
  options = {
    'command' => 'resetPasswordForVirtualMachine',
    'id' => id
  }
  
  request(options)
end
revoke_security_group_egress(options={}) click to toggle source
# File lib/fog/cloudstack/requests/compute/revoke_security_group_egress.rb, line 5
def revoke_security_group_egress(options={})
  options.merge!(
    'command' => 'revokeSecurityGroupEgress'
  )

  request(options)
end
revoke_security_group_ingress(options={}) click to toggle source
# File lib/fog/cloudstack/requests/compute/revoke_security_group_ingress.rb, line 6
def revoke_security_group_ingress(options={})
  options.merge!(
    'command' => 'revokeSecurityGroupIngress'
  )

  request(options)
end
start_virtual_machine(options={}) click to toggle source

Updates account information for the authenticated user.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/start_virtual_machine.rb, line 9
def start_virtual_machine(options={})
  options.merge!(
    'command' => 'startVirtualMachine'
  )

  request(options)
end
stop_virtual_machine(options={}) click to toggle source

Updates account information for the authenticated user.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/stop_virtual_machine.rb, line 9
def stop_virtual_machine(options={})
  options.merge!(
    'command' => 'stopVirtualMachine'
  )

  request(options)
end
update_account(options={}) click to toggle source

Updates account information for the authenticated user.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/update_account.rb, line 9
def update_account(options={})
  options.merge!(
    'command' => 'updateAccount'
  )

  request(options)
end
update_domain(options={}) click to toggle source

Updates a domain with a new name.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/update_domain.rb, line 9
def update_domain(options={})
  options.merge!(
    'command' => 'updateDomain'
  )

  request(options)
end
update_resource_count(options={}) click to toggle source

Updates a user account.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/update_resource_count.rb, line 9
def update_resource_count(options={})
  options.merge!(
    'command' => 'updateResourceCount'
  )

  request(options)
end
update_user(options={}) click to toggle source

Updates a user account.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/update_user.rb, line 9
def update_user(options={})
  options.merge!(
    'command' => 'updateUser'
  )

  request(options)
end
update_virtual_machine(options={}) click to toggle source

Updates account information for the authenticated user.

CloudStack API Reference

# File lib/fog/cloudstack/requests/compute/update_virtual_machine.rb, line 9
def update_virtual_machine(options={})
  options.merge!(
    'command' => 'updateVirtualMachine'
  )

  request(options)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.