Class: Fog::Compute::CloudSigma::Real

Inherits:
Object
  • Object
show all
Includes:
Collections, Fog::CloudSigma::CloudSigmaConnection::Real, CommonMockAndReal
Defined in:
lib/fog/cloudsigma/compute.rb,
lib/fog/cloudsigma/requests/get_ip.rb,
lib/fog/cloudsigma/requests/get_vlan.rb,
lib/fog/cloudsigma/requests/list_ips.rb,
lib/fog/cloudsigma/requests/open_vnc.rb,
lib/fog/cloudsigma/requests/close_vnc.rb,
lib/fog/cloudsigma/requests/get_server.rb,
lib/fog/cloudsigma/requests/get_volume.rb,
lib/fog/cloudsigma/requests/list_vlans.rb,
lib/fog/cloudsigma/requests/get_balance.rb,
lib/fog/cloudsigma/requests/get_pricing.rb,
lib/fog/cloudsigma/requests/get_profile.rb,
lib/fog/cloudsigma/requests/stop_server.rb,
lib/fog/cloudsigma/requests/update_vlan.rb,
lib/fog/cloudsigma/requests/clone_server.rb,
lib/fog/cloudsigma/requests/clone_volume.rb,
lib/fog/cloudsigma/requests/get_snapshot.rb,
lib/fog/cloudsigma/requests/list_servers.rb,
lib/fog/cloudsigma/requests/list_volumes.rb,
lib/fog/cloudsigma/requests/start_server.rb,
lib/fog/cloudsigma/requests/create_server.rb,
lib/fog/cloudsigma/requests/create_volume.rb,
lib/fog/cloudsigma/requests/delete_server.rb,
lib/fog/cloudsigma/requests/delete_volume.rb,
lib/fog/cloudsigma/requests/update_server.rb,
lib/fog/cloudsigma/requests/update_volume.rb,
lib/fog/cloudsigma/requests/clone_snapshot.rb,
lib/fog/cloudsigma/requests/get_lib_volume.rb,
lib/fog/cloudsigma/requests/list_snapshots.rb,
lib/fog/cloudsigma/requests/update_profile.rb,
lib/fog/cloudsigma/requests/clone_libvolume.rb,
lib/fog/cloudsigma/requests/create_snapshot.rb,
lib/fog/cloudsigma/requests/delete_snapshot.rb,
lib/fog/cloudsigma/requests/list_fwpolicies.rb,
lib/fog/cloudsigma/requests/update_snapshot.rb,
lib/fog/cloudsigma/requests/get_subscription.rb,
lib/fog/cloudsigma/requests/list_lib_volumes.rb,
lib/fog/cloudsigma/requests/get_current_usage.rb,
lib/fog/cloudsigma/requests/list_subscriptions.rb,
lib/fog/cloudsigma/requests/create_subscription.rb,
lib/fog/cloudsigma/requests/extend_subscription.rb,
lib/fog/cloudsigma/requests/calculate_subscription_price.rb

Instance Method Summary collapse

Methods included from Fog::CloudSigma::CloudSigmaConnection::Real

#auth_header, #create_request, #delete_request, #get_request, #list_request, #request, #setup_connection, #update_request

Methods included from CommonMockAndReal

#balance, #currency, #current_pricing, #current_pricing_levels, #current_usage, #initialize, #next_pricing, #next_pricing_levels, #pricing, #profile, #subscription_pricing

Instance Method Details

#calculate_subscription_price(data) ⇒ Object



5
6
7
# File 'lib/fog/cloudsigma/requests/calculate_subscription_price.rb', line 5

def calculate_subscription_price(data)
  create_request("subscriptioncalculator/", data)
end

#clone_libvolume(vol_id, clone_params = {}) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/cloudsigma/requests/clone_libvolume.rb', line 5

def clone_libvolume(vol_id, clone_params={})
  request(:path => "libdrives/#{vol_id}/action/",
          :method => 'POST',
          :query => {:do => :clone},
          :body => clone_params,
          :expects => [200, 202])
end

#clone_server(server_id, clone_params = {}) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/cloudsigma/requests/clone_server.rb', line 5

def clone_server(server_id, clone_params={})
  request(:path => "servers/#{server_id}/action/",
          :method => 'POST',
          :query => {:do => :clone},
          :body => clone_params,
          :expects => [200, 202])
end

#clone_snapshot(snap_id, clone_params = {}) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/cloudsigma/requests/clone_snapshot.rb', line 5

