deltacloud-core 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/config.ru +19 -1
  2. data/deltacloud.rb +20 -1
  3. data/lib/deltacloud/backend_capability.rb +18 -0
  4. data/lib/deltacloud/base_driver.rb +1 -1
  5. data/lib/deltacloud/base_driver/base_driver.rb +3 -0
  6. data/lib/deltacloud/drivers/azure/azure_driver.rb +32 -1
  7. data/lib/deltacloud/drivers/ec2/ec2_driver.rb +17 -11
  8. data/lib/deltacloud/drivers/ec2/ec2_mock_driver.rb +18 -0
  9. data/lib/deltacloud/drivers/gogrid/gogrid_client.rb +0 -1
  10. data/lib/deltacloud/drivers/gogrid/gogrid_driver.rb +20 -5
  11. data/lib/deltacloud/drivers/mock/mock_driver.rb +1 -1
  12. data/lib/deltacloud/drivers/rackspace/rackspace_client.rb +1 -1
  13. data/lib/deltacloud/drivers/rackspace/rackspace_driver.rb +28 -1
  14. data/lib/deltacloud/hardware_profile.rb +17 -0
  15. data/lib/deltacloud/helpers.rb +18 -0
  16. data/lib/deltacloud/helpers/application_helper.rb +2 -2
  17. data/lib/deltacloud/helpers/blob_stream.rb +5 -1
  18. data/lib/deltacloud/helpers/conversion_helper.rb +1 -2
  19. data/lib/deltacloud/helpers/hardware_profiles_helper.rb +17 -0
  20. data/lib/deltacloud/method_serializer.rb +1 -1
  21. data/lib/deltacloud/models/base_model.rb +1 -1
  22. data/lib/deltacloud/models/blob.rb +3 -1
  23. data/lib/deltacloud/models/bucket.rb +2 -1
  24. data/lib/deltacloud/models/image.rb +3 -2
  25. data/lib/deltacloud/models/instance.rb +1 -2
  26. data/lib/deltacloud/models/instance_profile.rb +2 -1
  27. data/lib/deltacloud/models/key.rb +2 -1
  28. data/lib/deltacloud/models/load_balancer.rb +1 -1
  29. data/lib/deltacloud/models/realm.rb +1 -1
  30. data/lib/deltacloud/models/storage_snapshot.rb +1 -1
  31. data/lib/deltacloud/models/storage_volume.rb +1 -1
  32. data/lib/deltacloud/state_machine.rb +17 -0
  33. data/lib/deltacloud/validation.rb +18 -0
  34. data/lib/drivers.rb +69 -43
  35. data/lib/sinatra/lazy_auth.rb +1 -1
  36. data/lib/sinatra/rabbit.rb +4 -4
  37. data/lib/sinatra/rack_driver_select.rb +21 -0
  38. data/server.rb +44 -15
  39. data/views/api/drivers.xml.haml +6 -0
  40. data/views/api/show.html.haml +2 -2
  41. data/views/api/show.xml.haml +1 -1
  42. data/views/buckets/index.html.haml +2 -1
  43. data/views/buckets/show.html.haml +4 -3
  44. data/views/errors/backend_error.xml.haml +1 -1
  45. data/views/images/index.xml.haml +5 -1
  46. data/views/keys/show.xml.haml +2 -0
  47. data/views/layout.html.haml +1 -1
  48. data/views/realms/index.html.haml +4 -7
  49. metadata +35 -34
  50. data/lib/deltacloud/drivers/gogrid/test.rb +0 -13
@@ -0,0 +1,6 @@
1
+ %api{ :version => settings.version }
2
+ %drivers
3
+ - DRIVERS.each do |id, details|
4
+ %driver{ :id => id }
5
+ %name<
6
+ =details[:name]
@@ -1,5 +1,5 @@
1
1
  %h1
2
- API v#{@version}
2
+ API v#{settings.version}
3
3
 
4
4
  %ul
5
5
  - collections.keys.sort_by { |k| k.to_s }.each do |key|
@@ -12,4 +12,4 @@
12
12
  = op
