steamcannon-deltacloud-core 0.0.7.1-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. data/COPYING +176 -0
  2. data/Rakefile +106 -0
  3. data/bin/deltacloudd +120 -0
  4. data/config.ru +5 -0
  5. data/deltacloud.rb +20 -0
  6. data/lib/deltacloud/base_driver/base_driver.rb +259 -0
  7. data/lib/deltacloud/base_driver/features.rb +173 -0
  8. data/lib/deltacloud/base_driver/mock_driver.rb +58 -0
  9. data/lib/deltacloud/base_driver.rb +20 -0
  10. data/lib/deltacloud/drivers/azure/azure_driver.rb +127 -0
  11. data/lib/deltacloud/drivers/ec2/ec2_driver.rb +580 -0
  12. data/lib/deltacloud/drivers/ec2/ec2_mock_driver.rb +170 -0
  13. data/lib/deltacloud/drivers/gogrid/gogrid_client.rb +50 -0
  14. data/lib/deltacloud/drivers/gogrid/gogrid_driver.rb +343 -0
  15. data/lib/deltacloud/drivers/gogrid/test.rb +13 -0
  16. data/lib/deltacloud/drivers/mock/data/buckets/blobs/blob1.yml +5 -0
  17. data/lib/deltacloud/drivers/mock/data/buckets/blobs/blob2.yml +5 -0
  18. data/lib/deltacloud/drivers/mock/data/buckets/blobs/blob3.yml +5 -0
  19. data/lib/deltacloud/drivers/mock/data/buckets/blobs/blob4.yml +5 -0
  20. data/lib/deltacloud/drivers/mock/data/buckets/blobs/blob5.yml +5 -0
  21. data/lib/deltacloud/drivers/mock/data/buckets/bucket1.yml +2 -0
  22. data/lib/deltacloud/drivers/mock/data/buckets/bucket2.yml +2 -0
  23. data/lib/deltacloud/drivers/mock/data/images/img1.yml +3 -0
  24. data/lib/deltacloud/drivers/mock/data/images/img2.yml +3 -0
  25. data/lib/deltacloud/drivers/mock/data/images/img3.yml +3 -0
  26. data/lib/deltacloud/drivers/mock/data/instances/inst0.yml +16 -0
  27. data/lib/deltacloud/drivers/mock/data/instances/inst1.yml +9 -0
  28. data/lib/deltacloud/drivers/mock/data/instances/inst2.yml +9 -0
  29. data/lib/deltacloud/drivers/mock/data/storage_snapshots/snap1.yml +4 -0
  30. data/lib/deltacloud/drivers/mock/data/storage_snapshots/snap2.yml +4 -0
  31. data/lib/deltacloud/drivers/mock/data/storage_snapshots/snap3.yml +4 -0
  32. data/lib/deltacloud/drivers/mock/data/storage_volumes/vol1.yml +6 -0
  33. data/lib/deltacloud/drivers/mock/data/storage_volumes/vol2.yml +6 -0
  34. data/lib/deltacloud/drivers/mock/data/storage_volumes/vol3.yml +6 -0
  35. data/lib/deltacloud/drivers/mock/mock_driver.rb +356 -0
  36. data/lib/deltacloud/drivers/opennebula/cloud_client.rb +116 -0
  37. data/lib/deltacloud/drivers/opennebula/occi_client.rb +204 -0
  38. data/lib/deltacloud/drivers/opennebula/opennebula_driver.rb +241 -0
  39. data/lib/deltacloud/drivers/rackspace/rackspace_client.rb +130 -0
  40. data/lib/deltacloud/drivers/rackspace/rackspace_driver.rb +290 -0
  41. data/lib/deltacloud/drivers/rhevm/rhevm_driver.rb +258 -0
  42. data/lib/deltacloud/drivers/rimuhosting/rimuhosting_client.rb +85 -0
  43. data/lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb +166 -0
  44. data/lib/deltacloud/drivers/terremark/terremark_driver.rb +295 -0
  45. data/lib/deltacloud/hardware_profile.rb +153 -0
  46. data/lib/deltacloud/helpers/application_helper.rb +122 -0
  47. data/lib/deltacloud/helpers/blob_stream.rb +51 -0
  48. data/lib/deltacloud/helpers/conversion_helper.rb +39 -0
  49. data/lib/deltacloud/helpers/hardware_profiles_helper.rb +35 -0
  50. data/lib/deltacloud/helpers.rb +5 -0
  51. data/lib/deltacloud/method_serializer.rb +85 -0
  52. data/lib/deltacloud/models/base_model.rb +59 -0
  53. data/lib/deltacloud/models/blob.rb +26 -0
  54. data/lib/deltacloud/models/bucket.rb +24 -0
  55. data/lib/deltacloud/models/image.rb +27 -0
  56. data/lib/deltacloud/models/instance.rb +38 -0
  57. data/lib/deltacloud/models/instance_profile.rb +48 -0
  58. data/lib/deltacloud/models/key.rb +35 -0
  59. data/lib/deltacloud/models/realm.rb +26 -0
  60. data/lib/deltacloud/models/storage_snapshot.rb +27 -0
  61. data/lib/deltacloud/models/storage_volume.rb +28 -0
  62. data/lib/deltacloud/state_machine.rb +84 -0
  63. data/lib/deltacloud/validation.rb +70 -0
  64. data/lib/drivers.rb +51 -0
  65. data/lib/sinatra/accept_media_types.rb +128 -0
  66. data/lib/sinatra/lazy_auth.rb +56 -0
  67. data/lib/sinatra/rabbit.rb +279 -0
  68. data/lib/sinatra/respond_to.rb +238 -0
  69. data/lib/sinatra/static_assets.rb +83 -0
  70. data/lib/sinatra/url_for.rb +53 -0
  71. data/public/favicon.ico +0 -0
  72. data/public/images/grid.png +0 -0
  73. data/public/images/logo-wide.png +0 -0
  74. data/public/images/rails.png +0 -0
  75. data/public/images/topbar-bg.png +0 -0
  76. data/public/javascripts/application.js +32 -0
  77. data/public/javascripts/jquery-1.4.2.min.js +154 -0
  78. data/public/stylesheets/compiled/application.css +613 -0
  79. data/public/stylesheets/compiled/ie.css +31 -0
  80. data/public/stylesheets/compiled/print.css +27 -0
  81. data/public/stylesheets/compiled/screen.css +456 -0
  82. data/server.rb +516 -0
  83. data/support/fedora/deltacloudd +68 -0
  84. data/support/fedora/rubygem-deltacloud-core.spec +91 -0
  85. data/tests/api_test.rb +37 -0
  86. data/tests/hardware_profiles_test.rb +120 -0
  87. data/tests/images_test.rb +111 -0
  88. data/tests/instance_states_test.rb +51 -0
  89. data/tests/instances_test.rb +222 -0
  90. data/tests/realms_test.rb +78 -0
  91. data/tests/url_for_test.rb +50 -0
  92. data/views/accounts/index.html.haml +11 -0
  93. data/views/accounts/show.html.haml +30 -0
  94. data/views/api/show.html.haml +15 -0
  95. data/views/api/show.xml.haml +5 -0
  96. data/views/blobs/show.html.haml +20 -0
  97. data/views/blobs/show.xml.haml +7 -0
  98. data/views/buckets/index.html.haml +33 -0
  99. data/views/buckets/index.xml.haml +10 -0
  100. data/views/buckets/new.html.haml +13 -0
  101. data/views/buckets/show.html.haml +19 -0
  102. data/views/buckets/show.xml.haml +8 -0
  103. data/views/docs/collection.html.haml +37 -0
  104. data/views/docs/collection.xml.haml +14 -0
  105. data/views/docs/index.html.haml +15 -0
  106. data/views/docs/index.xml.haml +5 -0
  107. data/views/docs/operation.html.haml +31 -0
  108. data/views/docs/operation.xml.haml +10 -0
  109. data/views/errors/auth_exception.html.haml +8 -0
  110. data/views/errors/auth_exception.xml.haml +2 -0
  111. data/views/errors/backend_error.html.haml +19 -0
  112. data/views/errors/backend_error.xml.haml +8 -0
  113. data/views/errors/not_found.html.haml +6 -0
  114. data/views/errors/not_found.xml.haml +2 -0
  115. data/views/errors/validation_failure.html.haml +11 -0
  116. data/views/errors/validation_failure.xml.haml +7 -0
  117. data/views/hardware_profiles/index.html.haml +25 -0
  118. data/views/hardware_profiles/index.xml.haml +4 -0
  119. data/views/hardware_profiles/show.html.haml +19 -0
  120. data/views/hardware_profiles/show.xml.haml +18 -0
  121. data/views/images/index.html.haml +30 -0
  122. data/views/images/index.xml.haml +8 -0
  123. data/views/images/show.html.haml +21 -0
  124. data/views/images/show.xml.haml +5 -0
  125. data/views/instance_states/show.html.haml +31 -0
  126. data/views/instance_states/show.png.erb +45 -0
  127. data/views/instance_states/show.xml.haml +8 -0
  128. data/views/instances/index.html.haml +30 -0
  129. data/views/instances/index.xml.haml +21 -0
  130. data/views/instances/new.html.haml +55 -0
  131. data/views/instances/show.html.haml +43 -0
  132. data/views/instances/show.xml.haml +49 -0
  133. data/views/keys/index.html.haml +26 -0
  134. data/views/keys/index.xml.haml +4 -0
  135. data/views/keys/new.html.haml +8 -0
  136. data/views/keys/show.html.haml +22 -0
  137. data/views/keys/show.xml.haml +20 -0
  138. data/views/layout.html.haml +26 -0
  139. data/views/realms/index.html.haml +29 -0
  140. data/views/realms/index.xml.haml +10 -0
  141. data/views/realms/show.html.haml +15 -0
  142. data/views/realms/show.xml.haml +9 -0
  143. data/views/root/index.html.haml +4 -0
  144. data/views/storage_snapshots/index.html.haml +20 -0
  145. data/views/storage_snapshots/index.xml.haml +9 -0
  146. data/views/storage_snapshots/show.html.haml +14 -0
  147. data/views/storage_snapshots/show.xml.haml +7 -0
  148. data/views/storage_volumes/index.html.haml +21 -0
  149. data/views/storage_volumes/index.xml.haml +23 -0
  150. data/views/storage_volumes/show.html.haml +20 -0
  151. data/views/storage_volumes/show.xml.haml +24 -0
  152. metadata +367 -0
