fog 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +8 -8
- data/Gemfile.lock +3 -3
- data/bin/fog +2 -10
- data/fog.gemspec +45 -20
- data/lib/fog.rb +2 -1
- data/lib/fog/attributes.rb +48 -8
- data/lib/fog/aws/ec2.rb +5 -2
- data/lib/fog/aws/elb.rb +5 -2
- data/lib/fog/aws/models/ec2/server.rb +1 -1
- data/lib/fog/aws/requests/simpledb/put_attributes.rb +43 -12
- data/lib/fog/aws/s3.rb +2 -2
- data/lib/fog/aws/simpledb.rb +15 -3
- data/lib/fog/bin.rb +11 -2
- data/lib/fog/bluebox.rb +5 -1
- data/lib/fog/connection.rb +9 -1
- data/lib/fog/credentials.rb +3 -0
- data/lib/fog/new_servers.rb +89 -0
- data/lib/fog/new_servers/bin.rb +30 -0
- data/lib/fog/new_servers/requests/add_server.rb +39 -0
- data/lib/fog/new_servers/requests/cancel_server.rb +36 -0
- data/lib/fog/new_servers/requests/get_server.rb +42 -0
- data/lib/fog/new_servers/requests/list_images.rb +33 -0
- data/lib/fog/new_servers/requests/list_plans.rb +36 -0
- data/lib/fog/new_servers/requests/list_servers.rb +43 -0
- data/lib/fog/new_servers/requests/reboot_server.rb +30 -0
- data/lib/fog/parser.rb +6 -0
- data/lib/fog/rackspace/files.rb +8 -2
- data/lib/fog/rackspace/models/servers/server.rb +5 -0
- data/lib/fog/rackspace/servers.rb +5 -1
- data/lib/fog/service.rb +6 -1
- data/lib/fog/slicehost.rb +5 -1
- data/lib/fog/terremark/ecloud.rb +1 -0
- data/lib/fog/terremark/shared.rb +4 -1
- data/lib/fog/terremark/vcloud.rb +1 -0
- data/lib/fog/vcloud.rb +150 -141
- data/lib/fog/vcloud/bin.rb +2 -2
- data/lib/fog/vcloud/collection.rb +3 -84
- data/lib/fog/vcloud/extension.rb +44 -0
- data/lib/fog/vcloud/generators.rb +33 -0
- data/lib/fog/vcloud/model.rb +5 -38
- data/lib/fog/vcloud/models/vdc.rb +14 -24
- data/lib/fog/vcloud/models/vdcs.rb +13 -8
- data/lib/fog/vcloud/requests/get_network.rb +4 -11
- data/lib/fog/vcloud/requests/get_organization.rb +4 -11
- data/lib/fog/vcloud/requests/get_vdc.rb +4 -12
- data/lib/fog/vcloud/requests/get_versions.rb +4 -13
- data/lib/fog/vcloud/requests/login.rb +4 -4
- data/lib/fog/vcloud/terremark/ecloud.rb +125 -54
- data/lib/fog/vcloud/terremark/ecloud/models/catalog.rb +30 -0
- data/lib/fog/vcloud/terremark/ecloud/models/catalog_item.rb +31 -0
- data/lib/fog/vcloud/terremark/ecloud/models/internet_service.rb +21 -22
- data/lib/fog/vcloud/terremark/ecloud/models/internet_services.rb +11 -25
- data/lib/fog/vcloud/terremark/ecloud/models/ip.rb +38 -5
- data/lib/fog/vcloud/terremark/ecloud/models/ips.rb +11 -15
- data/lib/fog/vcloud/terremark/ecloud/models/network.rb +52 -11
- data/lib/fog/vcloud/terremark/ecloud/models/networks.rb +14 -13
- data/lib/fog/vcloud/terremark/ecloud/models/node.rb +47 -0
- data/lib/fog/vcloud/terremark/ecloud/models/nodes.rb +30 -0
- data/lib/fog/vcloud/terremark/ecloud/models/public_ip.rb +6 -9
- data/lib/fog/vcloud/terremark/ecloud/models/public_ips.rb +19 -3
- data/lib/fog/vcloud/terremark/ecloud/models/server.rb +203 -0
- data/lib/fog/vcloud/terremark/ecloud/models/servers.rb +43 -0
- data/lib/fog/vcloud/terremark/ecloud/models/task.rb +22 -0
- data/lib/fog/vcloud/terremark/ecloud/models/tasks.rb +30 -0
- data/lib/fog/vcloud/terremark/ecloud/models/vdc.rb +32 -10
- data/lib/fog/vcloud/terremark/ecloud/models/vdcs.rb +5 -6
- data/lib/fog/vcloud/terremark/ecloud/requests/add_internet_service.rb +23 -10
- data/lib/fog/vcloud/terremark/ecloud/requests/add_node.rb +54 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_internet_service.rb +14 -12
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_network.rb +53 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_network_ip.rb +52 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_node.rb +42 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_vapp.rb +115 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/delete_internet_service.rb +4 -23
- data/lib/fog/vcloud/terremark/ecloud/requests/delete_node.rb +0 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/delete_vapp.rb +19 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_catalog.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_catalog_item.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_customization_options.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_internet_services.rb +9 -16
- data/lib/fog/vcloud/terremark/ecloud/requests/get_network.rb +8 -14
- data/lib/fog/vcloud/terremark/ecloud/requests/get_network_extensions.rb +36 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_network_ip.rb +44 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_network_ips.rb +11 -12
- data/lib/fog/vcloud/terremark/ecloud/requests/get_node.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_nodes.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_public_ip.rb +5 -19
- data/lib/fog/vcloud/terremark/ecloud/requests/get_public_ips.rb +5 -12
- data/lib/fog/vcloud/terremark/ecloud/requests/get_task.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_task_list.rb +19 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_vapp.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_vdc.rb +7 -15
- data/lib/fog/vcloud/terremark/ecloud/requests/power_off.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/power_on.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/power_reset.rb +18 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/power_shutdown.rb +18 -0
- data/lib/fog/vcloud/terremark/vcloud.rb +4 -18
- data/lib/fog/vcloud/terremark/vcloud/requests/get_vdc.rb +4 -12
- data/spec/aws/requests/simpledb/put_attributes_spec.rb +18 -0
- data/spec/vcloud/bin_spec.rb +2 -2
- data/spec/vcloud/models/vdc_spec.rb +35 -29
- data/spec/vcloud/requests/get_network_spec.rb +32 -43
- data/spec/vcloud/requests/get_organization_spec.rb +45 -38
- data/spec/vcloud/requests/get_vdc_spec.rb +42 -32
- data/spec/vcloud/requests/get_versions_spec.rb +17 -17
- data/spec/vcloud/requests/login_spec.rb +7 -4
- data/spec/vcloud/spec_helper.rb +137 -46
- data/spec/vcloud/terremark/ecloud/models/internet_service_spec.rb +53 -58
- data/spec/vcloud/terremark/ecloud/models/internet_services_spec.rb +20 -20
- data/spec/vcloud/terremark/ecloud/models/ip_spec.rb +22 -21
- data/spec/vcloud/terremark/ecloud/models/ips_spec.rb +18 -18
- data/spec/vcloud/terremark/ecloud/models/network_spec.rb +55 -51
- data/spec/vcloud/terremark/ecloud/models/networks_spec.rb +16 -15
- data/spec/vcloud/terremark/ecloud/models/public_ip_spec.rb +26 -27
- data/spec/vcloud/terremark/ecloud/models/public_ips_spec.rb +16 -15
- data/spec/vcloud/terremark/ecloud/models/vdc_spec.rb +52 -36
- data/spec/vcloud/terremark/ecloud/models/vdcs_spec.rb +18 -15
- data/spec/vcloud/terremark/ecloud/requests/add_internet_service_spec.rb +46 -43
- data/spec/vcloud/terremark/ecloud/requests/configure_internet_service_spec.rb +37 -32
- data/spec/vcloud/terremark/ecloud/requests/delete_internet_service_spec.rb +26 -23
- data/spec/vcloud/terremark/ecloud/requests/get_internet_services_spec.rb +57 -49
- data/spec/vcloud/terremark/ecloud/requests/get_network_ip_spec.rb +41 -0
- data/spec/vcloud/terremark/ecloud/requests/get_network_ips_spec.rb +39 -34
- data/spec/vcloud/terremark/ecloud/requests/get_network_spec.rb +26 -48
- data/spec/vcloud/terremark/ecloud/requests/get_public_ip_spec.rb +25 -26
- data/spec/vcloud/terremark/ecloud/requests/get_public_ips_spec.rb +35 -27
- data/spec/vcloud/terremark/ecloud/requests/get_vdc_spec.rb +85 -110
- data/spec/vcloud/terremark/ecloud/requests/login_spec.rb +7 -4
- data/spec/vcloud/vcloud_spec.rb +9 -8
- metadata +62 -26
- data/lib/fog/vcloud/parser.rb +0 -42
- data/lib/fog/vcloud/parsers/get_organization.rb +0 -37
- data/lib/fog/vcloud/parsers/get_vdc.rb +0 -62
- data/lib/fog/vcloud/parsers/get_versions.rb +0 -46
- data/lib/fog/vcloud/parsers/login.rb +0 -36
- data/lib/fog/vcloud/parsers/network.rb +0 -53
- data/lib/fog/vcloud/terremark/all.rb +0 -9
- data/lib/fog/vcloud/terremark/ecloud/parsers/get_internet_services.rb +0 -59
- data/lib/fog/vcloud/terremark/ecloud/parsers/get_public_ip.rb +0 -30
- data/lib/fog/vcloud/terremark/ecloud/parsers/get_public_ips.rb +0 -40
- data/lib/fog/vcloud/terremark/ecloud/parsers/get_vdc.rb +0 -59
- data/lib/fog/vcloud/terremark/ecloud/parsers/internet_service.rb +0 -58
- data/lib/fog/vcloud/terremark/ecloud/parsers/network.rb +0 -28
- data/lib/fog/vcloud/terremark/ecloud/parsers/network_ips.rb +0 -31
- data/lib/fog/vcloud/terremark/ecloud/requests/login.rb +0 -27
- data/lib/fog/vcloud/terremark/vcloud/parsers/get_vdc.rb +0 -34
- data/spec/vcloud/terremark/vcloud/requests/get_vdc_spec.rb +0 -74
data/lib/fog/bin.rb
CHANGED
@@ -1,11 +1,20 @@
|
|
1
|
-
require
|
1
|
+
require 'fog/credentials'
|
2
|
+
|
3
|
+
require 'fog/aws/bin'
|
4
|
+
require 'fog/local/bin'
|
5
|
+
require 'fog/new_servers/bin'
|
6
|
+
require 'fog/rackspace/bin'
|
7
|
+
require 'fog/slicehost/bin'
|
8
|
+
require 'fog/terremark/bin'
|
9
|
+
require 'fog/vcloud/bin'
|
10
|
+
require 'fog/bluebox/bin'
|
2
11
|
|
3
12
|
module Fog
|
4
13
|
class << self
|
5
14
|
|
6
15
|
def services
|
7
16
|
services = []
|
8
|
-
[::AWS, ::Local, ::Rackspace, ::Slicehost, ::Terremark, ::Vcloud, ::Bluebox].each do |service|
|
17
|
+
[::AWS, ::Local, ::NewServers, ::Rackspace, ::Slicehost, ::Terremark, ::Vcloud, ::Bluebox].each do |service|
|
9
18
|
if service.initialized?
|
10
19
|
services << service
|
11
20
|
end
|
data/lib/fog/bluebox.rb
CHANGED
@@ -53,10 +53,14 @@ module Fog
|
|
53
53
|
@host = options[:bluebox_host] || "boxpanel.blueboxgrp.com"
|
54
54
|
@port = options[:bluebox_port] || 443
|
55
55
|
@scheme = options[:bluebox_scheme] || 'https'
|
56
|
+
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent])
|
57
|
+
end
|
58
|
+
|
59
|
+
def reload
|
60
|
+
@connection.reset
|
56
61
|
end
|
57
62
|
|
58
63
|
def request(params)
|
59
|
-
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}")
|
60
64
|
params[:headers] ||= {}
|
61
65
|
params[:headers].merge!({
|
62
66
|
'Authorization' => "Basic #{Base64.encode64([@bluebox_customer_id, @bluebox_api_key].join(':')).delete("\r\n")}"
|
data/lib/fog/connection.rb
CHANGED
@@ -1,11 +1,15 @@
|
|
1
1
|
module Fog
|
2
2
|
class Connection
|
3
3
|
|
4
|
-
def initialize(url)
|
4
|
+
def initialize(url, persistent=false)
|
5
5
|
@excon = Excon.new(url)
|
6
|
+
@persistent = persistent
|
6
7
|
end
|
7
8
|
|
8
9
|
def request(params, &block)
|
10
|
+
unless @persistent
|
11
|
+
reset
|
12
|
+
end
|
9
13
|
unless block_given?
|
10
14
|
if (parser = params.delete(:parser))
|
11
15
|
body = Nokogiri::XML::SAX::PushParser.new(parser)
|
@@ -23,5 +27,9 @@ module Fog
|
|
23
27
|
response
|
24
28
|
end
|
25
29
|
|
30
|
+
def reset
|
31
|
+
@excon.reset
|
32
|
+
end
|
33
|
+
|
26
34
|
end
|
27
35
|
end
|
data/lib/fog/credentials.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'yaml'
|
1
2
|
module Fog
|
2
3
|
class << self
|
3
4
|
|
@@ -34,6 +35,8 @@ module Fog
|
|
34
35
|
:bluebox_api_key: INTENTIONALLY_LEFT_BLANK
|
35
36
|
:bluebox_customer_id: INTENTIONALLY_LEFT_BLANK
|
36
37
|
:local_root: INTENTIONALLY_LEFT_BLANK
|
38
|
+
:new_servers_password: INTENTIONALLY_LEFT_BLANK
|
39
|
+
:new_servers_username: INTENTIONALLY_LEFT_BLANK
|
37
40
|
:public_key_path: INTENTIONALLY_LEFT_BLANK
|
38
41
|
:private_key_path: INTENTIONALLY_LEFT_BLANK
|
39
42
|
:rackspace_api_key: INTENTIONALLY_LEFT_BLANK
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'fog/parser'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module NewServers
|
5
|
+
extend Fog::Service
|
6
|
+
|
7
|
+
requires :new_servers_password
|
8
|
+
requires :new_servers_username
|
9
|
+
|
10
|
+
model_path 'fog/new_servers/models'
|
11
|
+
|
12
|
+
request_path 'fog/new_servers/requests'
|
13
|
+
request 'add_server'
|
14
|
+
request 'cancel_server'
|
15
|
+
request 'get_server'
|
16
|
+
request 'list_images'
|
17
|
+
request 'list_plans'
|
18
|
+
request 'list_servers'
|
19
|
+
request 'reboot_server'
|
20
|
+
|
21
|
+
class Mock
|
22
|
+
include Collections
|
23
|
+
|
24
|
+
def self.data
|
25
|
+
@data ||= Hash.new do |hash, key|
|
26
|
+
hash[key] = {}
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.reset_data(keys=data.keys)
|
31
|
+
for key in [*keys]
|
32
|
+
data.delete(key)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def initialize(options={})
|
37
|
+
@new_server_username = options[:new_servers_username]
|
38
|
+
@data = self.class.data[@new_server_username]
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
class Real
|
44
|
+
include Collections
|
45
|
+
|
46
|
+
def initialize(options={})
|
47
|
+
@new_servers_password = options[:new_servers_password]
|
48
|
+
@new_servers_username = options[:new_servers_username]
|
49
|
+
@host = options[:host] || "noc.newservers.com"
|
50
|
+
@port = options[:port] || 443
|
51
|
+
@scheme = options[:scheme] || 'https'
|
52
|
+
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent])
|
53
|
+
end
|
54
|
+
|
55
|
+
def reload
|
56
|
+
@connection.reset
|
57
|
+
end
|
58
|
+
|
59
|
+
def request(params)
|
60
|
+
params[:query] ||= {}
|
61
|
+
params[:query].merge!({
|
62
|
+
:password => @new_servers_password,
|
63
|
+
:username => @new_servers_username
|
64
|
+
})
|
65
|
+
params[:headers] ||= {}
|
66
|
+
case params[:method]
|
67
|
+
when 'DELETE', 'GET', 'HEAD'
|
68
|
+
params[:headers]['Accept'] = 'application/xml'
|
69
|
+
when 'POST', 'PUT'
|
70
|
+
params[:headers]['Content-Type'] = 'application/xml'
|
71
|
+
end
|
72
|
+
|
73
|
+
begin
|
74
|
+
response = @connection.request(params.merge!({:host => @host}))
|
75
|
+
rescue Excon::Errors::Error => error
|
76
|
+
raise case error
|
77
|
+
when Excon::Errors::NotFound
|
78
|
+
Fog::NewServers::NotFound.slurp(error)
|
79
|
+
else
|
80
|
+
error
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
response
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module NewServers
|
2
|
+
class << self
|
3
|
+
if Fog.credentials[:new_servers_password] && Fog.credentials[:new_servers_username]
|
4
|
+
|
5
|
+
def initialized?
|
6
|
+
true
|
7
|
+
end
|
8
|
+
|
9
|
+
def [](service)
|
10
|
+
@@connections ||= Hash.new do |hash, key|
|
11
|
+
credentials = Fog.credentials.reject do |k,v|
|
12
|
+
![:new_servers_password, :new_servers_username].include?(k)
|
13
|
+
end
|
14
|
+
hash[key] = case key
|
15
|
+
when :new_servers
|
16
|
+
Fog::NewServers.new(credentials)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
@@connections[service]
|
20
|
+
end
|
21
|
+
|
22
|
+
else
|
23
|
+
|
24
|
+
def initialized?
|
25
|
+
false
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Fog
|
2
|
+
module NewServers
|
3
|
+
class Real
|
4
|
+
|
5
|
+
# Boot a new server
|
6
|
+
#
|
7
|
+
# ==== Parameters
|
8
|
+
# * planId<~String> - The id of the plan to boot the server with
|
9
|
+
# * options<~Hash>: optional extra arguments
|
10
|
+
# * imageId<~String> - Optional image to boot server from
|
11
|
+
# * name<~String> - Name to boot new server with
|
12
|
+
#
|
13
|
+
# ==== Returns
|
14
|
+
# * response<~Excon::Response>:
|
15
|
+
# * body<~Hash>:
|
16
|
+
# * 'server'<~Hash>:
|
17
|
+
# * 'id'<~String> - Id of the image
|
18
|
+
#
|
19
|
+
def add_server(plan_id, options = {})
|
20
|
+
request(
|
21
|
+
:expects => 200,
|
22
|
+
:method => 'GET',
|
23
|
+
:parser => Fog::ToHashDocument.new,
|
24
|
+
:path => 'api/addServer',
|
25
|
+
:query => {'planId' => plan_id}.merge!(options)
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
class Mock
|
32
|
+
|
33
|
+
def add_server(server_id)
|
34
|
+
Fog::Mock.not_implemented
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Fog
|
2
|
+
module NewServers
|
3
|
+
class Real
|
4
|
+
|
5
|
+
# Shutdown a running server
|
6
|
+
#
|
7
|
+
# ==== Parameters
|
8
|
+
# * serverId<~String> - The id of the server to shutdown
|
9
|
+
#
|
10
|
+
# ==== Returns
|
11
|
+
# * response<~Excon::Response>:
|
12
|
+
# * body<~Hash>:
|
13
|
+
# * 'server'<~Hash>:
|
14
|
+
# * 'id'<~String> - Id of the image
|
15
|
+
#
|
16
|
+
def cancel_server(server_id)
|
17
|
+
request(
|
18
|
+
:expects => 200,
|
19
|
+
:method => 'GET',
|
20
|
+
:parser => Fog::ToHashDocument.new,
|
21
|
+
:path => 'api/cancelServer',
|
22
|
+
:query => {'serverId' => server_id}
|
23
|
+
)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
class Mock
|
29
|
+
|
30
|
+
def cancel_server(server_id)
|
31
|
+
Fog::Mock.not_implemented
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Fog
|
2
|
+
module NewServers
|
3
|
+
class Real
|
4
|
+
|
5
|
+
# List servers
|
6
|
+
#
|
7
|
+
# ==== Returns
|
8
|
+
# * response<~Excon::Response>:
|
9
|
+
# * server<~Hash>:
|
10
|
+
# * 'id'<~String> - Id of the server
|
11
|
+
# * 'ip'<~Hash>:
|
12
|
+
# * 'address'<~String> - Address of the ip
|
13
|
+
# * 'name'<~String> - Name of the ip
|
14
|
+
# * 'login'<~Hash>:
|
15
|
+
# * 'name'<~String> - Name of the login
|
16
|
+
# * 'password'<~String> - Password of the login
|
17
|
+
# * 'username'<~String> - Username of the login
|
18
|
+
# * 'name'<~String> - Name of the server
|
19
|
+
# * 'notes'<~String> - Notes about the server
|
20
|
+
# * 'state'<~String> - State of the server
|
21
|
+
#
|
22
|
+
def get_server(server_id)
|
23
|
+
request(
|
24
|
+
:expects => 200,
|
25
|
+
:method => 'GET',
|
26
|
+
:parser => Fog::ToHashDocument.new,
|
27
|
+
:path => 'api/getServer',
|
28
|
+
:query => {'serverId' => server_id}
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
class Mock
|
35
|
+
|
36
|
+
def get_server(server_id)
|
37
|
+
Fog::Mock.not_implemented
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Fog
|
2
|
+
module NewServers
|
3
|
+
class Real
|
4
|
+
|
5
|
+
# List images
|
6
|
+
#
|
7
|
+
# ==== Returns
|
8
|
+
# * response<~Excon::Response>:
|
9
|
+
# * body<~Array>:
|
10
|
+
# * 'id'<~String> - Id of the image
|
11
|
+
# * 'name'<~String> - Name of the image
|
12
|
+
# * 'size'<~String> - Size of the image
|
13
|
+
#
|
14
|
+
def list_images
|
15
|
+
request(
|
16
|
+
:expects => 200,
|
17
|
+
:method => 'GET',
|
18
|
+
:parser => Fog::ToHashDocument.new,
|
19
|
+
:path => 'api/listImages'
|
20
|
+
)
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
class Mock
|
26
|
+
|
27
|
+
def list_images
|
28
|
+
Fog::Mock.not_implemented
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Fog
|
2
|
+
module NewServers
|
3
|
+
class Real
|
4
|
+
|
5
|
+
# List available plans
|
6
|
+
#
|
7
|
+
# ==== Returns
|
8
|
+
# * response<~Excon::Response>:
|
9
|
+
# * body<~Array>:
|
10
|
+
# * 'description'<~String> - Description of the plan
|
11
|
+
# * 'id'<~String> - Id of the plan
|
12
|
+
# * 'name'<~String> - Name of the plan
|
13
|
+
# * 'rate'<~String> - Cost per hour of the plan
|
14
|
+
# * 'os'<~String> - Operating system of the plan
|
15
|
+
# * 'config'<~String> - Configuration of the plan
|
16
|
+
#
|
17
|
+
def list_plans
|
18
|
+
request(
|
19
|
+
:expects => 200,
|
20
|
+
:method => 'GET',
|
21
|
+
:parser => Fog::ToHashDocument.new,
|
22
|
+
:path => 'api/listPlans'
|
23
|
+
)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
class Mock
|
29
|
+
|
30
|
+
def list_plans
|
31
|
+
Fog::Mock.not_implemented
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Fog
|
2
|
+
module NewServers
|
3
|
+
class Real
|
4
|
+
|
5
|
+
# List servers
|
6
|
+
#
|
7
|
+
# ==== Returns
|
8
|
+
# * response<~Excon::Response>:
|
9
|
+
# * body<~Array>:
|
10
|
+
# * server<~Hash>:
|
11
|
+
# * 'id'<~String> - Id of the server
|
12
|
+
# * 'ip'<~Hash>:
|
13
|
+
# * 'address'<~String> - Address of the ip
|
14
|
+
# * 'name'<~String> - Name of the ip
|
15
|
+
# * 'login'<~Hash>:
|
16
|
+
# * 'name'<~String> - Name of the login
|
17
|
+
# * 'password'<~String> - Password of the login
|
18
|
+
# * 'username'<~String> - Username of the login
|
19
|
+
# * 'name'<~String> - Name of the server
|
20
|
+
# * 'notes'<~String> - Notes about the server
|
21
|
+
# * 'state'<~String> - State of the server
|
22
|
+
#
|
23
|
+
def list_servers
|
24
|
+
request(
|
25
|
+
:expects => 200,
|
26
|
+
:method => 'GET',
|
27
|
+
:parser => Fog::ToHashDocument.new,
|
28
|
+
:path => 'api/listServers'
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
class Mock
|
35
|
+
|
36
|
+
def list_servers
|
37
|
+
Fog::Mock.not_implemented
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Fog
|
2
|
+
module NewServers
|
3
|
+
class Real
|
4
|
+
|
5
|
+
# Reboot a running server
|
6
|
+
#
|
7
|
+
# ==== Parameters
|
8
|
+
# * serverId<~String> - The id of the server to reboot
|
9
|
+
#
|
10
|
+
def reboot_server(server_id)
|
11
|
+
request(
|
12
|
+
:expects => 200,
|
13
|
+
:method => 'GET',
|
14
|
+
:parser => Fog::ToHashDocument.new,
|
15
|
+
:path => 'api/rebootServer',
|
16
|
+
:query => {'serverId' => server_id}
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
class Mock
|
23
|
+
|
24
|
+
def reboot_server(server_id)
|
25
|
+
Fog::Mock.not_implemented
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|