digital_ocean 0.0.1alpha1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/.rspec +2 -0
- data/.travis.yml +9 -0
- data/Gemfile +4 -0
- data/Guardfile +11 -0
- data/LICENSE.txt +22 -0
- data/README.md +32 -0
- data/Rakefile +17 -0
- data/digital_ocean.gemspec +38 -0
- data/lib/digital_ocean/api.rb +46 -0
- data/lib/digital_ocean/authentication_middleware.rb +29 -0
- data/lib/digital_ocean/resource/base.rb +22 -0
- data/lib/digital_ocean/resource/droplet.rb +84 -0
- data/lib/digital_ocean/resource/image.rb +17 -0
- data/lib/digital_ocean/resource/region.rb +9 -0
- data/lib/digital_ocean/resource/size.rb +9 -0
- data/lib/digital_ocean/resource/ssh_key.rb +27 -0
- data/lib/digital_ocean/resource.rb +12 -0
- data/lib/digital_ocean/version.rb +3 -0
- data/lib/digital_ocean.rb +10 -0
- data/spec/api_spec.rb +421 -0
- data/spec/digital_ocean_spec.rb +7 -0
- data/spec/spec_helper.rb +21 -0
- data/spec/support/vcr.rb +21 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_create/should_be_successful.yml +48 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_delete/should_be_successful.yml +48 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_disable_backups/should_be_successful.yml +48 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_enable_backups/should_be_successful.yml +48 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_list/should_be_successful.yml +48 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_list/should_return_a_list_of_all_droplets.yml +48 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_power_cycle/should_be_successful.yml +48 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_power_off/should_be_successful.yml +48 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_power_on/should_be_successful.yml +48 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_reboot/should_be_successful.yml +48 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_rebuild/should_be_successful.yml +48 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_reset_root_password/should_be_successful.yml +49 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_resize/should_be_successful.yml +48 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_restore/should_be_successful.yml +48 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_show/should_be_successful.yml +48 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_shutdown/should_be_successful.yml +48 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_droplets/_snapshot/should_be_successful.yml +48 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_images/_delete/invalid/should_not_be_successful.yml +48 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_images/_delete/valid/should_be_successful.yml +49 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_images/_list/with_filter_global/should_be_successful.yml +69 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_images/_list/with_filter_global/should_return_global_images.yml +69 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_images/_list/with_filter_my_images/should_be_successful.yml +48 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_images/_list/with_filter_my_images/should_return_my_images.yml +48 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_images/_list/without_filter/should_be_successful.yml +70 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_images/_list/without_filter/should_return_a_list_of_all_images.yml +70 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_images/_show/invalid/should_not_be_successful.yml +48 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_images/_show/valid/should_be_successful.yml +48 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_images/_show/valid/should_return_the_image.yml +48 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_regions/_list/should_be_successful.yml +49 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_regions/_list/should_return_a_list_of_all_available_regions.yml +49 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_regions/_list/should_return_a_list_of_all_regions.yml +49 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_sizes/_list/should_be_successful.yml +48 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_sizes/_list/should_return_a_list_of_all_droplet_sizes.yml +48 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_sizes/_list/should_return_the_correct_ID_for_the_96GB_size.yml +48 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_ssh_keys/_add/should_be_successful.yml +48 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_ssh_keys/_delete/should_be_successful.yml +48 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_ssh_keys/_list/should_be_successful.yml +48 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_ssh_keys/_list/should_return_a_list_of_all_SSH_keys.yml +48 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_ssh_keys/_show/invalid/should_not_be_successful.yml +48 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_ssh_keys/_show/valid/should_be_successful.yml +50 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_ssh_keys/_show/valid/should_return_a_list_of_all_SSH_keys.yml +50 -0
- data/spec/vcr/cassettes/DigitalOcean_API/_ssh_keys/_show/valid/should_return_the_public_keykey.yml +50 -0
- metadata +353 -0
data/spec/api_spec.rb
ADDED
@@ -0,0 +1,421 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe DigitalOcean::API, :vcr do
|
4
|
+
subject { DigitalOcean::API.new :client_id => client_id, :api_key => api_key }
|
5
|
+
let(:client_id) { CLIENT_ID }
|
6
|
+
let(:api_key) { API_KEY }
|
7
|
+
|
8
|
+
describe '.new' do
|
9
|
+
it 'should return an instance when called with the essential parameters' do
|
10
|
+
client = DigitalOcean::API.new :client_id => client_id, :api_key => api_key
|
11
|
+
client.should be_instance_of(DigitalOcean::API)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '#droplets' do
|
16
|
+
let(:droplet_id) { 87071 }
|
17
|
+
|
18
|
+
describe '#list' do
|
19
|
+
let(:response) {
|
20
|
+
subject.droplets.list
|
21
|
+
}
|
22
|
+
|
23
|
+
it 'should be successful' do
|
24
|
+
response.status.should eql('OK')
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'should return a list of all droplets' do
|
28
|
+
response.droplets.should have_at_least(1).item
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '#show' do
|
33
|
+
let(:id) { 83102 }
|
34
|
+
let(:response) {
|
35
|
+
subject.droplets.show id
|
36
|
+
}
|
37
|
+
|
38
|
+
it 'should be successful' do
|
39
|
+
response.status.should eql('OK')
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe '#create' do
|
44
|
+
let(:name) { 't1' } # "Only valid hostname characters are allowed. (a-z, A-Z, 0-9, . and -)"
|
45
|
+
let(:size_id) { 66 } # 512MB
|
46
|
+
let(:image_id) { 25306 } # Ubuntu 12.10 x32 Server
|
47
|
+
let(:region_id) { 2 } # Amsterdam/NL
|
48
|
+
let(:ssh_key_ids) { [] }
|
49
|
+
|
50
|
+
let(:response) {
|
51
|
+
subject.droplets.create :name => name,
|
52
|
+
:size_id => size_id,
|
53
|
+
:image_id => image_id,
|
54
|
+
:region_id => region_id,
|
55
|
+
:ssh_key_ids => ssh_key_ids
|
56
|
+
}
|
57
|
+
|
58
|
+
it 'should be successful' do
|
59
|
+
# #<Hashie::Rash droplet=#<Hashie::Rash event_id=123456 id=87071 image_id=25306 name="t1" size_id=66> status="OK">
|
60
|
+
response.status.should eql('OK')
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
describe '#reboot' do
|
65
|
+
let(:response) {
|
66
|
+
subject.droplets.reboot droplet_id
|
67
|
+
}
|
68
|
+
|
69
|
+
it 'should be successful' do
|
70
|
+
#<Hashie::Rash event_id=123456 status="OK">
|
71
|
+
response.status.should eql('OK')
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe '#power_cycle' do
|
76
|
+
let(:response) {
|
77
|
+
subject.droplets.power_cycle droplet_id
|
78
|
+
}
|
79
|
+
|
80
|
+
it 'should be successful' do
|
81
|
+
#<Hashie::Rash event_id=123456 status="OK">
|
82
|
+
response.status.should eql('OK')
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
describe '#shutdown' do
|
87
|
+
let(:response) {
|
88
|
+
subject.droplets.shutdown droplet_id
|
89
|
+
}
|
90
|
+
|
91
|
+
it 'should be successful' do
|
92
|
+
#<Hashie::Rash event_id=123456 status="OK">
|
93
|
+
response.status.should eql('OK')
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
describe '#power_on' do
|
98
|
+
let(:response) {
|
99
|
+
subject.droplets.power_on droplet_id
|
100
|
+
}
|
101
|
+
|
102
|
+
it 'should be successful' do
|
103
|
+
#<Hashie::Rash event_id=123456 status="OK">
|
104
|
+
response.status.should eql('OK')
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
describe '#power_off' do
|
109
|
+
let(:response) {
|
110
|
+
subject.droplets.power_off droplet_id
|
111
|
+
}
|
112
|
+
|
113
|
+
it 'should be successful' do
|
114
|
+
#<Hashie::Rash event_id=123456 status="OK">
|
115
|
+
response.status.should eql('OK')
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
describe '#reset_root_password' do
|
120
|
+
let(:response) {
|
121
|
+
subject.droplets.reset_root_password droplet_id
|
122
|
+
}
|
123
|
+
|
124
|
+
it 'should be successful' do
|
125
|
+
pending "does not work, ask digitalocean to fix"
|
126
|
+
#<Hashie::Rash event_id=123456 status="OK">
|
127
|
+
response.status.should eql('OK')
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
describe '#resize' do
|
132
|
+
let(:new_size_id) { 63 } # 1GB RAM
|
133
|
+
|
134
|
+
let(:response) {
|
135
|
+
subject.droplets.resize droplet_id, :size_id => new_size_id
|
136
|
+
}
|
137
|
+
|
138
|
+
it 'should be successful' do
|
139
|
+
# Note: you need to do a full powercycle after this!
|
140
|
+
#<Hashie::Rash event_id=123456 status="OK">
|
141
|
+
response.status.should eql('OK')
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
describe '#snapshot' do
|
146
|
+
let(:snapshot_name) { 'test_snapshot_1' }
|
147
|
+
let(:response) {
|
148
|
+
subject.droplets.snapshot droplet_id, :name => snapshot_name
|
149
|
+
}
|
150
|
+
|
151
|
+
it 'should be successful' do
|
152
|
+
#<Hashie::Rash event_id=123456 status="OK">
|
153
|
+
response.status.should eql('OK')
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
describe '#restore' do
|
158
|
+
let(:image_id) { 57658 }
|
159
|
+
let(:response) {
|
160
|
+
subject.droplets.restore droplet_id, :image_id => image_id
|
161
|
+
}
|
162
|
+
|
163
|
+
it 'should be successful' do
|
164
|
+
#<Hashie::Rash event_id=123456 status="OK">
|
165
|
+
response.status.should eql('OK')
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
describe '#rebuild' do
|
170
|
+
let(:image_id) { 57658 }
|
171
|
+
let(:response) {
|
172
|
+
subject.droplets.rebuild droplet_id, :image_id => image_id
|
173
|
+
}
|
174
|
+
|
175
|
+
it 'should be successful' do
|
176
|
+
#<Hashie::Rash event_id=123456 status="OK">
|
177
|
+
response.status.should eql('OK')
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
describe '#enable_backups' do
|
182
|
+
let(:response) {
|
183
|
+
subject.droplets.enable_backups droplet_id
|
184
|
+
}
|
185
|
+
|
186
|
+
it 'should be successful' do
|
187
|
+
#<Hashie::Rash event_id=123456 status="OK">
|
188
|
+
response.status.should eql('OK')
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
describe '#disable_backups' do
|
193
|
+
let(:response) {
|
194
|
+
subject.droplets.disable_backups droplet_id
|
195
|
+
}
|
196
|
+
|
197
|
+
it 'should be successful' do
|
198
|
+
#<Hashie::Rash event_id=123456 status="OK">
|
199
|
+
response.status.should eql('OK')
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
describe '#delete' do
|
204
|
+
let(:response) {
|
205
|
+
subject.droplets.delete droplet_id
|
206
|
+
}
|
207
|
+
|
208
|
+
it 'should be successful' do
|
209
|
+
puts response.inspect
|
210
|
+
#<Hashie::Rash event_id=123456 status="OK">
|
211
|
+
response.status.should eql('OK')
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
describe '#sizes' do
|
217
|
+
describe '#list' do
|
218
|
+
let(:response) {
|
219
|
+
subject.sizes.list
|
220
|
+
}
|
221
|
+
|
222
|
+
it 'should be successful' do
|
223
|
+
response.status.should eql('OK')
|
224
|
+
end
|
225
|
+
|
226
|
+
it 'should return a list of all droplet sizes' do
|
227
|
+
response.sizes.should have_at_least(5).item
|
228
|
+
end
|
229
|
+
|
230
|
+
it 'should return the correct ID for the 96GB size' do
|
231
|
+
example_size = response.sizes.select { |s| s.name == "96GB" }.first
|
232
|
+
example_size.id.should eql(68)
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
describe '#regions' do
|
238
|
+
describe '#list' do
|
239
|
+
let(:response) {
|
240
|
+
subject.regions.list
|
241
|
+
}
|
242
|
+
|
243
|
+
it 'should be successful' do
|
244
|
+
response.status.should eql('OK')
|
245
|
+
end
|
246
|
+
|
247
|
+
it 'should return a list of all regions' do
|
248
|
+
response.regions.should have_at_least(2).items
|
249
|
+
end
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
describe '#ssh_keys' do
|
254
|
+
describe '#list' do
|
255
|
+
let(:response) {
|
256
|
+
subject.ssh_keys.list
|
257
|
+
}
|
258
|
+
|
259
|
+
it 'should be successful' do
|
260
|
+
response.status.should eql('OK')
|
261
|
+
end
|
262
|
+
|
263
|
+
it 'should return a list of all SSH keys' do
|
264
|
+
response.ssh_keys.should have_at_least(1).item
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
describe '#show' do
|
269
|
+
let(:response) {
|
270
|
+
subject.ssh_keys.show id
|
271
|
+
}
|
272
|
+
|
273
|
+
context 'valid' do
|
274
|
+
let(:id) { 3738 }
|
275
|
+
|
276
|
+
it 'should be successful' do
|
277
|
+
response.status.should eql('OK')
|
278
|
+
end
|
279
|
+
|
280
|
+
it 'should return the public keykey' do
|
281
|
+
response.ssh_key.ssh_pub_key.should_not be_empty
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
285
|
+
context 'invalid' do
|
286
|
+
let(:id) { 1 }
|
287
|
+
|
288
|
+
it 'should not be successful' do
|
289
|
+
response.status.should eql('ERROR')
|
290
|
+
end
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
294
|
+
describe '#add' do
|
295
|
+
pending "does not work, ask digitalocean to fix"
|
296
|
+
|
297
|
+
let(:response) {
|
298
|
+
subject.ssh_keys.add :name => name, :ssh_key_pub => ssh_key_pub
|
299
|
+
}
|
300
|
+
let(:name) { 'mobile computer' }
|
301
|
+
let(:ssh_key_pub) {'xxx' }
|
302
|
+
|
303
|
+
xit 'should be successful' do
|
304
|
+
puts response.status
|
305
|
+
response.status.should eql('OK')
|
306
|
+
end
|
307
|
+
end
|
308
|
+
|
309
|
+
describe '#edit' do
|
310
|
+
pending "does not work, ask digitalocean to fix"
|
311
|
+
end
|
312
|
+
|
313
|
+
describe '#delete' do
|
314
|
+
let(:id) { 3928 }
|
315
|
+
|
316
|
+
let(:response) {
|
317
|
+
subject.ssh_keys.delete id
|
318
|
+
}
|
319
|
+
|
320
|
+
it 'should be successful' do
|
321
|
+
response.status.should eql('OK')
|
322
|
+
end
|
323
|
+
end
|
324
|
+
end
|
325
|
+
|
326
|
+
describe '#images' do
|
327
|
+
describe '#list' do
|
328
|
+
context 'without filter' do
|
329
|
+
let(:response) {
|
330
|
+
subject.images.list
|
331
|
+
}
|
332
|
+
|
333
|
+
it 'should be successful' do
|
334
|
+
response.status.should eql('OK')
|
335
|
+
end
|
336
|
+
|
337
|
+
it 'should return a list of all images' do
|
338
|
+
response.images.should have_at_least(1).item
|
339
|
+
end
|
340
|
+
end
|
341
|
+
|
342
|
+
context 'with filter: global' do
|
343
|
+
let(:response) {
|
344
|
+
subject.images.list :filter => 'global'
|
345
|
+
}
|
346
|
+
|
347
|
+
it 'should be successful' do
|
348
|
+
response.status.should eql('OK')
|
349
|
+
end
|
350
|
+
|
351
|
+
it 'should return global images' do
|
352
|
+
response.images.should have_at_least(1).item
|
353
|
+
end
|
354
|
+
end
|
355
|
+
|
356
|
+
context 'with filter: my_images' do
|
357
|
+
let(:response) {
|
358
|
+
subject.images.list :filter => 'my_images'
|
359
|
+
}
|
360
|
+
|
361
|
+
it 'should be successful' do
|
362
|
+
response.status.should eql('OK')
|
363
|
+
end
|
364
|
+
|
365
|
+
it 'should return my_images' do
|
366
|
+
response.images.should have_at_least(1).item
|
367
|
+
end
|
368
|
+
end
|
369
|
+
end
|
370
|
+
|
371
|
+
describe '#show' do
|
372
|
+
let(:response) {
|
373
|
+
subject.images.show id
|
374
|
+
}
|
375
|
+
|
376
|
+
context 'valid' do
|
377
|
+
let(:id) { 1601 } # CentOS 5.8 x64
|
378
|
+
|
379
|
+
it 'should be successful' do
|
380
|
+
response.status.should eql('OK')
|
381
|
+
end
|
382
|
+
|
383
|
+
it 'should return the image' do
|
384
|
+
response.image.name.should_not be_empty
|
385
|
+
response.image.distribution.should eql('CentOS')
|
386
|
+
end
|
387
|
+
end
|
388
|
+
|
389
|
+
context 'invalid' do
|
390
|
+
let(:id) { 0 }
|
391
|
+
|
392
|
+
it 'should not be successful' do
|
393
|
+
response.status.should eql('ERROR')
|
394
|
+
end
|
395
|
+
end
|
396
|
+
end
|
397
|
+
|
398
|
+
describe '#delete' do
|
399
|
+
let(:response) {
|
400
|
+
subject.images.delete id
|
401
|
+
}
|
402
|
+
|
403
|
+
context 'valid' do
|
404
|
+
let(:id) { 57089 }
|
405
|
+
it 'should be successful' do
|
406
|
+
pending "does not work, ask digitalocean to fix"
|
407
|
+
response.status.should eql('OK')
|
408
|
+
end
|
409
|
+
end
|
410
|
+
|
411
|
+
context 'invalid' do
|
412
|
+
let(:id) { 0 }
|
413
|
+
|
414
|
+
it 'should not be successful' do
|
415
|
+
response.status.should eql('ERROR')
|
416
|
+
end
|
417
|
+
end
|
418
|
+
end
|
419
|
+
|
420
|
+
end
|
421
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
2
|
+
require 'rspec/autorun'
|
3
|
+
require 'digital_ocean'
|
4
|
+
|
5
|
+
if ENV['RECORDING']
|
6
|
+
CLIENT_ID = ENV['DIGITAL_OCEAN_CLIENT_ID']
|
7
|
+
API_KEY = ENV['DIGITAL_OCEAN_API_KEY']
|
8
|
+
else
|
9
|
+
CLIENT_ID = 'client_id_XXXXXXXXXXXXXXXXXXX'
|
10
|
+
API_KEY = 'api_key_YYYYYYYYYYYYYYYYYYYYY'
|
11
|
+
end
|
12
|
+
|
13
|
+
RSpec.configure do |c|
|
14
|
+
# VCR:
|
15
|
+
# so we can use :vcr rather than :vcr => true;
|
16
|
+
# in RSpec 3 this will no longer be necessary.
|
17
|
+
c.treat_symbols_as_metadata_keys_with_true_values = true
|
18
|
+
end
|
19
|
+
|
20
|
+
Dir["./spec/support/**/*.rb"].sort.each {|f| require f}
|
21
|
+
|
data/spec/support/vcr.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'vcr'
|
2
|
+
require 'pp'
|
3
|
+
|
4
|
+
VCR.configure do |c|
|
5
|
+
c.cassette_library_dir = 'spec/vcr/cassettes'
|
6
|
+
c.hook_into :faraday
|
7
|
+
c.configure_rspec_metadata!
|
8
|
+
|
9
|
+
if ENV['RECORDING']
|
10
|
+
c.filter_sensitive_data('client_id_XXXXXXXXXXXXXXXXXXX') { ENV['DIGITAL_OCEAN_CLIENT_ID'] }
|
11
|
+
c.filter_sensitive_data('api_key_YYYYYYYYYYYYYYYYYYYYY') { ENV['DIGITAL_OCEAN_API_KEY'] }
|
12
|
+
end
|
13
|
+
|
14
|
+
c.filter_sensitive_data('_digitalocean2_session=wtf') do |http_interaction|
|
15
|
+
http_interaction.response.headers['set-cookie'].first
|
16
|
+
end
|
17
|
+
|
18
|
+
c.filter_sensitive_data('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') do |http_interaction|
|
19
|
+
http_interaction.response.headers['etag'].first
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.digitalocean.com/droplets/new?client_id=client_id_XXXXXXXXXXXXXXXXXXX&api_key=api_key_YYYYYYYYYYYYYYYYYYYYY&name=t1&size_id=66&image_id=25306®ion_id=2
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 200
|
13
|
+
message:
|
14
|
+
headers:
|
15
|
+
server:
|
16
|
+
- nginx
|
17
|
+
date:
|
18
|
+
- Thu, 24 Jan 2013 09:06:36 GMT
|
19
|
+
content-type:
|
20
|
+
- application/json; charset=utf-8
|
21
|
+
transfer-encoding:
|
22
|
+
- chunked
|
23
|
+
connection:
|
24
|
+
- close
|
25
|
+
status:
|
26
|
+
- '200'
|
27
|
+
x-powered-by:
|
28
|
+
- Phusion Passenger (mod_rails/mod_rack) 3.0.11
|
29
|
+
x-ua-compatible:
|
30
|
+
- IE=Edge,chrome=1
|
31
|
+
etag:
|
32
|
+
- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
33
|
+
cache-control:
|
34
|
+
- max-age=0, private, must-revalidate
|
35
|
+
set-cookie:
|
36
|
+
- _digitalocean2_session=wtf
|
37
|
+
x-request-id:
|
38
|
+
- 92c20c5ff4c03cd11de1a1faf1b3203c
|
39
|
+
x-runtime:
|
40
|
+
- '1.849309'
|
41
|
+
x-rack-cache:
|
42
|
+
- miss
|
43
|
+
body:
|
44
|
+
encoding: US-ASCII
|
45
|
+
string: ! '{"status":"OK","droplet":{"id":87071,"name":"t1","image_id":25306,"size_id":66,"event_id":594537}}'
|
46
|
+
http_version:
|
47
|
+
recorded_at: Thu, 24 Jan 2013 09:06:36 GMT
|
48
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,48 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: delete
|
5
|
+
uri: https://api.digitalocean.com/droplets/87071/destroy?client_id=client_id_XXXXXXXXXXXXXXXXXXX&api_key=api_key_YYYYYYYYYYYYYYYYYYYYY
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 200
|
13
|
+
message:
|
14
|
+
headers:
|
15
|
+
server:
|
16
|
+
- nginx
|
17
|
+
date:
|
18
|
+
- Thu, 24 Jan 2013 10:02:25 GMT
|
19
|
+
content-type:
|
20
|
+
- application/json; charset=utf-8
|
21
|
+
transfer-encoding:
|
22
|
+
- chunked
|
23
|
+
connection:
|
24
|
+
- close
|
25
|
+
status:
|
26
|
+
- '200'
|
27
|
+
x-powered-by:
|
28
|
+
- Phusion Passenger (mod_rails/mod_rack) 3.0.11
|
29
|
+
x-ua-compatible:
|
30
|
+
- IE=Edge,chrome=1
|
31
|
+
etag:
|
32
|
+
- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
33
|
+
cache-control:
|
34
|
+
- max-age=0, private, must-revalidate
|
35
|
+
set-cookie:
|
36
|
+
- _digitalocean2_session=wtf
|
37
|
+
x-request-id:
|
38
|
+
- 214430901aca3df5620ead3434e2df9e
|
39
|
+
x-runtime:
|
40
|
+
- '0.643373'
|
41
|
+
x-rack-cache:
|
42
|
+
- invalidate, pass
|
43
|
+
body:
|
44
|
+
encoding: US-ASCII
|
45
|
+
string: ! '{"status":"OK","event_id":594739}'
|
46
|
+
http_version:
|
47
|
+
recorded_at: Thu, 24 Jan 2013 10:02:25 GMT
|
48
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,48 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.digitalocean.com/droplets/87071/disable_backups?client_id=client_id_XXXXXXXXXXXXXXXXXXX&api_key=api_key_YYYYYYYYYYYYYYYYYYYYY
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 200
|
13
|
+
message:
|
14
|
+
headers:
|
15
|
+
server:
|
16
|
+
- nginx
|
17
|
+
date:
|
18
|
+
- Thu, 24 Jan 2013 09:56:26 GMT
|
19
|
+
content-type:
|
20
|
+
- application/json; charset=utf-8
|
21
|
+
transfer-encoding:
|
22
|
+
- chunked
|
23
|
+
connection:
|
24
|
+
- close
|
25
|
+
status:
|
26
|
+
- '200'
|
27
|
+
x-powered-by:
|
28
|
+
- Phusion Passenger (mod_rails/mod_rack) 3.0.11
|
29
|
+
x-ua-compatible:
|
30
|
+
- IE=Edge,chrome=1
|
31
|
+
etag:
|
32
|
+
- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
33
|
+
cache-control:
|
34
|
+
- max-age=0, private, must-revalidate
|
35
|
+
set-cookie:
|
36
|
+
- _digitalocean2_session=wtf
|
37
|
+
x-request-id:
|
38
|
+
- 84e1e7680d5d50e88d06a8695457745e
|
39
|
+
x-runtime:
|
40
|
+
- '0.271582'
|
41
|
+
x-rack-cache:
|
42
|
+
- invalidate, pass
|
43
|
+
body:
|
44
|
+
encoding: US-ASCII
|
45
|
+
string: ! '{"status":"OK","event_id":594710}'
|
46
|
+
http_version:
|
47
|
+
recorded_at: Thu, 24 Jan 2013 09:56:26 GMT
|
48
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,48 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.digitalocean.com/droplets/87071/enable_backups?client_id=client_id_XXXXXXXXXXXXXXXXXXX&api_key=api_key_YYYYYYYYYYYYYYYYYYYYY
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 200
|
13
|
+
message:
|
14
|
+
headers:
|
15
|
+
server:
|
16
|
+
- nginx
|
17
|
+
date:
|
18
|
+
- Thu, 24 Jan 2013 09:56:25 GMT
|
19
|
+
content-type:
|
20
|
+
- application/json; charset=utf-8
|
21
|
+
transfer-encoding:
|
22
|
+
- chunked
|
23
|
+
connection:
|
24
|
+
- close
|
25
|
+
status:
|
26
|
+
- '200'
|
27
|
+
x-powered-by:
|
28
|
+
- Phusion Passenger (mod_rails/mod_rack) 3.0.11
|
29
|
+
x-ua-compatible:
|
30
|
+
- IE=Edge,chrome=1
|
31
|
+
etag:
|
32
|
+
- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
33
|
+
cache-control:
|
34
|
+
- max-age=0, private, must-revalidate
|
35
|
+
set-cookie:
|
36
|
+
- _digitalocean2_session=wtf
|
37
|
+
x-request-id:
|
38
|
+
- 2583dacb0be13efdaa97ea1ecc1dd36c
|
39
|
+
x-runtime:
|
40
|
+
- '0.504030'
|
41
|
+
x-rack-cache:
|
42
|
+
- invalidate, pass
|
43
|
+
body:
|
44
|
+
encoding: US-ASCII
|
45
|
+
string: ! '{"status":"OK","event_id":594709}'
|
46
|
+
http_version:
|
47
|
+
recorded_at: Thu, 24 Jan 2013 09:56:25 GMT
|
48
|
+
recorded_with: VCR 2.4.0
|