Class: Fog::Compute::Ninefold::Real
- Inherits:
-
Object
- Object
- Fog::Compute::Ninefold::Real
- Defined in:
- lib/fog/ninefold/compute.rb,
lib/fog/ninefold/requests/compute/list_zones.rb,
lib/fog/ninefold/requests/compute/list_events.rb,
lib/fog/ninefold/requests/compute/list_accounts.rb,
lib/fog/ninefold/requests/compute/list_networks.rb,
lib/fog/ninefold/requests/compute/list_templates.rb,
lib/fog/ninefold/requests/compute/list_async_jobs.rb,
lib/fog/ninefold/requests/compute/list_hypervisors.rb,
lib/fog/ninefold/requests/compute/enable_static_nat.rb,
lib/fog/ninefold/requests/compute/list_capabilities.rb,
lib/fog/ninefold/requests/compute/disable_static_nat.rb,
lib/fog/ninefold/requests/compute/list_disk_offerings.rb,
lib/fog/ninefold/requests/compute/associate_ip_address.rb,
lib/fog/ninefold/requests/compute/list_resource_limits.rb,
lib/fog/ninefold/requests/compute/stop_virtual_machine.rb,
lib/fog/ninefold/requests/compute/list_virtual_machines.rb,
lib/fog/ninefold/requests/compute/start_virtual_machine.rb,
lib/fog/ninefold/requests/compute/deploy_virtual_machine.rb,
lib/fog/ninefold/requests/compute/list_network_offerings.rb,
lib/fog/ninefold/requests/compute/list_service_offerings.rb,
lib/fog/ninefold/requests/compute/query_async_job_result.rb,
lib/fog/ninefold/requests/compute/reboot_virtual_machine.rb,
lib/fog/ninefold/requests/compute/update_virtual_machine.rb,
lib/fog/ninefold/requests/compute/destroy_virtual_machine.rb,
lib/fog/ninefold/requests/compute/disassociate_ip_address.rb,
lib/fog/ninefold/requests/compute/list_ip_forwarding_rules.rb,
lib/fog/ninefold/requests/compute/list_load_balancer_rules.rb,
lib/fog/ninefold/requests/compute/list_public_ip_addresses.rb,
lib/fog/ninefold/requests/compute/create_ip_forwarding_rule.rb,
lib/fog/ninefold/requests/compute/create_load_balancer_rule.rb,
lib/fog/ninefold/requests/compute/delete_ip_forwarding_rule.rb,
lib/fog/ninefold/requests/compute/delete_load_balancer_rule.rb,
lib/fog/ninefold/requests/compute/update_load_balancer_rule.rb,
lib/fog/ninefold/requests/compute/assign_to_load_balancer_rule.rb,
lib/fog/ninefold/requests/compute/remove_from_load_balancer_rule.rb,
lib/fog/ninefold/requests/compute/list_load_balancer_rule_instances.rb,
lib/fog/ninefold/requests/compute/change_service_for_virtual_machine.rb,
lib/fog/ninefold/requests/compute/reset_password_for_virtual_machine.rb
Instance Method Summary collapse
- #assign_to_load_balancer_rule(options = {}) ⇒ Object
- #associate_ip_address(options = {}) ⇒ Object
- #change_service_for_virtual_machine(options = {}) ⇒ Object
- #create_ip_forwarding_rule(options = {}) ⇒ Object
- #create_load_balancer_rule(options = {}) ⇒ Object
- #delete_ip_forwarding_rule(options = {}) ⇒ Object
- #delete_load_balancer_rule(options = {}) ⇒ Object
- #deploy_virtual_machine(options = {}) ⇒ Object
- #destroy_virtual_machine(options = {}) ⇒ Object
- #disable_static_nat(options = {}) ⇒ Object
- #disassociate_ip_address(options = {}) ⇒ Object
- #enable_static_nat(options = {}) ⇒ Object
-
#initialize(options) ⇒ Real
constructor
A new instance of Real.
- #list_accounts(options = {}) ⇒ Object
- #list_async_jobs(options = {}) ⇒ Object
- #list_capabilities(options = {}) ⇒ Object
- #list_disk_offerings(options = {}) ⇒ Object
- #list_events(options = {}) ⇒ Object
- #list_hypervisors(options = {}) ⇒ Object
- #list_ip_forwarding_rules(options = {}) ⇒ Object
- #list_load_balancer_rule_instances(options = {}) ⇒ Object
- #list_load_balancer_rules(options = {}) ⇒ Object
- #list_network_offerings(options = {}) ⇒ Object
- #list_networks(options = {}) ⇒ Object
- #list_public_ip_addresses(options = {}) ⇒ Object
- #list_resource_limits(options = {}) ⇒ Object
- #list_service_offerings(options = {}) ⇒ Object
- #list_templates(options = {}) ⇒ Object
- #list_virtual_machines(options = {}) ⇒ Object
- #list_zones(options = {}) ⇒ Object
- #query_async_job_result(options = {}) ⇒ Object
- #reboot_virtual_machine(options = {}) ⇒ Object
- #remove_from_load_balancer_rule(options = {}) ⇒ Object
- #request(command, params, options) ⇒ Object
- #reset_password_for_virtual_machine(options = {}) ⇒ Object
- #start_virtual_machine(options = {}) ⇒ Object
- #stop_virtual_machine(options = {}) ⇒ Object
- #update_load_balancer_rule(options = {}) ⇒ Object
- #update_virtual_machine(options = {}) ⇒ Object
Constructor Details
#initialize(options) ⇒ Real
Returns a new instance of Real.
83 84 85 86 87 88 89 90 |
# File 'lib/fog/ninefold/compute.rb', line 83 def initialize() @api_url = [:ninefold_api_url] || API_URL @ninefold_compute_key = [:ninefold_compute_key] @ninefold_compute_secret = [:ninefold_compute_secret] @connection_options = [:connection_options] || {} @persistent = [:persistent] || false @connection = Fog::XML::Connection.new(@api_url, @persistent, @connection_options) end |
Instance Method Details
#assign_to_load_balancer_rule(options = {}) ⇒ Object
5 6 7 |
# File 'lib/fog/ninefold/requests/compute/assign_to_load_balancer_rule.rb', line 5 def assign_to_load_balancer_rule(={}) request 'assignToLoadBalancerRule', , :expects => [200], :response_prefix => 'assigntoloadbalancerruleresponse', :response_type => Hash end |
#associate_ip_address(options = {}) ⇒ Object
5 6 7 8 |
# File 'lib/fog/ninefold/requests/compute/associate_ip_address.rb', line 5 def associate_ip_address( = {}) request('associateIpAddress', , :expects => [200], :response_prefix => 'associateipaddressresponse', :response_type => Hash) end |
#change_service_for_virtual_machine(options = {}) ⇒ Object
5 6 7 8 |
# File 'lib/fog/ninefold/requests/compute/change_service_for_virtual_machine.rb', line 5 def change_service_for_virtual_machine( = {}) request('changeServiceForVirtualMachine', , :expects => [200], :response_prefix => 'changeserviceforvirtualmachineresponse/virtualmachine', :response_type => Hash) end |
#create_ip_forwarding_rule(options = {}) ⇒ Object
5 6 7 8 |
# File 'lib/fog/ninefold/requests/compute/create_ip_forwarding_rule.rb', line 5 def create_ip_forwarding_rule( = {}) request('createIpForwardingRule', , :expects => [200], :response_prefix => 'createipforwardingruleresponse', :response_type => Hash) end |
#create_load_balancer_rule(options = {}) ⇒ Object
5 6 7 |
# File 'lib/fog/ninefold/requests/compute/create_load_balancer_rule.rb', line 5 def create_load_balancer_rule(={}) request 'createLoadBalancerRule', , :expects => [200], :response_prefix => 'createloadbalancerruleresponse', :response_type => Hash end |
#delete_ip_forwarding_rule(options = {}) ⇒ Object
5 6 7 8 |
# File 'lib/fog/ninefold/requests/compute/delete_ip_forwarding_rule.rb', line 5 def delete_ip_forwarding_rule( = {}) request('deleteIpForwardingRule', , :expects => [200], :response_prefix => 'deleteipforwardingruleresponse', :response_type => Hash) end |
#delete_load_balancer_rule(options = {}) ⇒ Object
5 6 7 |
# File 'lib/fog/ninefold/requests/compute/delete_load_balancer_rule.rb', line 5 def delete_load_balancer_rule(={}) request 'deleteLoadBalancerRule', , :expects => [200], :response_prefix => 'deleteloadbalancerruleresponse', :response_type => Hash end |
#deploy_virtual_machine(options = {}) ⇒ Object
5 6 7 8 |
# File 'lib/fog/ninefold/requests/compute/deploy_virtual_machine.rb', line 5 def deploy_virtual_machine( = {}) request('deployVirtualMachine', , :expects => [200], :response_prefix => 'deployvirtualmachineresponse', :response_type => Hash) end |
#destroy_virtual_machine(options = {}) ⇒ Object
5 6 7 8 |
# File 'lib/fog/ninefold/requests/compute/destroy_virtual_machine.rb', line 5 def destroy_virtual_machine( = {}) request('destroyVirtualMachine', , :expects => [200], :response_prefix => 'destroyvirtualmachineresponse', :response_type => Hash) end |
#disable_static_nat(options = {}) ⇒ Object
5 6 7 8 |
# File 'lib/fog/ninefold/requests/compute/disable_static_nat.rb', line 5 def disable_static_nat( = {}) request('disableStaticNat', , :expects => [200], :response_prefix => 'disablestaticnatresponse', :response_type => Hash) end |
#disassociate_ip_address(options = {}) ⇒ Object
5 6 7 8 |
# File 'lib/fog/ninefold/requests/compute/disassociate_ip_address.rb', line 5 def disassociate_ip_address( = {}) request('disassociateIpAddress', , :expects => [200], :response_prefix => 'disassociateipaddressresponse', :response_type => Hash) end |
#enable_static_nat(options = {}) ⇒ Object
5 6 7 8 |
# File 'lib/fog/ninefold/requests/compute/enable_static_nat.rb', line 5 def enable_static_nat( = {}) request('enableStaticNat', , :expects => [200], :response_prefix => 'enablestaticnatresponse', :response_type => Hash) end |
#list_accounts(options = {}) ⇒ Object
5 6 7 8 |
# File 'lib/fog/ninefold/requests/compute/list_accounts.rb', line 5 def list_accounts( = {}) request('listAccounts', , :expects => [200], :response_prefix => 'listaccountsresponse/account', :response_type => Array) end |
#list_async_jobs(options = {}) ⇒ Object
5 6 7 8 |
# File 'lib/fog/ninefold/requests/compute/list_async_jobs.rb', line 5 def list_async_jobs( = {}) request('listAsyncJobs', , :expects => [200], :response_prefix => 'listasyncjobsresponse/asyncjobs', :response_type => Array) end |
#list_capabilities(options = {}) ⇒ Object
5 6 7 8 |
# File 'lib/fog/ninefold/requests/compute/list_capabilities.rb', line 5 def list_capabilities( = {}) request('listCapabilities', , :expects => [200], :response_prefix => 'listcapabilitiesresponse/capability', :response_type => Array) end |
#list_disk_offerings(options = {}) ⇒ Object
5 6 7 8 |
# File 'lib/fog/ninefold/requests/compute/list_disk_offerings.rb', line 5 def list_disk_offerings( = {}) request('listDiskOfferings', , :expects => [200], :response_prefix => 'listdiskofferingsresponse/diskoffering', :response_type => Array) end |
#list_events(options = {}) ⇒ Object
5 6 7 8 |
# File 'lib/fog/ninefold/requests/compute/list_events.rb', line 5 def list_events( = {}) request('listEvents', , :expects => [200], :response_prefix => 'listeventsresponse/event', :response_type => Array) end |
#list_hypervisors(options = {}) ⇒ Object
5 6 7 8 |
# File 'lib/fog/ninefold/requests/compute/list_hypervisors.rb', line 5 def list_hypervisors( = {}) request('listHypervisors', , :expects => [200], :response_prefix => 'listhypervisorsresponse/hypervisor', :response_type => Array) end |
#list_ip_forwarding_rules(options = {}) ⇒ Object
5 6 7 8 |
# File 'lib/fog/ninefold/requests/compute/list_ip_forwarding_rules.rb', line 5 def list_ip_forwarding_rules( = {}) request('listIpForwardingRules', , :expects => [200], :response_prefix => 'listipforwardingrulesresponse/ipforwardingrule', :response_type => Hash) end |
#list_load_balancer_rule_instances(options = {}) ⇒ Object
5 6 7 |
# File 'lib/fog/ninefold/requests/compute/list_load_balancer_rule_instances.rb', line 5 def list_load_balancer_rule_instances(={}) request 'listLoadBalancerRuleInstances', , :expects => [200], :response_prefix => 'listloadbalancerruleinstancesresponse', :response_type => Hash end |
#list_load_balancer_rules(options = {}) ⇒ Object
5 6 7 |
# File 'lib/fog/ninefold/requests/compute/list_load_balancer_rules.rb', line 5 def list_load_balancer_rules(={}) request 'listLoadBalancerRules', , :expects => [200], :response_prefix => 'listloadbalancerrulesresponse', :response_type => Hash end |
#list_network_offerings(options = {}) ⇒ Object
5 6 7 8 |
# File 'lib/fog/ninefold/requests/compute/list_network_offerings.rb', line 5 def list_network_offerings( = {}) request('listNetworkOfferings', , :expects => [200], :response_prefix => 'listnetworkofferingsresponse/networkoffering', :response_type => Array) end |
#list_networks(options = {}) ⇒ Object
5 6 7 8 |
# File 'lib/fog/ninefold/requests/compute/list_networks.rb', line 5 def list_networks( = {}) request('listNetworks', , :expects => [200], :response_prefix => 'listnetworksresponse/network', :response_type => Array) end |
#list_public_ip_addresses(options = {}) ⇒ Object
5 6 7 8 |
# File 'lib/fog/ninefold/requests/compute/list_public_ip_addresses.rb', line 5 def list_public_ip_addresses( = {}) request('listPublicIpAddresses', , :expects => [200], :response_prefix => 'listpublicipaddressesresponse/publicipaddress', :response_type => Hash) end |
#list_resource_limits(options = {}) ⇒ Object
5 6 7 8 |
# File 'lib/fog/ninefold/requests/compute/list_resource_limits.rb', line 5 def list_resource_limits( = {}) request('listResourceLimits', , :expects => [200], :response_prefix => 'listresourcelimitsresponse/resourcelimit', :response_type => Array) end |
#list_service_offerings(options = {}) ⇒ Object
5 6 7 8 |
# File 'lib/fog/ninefold/requests/compute/list_service_offerings.rb', line 5 def list_service_offerings( = {}) request('listServiceOfferings', , :expects => [200], :response_prefix => 'listserviceofferingsresponse/serviceoffering', :response_type => Array) end |
#list_templates(options = {}) ⇒ Object
5 6 7 8 |
# File 'lib/fog/ninefold/requests/compute/list_templates.rb', line 5 def list_templates( = {}) request('listTemplates', , :expects => [200], :response_prefix => 'listtemplatesresponse/template', :response_type => Array) end |
#list_virtual_machines(options = {}) ⇒ Object
5 6 7 8 |
# File 'lib/fog/ninefold/requests/compute/list_virtual_machines.rb', line 5 def list_virtual_machines( = {}) request('listVirtualMachines', , :expects => [200], :response_prefix => 'listvirtualmachinesresponse/virtualmachine', :response_type => Array) end |
#list_zones(options = {}) ⇒ Object
5 6 7 8 |
# File 'lib/fog/ninefold/requests/compute/list_zones.rb', line 5 def list_zones( = {}) request('listZones', , :expects => [200], :response_prefix => 'listzonesresponse/zone', :response_type => Array) end |
#query_async_job_result(options = {}) ⇒ Object
5 6 7 8 |
# File 'lib/fog/ninefold/requests/compute/query_async_job_result.rb', line 5 def query_async_job_result( = {}) request('queryAsyncJobResult', , :expects => [200], :response_prefix => 'queryasyncjobresultresponse', :response_type => Array) end |
#reboot_virtual_machine(options = {}) ⇒ Object
5 6 7 8 |
# File 'lib/fog/ninefold/requests/compute/reboot_virtual_machine.rb', line 5 def reboot_virtual_machine( = {}) request('rebootVirtualMachine', , :expects => [200], :response_prefix => 'rebootvirtualmachineresponse', :response_type => Hash) end |
#remove_from_load_balancer_rule(options = {}) ⇒ Object
5 6 7 |
# File 'lib/fog/ninefold/requests/compute/remove_from_load_balancer_rule.rb', line 5 def remove_from_load_balancer_rule(={}) request 'removeFromLoadBalancerRule', , :expects => [200], :response_prefix => 'removefromloadbalancerruleresponse', :response_type => Hash end |
#request(command, params, options) ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/fog/ninefold/compute.rb', line 92 def request(command, params, ) params['response'] = "json" # convert params to strings for sort req_params = params.merge('apiKey' => @ninefold_compute_key, 'command' => command) req = URI.escape(req_params.sort_by{|k,v| k.to_s }.map{|e| "#{e[0].to_s}=#{e[1].to_s}"}.join('&')) encoded_signature = url_escape(encode_signature(req)) = { :expects => 200, :method => 'GET', :query => "#{req}&signature=#{encoded_signature}" }.merge() begin response = @connection.request() end unless response.body.empty? # Because the response is some weird xml-json thing, we need to try and mung # the values out with a prefix, and if there is an empty data entry return an # empty version of the expected type (if provided) response = Fog::JSON.decode(response.body) if .key? :response_prefix keys = [:response_prefix].split('/') keys.each do |k| if response[k] response = response[k] elsif [:response_type] response = [:response_type].new break else end end response else response end end end |
#reset_password_for_virtual_machine(options = {}) ⇒ Object
5 6 7 8 |
# File 'lib/fog/ninefold/requests/compute/reset_password_for_virtual_machine.rb', line 5 def reset_password_for_virtual_machine( = {}) request('resetPasswordForVirtualMachine', , :expects => [200], :response_prefix => 'resetpasswordforvirtualmachineresponse', :response_type => Hash) end |
#start_virtual_machine(options = {}) ⇒ Object
5 6 7 8 |
# File 'lib/fog/ninefold/requests/compute/start_virtual_machine.rb', line 5 def start_virtual_machine( = {}) request('startVirtualMachine', , :expects => [200], :response_prefix => 'startvirtualmachineresponse', :response_type => Hash) end |
#stop_virtual_machine(options = {}) ⇒ Object
5 6 7 8 |
# File 'lib/fog/ninefold/requests/compute/stop_virtual_machine.rb', line 5 def stop_virtual_machine( = {}) request('stopVirtualMachine', , :expects => [200], :response_prefix => 'stopvirtualmachineresponse', :response_type => Hash) end |
#update_load_balancer_rule(options = {}) ⇒ Object
5 6 7 |
# File 'lib/fog/ninefold/requests/compute/update_load_balancer_rule.rb', line 5 def update_load_balancer_rule(={}) request 'updateLoadBalancerRule', , :expects => [200], :response_prefix => 'updateloadbalancerruleresponse', :response_type => Hash end |
#update_virtual_machine(options = {}) ⇒ Object
5 6 7 8 |
# File 'lib/fog/ninefold/requests/compute/update_virtual_machine.rb', line 5 def update_virtual_machine( = {}) request('updateVirtualMachine', , :expects => [200], :response_prefix => 'updatevirtualmachineresponse', :response_type => Hash) end |