def clone_snapshot(snap_id, clone_params={})
  request(:path => "snapshots/#{snap_id}/action/",
          :method => 'POST',
          :query => {:do => :clone},
          :body => clone_params,
          :expects => [200, 202])
end

#clone_volume(vol_id, clone_params = {}) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/cloudsigma/requests/clone_volume.rb', line 5

def clone_volume(vol_id, clone_params={})
  request(:path => "drives/#{vol_id}/action/",
          :method => 'POST',
          :query => {:do => :clone},
          :body => clone_params,
          :expects => [200, 202])
end

#close_vnc(server_id) ⇒ Object



5
6
7
8
9
10
# File 'lib/fog/cloudsigma/requests/close_vnc.rb', line 5

def close_vnc(server_id)
  request(:path => "servers/#{server_id}/action/",
          :method => 'POST',
          :query => {:do => :close_vnc},
          :expects => [200, 202])
end

#create_server(data) ⇒ Object



5
6
7
# File 'lib/fog/cloudsigma/requests/create_server.rb', line 5

def create_server(data)
  create_request("servers/", data)
end

#create_snapshot(data) ⇒ Object



5
6
7
# File 'lib/fog/cloudsigma/requests/create_snapshot.rb', line 5

def create_snapshot(data)
  create_request("snapshots/", data)
end

#create_subscription(data) ⇒ Object



5
6
7
# File 'lib/fog/cloudsigma/requests/create_subscription.rb', line 5

def create_subscription(data)
  create_request("subscriptions/", data)
end

#create_volume(data) ⇒ Object



5
6
7
# File 'lib/fog/cloudsigma/requests/create_volume.rb', line 5

def create_volume(data)
  create_request("drives/", data)
end

#delete_server(server_id) ⇒ Object



5
6
7
# File 'lib/fog/cloudsigma/requests/delete_server.rb', line 5

def delete_server(server_id)
  delete_request("servers/#{server_id}/")
end

#delete_snapshot(snap_id) ⇒ Object



5
6
7
# File 'lib/fog/cloudsigma/requests/delete_snapshot.rb', line 5

def delete_snapshot(snap_id)
  delete_request("snapshots/#{snap_id}/")
end

#delete_volume(vol_id) ⇒ Object



5
6
7
# File 'lib/fog/cloudsigma/requests/delete_volume.rb', line 5

def delete_volume(vol_id)
  delete_request("drives/#{vol_id}/")
end

#extend_subscription(sub_id, data) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/cloudsigma/requests/extend_subscription.rb', line 5

def extend_subscription(sub_id, data)
  request(:path => "subscriptions/#{sub_id}/action/",
          :method => 'POST',
          :expects => [200, 202],
          :query => {:do => :extend},
          :body=>data)
end

#get_balanceObject



5
6
7
# File 'lib/fog/cloudsigma/requests/get_balance.rb', line 5

def get_balance
  get_request("balance/")
end

#get_current_usageObject



5
6
7
# File 'lib/fog/cloudsigma/requests/get_current_usage.rb', line 5

def get_current_usage
  get_request("currentusage/")
end

#get_ip(ip) ⇒ Object



5
6
7
# File 'lib/fog/cloudsigma/requests/get_ip.rb', line 5

def get_ip(ip)
  request("ips/#{ip}/")
end

#get_lib_volume(vol_id) ⇒ Object



5
6
7
# File 'lib/fog/cloudsigma/requests/get_lib_volume.rb', line 5

def get_lib_volume(vol_id)
  get_request("libdrives/#{vol_id}/")
end

#get_pricing(currency = nil, subscription = false) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/fog/cloudsigma/requests/get_pricing.rb', line 5

def get_pricing(currency=nil, subscription=false)
  query = {:limit => 0}
  if currency
    query[:currency] = currency
  end
  if subscription
    query[:level] = 0
  end
  request(:path => "pricing/",
          :method => 'GET',
          :expects => 200,
          :query => query)
end

#get_profileObject



5
6
7
# File 'lib/fog/cloudsigma/requests/get_profile.rb', line 5

def get_profile
  get_request("profile/")
end

#get_server(server_id) ⇒ Object



5
6
7
# File 'lib/fog/cloudsigma/requests/get_server.rb', line 5

def get_server(server_id)
  get_request("servers/#{server_id}/")
end

#get_snapshot(snap_id) ⇒ Object



5
6
7
# File 'lib/fog/cloudsigma/requests/get_snapshot.rb', line 5