@@ -0,0 +1,15 @@
1
+ %h1
2
+ API v#{@version}
3
+
4
+ %ul
5
+ - collections.keys.sort_by { |k| k.to_s }.each do |key|
6
+ %li
7
+ = link_to key.to_s.gsub('_', ' ').titlecase, url_for("/api/#{key}")
8
+ %dl
9
+ - collections[key].operations.each_key do |op|
10
+ - next if [:index, :show].include?(op)
11
+ %dt
12
+ = op
13
+ %li
14
+ %strong
15
+ %a{:href => url_for("/api/docs")} Documentation (v#{@version})
@@ -0,0 +1,5 @@
1
+ %api{ :version=>@version, :driver=>DRIVER }
2
+ - for entry_point in entry_points
3
+ %link{ :rel=>entry_point[0], :href=>entry_point[1] }
4
+ - for feature in driver.features(entry_point[0])
5
+ %feature{ :name=>feature.name }
@@ -0,0 +1,20 @@
1
+ %h1 Blob
2
+ %h2
3
+ = @blob.id
4
+
5
+ %dl
6
+ %dt bucket
7
+ %dd
8
+ = @blob.bucket
9
+ %dt Content_Length
10
+ %dd
11
+ = @blob.content_length
12
+ %dt Content_Type
13
+ %dd
14
+ = @blob.content_type
15
+ %dt Last_Modified
16
+ %dd
17
+ = @blob.last_modified
18
+ %dt Content
19
+ %dd
20
+ =link_to 'Blob content', bucket_url(@blob.bucket) + '/' + @blob.id + '/content'
@@ -0,0 +1,7 @@
1
+ !!! XML
2
+ %blob{:href => bucket_url(@blob.bucket) + '/' + @blob.id, :id => @blob.id}
3
+ - @blob.attributes.select{ |attr| attr!=:id}.each do |attribute|
4
+ - unless attribute == :content
5
+ - haml_tag(attribute, :<) do
6
+ - haml_concat @blob.send(attribute)
7
+ %content{:href => bucket_url(@blob.bucket) + '/' + @blob.id + '/content'}
@@ -0,0 +1,33 @@
1
+ %h1
2
+ Buckets
3
+ %br
4
+ %p
5
+ =link_to 'Create new bucket', "/api/buckets/new"
6
+
7
+ %table.display
8
+ %thead
9
+ %tr
10
+ %th
11
+ ID
12
+ %th
13
+ Name
14
+ %th
15
+ Size
16
+ %th
17
+ Blob List
18
+ %th
19
+
20
+ %tbody
21
+ - @buckets.each do |bucket|
22
+ %tr
23
+ %td
24
+ = link_to bucket.id, bucket_url(bucket.id)
25
+ %td
26
+ = bucket.name
27
+ %td
28
+ = bucket.size
29
+ %td
30
+ -bucket.blob_list.each do |blob|
31
+ = blob
32
+ %td
33
+ =link_to 'Delete', destroy_bucket_url(bucket.name), :class => 'delete'
@@ -0,0 +1,10 @@
1
+ !!! XML
2
+ %buckets
3
+ - @elements.each do |bucket|
4
+ %bucket{:href => bucket_url(bucket.id), :id => bucket.id}
5
+ - bucket.attributes.select{ |attr| attr!=:id }.each do |attribute|
6
+ - unless attribute == :blob_list
7
+ - haml_tag("#{attribute}".tr('-', '_'), :<) do
8
+ - haml_concat bucket.send(attribute)
9
+ - bucket.blob_list.each do |blb|
10
+ %blob{ :id => blb, :href => bucket_url(bucket.id) +"/#{blb}"}
@@ -0,0 +1,13 @@
1
+ %h1 New Bucket
2
+
3
+ %form{ :action => buckets_url, :method => :post }
4
+ %label
5
+ Bucket Name:
6
+ %input{ :name => 'name', :size => 250}/
7
+ %br
8
+ -if driver_has_bucket_location_feature?
9
+ %p
10
+ %label
11
+ Location: (optional)
12
+ %input{ :name => 'location', :size => 20 }/
13
+ %input{ :type => :submit, :name => "commit", :value => "create"}/
@@ -0,0 +1,19 @@
1
+ %h1 Bucket
2
+ %h2
3
+ = @bucket.id
4
+
5
+ %dl
6
+ %di
7
+ %dt Name
8
+ %dd
9
+ = @bucket.name
10
+ %dt Size
11
+ %dd
12
+ = @bucket.size
13
+ %dt Blobs
14
+ %dd
15
+ -@bucket.blob_list.each do |blob|
16
+ = link_to blob, bucket_url(@bucket.name) + '/' + blob
17
+ %dt delete bucket (must be empty)
18
+ %dd
19
+ =link_to 'Delete', destroy_bucket_url(@bucket.name), :class => 'delete'
@@ -0,0 +1,8 @@
1
+ !!! XML
2
+ %bucket{:href => bucket_url(@bucket.id), :id => @bucket.id}
3
+ - @bucket.attributes.select{ |attr| attr!=:id }.each do |attribute|
4
+ - unless attribute == :blob_list
5
+ -haml_tag(attribute, :<) do
6
+ - haml_concat @bucket.send(attribute)
7
+ - @bucket.blob_list.each do |blb|
8
+ %blob{:id => blb, :href => bucket_url(@bucket.id) +"/#{blb}"}
@@ -0,0 +1,37 @@
1
+ %h2
2
+ = @collection.name.to_s.titlecase
3
+
4
+ %p #{@collection.description}
5
+
6
+ %br
7
+
8
+ %h3 Operations:
9
+
10
+ %table
11
+ %thead
12
+ %tr
13
+ %th Name
14
+ %th Description
15
+ %tbody
16
+ - @operations.keys.sort_by { |k| k.to_s }.each do |operation|
17
+ %tr
18
+ %td{:style => "width:15em"}
19
+ %a{:href => url_for("/api/docs/#{@collection.name.to_s}/#{operation}")} #{operation}
20
+ %td{:style => "width:10em"} #{@operations[operation].description}
21
+
22
+ %h3 Features:
23
+
24
+ %table
25
+ %thead
26
+ %tr
27
+ %th Name
28
+ %th Description
29
+ %th Modified Operations
30
+ %tbody
31
+ - @features.sort_by { |f| f.name.to_s }.each do |feature|
32
+ %tr
33
+ %td= feature.name
34
+ %td= feature.description
35
+ %td
36
+ - feature.operations.each do |op|
37
+ %a{:href => url_for("/api/docs/#{@collection.name.to_s}/#{op.name}")} #{op.name}
@@ -0,0 +1,14 @@
1
+ %docs{:status => "unsupported"}
2
+ %collection{:url => url_for("/api/docs/#{@collection.name}"), :name => "#{@collection.name}"}
3
+ %description #{@collection.description}
4
+ %operations
5
+ - @operations.keys.sort_by { |k| k.to_s }.each do |operation|
6
+ %operation{:url => url_for("/api/#{@collection.name.to_s}"), :name => "#{operation}", :href => url_for("#{@operations[operation].path}"), :method => "#{@operations[operation].method}"}
7
+ %description #{@operations[operation].description}
8
+ - @operations[operation].each_param do |param|
9
+ %parameter{:name => "#{param.name}", :type => "#{param.type}"}
10
+ %class #{param.klass}
11
+ - unless param.options.empty?
12
+ %values
13
+ - param.options.each do |v|
14
+ %value #{v}
@@ -0,0 +1,15 @@
1
+ %h2 API Documentation
2
+
3
+ %h3 Collections:
4
+
5
+ %table
6
+ %thead
7
+ %tr
8
+ %th Name
9
+ %th Description
10
+ %tbody
11
+ - collections.keys.sort_by { |k| k.to_s }.each do |collection|
12
+ %tr
13
+ %td{:style => "width:15em"}
14
+ %a{:href => url_for("/api/docs/#{collection}")} #{collection}
15
+ %td{:style => "width:10em"} #{collections[collection].description}
@@ -0,0 +1,5 @@
1
+ %docs{:status => "unsupported"}
2
+ - collections.keys.sort_by { |k| k.to_s }.each do |collection|
3
+ %collection{:url => url_for("/api/docs/#{collection}")}
4
+ %name #{collection}
5
+ %description #{collections[collection].description}
@@ -0,0 +1,31 @@
1
+ %h2
2
+ %a{:href => url_for("/api/docs/#{@collection.name.to_s}")} #{@collection.name.to_s.titlecase}
3
+ #{'::'}
4
+ #{@operation.name}
5
+
6
+ %p #{@operation.description}
7
+
8
+ %br
9
+ %h3
10
+ URL:
11
+ %u
12
+ = url_for("/api/#{@collection.name.to_s}/#{@operation.name.to_s}")
13
+ %br
14
+ %h3 Parameters:
15
+
16
+
17
+ %table
18
+ %thead
19
+ %tr
20
+ %th Name
21
+ %th Type
22
+ %th Class
23
+ %th Valid values
24
+ %tbody
25
+ - @operation.each_param do |p|
26
+ %tr
27
+ %td{:style => "width:15em"}
28
+ %em #{p.name}
29
+ %td{:style => "width:10em"} #{p.type}
30
+ %td #{p.klass}
31
+ %td{:style => "width:10em"} #{p.options.join(',')}
@@ -0,0 +1,10 @@
1
+ %docs{:status => "unsupported"}
2
+ %operation{:url => url_for("/api/docs/#{@collection.name.to_s}"), :name => "#{@operation.name.to_s}", :href => url_for("#{@operation.path}"), :method => "#{@operation.method}"}
3
+ %description #{@operation.description}
4
+ - @operation.each_param do |param|
5
+ %parameter{:name => "#{param.name}", :type => "#{param.type}"}
6
+ %class #{param.klass}
7
+ - unless param.options.empty?
8
+ %values
9
+ - param.options.each do |v|
10
+ %value #{v}
@@ -0,0 +1,8 @@
1
+ %h1 Authentication Failure
2
+
3
+ %p= @error.message
4
+
5
+ %dl
6
+ %di
7
+ %dt Request URL
8
+ %dd= request.env['REQUEST_URI']
@@ -0,0 +1,2 @@
1
+ %error{:url => "#{request.env['REQUEST_URI']}", :status => "#{response.status}"}
2
+ %message #{@error.message}
@@ -0,0 +1,19 @@
1
+ %h1 Backend Error
2
+
3
+ %p= @error.message
4
+
5
+ %dl
6
+ %di
7
+ %dt Request URL
8
+ %dd= request.env['REQUEST_URI']
9
+ %di
10
+ %dt Code
11
+ %dd= @error.code
12
+ %di
13
+ %dt Cause
14
+ %dd= @error.cause
15
+ %di
16
+ %dt Details
17
+ %dd
18
+ %pre
19
+ =@error.details.join("\n")
@@ -0,0 +1,8 @@
1
+ %error{:url => "#{request.env['REQUEST_URI']}", :status => "#{response.status}"}
2
+ %kind backend_error
3
+ %backend{ :driver => DRIVER }
4
+ %code= @error.code
5
+ %cause= @error.cause
6
+ - if @error.details
7
+ %details #{@error.details}
8
+ %message #{@error.message}
@@ -0,0 +1,6 @@
1
+ %h1 Not Found
2
+
3
+ %dl
4
+ %di
5
+ %dt Request URL
6
+ %dd= request.env['REQUEST_URI']
@@ -0,0 +1,2 @@
1
+ %error{:url => "#{request.env['REQUEST_URI']}", :status => "#{response.status}"}
2
+ %message Not Found
@@ -0,0 +1,11 @@
1
+ %h1 Validation Failure
2
+
3
+ %p= @error.message
4
+
5
+ %dl
6
+ %di
7
+ %dt Request URL
8
+ %dd= request.env['REQUEST_URI']
9
+ %di
10
+ %dt Parameter
11
+ %dd= @error.name
@@ -0,0 +1,7 @@
1
+ %error{:url => "#{request.env['REQUEST_URI']}", :status => "#{response.status}"}
2
+ %parameter #{@error.name}
3
+ %message #{@error.message}
4
+ - unless @error.param.options.empty?
5
+ %valid_options
6
+ - @error.param.options.each do |v|
7
+ %value #{v}
@@ -0,0 +1,25 @@
1
+ %h1
2
+ Hardware Profiles
3
+
4
+ %table.display
5
+ %thead
6
+ %tr
7
+ %th
8
+ Name
9
+ %th
10
+ Architecture
11
+ %th
12
+ Memory
13
+ %th
14
+ Storage
15
+ %tbody
16
+ - for profile in @profiles
17
+ %tr
18
+ %td
19
+ = link_to profile.name, hardware_profile_url( profile.name )
20
+ %td
21
+ = format_hardware_property profile.architecture
22
+ %td
23
+ = format_hardware_property profile.memory
24
+ %td
25
+ = format_hardware_property profile.storage
@@ -0,0 +1,4 @@
1
+ !!! XML
2
+ %hardware_profiles
3
+ - @profiles.each do |prof|
4
+ = haml :'hardware_profiles/show', :locals => { :@profile => prof, :partial => true }
@@ -0,0 +1,19 @@
1
+ %h1
2
+ = @profile.name
3
+
4
+ %dl
5
+ %di
6
+ %dt
7
+ Architecture
8
+ %dd
9
+ = format_hardware_property @profile.architecture
10
+ %di
11
+ %dt
12
+ Memory
13
+ %dd
14
+ = format_hardware_property @profile.memory
15
+ %di
16
+ %dt
17
+ Storage
18
+ %dd
19
+ = format_hardware_property @profile.storage
@@ -0,0 +1,18 @@
1
+ - unless defined?(partial)
2
+ !!! XML
3
+ %hardware_profile{ :href => hardware_profile_url(@profile.name), :id => @profile.name }
4
+ %name<
5
+ =@profile.name
6
+ - @profile.each_property do |prop|
7
+ - attr = { :name => prop.name, :kind => prop.kind, :unit => prop.unit }
8
+ - if prop.kind == :fixed
9
+ %property{ attr, :value => prop.value }/
10
+ - else
11
+ %property{ attr, :value => prop.default }
12
+ %param{ :operation => "create", :href => instances_url, :method => "post", :name => prop.param }
13
+ - if prop.kind == :range
14
+ %range{ :first => prop.first, :last => prop.last }/
15
+ - elsif prop.kind == :enum
16
+ %enum
17
+ - prop.values.each do |v|
18
+ %entry{ :value => v }/
@@ -0,0 +1,30 @@
1
+ %h1
2
+ Images
3
+
4
+ %table.display
5
+ %thead
6
+ %tr
7
+ %th
8
+ ID
9
+ %th
10
+ Name
11
+ %th
12
+ Owner
13
+ %th
14
+ Architecture
15
+ %th
16
+ Description
17
+ %tbody
18
+ - @images.each do |image|
19
+ %tr
20
+ %td
21
+ = link_to image.id, image_url(image.id)
22
+ %td
23
+ = image.name
24
+ %td
25
+ = link_to image.owner_id, images_url
26
+ %td
27
+ = image.architecture
28
+ %td
29
+ = image.description
30
+
@@ -0,0 +1,8 @@
1
+ !!! XML
2
+ %images
3
+ - @elements.each do |image|
4
+ %image{:href => image_url(image.id), :id => image.id}
5
+ - image.attributes.select{ |attr| attr!=:id }.each do |attribute|
6
+ - haml_tag("#{attribute}".tr('-', '_'), :<) do
7
+ - haml_concat image.send(attribute)
8
+
@@ -0,0 +1,21 @@
1
+ %h1 Image
2
+ %h2
3
+ = @image.id
4
+
5
+ %dl
6
+ %di
7
+ %dt Name
8
+ %dd
9
+ = @image.name
10
+ %dt Owner
11
+ %dd
12
+ = link_to @image.owner_id, images_url( :owner_id => @image.owner_id )
13
+ %dt Architecture
14
+ %dd
15
+ = @image.architecture
16
+ %dt Description
17
+ %dd
18
+ = @image.description
19
+ %dt
20
+ %dd
21
+ = link_to 'Launch', "/api/instances/new?image_id=#{@image.id}"
@@ -0,0 +1,5 @@
1
+ !!! XML
2
+ %image{:href => image_url(@image.id), :id => @image.id}
3
+ - @image.attributes.select{ |attr| attr!=:id }.each do |attribute|
4
+ - haml_tag(attribute, :<) do
5
+ - haml_concat @image.send(attribute)
@@ -0,0 +1,31 @@
1
+ %h1 Instance States
2
+
3
+ %div#state_graph
4
+ = image_tag url_for( '/api/instance_states?format=png' )
5
+
6
+ %table.states
7
+ %thead
8
+ %tr
9
+ %th Origin
10
+ %th Action
11
+ %th Destination
12
+ %tbody
13
+ - @machine.states.each do |state|
14
+ %tr
15
+ %td.origin{:rowspan => "#{state.transitions.empty? ? 2 : (state.transitions.size + 1)}"}
16
+ = state
17
+ - if state.transitions.empty?
18
+ %tr
19
+ %td --
20
+ %td --
21
+ - else
22
+ - state.transitions.each do |transition|
23
+ %tr
24
+ %td
25
+ - if transition.automatically?
26
+ %em auto
27
+ - else
28
+ = transition.action
29
+ %td
30
+ = transition.destination
31
+
@@ -0,0 +1,45 @@
1
+ digraph instance_states {
2
+ rankdir=LR;
3
+ <% for state in @machine.states do %>
4
+ <%= state %>
5
+ [
6
+ label="<%= state.to_s.titlecase %>",
7
+ labelloc="c",
8
+ fontsize="12.0",
9
+ <% if ( state.name == :start || state.name == :finish ) %>
10
+ fontname="Liberation Sans Bold",
11
+ color="<%= state.name == :start ? '#449944' : '#994444' %>",
12
+ fillcolor="<%= state.name == :start ? '#88DD88' : '#DD8888' %>",
13
+ style="filled",
14
+ shape="doublecircle",
15
+ <% else %>
16
+ fontname="Liberation Sans Bold",
17
+ shape="rect",
18
+ color="#999999",
19
+ fillcolor="#DDDDDD",
20
+ style="filled",
21
+ <% end %>
22
+ height=0.5
23
+ ]
24
+ <% end %>
25
+
26
+ <% for state in @machine.states do %>
27
+ <% for transition in state.transitions do %>
28
+ <%= state %> -> <%= transition.destination %>
29
+ [
30
+ label="<%= transition.automatically? ? 'auto' : transition.action %>",
31
+ fontsize="14.0",
32
+ penwidth="2.0",
33
+ labelloc="t",
34
+ color="#CCCCCC",
35
+ <% if transition.automatically? %>
36
+ fontcolor="#227722",
37
+ fontname="Liberation Sans Bold Italic",
38
+ <% else %>
39
+ fontcolor="#333333",
40
+ fontname="Liberation Sans Bold",
41
+ <% end %>
42
+ ];
43
+ <% end %>
44
+ <% end %>
45
+ }
@@ -0,0 +1,8 @@
1
+ %states
2
+ - for state in @machine.states
3
+ %state{ :name=>state }
4
+ - for transition in state.transitions
5
+ - if ( transition.automatically? )
6
+ %transition{ :to=>transition.destination, :auto=>'true'}
7
+ - else
8
+ %transition{ :to=>transition.destination, :action=>transition.action }
@@ -0,0 +1,30 @@
1
+ %h1 Instances
2
+
3
+ %table.display
4
+ %thead
5
+ %tr
6
+ %th ID
7
+ %th Owner
8
+ %th Name
9
+ %th Image
10
+ %th Realm
11
+ %th State
12
+ %th Actions
13
+ %tbody
14
+ - @instances.each do |instance|
15
+ %tr
16
+ %td
17
+ = link_to instance.id, instance_url( instance.id )
18
+ %td
19
+ = link_to instance.owner_id, images_url
20
+ %td
21
+ = instance.name
22
+ %td
23
+ = link_to instance.image_id, image_url( instance.image_id )
24
+ %td
25
+ = instance.realm_id ? link_to(instance.realm_id, realm_url( instance.realm_id )) : 'default'
26
+ %td
27
+ = instance.state
28
+ %td
29
+ -instance.actions.each do |action|
30
+ =link_to action, self.send(:"#{action}_instance_url", instance.id), :class => instance_action_method(action)
@@ -0,0 +1,21 @@
1
+ !!! XML
2
+ %instances
3
+ - @elements.each do |instance|
4
+ %instance{:href => instance_url(instance.id), :id => instance.id}
5
+ %name #{instance.name}
6
+ %owner_id #{instance.owner_id}
7
+ %image{:href => image_url(instance.image_id), :id => instance.image_id }
8
+ %realm{:href => realm_url(instance.realm_id), :id => instance.realm_id }
9
+ %state #{instance.state}
10
+ - haml_tag :"hardware_profile", { :id => instance.instance_profile.id, :href => hardware_profile_url(instance.instance_profile.id)} do
11
+ - instance.instance_profile.overrides.each do |p, v|
12
+ %property{:kind => 'fixed', :name => p, :value => v, :unit => Deltacloud::HardwareProfile::unit(p)}
13
+ %actions
14
+ - instance.actions.compact.each do |action|
15
+ %link{:rel => action, :href => self.send("#{action}_instance_url", instance.id), :method => instance_action_method(action)}
16
+ %public_addresses
17
+ - instance.public_addresses.each do |address|
18
+ %address #{address}
19
+ %private_addresses
20
+ - instance.private_addresses.each do |address|
21
+ %address #{address}