deltacloud-core 0.1.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/DISCLAIMER +8 -0
- data/{COPYING → LICENSE} +0 -0
- data/NOTICE +13 -0
- data/Rakefile +50 -51
- data/bin/deltacloudd +8 -1
- data/config.ru +0 -2
- data/config/drivers.yaml +48 -0
- data/deltacloud-core.gemspec +75 -0
- data/deltacloud.rb +3 -2
- data/lib/deltacloud/backend_capability.rb +15 -3
- data/lib/deltacloud/base_driver.rb +0 -2
- data/lib/deltacloud/base_driver/base_driver.rb +85 -89
- data/lib/deltacloud/base_driver/features.rb +61 -7
- data/lib/deltacloud/base_driver/mock_driver.rb +42 -43
- data/lib/deltacloud/core_ext.rb +18 -0
- data/lib/deltacloud/core_ext/integer.rb +31 -0
- data/lib/deltacloud/core_ext/string.rb +50 -0
- data/lib/deltacloud/drivers/azure/azure_driver.rb +71 -22
- data/lib/deltacloud/drivers/ec2/ec2_driver.rb +641 -584
- data/lib/deltacloud/drivers/ec2/ec2_mock_driver.rb +0 -2
- data/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb +167 -0
- data/lib/deltacloud/drivers/gogrid/gogrid_client.rb +39 -1
- data/lib/deltacloud/drivers/gogrid/gogrid_driver.rb +41 -25
- data/lib/deltacloud/drivers/mock/data/buckets/blobs/blob1.yml +6 -3
- data/lib/deltacloud/drivers/mock/data/buckets/blobs/blob2.yml +6 -3
- data/lib/deltacloud/drivers/mock/data/buckets/blobs/blob3.yml +4 -2
- data/lib/deltacloud/drivers/mock/data/buckets/blobs/blob4.yml +5 -2
- data/lib/deltacloud/drivers/mock/data/buckets/blobs/blob5.yml +4 -2
- data/lib/deltacloud/drivers/mock/data/instances/inst0.yml +1 -0
- data/lib/deltacloud/drivers/mock/data/instances/inst1.yml +1 -0
- data/lib/deltacloud/drivers/mock/data/instances/inst2.yml +1 -0
- data/lib/deltacloud/drivers/mock/data/storage_volumes/vol1.yml +1 -0
- data/lib/deltacloud/drivers/mock/data/storage_volumes/vol2.yml +1 -0
- data/lib/deltacloud/drivers/mock/data/storage_volumes/vol3.yml +1 -0
- data/lib/deltacloud/drivers/mock/mock_driver.rb +138 -30
- data/lib/deltacloud/drivers/opennebula/cloud_client.rb +13 -15
- data/lib/deltacloud/drivers/opennebula/occi_client.rb +13 -15
- data/lib/deltacloud/drivers/opennebula/opennebula_driver.rb +13 -15
- data/lib/deltacloud/drivers/rackspace/rackspace_driver.rb +224 -113
- data/lib/deltacloud/drivers/rhevm/rhevm_client.rb +332 -0
- data/lib/deltacloud/drivers/rhevm/rhevm_driver.rb +221 -170
- data/lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb +0 -1
- data/lib/deltacloud/drivers/sbc/sbc_client.rb +247 -0
- data/lib/deltacloud/drivers/sbc/sbc_driver.rb +297 -0
- data/lib/deltacloud/drivers/terremark/terremark_driver.rb +0 -2
- data/lib/deltacloud/hardware_profile.rb +1 -3
- data/lib/deltacloud/helpers.rb +0 -2
- data/lib/deltacloud/helpers/application_helper.rb +86 -12
- data/lib/deltacloud/helpers/blob_stream.rb +19 -2
- data/lib/deltacloud/helpers/conversion_helper.rb +0 -2
- data/lib/deltacloud/helpers/hardware_profiles_helper.rb +0 -2
- data/lib/deltacloud/method_serializer.rb +0 -2
- data/lib/deltacloud/models/base_model.rb +0 -2
- data/lib/deltacloud/models/blob.rb +1 -2
- data/lib/deltacloud/models/bucket.rb +0 -2
- data/lib/deltacloud/models/image.rb +0 -2
- data/lib/deltacloud/models/instance.rb +19 -2
- data/lib/deltacloud/models/instance_profile.rb +4 -2
- data/lib/deltacloud/models/key.rb +0 -2
- data/lib/deltacloud/models/load_balancer.rb +0 -2
- data/lib/deltacloud/models/realm.rb +0 -2
- data/lib/deltacloud/models/storage_snapshot.rb +0 -2
- data/lib/deltacloud/models/storage_volume.rb +4 -2
- data/lib/deltacloud/runner.rb +132 -0
- data/lib/deltacloud/state_machine.rb +0 -2
- data/lib/deltacloud/validation.rb +9 -7
- data/lib/drivers.rb +36 -48
- data/lib/sinatra/accept_media_types.rb +26 -0
- data/lib/sinatra/lazy_auth.rb +16 -0
- data/lib/sinatra/rabbit.rb +112 -54
- data/lib/sinatra/rack_driver_select.rb +50 -16
- data/lib/sinatra/rack_etag.rb +79 -0
- data/lib/sinatra/rack_matrix_params.rb +84 -0
- data/lib/sinatra/rack_runtime.rb +47 -0
- data/lib/sinatra/static_assets.rb +16 -0
- data/lib/sinatra/url_for.rb +31 -4
- data/public/favicon.ico +0 -0
- data/public/images/bread-bg.png +0 -0
- data/public/images/error.png +0 -0
- data/public/images/pending.png +0 -0
- data/public/images/running.png +0 -0
- data/public/images/stopped.png +0 -0
- data/public/javascripts/application.js +35 -0
- data/public/stylesheets/compiled/application.css +59 -5
- data/public/stylesheets/compiled/screen.css +1 -1
- data/server.rb +293 -29
- data/support/fedora/deltacloud-core +78 -0
- data/support/fedora/deltacloud-core.spec +143 -0
- data/support/fedora/deltacloudd +78 -18
- data/support/fedora/rubygem-deltacloud-core.spec +76 -40
- data/tests/common.rb +172 -0
- data/tests/drivers/mock/api_test.rb +133 -0
- data/tests/drivers/mock/hardware_profiles_test.rb +134 -0
- data/tests/drivers/mock/images_test.rb +126 -0
- data/tests/drivers/mock/instance_states_test.rb +71 -0
- data/tests/drivers/mock/instances_test.rb +236 -0
- data/tests/drivers/mock/realms_test.rb +93 -0
- data/tests/drivers/mock/setup.rb +3 -0
- data/tests/drivers/mock/url_for_test.rb +67 -0
- data/tests/drivers/rackspace/api_test.rb +41 -0
- data/tests/drivers/rackspace/hardware_profiles_test.rb +53 -0
- data/tests/drivers/rackspace/images_test.rb +40 -0
- data/tests/drivers/rackspace/instances_test.rb +161 -0
- data/tests/drivers/rackspace/realms_test.rb +36 -0
- data/tests/drivers/rackspace/setup.rb +14 -0
- data/tests/drivers/rhevm/api_test.rb +39 -0
- data/tests/drivers/rhevm/hardware_profiles_test.rb +53 -0
- data/tests/drivers/rhevm/images_test.rb +42 -0
- data/tests/drivers/rhevm/instances_test.rb +179 -0
- data/tests/drivers/rhevm/realms_test.rb +35 -0
- data/tests/drivers/rhevm/setup.rb +14 -0
- data/tests/rabbit_test.rb +52 -0
- data/views/api/show.html.haml +2 -5
- data/views/blobs/new.html.haml +17 -1
- data/views/blobs/show.html.haml +6 -0
- data/views/blobs/show.xml.haml +5 -1
- data/views/buckets/index.html.haml +1 -12
- data/views/buckets/index.xml.haml +3 -5
- data/views/docs/operation.html.haml +23 -11
- data/views/drivers/index.html.haml +15 -0
- data/views/drivers/index.xml.haml +7 -0
- data/views/drivers/show.html.haml +20 -0
- data/views/drivers/show.xml.haml +7 -0
- data/views/error.html.haml +31 -0
- data/views/errors/auth_exception.xml.haml +2 -1
- data/views/errors/backend_capability_failure.xml.haml +2 -1
- data/views/errors/backend_error.html.haml +3 -0
- data/views/errors/backend_error.xml.haml +2 -2
- data/views/errors/validation_failure.xml.haml +3 -2
- data/views/images/index.html.haml +1 -6
- data/views/images/index.xml.haml +2 -0
- data/views/images/new.html.haml +14 -0
- data/views/images/show.xml.haml +2 -0
- data/views/instances/index.html.haml +8 -6
- data/views/instances/index.xml.haml +4 -0
- data/views/instances/new.html.haml +40 -11
- data/views/instances/run.html.haml +9 -0
- data/views/instances/run.xml.haml +7 -0
- data/views/instances/run_command.html.haml +16 -0
- data/views/instances/show.html.haml +14 -0
- data/views/instances/show.xml.haml +12 -4
- data/views/layout.html.haml +7 -2
- data/views/load_balancers/index.html.haml +1 -1
- data/views/load_balancers/new.html.haml +2 -2
- data/views/load_balancers/show.html.haml +1 -1
- data/views/storage_snapshots/index.html.haml +3 -0
- data/views/storage_snapshots/new.html.haml +9 -0
- data/views/storage_volumes/attach.html.haml +20 -0
- data/views/storage_volumes/index.html.haml +16 -1
- data/views/storage_volumes/index.xml.haml +1 -10
- data/views/storage_volumes/new.html.haml +17 -0
- data/views/storage_volumes/show.html.haml +8 -0
- data/views/storage_volumes/show.xml.haml +25 -3
- metadata +197 -127
- data/lib/deltacloud/drivers/rackspace/rackspace_client.rb +0 -130
- data/parse.rb +0 -7
- data/test.rb +0 -3
- data/views/api/drivers.xml.haml +0 -6
@@ -0,0 +1,179 @@
|
|
1
|
+
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
|
2
|
+
require 'tests/common'
|
3
|
+
|
4
|
+
module RHEVMTest
|
5
|
+
|
6
|
+
class InstancesTest < Test::Unit::TestCase
|
7
|
+
include Rack::Test::Methods
|
8
|
+
|
9
|
+
def app
|
10
|
+
Sinatra::Application
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_01_01_it_can_create_instance_without_hardware_profile
|
14
|
+
params = {
|
15
|
+
:image_id => 'bb2e79bd-fd73-46a1-b391-a390b1998f03',
|
16
|
+
:name => 'mock-test1',
|
17
|
+
:'api[driver]' => 'rhevm',
|
18
|
+
}
|
19
|
+
post_url '/api/instances', params
|
20
|
+
last_response.status.should == 201 # Created
|
21
|
+
@@instance = last_xml_response
|
22
|
+
(@@instance/'instance').length.should > 0
|
23
|
+
(@@instance/'instance/name').first.text.should_not == nil
|
24
|
+
(@@instance/'instance/name').first.text.should == 'mock-test1'
|
25
|
+
(@@instance/'instance/owner_id').first.text.should_not == ''
|
26
|
+
(@@instance/'instance/owner_id').first.text.should == ENV['API_USER']
|
27
|
+
(@@instance/'instance/state').first.text.should == 'PENDING'
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_01_02_it_can_create_instance_with_hardware_profile
|
31
|
+
params = {
|
32
|
+
:image_id => 'bb2e79bd-fd73-46a1-b391-a390b1998f03',
|
33
|
+
:name => 'mock-test2',
|
34
|
+
:hwp_id => 'SERVER',
|
35
|
+
:'api[driver]' => 'rhevm',
|
36
|
+
}
|
37
|
+
post_url '/api/instances', params
|
38
|
+
last_response.status.should == 201 # Created
|
39
|
+
@@instance2 = last_xml_response
|
40
|
+
(@@instance2/'instance').length.should > 0
|
41
|
+
(@@instance2/'instance/name').first.text.should_not == nil
|
42
|
+
(@@instance2/'instance/name').first.text.should == 'mock-test2'
|
43
|
+
(@@instance2/'instance/owner_id').first.text.should_not == ''
|
44
|
+
(@@instance2/'instance/owner_id').first.text.should == ENV['API_USER']
|
45
|
+
(@@instance2/'instance/state').first.text.should == 'PENDING'
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_03_02_created_instance_has_correct_hardware_profile
|
49
|
+
(@@instance2/'instance/hardware_profile').length.should == 1
|
50
|
+
(@@instance2/'instance/hardware_profile').first[:id].should == "SERVER"
|
51
|
+
(@@instance2/'instance/hardware_profile').first[:href].should_not == nil
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_03_01_instance_can_be_started
|
55
|
+
params = {
|
56
|
+
:'api[driver]' => 'rhevm'
|
57
|
+
}
|
58
|
+
20.times do |tick|
|
59
|
+
get_auth_url "/api;driver=rhevm/instances/#{(@@instance2/'instance').first[:id]}", { :tick => "START1-#{tick}"}
|
60
|
+
last_response.status.should_not == 500
|
61
|
+
state = (last_xml_response/'instance/state').first.text
|
62
|
+
break if state=='STOPPED'
|
63
|
+
sleep(5)
|
64
|
+
end
|
65
|
+
post_url "/api/instances/#{(@@instance/'instance').first[:id]}/start", params
|
66
|
+
last_response.status.should == 204
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_04_01_created_instance_goes_to_running_state
|
70
|
+
20.times do |tick|
|
71
|
+
get_auth_url "/api;driver=rhevm/instances/#{(@@instance/'instance').first[:id]}", { :tick => tick}
|
72
|
+
last_response.status.should_not == 500
|
73
|
+
state = (last_xml_response/'instance/state').first.text
|
74
|
+
break if state=='RUNNING'
|
75
|
+
sleep(5)
|
76
|
+
end
|
77
|
+
@@instance = last_xml_response
|
78
|
+
get_auth_url "/api;driver=rhevm/instances/#{(@@instance/'instance').first[:id]}"
|
79
|
+
last_response.status.should_not == 500
|
80
|
+
(last_xml_response/'instance/state').first.text.should == 'RUNNING'
|
81
|
+
(last_xml_response/'instance/actions/link[@rel="stop"]').first.should_not == nil
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_03_02_instance_can_be_started
|
85
|
+
params = {
|
86
|
+
:'api[driver]' => 'rhevm'
|
87
|
+
}
|
88
|
+
20.times do |tick|
|
89
|
+
get_auth_url "/api;driver=rhevm/instances/#{(@@instance2/'instance').first[:id]}", { :tick => "START2-#{tick}"}
|
90
|
+
last_response.status.should_not == 500
|
91
|
+
state = (last_xml_response/'instance/state').first.text
|
92
|
+
break if state=='STOPPED'
|
93
|
+
sleep(5)
|
94
|
+
end
|
95
|
+
post_url "/api/instances/#{(@@instance2/'instance').first[:id]}/start", params
|
96
|
+
last_response.status.should == 204
|
97
|
+
end
|
98
|
+
|
99
|
+
def test_04_02_created_instance_goes_to_running_state
|
100
|
+
20.times do |tick|
|
101
|
+
get_auth_url "/api;driver=rhevm/instances/#{(@@instance2/'instance').first[:id]}", { :tick => tick}
|
102
|
+
last_response.status.should_not == 500
|
103
|
+
state = (last_xml_response/'instance/state').first.text
|
104
|
+
break if state=='RUNNING'
|
105
|
+
sleep(5)
|
106
|
+
end
|
107
|
+
@@instance2 = last_xml_response
|
108
|
+
get_auth_url "/api;driver=rhevm/instances/#{(@@instance2/'instance').first[:id]}"
|
109
|
+
last_response.status.should_not == 500
|
110
|
+
(last_xml_response/'instance/state').first.text.should == 'RUNNING'
|
111
|
+
(last_xml_response/'instance/actions/link[@rel="stop"]').first.should_not == nil
|
112
|
+
end
|
113
|
+
|
114
|
+
def test_05_01_created_instance_can_be_stopped
|
115
|
+
params = {
|
116
|
+
:'api[driver]' => 'rhevm',
|
117
|
+
}
|
118
|
+
post_url "/api/instances/#{(@@instance/'instance').first[:id]}/stop", params
|
119
|
+
last_response.status.should == 204
|
120
|
+
20.times do |tick|
|
121
|
+
get_auth_url "/api;driver=rhevm/instances/#{(@@instance/'instance').first[:id]}", { :tick => tick}
|
122
|
+
last_response.status.should_not == 500
|
123
|
+
state = (last_xml_response/'instance/state').first.text
|
124
|
+
break if state=='STOPPED'
|
125
|
+
sleep(5)
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
def test_05_02_created_instance_can_be_stopped
|
130
|
+
params = {
|
131
|
+
:'api[driver]' => 'rhevm',
|
132
|
+
}
|
133
|
+
post_url "/api/instances/#{(@@instance2/'instance').first[:id]}/stop", params
|
134
|
+
last_response.status.should == 204
|
135
|
+
20.times do |tick|
|
136
|
+
get_auth_url "/api;driver=rhevm/instances/#{(@@instance2/'instance').first[:id]}", { :tick => tick}
|
137
|
+
last_response.status.should_not == 500
|
138
|
+
state = (last_xml_response/'instance/state').first.text
|
139
|
+
break if state=='STOPPED'
|
140
|
+
sleep(5)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
# FIXME:
|
145
|
+
# New RHEV-M version introduces a bug that when you're requesting an
|
146
|
+
# instance which was deleted or not exists instead of returning 404 as
|
147
|
+
# status code it returns 500
|
148
|
+
#
|
149
|
+
def test_06_01_created_instance_can_be_destroyed
|
150
|
+
params = {
|
151
|
+
:'api[driver]' => 'rhevm',
|
152
|
+
}
|
153
|
+
delete_url "/api/instances/#{(@@instance/'instance').first[:id]}", params
|
154
|
+
last_response.status.should == 204
|
155
|
+
20.times do |tick|
|
156
|
+
get_auth_url "/api;driver=rhevm/instances/#{(@@instance/'instance').first[:id]}", { :tick => tick}
|
157
|
+
#last_response.status.should_not == 500
|
158
|
+
break if last_response.status == 500
|
159
|
+
sleep(5)
|
160
|
+
end
|
161
|
+
last_response.status.should == 500
|
162
|
+
end
|
163
|
+
|
164
|
+
def test_06_02_created_instance_can_be_destroyed
|
165
|
+
params = {
|
166
|
+
:'api[driver]' => 'rhevm',
|
167
|
+
}
|
168
|
+
delete_url "/api/instances/#{(@@instance2/'instance').first[:id]}", params, authenticate
|
169
|
+
last_response.status.should == 204
|
170
|
+
20.times do |tick|
|
171
|
+
get_auth_url "/api;driver=rhevm/instances/#{(@@instance2/'instance').first[:id]}", { :tick => tick}
|
172
|
+
#last_response.status.should_not == 500
|
173
|
+
break if last_response.status == 500
|
174
|
+
sleep(5)
|
175
|
+
end
|
176
|
+
last_response.status.should == 500
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
|
2
|
+
require 'tests/common'
|
3
|
+
|
4
|
+
module RHEVMTest
|
5
|
+
|
6
|
+
class RealmsTest < Test::Unit::TestCase
|
7
|
+
include Rack::Test::Methods
|
8
|
+
|
9
|
+
def app
|
10
|
+
Sinatra::Application
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_01_it_returns_realms
|
14
|
+
get_auth_url '/api;driver=rhevm/realms'
|
15
|
+
(last_xml_response/'realms/realm').length.should == 1
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_02_each_realm_has_a_name
|
19
|
+
get_auth_url '/api;driver=rhevm/realms'
|
20
|
+
(last_xml_response/'realms/realm').each do |profile|
|
21
|
+
(profile/'name').text.should_not == nil
|
22
|
+
(profile/'name').text.should_not == ''
|
23
|
+
(profile/'name').text.should == 'Default'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_03_it_returns_single_realm
|
28
|
+
get_auth_url '/api;driver=rhevm/realms/us'
|
29
|
+
(last_xml_response/'realm').first[:id].should == '0'
|
30
|
+
(last_xml_response/'realm/name').first.text.should == 'Default'
|
31
|
+
(last_xml_response/'realm/state').first.text.should == 'AVAILABLE'
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
ENV['API_USER'] = 'rhev-m@deltacloud.local'
|
2
|
+
ENV['API_PASSWORD'] = 'RedHat001'
|
3
|
+
ENV['API_PROVIDER'] = 'https://rhev-dc.lab.eng.brq.redhat.com:8443/rhevm-api-powershell'
|
4
|
+
|
5
|
+
require 'vcr'
|
6
|
+
|
7
|
+
DeltacloudTestCommon::record!
|
8
|
+
|
9
|
+
VCR.config do |c|
|
10
|
+
c.cassette_library_dir = "#{File.dirname(__FILE__)}/../../../tests/drivers/rhevm/fixtures/"
|
11
|
+
c.stub_with :webmock
|
12
|
+
c.default_cassette_options = { :record => :none }
|
13
|
+
end
|
14
|
+
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright ownership. The
|
4
|
+
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
5
|
+
# "License"); you may not use this file except in compliance with the
|
6
|
+
# License. You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
12
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
13
|
+
# License for the specific language governing permissions and limitations
|
14
|
+
# under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
|
18
|
+
require 'tests/common'
|
19
|
+
|
20
|
+
require 'drivers'
|
21
|
+
require 'deltacloud/drivers/mock/mock_driver'
|
22
|
+
|
23
|
+
module DeltacloudUnitTest
|
24
|
+
class ApiTest < Test::Unit::TestCase
|
25
|
+
include Rack::Test::Methods
|
26
|
+
|
27
|
+
def setup
|
28
|
+
@app ||= Sinatra::Application
|
29
|
+
@driver ||= Deltacloud::Drivers::Mock::MockDriver.new
|
30
|
+
end
|
31
|
+
|
32
|
+
def teardown
|
33
|
+
@app = nil
|
34
|
+
@driver = nil
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_params
|
38
|
+
op = @app.collections[:instances].operations[:create]
|
39
|
+
op.params.keys =~ [:realm_id, :image_id, :hwp_id]
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_effective_params
|
43
|
+
features = @driver.features(:instances).collect { |f| f.name }
|
44
|
+
features.should =~ [:hardware_profiles, :user_name, :authentication_key]
|
45
|
+
|
46
|
+
op = @app.collections[:instances].operations[:create]
|
47
|
+
op.effective_params(@driver).keys.should =~ [:image_id, :hwp_memory, :hwp_id, :keyname, :name, :hwp_storage, :realm_id]
|
48
|
+
|
49
|
+
op.params.keys =~ [:realm_id, :image_id, :hwp_id]
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
data/views/api/show.html.haml
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
%h1
|
2
|
-
API
|
2
|
+
Deltacloud API #{settings.version}
|
3
3
|
|
4
4
|
%ul
|
5
|
-
- collections.
|
5
|
+
- @collections.sort_by { |k| k.to_s }.each do |key|
|
6
6
|
%li
|
7
7
|
= link_to key.to_s.gsub('_', ' ').titlecase, url_for("/api/#{key}")
|
8
8
|
%dl
|
@@ -10,6 +10,3 @@
|
|
10
10
|
- next if [:index, :show].include?(op)
|
11
11
|
%dt
|
12
12
|
= op
|
13
|
-
%li
|
14
|
-
%strong
|
15
|
-
%a{:href => url_for("/api/docs")} Documentation (#{settings.version})
|
data/views/blobs/new.html.haml
CHANGED
@@ -4,7 +4,23 @@
|
|
4
4
|
%label
|
5
5
|
Blob Name:
|
6
6
|
%input{ :name => 'blob_id', :size => 512}/
|
7
|
+
%label
|
7
8
|
Blob Data:
|
8
|
-
%input{ :type => "file", :name => 'blob_data', :size => 50}/
|
9
9
|
%br
|
10
|
+
%input{ :type => "file", :name => 'blob_data', :size => 50}/
|
11
|
+
%br
|
12
|
+
%br
|
13
|
+
%input{ :type => "hidden", :name => "meta_params", :value => "0"}
|
14
|
+
%a{ :href => "javascript:;", :onclick => "more_fields();"} Add Metadata
|
15
|
+
%div{ :id => "metadata_holder", :style => "display: none;"}
|
16
|
+
%label
|
17
|
+
Metadata Key:
|
18
|
+
%input{ :type => "text", :name => "meta_name", :value => ""}/
|
19
|
+
%label
|
20
|
+
Metadata Value:
|
21
|
+
%input{ :type => "text", :name => "meta_value", :value => ""}/
|
22
|
+
%br
|
23
|
+
%a{ :href => "javascript:;", :onclick => "less_fields();"} Less Metadata
|
24
|
+
%br
|
25
|
+
%br
|
10
26
|
%input{ :type => :submit, :name => "commit", :value => "create"}/
|
data/views/blobs/show.html.haml
CHANGED
@@ -19,6 +19,12 @@
|
|
19
19
|
%dt Content
|
20
20
|
%dd
|
21
21
|
=link_to 'Blob content', bucket_url(@blob.bucket) + '/' + @blob.id + '/content'
|
22
|
+
%dt User_Metadata
|
23
|
+
%dd
|
24
|
+
-@blob.user_metadata.each do |k,v|
|
25
|
+
%b #{k} :
|
26
|
+
#{v}
|
27
|
+
%br
|
22
28
|
%dt Delete this Blob
|
23
29
|
%dd
|
24
30
|
%form{ :action => bucket_url(@blob.bucket) + '/' + @blob.id , :method => :post }
|
data/views/blobs/show.xml.haml
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
!!! XML
|
2
2
|
%blob{:href => bucket_url(@blob.bucket) + '/' + @blob.id, :id => @blob.id}
|
3
|
-
- @blob.attributes.select{ |attr| attr!=:id}.each do |attribute|
|
3
|
+
- @blob.attributes.select{ |attr| (attr!=:id && attr!=:user_metadata) }.each do |attribute|
|
4
4
|
- unless attribute == :content
|
5
5
|
- haml_tag(attribute, :<) do
|
6
6
|
- haml_concat @blob.send(attribute)
|
7
|
+
%user_metadata
|
8
|
+
- @blob.user_metadata.each do |k, v|
|
9
|
+
%entry{:key => k}
|
10
|
+
#{cdata v}
|
7
11
|
%content{:href => bucket_url(@blob.bucket) + '/' + @blob.id + '/content'}
|
@@ -11,11 +11,6 @@
|
|
11
11
|
ID
|
12
12
|
%th
|
13
13
|
Name
|
14
|
-
%th
|
15
|
-
Size
|
16
|
-
%th
|
17
|
-
Blob List
|
18
|
-
%th
|
19
14
|
|
20
15
|
%tbody
|
21
16
|
- @buckets.each do |bucket|
|
@@ -25,10 +20,4 @@
|
|
25
20
|
%td
|
26
21
|
= bucket.name
|
27
22
|
%td
|
28
|
-
= bucket.
|
29
|
-
%td
|
30
|
-
-bucket.blob_list.each do |blob|
|
31
|
-
= blob
|
32
|
-
%td
|
33
|
-
-if bucket.size == 0
|
34
|
-
=link_to_action 'Delete', destroy_bucket_url(bucket.name), :delete
|
23
|
+
=link_to_action 'Delete', destroy_bucket_url(bucket.name), :delete
|
@@ -3,8 +3,6 @@
|
|
3
3
|
- @elements.each do |bucket|
|
4
4
|
%bucket{:href => bucket_url(bucket.id), :id => bucket.id}
|
5
5
|
- bucket.attributes.select{ |attr| attr!=:id }.each do |attribute|
|
6
|
-
-
|
7
|
-
-
|
8
|
-
|
9
|
-
- bucket.blob_list.each do |blb|
|
10
|
-
%blob{ :id => blb, :href => bucket_url(bucket.id) +"/#{blb}"}
|
6
|
+
- haml_tag("#{attribute}".tr('-', '_'), :<) do
|
7
|
+
- haml_concat bucket.send(attribute)
|
8
|
+
|
@@ -1,17 +1,13 @@
|
|
1
1
|
%h2
|
2
|
-
|
3
|
-
|
4
|
-
#{@operation.name}
|
2
|
+
= action_method(@operation.name, @collection.name).to_s.upcase
|
3
|
+
= action_url
|
5
4
|
|
6
|
-
%p
|
5
|
+
%p
|
6
|
+
#{@operation.description}
|
7
7
|
|
8
8
|
%br
|
9
|
-
|
10
|
-
|
11
|
-
%u
|
12
|
-
= url_for("/api/#{@collection.name.to_s}/#{@operation.name.to_s}")
|
13
|
-
%br
|
14
|
-
%h3 Parameters:
|
9
|
+
|
10
|
+
%h2 Parameters:
|
15
11
|
|
16
12
|
|
17
13
|
%table
|
@@ -21,6 +17,7 @@
|
|
21
17
|
%th Type
|
22
18
|
%th Class
|
23
19
|
%th Valid values
|
20
|
+
%th Description
|
24
21
|
%tbody
|
25
22
|
- @operation.each_param do |p|
|
26
23
|
%tr
|
@@ -28,4 +25,19 @@
|
|
28
25
|
%em #{p.name}
|
29
26
|
%td{:style => "width:10em"} #{p.type}
|
30
27
|
%td #{p.klass}
|
31
|
-
%td{:style => "width:10em"} #{p.options.join(',')}
|
28
|
+
%td{:style => "width:10em"} #{p.options.join(', ')}
|
29
|
+
%td #{p.description}
|
30
|
+
- @features.sort { |a,b| a.name.to_s <=> b.name.to_s }.each do |f|
|
31
|
+
%tr
|
32
|
+
%th{:colspan => 4}
|
33
|
+
Feature #{f.name}
|
34
|
+
%th{:colspan => 1}
|
35
|
+
%em= f.description
|
36
|
+
- f.decl.operation(@operation.name).each_param do |p|
|
37
|
+
%tr
|
38
|
+
%td{:style => "width:15em"}
|
39
|
+
%em #{p.name}
|
40
|
+
%td{:style => "width:10em"} #{p.type}
|
41
|
+
%td #{p.klass}
|
42
|
+
%td{:style => "width:10em"} #{p.options.join(', ')}
|
43
|
+
%td #{p.description}
|