profitbricks 1.0.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -0
- data/Manifest.txt +14 -0
- data/lib/profitbricks.rb +2 -1
- data/lib/profitbricks/nic.rb +1 -0
- data/lib/profitbricks/profitbricks.rb +4 -3
- data/lib/profitbricks/snapshot.rb +89 -0
- data/spec/fixtures/create_snapshot/success.json +9 -0
- data/spec/fixtures/create_snapshot/success.xml +1 -0
- data/spec/fixtures/delete_snapshot/success.json +1 -0
- data/spec/fixtures/delete_snapshot/success.xml +1 -0
- data/spec/fixtures/get_all_snapshots/success.json +49 -0
- data/spec/fixtures/get_all_snapshots/success.xml +1 -0
- data/spec/fixtures/get_snapshot/success.json +19 -0
- data/spec/fixtures/get_snapshot/success.xml +1 -0
- data/spec/fixtures/rollback_snapshot/success.json +10 -0
- data/spec/fixtures/rollback_snapshot/success.xml +1 -0
- data/spec/fixtures/update_snapshot/success.json +1 -0
- data/spec/fixtures/update_snapshot/success.xml +1 -0
- data/spec/profitbricks/snapshot_spec.rb +54 -0
- metadata +18 -4
data/CHANGELOG.md
CHANGED
data/Manifest.txt
CHANGED
@@ -24,6 +24,7 @@ lib/profitbricks/nic.rb
|
|
24
24
|
lib/profitbricks/profitbricks.rb
|
25
25
|
lib/profitbricks/rule.rb
|
26
26
|
lib/profitbricks/server.rb
|
27
|
+
lib/profitbricks/snapshot.rb
|
27
28
|
lib/profitbricks/storage.rb
|
28
29
|
profitbricks.gemspec
|
29
30
|
spec/fixtures/activate_firewalls/success.json
|
@@ -48,6 +49,8 @@ spec/fixtures/create_nic/success.json
|
|
48
49
|
spec/fixtures/create_nic/success.xml
|
49
50
|
spec/fixtures/create_server/minimal.json
|
50
51
|
spec/fixtures/create_server/minimal.xml
|
52
|
+
spec/fixtures/create_snapshot/success.json
|
53
|
+
spec/fixtures/create_snapshot/success.xml
|
51
54
|
spec/fixtures/create_storage/success.json
|
52
55
|
spec/fixtures/create_storage/success.xml
|
53
56
|
spec/fixtures/deactivate_firewalls/success.json
|
@@ -64,6 +67,8 @@ spec/fixtures/delete_nic/success.json
|
|
64
67
|
spec/fixtures/delete_nic/success.xml
|
65
68
|
spec/fixtures/delete_server/success.json
|
66
69
|
spec/fixtures/delete_server/success.xml
|
70
|
+
spec/fixtures/delete_snapshot/success.json
|
71
|
+
spec/fixtures/delete_snapshot/success.xml
|
67
72
|
spec/fixtures/delete_storage/failture.json
|
68
73
|
spec/fixtures/delete_storage/failture.xml
|
69
74
|
spec/fixtures/delete_storage/success.json
|
@@ -82,6 +87,8 @@ spec/fixtures/get_all_images/success.json
|
|
82
87
|
spec/fixtures/get_all_images/success.xml
|
83
88
|
spec/fixtures/get_all_public_ip_blocks/success.json
|
84
89
|
spec/fixtures/get_all_public_ip_blocks/success.xml
|
90
|
+
spec/fixtures/get_all_snapshots/success.json
|
91
|
+
spec/fixtures/get_all_snapshots/success.xml
|
85
92
|
spec/fixtures/get_data_center/create.json
|
86
93
|
spec/fixtures/get_data_center/create.xml
|
87
94
|
spec/fixtures/get_data_center/firewall.json
|
@@ -108,6 +115,8 @@ spec/fixtures/get_server/connected_storage.json
|
|
108
115
|
spec/fixtures/get_server/connected_storage.xml
|
109
116
|
spec/fixtures/get_server/two_nics.json
|
110
117
|
spec/fixtures/get_server/two_nics.xml
|
118
|
+
spec/fixtures/get_snapshot/success.json
|
119
|
+
spec/fixtures/get_snapshot/success.xml
|
111
120
|
spec/fixtures/get_storage/mount_image.json
|
112
121
|
spec/fixtures/get_storage/mount_image.xml
|
113
122
|
spec/fixtures/get_storage/success.json
|
@@ -124,6 +133,8 @@ spec/fixtures/reserve_public_ip_block/success.json
|
|
124
133
|
spec/fixtures/reserve_public_ip_block/success.xml
|
125
134
|
spec/fixtures/reset_server/success.json
|
126
135
|
spec/fixtures/reset_server/success.xml
|
136
|
+
spec/fixtures/rollback_snapshot/success.json
|
137
|
+
spec/fixtures/rollback_snapshot/success.xml
|
127
138
|
spec/fixtures/set_image_os_type/success.json
|
128
139
|
spec/fixtures/set_image_os_type/success.xml
|
129
140
|
spec/fixtures/set_internet_access/success.json
|
@@ -140,6 +151,8 @@ spec/fixtures/update_nic/success.json
|
|
140
151
|
spec/fixtures/update_nic/success.xml
|
141
152
|
spec/fixtures/update_server/basic.json
|
142
153
|
spec/fixtures/update_server/basic.xml
|
154
|
+
spec/fixtures/update_snapshot/success.json
|
155
|
+
spec/fixtures/update_snapshot/success.xml
|
143
156
|
spec/fixtures/update_storage/success.json
|
144
157
|
spec/fixtures/update_storage/success.xml
|
145
158
|
spec/live/data_center_spec.rb
|
@@ -153,5 +166,6 @@ spec/profitbricks/load_balancer_spec.rb
|
|
153
166
|
spec/profitbricks/model_spec.rb
|
154
167
|
spec/profitbricks/nic_spec.rb
|
155
168
|
spec/profitbricks/server_spec.rb
|
169
|
+
spec/profitbricks/snapshot_spec.rb
|
156
170
|
spec/profitbricks/storage_spec.rb
|
157
171
|
spec/spec_helper.rb
|
data/lib/profitbricks.rb
CHANGED
@@ -13,9 +13,10 @@ require 'profitbricks/image'
|
|
13
13
|
require 'profitbricks/storage'
|
14
14
|
require 'profitbricks/ip_block'
|
15
15
|
require 'profitbricks/rule'
|
16
|
+
require 'profitbricks/snapshot'
|
16
17
|
|
17
18
|
module Profitbricks
|
18
|
-
VERSION = '1.0
|
19
|
+
VERSION = '1.1.0'
|
19
20
|
end
|
20
21
|
|
21
22
|
PB = Profitbricks
|
data/lib/profitbricks/nic.rb
CHANGED
@@ -77,6 +77,7 @@ module Profitbricks
|
|
77
77
|
# @option options [Fixnum] :lan_id Identifier of the target LAN > 0 that is to be connected to the specified virtual server. If no LAN exists for such ID, a new LAN with the given ID will be created. (required)
|
78
78
|
# @option options [String] :ip Public/private IP address.
|
79
79
|
# @option options [String] :name Names the NIC
|
80
|
+
# @option options [Boolean] :dhcpActive Toggles usage of ProfitBricks DHCP
|
80
81
|
# @return [Nic] The created NIC
|
81
82
|
def create(options = {})
|
82
83
|
options[:nic_name] = options.delete :name if options[:name]
|
@@ -3,7 +3,8 @@ module Profitbricks
|
|
3
3
|
class AuthenticationError < StandardError; end
|
4
4
|
NEED_PREFIX = [:create_nic, :create_load_balancer, :update_storage, :create_storage,
|
5
5
|
:update_data_center, :rom_drive, :update_nic, :create_server,
|
6
|
-
:update_load_balancer, :connect_storage_to_server, :update_server
|
6
|
+
:update_load_balancer, :connect_storage_to_server, :update_server,
|
7
|
+
:create_snapshot, :update_snapshot, :rollback_snapshot]
|
7
8
|
# Configure the Profitbricks API client
|
8
9
|
#
|
9
10
|
# @see Profitbricks::Config
|
@@ -23,8 +24,8 @@ module Profitbricks
|
|
23
24
|
globals.raise_errors true
|
24
25
|
globals.log Profitbricks::Config.log
|
25
26
|
globals.pretty_print_xml true
|
26
|
-
globals.open_timeout
|
27
|
-
globals.read_timeout
|
27
|
+
globals.open_timeout 10
|
28
|
+
globals.read_timeout 10
|
28
29
|
|
29
30
|
# Looks like ssl verifycation works with current jruby
|
30
31
|
#if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby' && !ENV['SSL_CERT_DIR']
|
@@ -0,0 +1,89 @@
|
|
1
|
+
module Profitbricks
|
2
|
+
class Snapshot < Profitbricks::Model
|
3
|
+
|
4
|
+
def initialize(hash, parent=nil)
|
5
|
+
super(hash)
|
6
|
+
end
|
7
|
+
|
8
|
+
# Updates meta data of a snapshot. This meta data can be relevant as they trigger other features like Live Vertical Scaling of CPU or RAM.
|
9
|
+
#
|
10
|
+
# @param [Hash] options parameters to update
|
11
|
+
# @option options [String] :description Text field to add additional information (e.g. for details about time or reason why snapshot was created)
|
12
|
+
# @option options [Fixnum] :name name of snapshot
|
13
|
+
# @option options [Boolean] :bootable flag of type boolean
|
14
|
+
# @option options [String] :os_type flag to specify OS type; relevant for license accounting in case snapshot gets redeployed on further virtual storage instances
|
15
|
+
# @option options [Boolean] :cpu_hot_plug snapshot contains capabilities to hotplug CPU; flag of type boolean
|
16
|
+
# @option options [Boolean] :ram_hot_plug snapshot contains capabilities to hotplug RAM; flag of type boolean
|
17
|
+
# @option options [Boolean] :nic_hot_plug snapshot contains capabilities to hotplug NIC; flag of type boolean
|
18
|
+
# @option options [Boolean] :nic_hot_un_plug snapshot contains capabilities to hotunplug NIC; flag of type boolean
|
19
|
+
# @return [Boolean] true on success, false otherwise
|
20
|
+
def update(options = {})
|
21
|
+
update_attributes_from_hash options
|
22
|
+
options[:snapshot_name] = options.delete :name if options[:name]
|
23
|
+
response = Profitbricks.request :update_snapshot, options.merge(:snapshot_id => self.id)
|
24
|
+
return true
|
25
|
+
end
|
26
|
+
|
27
|
+
# Deletes a snapshot. Please be aware that deleted snapshots and related data in this snapshot cannot be recovered anymore.
|
28
|
+
#
|
29
|
+
# @return [Boolean] true on success, false otherwise
|
30
|
+
def delete
|
31
|
+
response = Profitbricks.request :delete_snapshot, snapshot_id: self.id
|
32
|
+
return true
|
33
|
+
end
|
34
|
+
|
35
|
+
# Using the rollback option you may redeploy the snapshotted state on a storage.
|
36
|
+
#
|
37
|
+
# Attention: The current state of the storage will be lost unless you create another snapshot before rolling back.
|
38
|
+
#
|
39
|
+
# @param [Hash] options parameters
|
40
|
+
# @option options [String] :storage_id Identifier of the virtual storage as target for the snapshot
|
41
|
+
# @return [Boolean] true on success, false otherwise
|
42
|
+
def rollback(options = {})
|
43
|
+
response = Profitbricks.request :rollback_snapshot, options.merge(:snapshot_id => self.id)
|
44
|
+
return true
|
45
|
+
end
|
46
|
+
|
47
|
+
class << self
|
48
|
+
# Provides a list of all snapshots available to this account
|
49
|
+
#
|
50
|
+
# @return [Array <Snapshot>] Array of all available Snapshots
|
51
|
+
def all
|
52
|
+
resp = Profitbricks.request :get_all_snapshots
|
53
|
+
[resp].flatten.compact.collect do |snapshot|
|
54
|
+
PB::Snapshot.new(snapshot)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# Creates a snapshot of an existing storage device.
|
59
|
+
#
|
60
|
+
# The size of the snapshot will be the same as the size of the storage it was taken from independent of how much of it is in use. Any snapshot will be charged to your account and billed like an HD storage of the same size.
|
61
|
+
#
|
62
|
+
# @param [Hash] options parameters for the new NIC
|
63
|
+
# @option options [String] :storageId Identifier of the virtual storage for which a snapshot shall be created (required)
|
64
|
+
# @option options [String] :name Name of the snapshot to be created
|
65
|
+
# @option options [String] :description Additional field to provide customized information about the data in this snapshot
|
66
|
+
# @return [Boolean] true on success
|
67
|
+
def create(options = {})
|
68
|
+
options[:snapshot_name] = options.delete :name if options[:name]
|
69
|
+
response = Profitbricks.request :create_snapshot, options
|
70
|
+
true
|
71
|
+
end
|
72
|
+
|
73
|
+
# Returns information about a particular Snapshot
|
74
|
+
#
|
75
|
+
# @param [Hash] options currently just :id is supported
|
76
|
+
# @option options [String] :id The id of the Snapshot to locate
|
77
|
+
# @option options [String] :name The name of the Snapshot
|
78
|
+
# @return [Snapshot] the found Snapshot
|
79
|
+
def find(options = {})
|
80
|
+
if options[:name]
|
81
|
+
return PB::Snapshot.all().select { |s| s.name == options[:name] }.first
|
82
|
+
end
|
83
|
+
raise "Unable to locate the Snapshot named '#{options[:name]}'" unless options[:id]
|
84
|
+
response = Profitbricks.request :get_snapshot, snapshot_id: options[:id]
|
85
|
+
PB::Snapshot.new(response)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:createSnapshotReturn xmlns:ns2="http://ws.api.profitbricks.com/"><return><requestId>333985</requestId><snapshotId>c67f2247-2416-42d3-993f-752f3c189bce</snapshotId></return></ns2:createSnapshotReturn></S:Body></S:Envelope>
|
@@ -0,0 +1 @@
|
|
1
|
+
{"delete_snapshot_response":{"return":{"request_id":"335204"},"@xmlns:ns2":"http://ws.api.profitbricks.com/"}}
|
@@ -0,0 +1 @@
|
|
1
|
+
<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:deleteSnapshotResponse xmlns:ns2="http://ws.api.profitbricks.com/"><return><requestId>335204</requestId></return></ns2:deleteSnapshotResponse></S:Body></S:Envelope>
|
@@ -0,0 +1,49 @@
|
|
1
|
+
{
|
2
|
+
"get_all_snapshots_response": {
|
3
|
+
"return": [
|
4
|
+
{
|
5
|
+
"snapshot_id": "77b618a5-18c3-49ec-8c5e-ef13dc905dce",
|
6
|
+
"description": "description",
|
7
|
+
"snapshot_size": "20480",
|
8
|
+
"snapshot_name": "test",
|
9
|
+
"provisioning_state": "AVAILABLE",
|
10
|
+
"bootable": true,
|
11
|
+
"os_type": "UNKNOWN",
|
12
|
+
"cpu_hot_plug": false,
|
13
|
+
"ram_hot_plug": false,
|
14
|
+
"nic_hot_plug": false,
|
15
|
+
"nic_hot_un_plug": false,
|
16
|
+
"region": "EUROPE"
|
17
|
+
},
|
18
|
+
{
|
19
|
+
"snapshot_id": "bb34813c-8e29-4894-baf8-c8cbfa4ba12f",
|
20
|
+
"description": "description",
|
21
|
+
"snapshot_size": "5120",
|
22
|
+
"snapshot_name": "test3",
|
23
|
+
"provisioning_state": "AVAILABLE",
|
24
|
+
"bootable": false,
|
25
|
+
"os_type": "UNKNOWN",
|
26
|
+
"cpu_hot_plug": false,
|
27
|
+
"ram_hot_plug": false,
|
28
|
+
"nic_hot_plug": false,
|
29
|
+
"nic_hot_un_plug": false,
|
30
|
+
"region": "EUROPE"
|
31
|
+
},
|
32
|
+
{
|
33
|
+
"snapshot_id": "c67f2247-2416-42d3-993f-752f3c189bce",
|
34
|
+
"description": "description",
|
35
|
+
"snapshot_size": "10240",
|
36
|
+
"snapshot_name": "test3",
|
37
|
+
"provisioning_state": "AVAILABLE",
|
38
|
+
"bootable": true,
|
39
|
+
"os_type": "UNKNOWN",
|
40
|
+
"cpu_hot_plug": false,
|
41
|
+
"ram_hot_plug": false,
|
42
|
+
"nic_hot_plug": false,
|
43
|
+
"nic_hot_un_plug": false,
|
44
|
+
"region": "EUROPE"
|
45
|
+
}
|
46
|
+
],
|
47
|
+
"@xmlns:ns2": "http://ws.api.profitbricks.com/"
|
48
|
+
}
|
49
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:getAllSnapshotsResponse xmlns:ns2="http://ws.api.profitbricks.com/"><return><snapshotId>77b618a5-18c3-49ec-8c5e-ef13dc905dce</snapshotId><description>description</description><snapshotSize>20480</snapshotSize><snapshotName>test</snapshotName><provisioningState>AVAILABLE</provisioningState><bootable>true</bootable><osType>UNKNOWN</osType><cpuHotPlug>false</cpuHotPlug><ramHotPlug>false</ramHotPlug><nicHotPlug>false</nicHotPlug><nicHotUnPlug>false</nicHotUnPlug><region>EUROPE</region></return><return><snapshotId>bb34813c-8e29-4894-baf8-c8cbfa4ba12f</snapshotId><description>description</description><snapshotSize>5120</snapshotSize><snapshotName>test3</snapshotName><provisioningState>AVAILABLE</provisioningState><bootable>false</bootable><osType>UNKNOWN</osType><cpuHotPlug>false</cpuHotPlug><ramHotPlug>false</ramHotPlug><nicHotPlug>false</nicHotPlug><nicHotUnPlug>false</nicHotUnPlug><region>EUROPE</region></return><return><snapshotId>c67f2247-2416-42d3-993f-752f3c189bce</snapshotId><description>description</description><snapshotSize>10240</snapshotSize><snapshotName>test3</snapshotName><provisioningState>AVAILABLE</provisioningState><bootable>true</bootable><osType>UNKNOWN</osType><cpuHotPlug>false</cpuHotPlug><ramHotPlug>false</ramHotPlug><nicHotPlug>false</nicHotPlug><nicHotUnPlug>false</nicHotUnPlug><region>EUROPE</region></return></ns2:getAllSnapshotsResponse></S:Body></S:Envelope>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
{
|
2
|
+
"get_snapshot_response": {
|
3
|
+
"return": {
|
4
|
+
"snapshot_id": "77b618a5-18c3-49ec-8c5e-ef13dc905dce",
|
5
|
+
"description": "description",
|
6
|
+
"snapshot_size": "20480",
|
7
|
+
"snapshot_name": "test",
|
8
|
+
"provisioning_state": "INPROCESS",
|
9
|
+
"bootable": true,
|
10
|
+
"os_type": "UNKNOWN",
|
11
|
+
"cpu_hot_plug": false,
|
12
|
+
"ram_hot_plug": false,
|
13
|
+
"nic_hot_plug": false,
|
14
|
+
"nic_hot_un_plug": false,
|
15
|
+
"region": "EUROPE"
|
16
|
+
},
|
17
|
+
"@xmlns:ns2": "http://ws.api.profitbricks.com/"
|
18
|
+
}
|
19
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:getSnapshotResponse xmlns:ns2="http://ws.api.profitbricks.com/"><return><snapshotId>77b618a5-18c3-49ec-8c5e-ef13dc905dce</snapshotId><description>description</description><snapshotSize>20480</snapshotSize><snapshotName>test</snapshotName><provisioningState>INPROCESS</provisioningState><bootable>true</bootable><osType>UNKNOWN</osType><cpuHotPlug>false</cpuHotPlug><ramHotPlug>false</ramHotPlug><nicHotPlug>false</nicHotPlug><nicHotUnPlug>false</nicHotUnPlug><region>EUROPE</region></return></ns2:getSnapshotResponse></S:Body></S:Envelope>
|
@@ -0,0 +1 @@
|
|
1
|
+
<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:rollbackSnapshotResponse xmlns:ns2="http://ws.api.profitbricks.com/"><return><requestId>335484</requestId><dataCenterId>aae67a49-8a53-46ba-a2d6-6d9e933c7a7d</dataCenterId><dataCenterVersion>3</dataCenterVersion></return></ns2:rollbackSnapshotResponse></S:Body></S:Envelope>
|
@@ -0,0 +1 @@
|
|
1
|
+
{"update_snapshot_response":{"return":{"request_id":"335069"},"@xmlns:ns2":"http://ws.api.profitbricks.com/"}}
|
@@ -0,0 +1 @@
|
|
1
|
+
<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:updateSnapshotResponse xmlns:ns2="http://ws.api.profitbricks.com/"><return><requestId>335069</requestId></return></ns2:updateSnapshotResponse></S:Body></S:Envelope>
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Profitbricks::Snapshot do
|
4
|
+
include Savon::SpecHelper
|
5
|
+
|
6
|
+
before(:all) { savon.mock! }
|
7
|
+
after(:all) { savon.unmock! }
|
8
|
+
|
9
|
+
it "should find a Snapshot" do
|
10
|
+
savon.expects(:get_snapshot).with(message: {snapshot_id: '77b618a5-18c3-49ec-8c5e-ef13dc905dce'}).returns(f :get_snapshot, :success)
|
11
|
+
snapshot = Snapshot.find(id: '77b618a5-18c3-49ec-8c5e-ef13dc905dce')
|
12
|
+
snapshot.name.should == 'test'
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should find all Snapshots" do
|
16
|
+
savon.expects(:get_all_snapshots).with(message: {}).returns(f :get_all_snapshots, :success)
|
17
|
+
snapshots = Snapshot.all
|
18
|
+
snapshots.length.should == 3
|
19
|
+
snapshots.first.class.should == Snapshot
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should find a Snapshot by name" do
|
23
|
+
savon.expects(:get_all_snapshots).with(message: {}).returns(f :get_all_snapshots, :success)
|
24
|
+
snapshot = Snapshot.find(name: 'test3')
|
25
|
+
snapshot.name.should == 'test3'
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should create a new Snapshot" do
|
29
|
+
savon.expects(:create_snapshot).with(message: {request: {snapshot_name: 'test3', storage_id: '1234a', description: 'description'}}).returns(f :create_snapshot, :success)
|
30
|
+
Snapshot.create(name: 'test3', storage_id: '1234a', description: 'description').should == true
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should update a Snapshot" do
|
34
|
+
savon.expects(:get_snapshot).with(message: {snapshot_id: '77b618a5-18c3-49ec-8c5e-ef13dc905dce'}).returns(f :get_snapshot, :success)
|
35
|
+
savon.expects(:update_snapshot).with(message: {request: {snapshot_id: '77b618a5-18c3-49ec-8c5e-ef13dc905dce',cpu_hot_plug: true, ram_hot_plug: true, nic_hot_plug: true, nic_hot_un_plug: true, bootable: true, snapshot_name: 'updated'}}).returns(f :update_snapshot, :success)
|
36
|
+
s = Snapshot.find(id: '77b618a5-18c3-49ec-8c5e-ef13dc905dce')
|
37
|
+
s.update(cpu_hot_plug: true, ram_hot_plug: true, nic_hot_plug: true, nic_hot_un_plug: true, bootable: true, name: 'updated')
|
38
|
+
s.name.should == 'updated'
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should delete a Snapshot" do
|
42
|
+
savon.expects(:get_snapshot).with(message: {snapshot_id: '77b618a5-18c3-49ec-8c5e-ef13dc905dce'}).returns(f :get_snapshot, :success)
|
43
|
+
savon.expects(:delete_snapshot).with(message: {snapshot_id: '77b618a5-18c3-49ec-8c5e-ef13dc905dce'}).returns(f :delete_snapshot, :success)
|
44
|
+
s = Snapshot.find(id: '77b618a5-18c3-49ec-8c5e-ef13dc905dce')
|
45
|
+
s.delete.should == true
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should delete a Snapshot" do
|
49
|
+
savon.expects(:get_snapshot).with(message: {snapshot_id: '77b618a5-18c3-49ec-8c5e-ef13dc905dce'}).returns(f :get_snapshot, :success)
|
50
|
+
savon.expects(:rollback_snapshot).with(message: {request: {snapshot_id: '77b618a5-18c3-49ec-8c5e-ef13dc905dce', storage_id: 'cafee6b2-9f1b-4a3a-a590-487f93545e3a'}}).returns(f :rollback_snapshot, :success)
|
51
|
+
s = Snapshot.find(id: '77b618a5-18c3-49ec-8c5e-ef13dc905dce')
|
52
|
+
s.rollback(storage_id: 'cafee6b2-9f1b-4a3a-a590-487f93545e3a').should == true
|
53
|
+
end
|
54
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: profitbricks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-09-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: savon
|
@@ -94,6 +94,7 @@ files:
|
|
94
94
|
- lib/profitbricks/profitbricks.rb
|
95
95
|
- lib/profitbricks/rule.rb
|
96
96
|
- lib/profitbricks/server.rb
|
97
|
+
- lib/profitbricks/snapshot.rb
|
97
98
|
- lib/profitbricks/storage.rb
|
98
99
|
- profitbricks.gemspec
|
99
100
|
- spec/fixtures/activate_firewalls/success.json
|
@@ -118,6 +119,8 @@ files:
|
|
118
119
|
- spec/fixtures/create_nic/success.xml
|
119
120
|
- spec/fixtures/create_server/minimal.json
|
120
121
|
- spec/fixtures/create_server/minimal.xml
|
122
|
+
- spec/fixtures/create_snapshot/success.json
|
123
|
+
- spec/fixtures/create_snapshot/success.xml
|
121
124
|
- spec/fixtures/create_storage/success.json
|
122
125
|
- spec/fixtures/create_storage/success.xml
|
123
126
|
- spec/fixtures/deactivate_firewalls/success.json
|
@@ -134,6 +137,8 @@ files:
|
|
134
137
|
- spec/fixtures/delete_nic/success.xml
|
135
138
|
- spec/fixtures/delete_server/success.json
|
136
139
|
- spec/fixtures/delete_server/success.xml
|
140
|
+
- spec/fixtures/delete_snapshot/success.json
|
141
|
+
- spec/fixtures/delete_snapshot/success.xml
|
137
142
|
- spec/fixtures/delete_storage/failture.json
|
138
143
|
- spec/fixtures/delete_storage/failture.xml
|
139
144
|
- spec/fixtures/delete_storage/success.json
|
@@ -152,6 +157,8 @@ files:
|
|
152
157
|
- spec/fixtures/get_all_images/success.xml
|
153
158
|
- spec/fixtures/get_all_public_ip_blocks/success.json
|
154
159
|
- spec/fixtures/get_all_public_ip_blocks/success.xml
|
160
|
+
- spec/fixtures/get_all_snapshots/success.json
|
161
|
+
- spec/fixtures/get_all_snapshots/success.xml
|
155
162
|
- spec/fixtures/get_data_center/create.json
|
156
163
|
- spec/fixtures/get_data_center/create.xml
|
157
164
|
- spec/fixtures/get_data_center/firewall.json
|
@@ -178,6 +185,8 @@ files:
|
|
178
185
|
- spec/fixtures/get_server/connected_storage.xml
|
179
186
|
- spec/fixtures/get_server/two_nics.json
|
180
187
|
- spec/fixtures/get_server/two_nics.xml
|
188
|
+
- spec/fixtures/get_snapshot/success.json
|
189
|
+
- spec/fixtures/get_snapshot/success.xml
|
181
190
|
- spec/fixtures/get_storage/mount_image.json
|
182
191
|
- spec/fixtures/get_storage/mount_image.xml
|
183
192
|
- spec/fixtures/get_storage/success.json
|
@@ -194,6 +203,8 @@ files:
|
|
194
203
|
- spec/fixtures/reserve_public_ip_block/success.xml
|
195
204
|
- spec/fixtures/reset_server/success.json
|
196
205
|
- spec/fixtures/reset_server/success.xml
|
206
|
+
- spec/fixtures/rollback_snapshot/success.json
|
207
|
+
- spec/fixtures/rollback_snapshot/success.xml
|
197
208
|
- spec/fixtures/set_image_os_type/success.json
|
198
209
|
- spec/fixtures/set_image_os_type/success.xml
|
199
210
|
- spec/fixtures/set_internet_access/success.json
|
@@ -210,6 +221,8 @@ files:
|
|
210
221
|
- spec/fixtures/update_nic/success.xml
|
211
222
|
- spec/fixtures/update_server/basic.json
|
212
223
|
- spec/fixtures/update_server/basic.xml
|
224
|
+
- spec/fixtures/update_snapshot/success.json
|
225
|
+
- spec/fixtures/update_snapshot/success.xml
|
213
226
|
- spec/fixtures/update_storage/success.json
|
214
227
|
- spec/fixtures/update_storage/success.xml
|
215
228
|
- spec/live/data_center_spec.rb
|
@@ -223,6 +236,7 @@ files:
|
|
223
236
|
- spec/profitbricks/model_spec.rb
|
224
237
|
- spec/profitbricks/nic_spec.rb
|
225
238
|
- spec/profitbricks/server_spec.rb
|
239
|
+
- spec/profitbricks/snapshot_spec.rb
|
226
240
|
- spec/profitbricks/storage_spec.rb
|
227
241
|
- spec/spec_helper.rb
|
228
242
|
homepage: https://github.com/profitbricks/profitbricks-rb
|
@@ -241,7 +255,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
241
255
|
version: '0'
|
242
256
|
segments:
|
243
257
|
- 0
|
244
|
-
hash:
|
258
|
+
hash: -88399394182286319
|
245
259
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
246
260
|
none: false
|
247
261
|
requirements:
|
@@ -250,7 +264,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
250
264
|
version: '0'
|
251
265
|
segments:
|
252
266
|
- 0
|
253
|
-
hash:
|
267
|
+
hash: -88399394182286319
|
254
268
|
requirements: []
|
255
269
|
rubyforge_project: profitbricks
|
256
270
|
rubygems_version: 1.8.23
|