13
13
  %li
14
14
  %strong
15
- %a{:href => url_for("/api/docs")} Documentation (v#{@version})
15
+ %a{:href => url_for("/api/docs")} Documentation (#{settings.version})
@@ -1,4 +1,4 @@
1
- %api{ :version=>@version, :driver=>DRIVER }
1
+ %api{ :version => settings.version, :driver => driver_symbol }
2
2
  - for entry_point in entry_points
3
3
  %link{ :rel=>entry_point[0], :href=>entry_point[1] }
4
4
  - for feature in driver.features(entry_point[0])
@@ -30,4 +30,5 @@
30
30
  -bucket.blob_list.each do |blob|
31
31
  = blob
32
32
  %td
33
- =link_to_action 'Delete', destroy_bucket_url(bucket.name), :delete
33
+ -if bucket.size == 0
34
+ =link_to_action 'Delete', destroy_bucket_url(bucket.name), :delete
@@ -14,9 +14,10 @@
14
14
  %dd
15
15
  -@bucket.blob_list.each do |blob|
16
16
  = link_to blob, bucket_url(@bucket.name) + '/' + blob
17
- %dt Delete bucket (must be empty)
18
- %dd
19
17
  %dt Create a new blob
20
18
  %dd
21
19
  =link_to 'Create Blob', bucket_url(@bucket.name) + '/new_blob'
22
- =link_to_action 'Delete', destroy_bucket_url(@bucket.name), :delete
20
+ %dt Delete bucket (must be empty)
21
+ %dd
22
+ -if @bucket.size == 0
23
+ =link_to_action 'Delete', destroy_bucket_url(@bucket.name), :delete
@@ -1,6 +1,6 @@
1
1
  %error{:url => "#{request.env['REQUEST_URI']}", :status => "#{response.status}"}
2
2
  %kind backend_error
3
- %backend{ :driver => DRIVER }
3
+ %backend{ :driver => driver_symbol }
4
4
  %code= @error.code
5
5
  %cause= @error.cause
6
6
  - if @error.details
@@ -4,5 +4,9 @@
4
4
  %image{:href => image_url(image.id), :id => image.id}
5
5
  - image.attributes.select{ |attr| attr!=:id }.each do |attribute|
6
6
  - haml_tag("#{attribute}".tr('-', '_'), :<) do
7
- - haml_concat image.send(attribute)
7
+ - if [:name, :description].include?(attribute)
8
+ =cdata do
9
+ - haml_concat image.send(attribute)
10
+ - else
11
+ - haml_concat image.send(attribute)
8
12
 
@@ -17,3 +17,5 @@
17
17
  %password<
18
18
  =cdata do
19
19
  =@key.password
20
+ %state<
21
+ =@key.state
@@ -19,7 +19,7 @@
19
19
  = yield
20
20
  #footer
21
21
  #driver_info
22
- Driver: #{DRIVER}
22
+ Driver: #{driver_symbol} | API version: #{settings.version}
23
23
  #copyright
24
24
  Copyright 2009, 2010
25
25
  %a{:href => 'http://redhat.com'} Red Hat
@@ -5,15 +5,13 @@
5
5
  %thead
6
6
  %tr
7
7
  %th
8
- Name
9
- %th
10
- Architecture
8
+ ID
11
9
  %th
12
- Memory
10
+ Name
13
11
  %th
14
- Storage
12
+ State
15
13
  %th
16
- Mutable
14
+ Limit
17
15
  %tbody
18
16
  - @realms.each do |realm|
19
17
  %tr
@@ -25,5 +23,4 @@
25
23
  = realm.state
26
24
  %td
27
25
  = realm.limit
28
- %td
29
26
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deltacloud-core
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Red Hat, Inc.
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-26 00:00:00 +01:00
18
+ date: 2010-12-09 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -222,8 +222,8 @@ files:
222
222
  - Rakefile
223
223
  - config.ru
224
224
  - parse.rb
225
- - deltacloud.rb
226
225
  - test.rb
226
+ - deltacloud.rb
227
227
  - server.rb
228
228
  - support/fedora/rubygem-deltacloud-core.spec
229
229
  - support/fedora/deltacloudd
@@ -233,21 +233,19 @@ files:
233
233
  - lib/sinatra/url_for.rb
234
234
  - lib/sinatra/lazy_auth.rb
235
235
  - lib/sinatra/rabbit.rb
236
+ - lib/sinatra/rack_driver_select.rb
236
237
  - lib/deltacloud/models/base_model.rb
237
238
  - lib/deltacloud/models/blob.rb
238
239
  - lib/deltacloud/models/bucket.rb
240
+ - lib/deltacloud/models/image.rb
239
241
  - lib/deltacloud/models/instance_profile.rb
242
+ - lib/deltacloud/models/key.rb
240
243
  - lib/deltacloud/models/realm.rb
241
244
  - lib/deltacloud/models/storage_snapshot.rb
245
+ - lib/deltacloud/models/storage_volume.rb
242
246
  - lib/deltacloud/models/load_balancer.rb
243
- - lib/deltacloud/models/image.rb
244
247
  - lib/deltacloud/models/instance.rb
245
- - lib/deltacloud/models/key.rb
246
- - lib/deltacloud/models/storage_volume.rb
247
- - lib/deltacloud/drivers/ec2/ec2_mock_driver.rb
248
- - lib/deltacloud/drivers/ec2/ec2_driver.rb
249
248
  - lib/deltacloud/drivers/terremark/terremark_driver.rb
250
- - lib/deltacloud/drivers/gogrid/test.rb
251
249
  - lib/deltacloud/drivers/gogrid/gogrid_client.rb
252
250
  - lib/deltacloud/drivers/gogrid/gogrid_driver.rb
253
251
  - lib/deltacloud/drivers/opennebula/occi_client.rb
@@ -260,20 +258,22 @@ files:
260
258
  - lib/deltacloud/drivers/rackspace/rackspace_client.rb
261
259
  - lib/deltacloud/drivers/rhevm/rhevm_driver.rb
262
260
  - lib/deltacloud/drivers/azure/azure_driver.rb
263
- - lib/deltacloud/base_driver/base_driver.rb
261
+ - lib/deltacloud/drivers/ec2/ec2_mock_driver.rb
262
+ - lib/deltacloud/drivers/ec2/ec2_driver.rb
264
263
  - lib/deltacloud/base_driver/features.rb
265
264
  - lib/deltacloud/base_driver/mock_driver.rb
265
+ - lib/deltacloud/base_driver/base_driver.rb
266
266
  - lib/deltacloud/helpers/blob_stream.rb
267
267
  - lib/deltacloud/helpers/conversion_helper.rb
268
268
  - lib/deltacloud/helpers/hardware_profiles_helper.rb
269
269
  - lib/deltacloud/helpers/application_helper.rb
270
+ - lib/deltacloud/backend_capability.rb
270
271
  - lib/deltacloud/base_driver.rb
271
272
  - lib/deltacloud/hardware_profile.rb
272
273
  - lib/deltacloud/helpers.rb
273
274
  - lib/deltacloud/method_serializer.rb
274
275
  - lib/deltacloud/state_machine.rb
275
276
  - lib/deltacloud/validation.rb
276
- - lib/deltacloud/backend_capability.rb
277
277
  - lib/drivers.rb
278
278
  - lib/deltacloud/drivers/mock/data/storage_volumes/vol1.yml
279
279
  - lib/deltacloud/drivers/mock/data/storage_volumes/vol3.yml
@@ -305,61 +305,62 @@ files:
305
305
  - views/accounts/show.html.haml
306
306
  - views/storage_snapshots/show.html.haml
307
307
  - views/storage_snapshots/index.xml.haml
308
- - views/storage_snapshots/show.xml.haml
309
308
  - views/storage_snapshots/index.html.haml
309
+ - views/storage_snapshots/show.xml.haml
310
310
  - views/errors/not_found.html.haml
311
311
  - views/errors/auth_exception.xml.haml
312
312
  - views/errors/validation_failure.xml.haml
313
313
  - views/errors/not_found.xml.haml
314
314
  - views/errors/auth_exception.html.haml
315
- - views/errors/backend_error.html.haml
316
315
  - views/errors/validation_failure.html.haml
317
- - views/errors/backend_capability_failure.html.haml
318
- - views/errors/backend_capability_failure.xml.haml
319
316
  - views/errors/not_allowed.html.haml
320
317
  - views/errors/not_allowed.xml.haml
318
+ - views/errors/backend_error.html.haml
319
+ - views/errors/backend_capability_failure.html.haml
320
+ - views/errors/backend_capability_failure.xml.haml
321
321
  - views/errors/backend_error.xml.haml
322
- - views/images/show.xml.haml
323
- - views/images/index.xml.haml
324
322
  - views/images/index.html.haml
325
323
  - views/images/show.html.haml
324
+ - views/images/index.xml.haml
325
+ - views/images/show.xml.haml
326
326
  - views/keys/new.html.haml
327
- - views/keys/index.xml.haml
328
327
  - views/keys/show.html.haml
329
- - views/keys/show.xml.haml
330
328
  - views/keys/index.html.haml
331
- - views/instances/show.xml.haml
332
- - views/instances/index.xml.haml
333
- - views/instances/new.html.haml
329
+ - views/keys/index.xml.haml
330
+ - views/keys/show.xml.haml
334
331
  - views/instances/index.html.haml
332
+ - views/instances/new.html.haml
335
333
  - views/instances/show.html.haml
336
- - views/hardware_profiles/show.xml.haml
337
- - views/hardware_profiles/index.xml.haml
334
+ - views/instances/index.xml.haml
335
+ - views/instances/show.xml.haml
338
336
  - views/hardware_profiles/index.html.haml
339
337
  - views/hardware_profiles/show.html.haml
338
+ - views/hardware_profiles/index.xml.haml
339
+ - views/hardware_profiles/show.xml.haml
340
340
  - views/docs/operation.xml.haml
341
341
  - views/docs/operation.html.haml
342
342
  - views/docs/collection.xml.haml
343
343
  - views/docs/index.xml.haml
344
344
  - views/docs/index.html.haml
345
345
  - views/docs/collection.html.haml
346
- - views/realms/show.xml.haml
347
- - views/realms/index.xml.haml
348
346
  - views/realms/show.html.haml
349
347
  - views/realms/index.html.haml
350
- - views/blobs/show.xml.haml
348
+ - views/realms/index.xml.haml
349
+ - views/realms/show.xml.haml
351
350
  - views/blobs/new.html.haml
352
351
  - views/blobs/show.html.haml
353
- - views/buckets/index.xml.haml
352
+ - views/blobs/show.xml.haml
354
353
  - views/buckets/new.html.haml
355
- - views/buckets/show.xml.haml
356
354
  - views/buckets/index.html.haml
357
355
  - views/buckets/show.html.haml
358
- - views/load_balancers/index.xml.haml
359
- - views/load_balancers/new.html.haml
360
- - views/load_balancers/show.xml.haml
356
+ - views/buckets/index.xml.haml
357
+ - views/buckets/show.xml.haml
361
358
  - views/load_balancers/index.html.haml
359
+ - views/load_balancers/new.html.haml
360
+ - views/load_balancers/index.xml.haml
362
361
  - views/load_balancers/show.html.haml
362
+ - views/load_balancers/show.xml.haml
363
+ - views/api/drivers.xml.haml
363
364
  - views/api/show.html.haml
364
365
  - views/api/show.xml.haml
365
366
  - views/layout.html.haml
@@ -1,13 +0,0 @@
1
- require 'gogrid_client'
2
- require 'ap'
3
-
4
- user='fbb1de3897597ccf'
5
- password='ngieth10'
6
-
7
- client=GoGridClient.new('https://api.gogrid.com/api', user, password)
8
-
9
- ap client.request('grid/ip/list', {
10
- 'ip.type' => '1',
11
- 'ip.state' => '1',
12
- 'datacenter' => '1'
13
- })