def get_snapshot(snap_id)
  get_request("snapshots/#{snap_id}/")
end

#get_subscription(sub_id) ⇒ Object



5
6
7
# File 'lib/fog/cloudsigma/requests/get_subscription.rb', line 5

def get_subscription(sub_id)
  get_request("subscriptions/#{sub_id}/")
end

#get_vlan(vlan) ⇒ Object



5
6
7
# File 'lib/fog/cloudsigma/requests/get_vlan.rb', line 5

def get_vlan(vlan)
  get_request("vlans/#{vlan}/")
end

#get_volume(vol_id) ⇒ Object



5
6
7
# File 'lib/fog/cloudsigma/requests/get_volume.rb', line 5

def get_volume(vol_id)
  get_request("drives/#{vol_id}/")
end

#list_fwpoliciesObject



5
6
7
# File 'lib/fog/cloudsigma/requests/list_fwpolicies.rb', line 5

def list_fwpolicies
  list_request('fwpolicies/detail/')
end

#list_ipsObject



5
6
7
# File 'lib/fog/cloudsigma/requests/list_ips.rb', line 5

def list_ips
  list_request('ips/detail/')
end

#list_lib_volumesObject



5
6
7
# File 'lib/fog/cloudsigma/requests/list_lib_volumes.rb', line 5

def list_lib_volumes
  list_request('libdrives/')
end

#list_serversObject



5
6
7
# File 'lib/fog/cloudsigma/requests/list_servers.rb', line 5

def list_servers
  list_request('servers/detail/')
end

#list_snapshotsObject



5
6
7
# File 'lib/fog/cloudsigma/requests/list_snapshots.rb', line 5

def list_snapshots
  list_request('snapshots/detail/')
end

#list_subscriptionsObject



5
6
7
# File 'lib/fog/cloudsigma/requests/list_subscriptions.rb', line 5

def list_subscriptions
  list_request('subscriptions/')
end

#list_vlansObject



5
6
7
# File 'lib/fog/cloudsigma/requests/list_vlans.rb', line 5

def list_vlans
  list_request('vlans/detail/')
end

#list_volumesObject



5
6
7
# File 'lib/fog/cloudsigma/requests/list_volumes.rb', line 5

def list_volumes
  list_request('drives/detail/')
end

#open_vnc(server_id) ⇒ Object



5
6
7
8
9
10
# File 'lib/fog/cloudsigma/requests/open_vnc.rb', line 5

def open_vnc(server_id)
  request(:path => "servers/#{server_id}/action/",
          :method => 'POST',
          :query => {:do => :open_vnc},
          :expects => [200, 202])
end

#start_server(server_id, start_params = {}) ⇒ Object



5
6
7
8
9
10
# File 'lib/fog/cloudsigma/requests/start_server.rb', line 5

def start_server(server_id, start_params={})
  request(:path => "servers/#{server_id}/action/",
          :method => 'POST',
          :query => {:do => :start}.merge!(start_params),
          :expects => [200, 202])
end

#stop_server(server_id, graceful_acpi = false) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/cloudsigma/requests/stop_server.rb', line 5

def stop_server(server_id, graceful_acpi = false)
  action = graceful_acpi ? :shutdown : :stop
  request(:path => "servers/#{server_id}/action/",
          :method => 'POST',
          :query => {:do => action},
          :expects => [200, 202])
end

#update_profile(data) ⇒ Object



5
6
7
# File 'lib/fog/cloudsigma/requests/update_profile.rb', line 5

def update_profile(data)
  update_request("profile/", data)
end

#update_server(server_id, data) ⇒ Object



7
8
9
# File 'lib/fog/cloudsigma/requests/update_server.rb', line 7

def update_server(server_id, data)
  update_request("servers/#{server_id}/", data)
end

#update_snapshot(snap_id, data) ⇒ Object



5
6
7
# File 'lib/fog/cloudsigma/requests/update_snapshot.rb', line 5

def update_snapshot(snap_id, data)
  update_request("snapshots/#{snap_id}/", data)
end

#update_vlan(vlan_id, data) ⇒ Object



7
8
9
# File 'lib/fog/cloudsigma/requests/update_vlan.rb', line 7

def update_vlan(vlan_id, data)
  update_request("vlans/#{vlan_id}/", data)
end

#update_volume(vol_id, data) ⇒ Object



5
6
7
# File 'lib/fog/cloudsigma/requests/update_volume.rb', line 5

def update_volume(vol_id, data)
  update_request("drives/#{vol_id}/", data)
end