deltacloud-core 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -1
- data/bin/deltacloudd +11 -5
- data/config.ru +3 -3
- data/deltacloud-core.gemspec +24 -18
- data/lib/cimi/collections/address_templates.rb +3 -3
- data/lib/cimi/collections/addresses.rb +6 -5
- data/lib/cimi/collections/entity_metadata.rb +0 -2
- data/lib/cimi/collections/machine_admins.rb +5 -5
- data/lib/cimi/collections/machine_configurations.rb +2 -2
- data/lib/cimi/collections/machine_images.rb +3 -3
- data/lib/cimi/collections/machines.rb +32 -10
- data/lib/cimi/collections/network_configurations.rb +4 -3
- data/lib/cimi/collections/network_templates.rb +4 -3
- data/lib/cimi/collections/networks.rb +8 -8
- data/lib/cimi/collections/routing_group_templates.rb +4 -3
- data/lib/cimi/collections/routing_groups.rb +4 -3
- data/lib/cimi/collections/volume_configurations.rb +3 -3
- data/lib/cimi/collections/volume_images.rb +3 -3
- data/lib/cimi/collections/volumes.rb +4 -3
- data/lib/cimi/collections/vsp_configurations.rb +4 -3
- data/lib/cimi/collections/vsp_templates.rb +4 -3
- data/lib/cimi/collections/vsps.rb +8 -7
- data/lib/cimi/helpers.rb +1 -1
- data/lib/cimi/helpers/cimi_helper.rb +11 -1
- data/lib/cimi/models.rb +4 -0
- data/lib/cimi/models/base.rb +11 -1
- data/lib/cimi/models/cloud_entry_point.rb +7 -14
- data/lib/cimi/models/disk.rb +40 -0
- data/lib/cimi/models/disk_collection.rb +38 -0
- data/lib/cimi/models/machine.rb +9 -43
- data/lib/cimi/models/machine_collection.rb +7 -4
- data/lib/cimi/models/machine_configuration.rb +8 -15
- data/lib/cimi/models/machine_configuration_collection.rb +6 -4
- data/lib/cimi/models/machine_image_collection.rb +6 -4
- data/lib/cimi/models/machine_template_collection.rb +6 -4
- data/lib/cimi/models/machine_volume.rb +42 -0
- data/lib/cimi/models/machine_volume_collection.rb +34 -0
- data/lib/cimi/models/network.rb +5 -9
- data/lib/cimi/models/network_collection.rb +6 -5
- data/lib/cimi/models/schema.rb +20 -0
- data/lib/cimi/models/volume_collection.rb +6 -4
- data/lib/cimi/models/volume_configuration_collection.rb +6 -4
- data/lib/cimi/models/volume_image_collection.rb +6 -4
- data/lib/cimi/models/volume_template_collection.rb +6 -4
- data/lib/deltacloud/api.rb +3 -3
- data/lib/deltacloud/collections/addresses.rb +1 -1
- data/lib/deltacloud/collections/firewalls.rb +4 -2
- data/lib/deltacloud/collections/keys.rb +1 -1
- data/lib/deltacloud/collections/load_balancers.rb +1 -1
- data/lib/deltacloud/collections/storage_volumes.rb +4 -4
- data/lib/deltacloud/drivers/base_driver.rb +12 -20
- data/lib/deltacloud/drivers/ec2/aws_vpc_monkey_patch.rb +294 -0
- data/lib/deltacloud/drivers/ec2/ec2_driver.rb +38 -6
- data/lib/deltacloud/drivers/fgcp/fgcp_client.rb +4 -0
- data/lib/deltacloud/drivers/fgcp/fgcp_driver.rb +40 -4
- data/lib/deltacloud/drivers/gogrid/gogrid_client.rb +8 -7
- data/lib/deltacloud/drivers/gogrid/gogrid_driver.rb +422 -416
- data/lib/deltacloud/drivers/google/google_driver.rb +2 -1
- data/lib/deltacloud/drivers/openstack/openstack_driver.rb +30 -16
- data/lib/deltacloud/drivers/rhevm/rhevm_driver.rb +1 -0
- data/lib/deltacloud/drivers/vsphere/vsphere_driver.rb +3 -9
- data/lib/deltacloud/helpers/deltacloud_helper.rb +0 -2
- data/lib/deltacloud/models/firewall_rule.rb +2 -0
- data/lib/deltacloud/models/hardware_profile.rb +61 -59
- data/{tests/deprecated/core_ext/string.rb → lib/deltacloud/version.rb} +3 -15
- data/lib/deltacloud_rack.rb +1 -0
- data/lib/ec2/server.rb +5 -3
- data/lib/sinatra/rack_accept.rb +53 -53
- data/lib/sinatra/rack_etag.rb +1 -1
- data/tests/cimi/collections/cloud_entry_point_test.rb +11 -2
- data/tests/deltacloud/common.rb +1 -1
- data/tests/deltacloud/rack_test.rb +3 -3
- data/tests/drivers/base/base_driver_test.rb +6 -2
- data/tests/drivers/base/common.rb +1 -0
- data/tests/drivers/base/library_test.rb +6 -2
- data/tests/drivers/ec2/common.rb +34 -15
- data/tests/drivers/ec2/images_test.rb +2 -3
- data/tests/drivers/ec2/instance_test.rb +12 -2
- data/tests/drivers/ec2/keys_test.rb +2 -2
- data/tests/drivers/ec2/realms_test.rb +7 -3
- data/tests/drivers/ec2/storage_snapshots_test.rb +2 -3
- data/tests/drivers/gogrid/common.rb +24 -0
- data/tests/drivers/gogrid/hardware_profiles_test.rb +51 -0
- data/tests/drivers/gogrid/images_test.rb +57 -0
- data/tests/drivers/gogrid/instances_test.rb +92 -0
- data/tests/drivers/gogrid/realms_test.rb +45 -0
- data/tests/drivers/google/buckets_test.rb +105 -0
- data/tests/drivers/google/common.rb +20 -0
- data/tests/drivers/mock/common.rb +1 -0
- data/tests/drivers/mock/images_test.rb +3 -2
- data/tests/drivers/mock/instances_test.rb +3 -2
- data/tests/drivers/mock/keys_test.rb +3 -2
- data/tests/drivers/mock/realms_test.rb +3 -2
- data/tests/drivers/mock/storage_snapshots_test.rb +3 -2
- data/tests/drivers/mock/storage_volumes_test.rb +3 -2
- data/tests/drivers/models/address_test.rb +3 -3
- data/tests/drivers/models/base_test.rb +4 -2
- data/tests/drivers/models/blob_test.rb +3 -3
- data/tests/drivers/models/common.rb +3 -0
- data/tests/drivers/models/hardware_profile_test.rb +5 -4
- data/tests/drivers/models/instance_address_test.rb +3 -3
- data/tests/drivers/models/instance_profile_test.rb +3 -3
- data/tests/drivers/models/instance_test.rb +3 -3
- data/tests/drivers/models/keys_test.rb +3 -3
- data/tests/drivers/models/metrics_test.rb +3 -3
- data/tests/drivers/openstack/common.rb +26 -0
- data/tests/drivers/openstack/hardware_profiles_test.rb +46 -0
- data/tests/drivers/openstack/images_test.rb +50 -0
- data/tests/drivers/openstack/instances_test.rb +66 -0
- data/tests/drivers/openstack/keys_test.rb +61 -0
- data/tests/drivers/openstack/realms_test.rb +46 -0
- data/tests/drivers/rhevm/common.rb +2 -0
- data/tests/drivers/rhevm/images_test.rb +3 -4
- data/tests/drivers/rhevm/instance_test.rb +2 -2
- data/tests/drivers/rhevm/provider_test.rb +2 -2
- data/tests/drivers/rhevm/realms_test.rb +2 -3
- data/tests/ec2/common.rb +5 -4
- data/tests/ec2/server_test.rb +3 -2
- data/tests/helpers/rack/common.rb +3 -0
- data/tests/helpers/rack/rack_accept_test.rb +65 -0
- data/tests/helpers/rack/rack_date_test.rb +27 -0
- data/tests/helpers/rack/rack_driver_select_test.rb +53 -0
- data/tests/helpers/rack/rack_etag_test.rb +29 -0
- data/tests/helpers/rack/rack_matrix_params_test.rb +72 -0
- data/tests/test_helper.rb +44 -36
- data/views/hardware_profiles/index.html.haml +1 -1
- data/views/hardware_profiles/show.html.haml +2 -2
- data/views/hardware_profiles/show.xml.haml +2 -1
- data/views/images/show.html.haml +6 -5
- metadata +74 -117
- data/tests/deprecated/api/common.rb +0 -1
- data/tests/deprecated/api/driver_test.rb +0 -79
- data/tests/deprecated/api/library_test.rb +0 -6
- data/tests/deprecated/cimi/features/step_definitions/common_steps.rb +0 -59
- data/tests/deprecated/cimi/features/step_definitions/machine_images_steps.rb +0 -0
- data/tests/deprecated/cimi/features/step_definitions/machines_steps.rb +0 -100
- data/tests/deprecated/cimi/features/step_definitions/volumes_steps.rb +0 -115
- data/tests/deprecated/cimi/features/support/env.rb +0 -75
- data/tests/deprecated/common.rb +0 -279
- data/tests/deprecated/drivers/ec2/api_test.rb +0 -19
- data/tests/deprecated/drivers/ec2/common.rb +0 -23
- data/tests/deprecated/drivers/ec2/drivers_test.rb +0 -120
- data/tests/deprecated/drivers/ec2/hardware_profiles_test.rb +0 -224
- data/tests/deprecated/drivers/ec2/images_test.rb +0 -230
- data/tests/deprecated/drivers/ec2/instances_test.rb +0 -356
- data/tests/deprecated/drivers/ec2/keys_test.rb +0 -181
- data/tests/deprecated/drivers/ec2/realms_test.rb +0 -146
- data/tests/deprecated/drivers/fgcp/api_test.rb +0 -47
- data/tests/deprecated/drivers/fgcp/hardware_profiles_test.rb +0 -54
- data/tests/deprecated/drivers/fgcp/realms_test.rb +0 -42
- data/tests/deprecated/drivers/fgcp/setup.rb +0 -13
- data/tests/deprecated/drivers/google/api_test.rb +0 -19
- data/tests/deprecated/drivers/google/buckets_test.rb +0 -100
- data/tests/deprecated/drivers/google/common.rb +0 -54
- data/tests/deprecated/drivers/mock/api_test.rb +0 -10
- data/tests/deprecated/drivers/mock/buckets_test.rb +0 -195
- data/tests/deprecated/drivers/mock/common.rb +0 -7
- data/tests/deprecated/drivers/mock/drivers_test.rb +0 -123
- data/tests/deprecated/drivers/mock/hardware_profiles_test.rb +0 -224
- data/tests/deprecated/drivers/mock/images_test.rb +0 -197
- data/tests/deprecated/drivers/mock/instances_test.rb +0 -343
- data/tests/deprecated/drivers/mock/keys_test.rb +0 -161
- data/tests/deprecated/drivers/mock/realms_test.rb +0 -132
- data/tests/deprecated/drivers/mock/storage_snapshots_test.rb +0 -114
- data/tests/deprecated/drivers/mock/storage_volumes_test.rb +0 -122
- data/tests/deprecated/drivers/openstack/api_test.rb +0 -46
- data/tests/deprecated/drivers/openstack/common.rb +0 -21
- data/tests/deprecated/drivers/openstack/hardware_profiles_test.rb +0 -64
- data/tests/deprecated/drivers/openstack/images_test.rb +0 -46
- data/tests/deprecated/drivers/openstack/instances_test.rb +0 -208
- data/tests/deprecated/drivers/openstack/realms_test.rb +0 -40
- data/tests/deprecated/drivers/rackspace/api_test.rb +0 -46
- data/tests/deprecated/drivers/rackspace/buckets_test.rb +0 -150
- data/tests/deprecated/drivers/rackspace/common.rb +0 -16
- data/tests/deprecated/drivers/rackspace/hardware_profiles_test.rb +0 -58
- data/tests/deprecated/drivers/rackspace/images_test.rb +0 -45
- data/tests/deprecated/drivers/rackspace/instances_test.rb +0 -166
- data/tests/deprecated/drivers/rackspace/realms_test.rb +0 -41
- data/tests/deprecated/drivers/rhevm/api_test.rb +0 -45
- data/tests/deprecated/drivers/rhevm/common.rb +0 -21
- data/tests/deprecated/drivers/rhevm/hardware_profiles_test.rb +0 -58
- data/tests/deprecated/drivers/rhevm/images_test.rb +0 -48
- data/tests/deprecated/drivers/rhevm/instances_test.rb +0 -182
- data/tests/deprecated/drivers/rhevm/realms_test.rb +0 -40
- data/tests/deprecated/minitest_common.rb +0 -58
- data/tests/deprecated/minitest_common_api_test.rb +0 -115
- data/tests/deprecated/rabbit_test.rb +0 -52
data/Rakefile
CHANGED
@@ -116,7 +116,7 @@ task :routes do
|
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
119
|
-
DRIVERS = [:mock, :ec2, :rhevm]
|
119
|
+
DRIVERS = [:mock, :ec2, :rhevm, :google, :gogrid, :openstack]
|
120
120
|
|
121
121
|
desc 'Run all tests'
|
122
122
|
task :test do
|
@@ -164,6 +164,7 @@ namespace :test do
|
|
164
164
|
end
|
165
165
|
t.test_files = FileList[
|
166
166
|
'tests/helpers/core_ext/*test.rb', # Deltacloud extensions (core_ext) and other helpers
|
167
|
+
'tests/helpers/rack/*test.rb', # Rack extensions Deltacloud use
|
167
168
|
'tests/drivers/base/*test.rb', # Deltacloud drivers API tests
|
168
169
|
'tests/drivers/models/*test.rb', # Deltacloud models tests
|
169
170
|
'tests/deltacloud/*test.rb', # Deltacloud internal API tests
|
data/bin/deltacloudd
CHANGED
@@ -150,10 +150,15 @@ end
|
|
150
150
|
|
151
151
|
if options[:config]
|
152
152
|
cfg = YAML::load(File.read(options[:config]))
|
153
|
-
if
|
154
|
-
|
155
|
-
|
156
|
-
|
153
|
+
if cfg.keys.any? { |k| k.is_a?(Symbol) }
|
154
|
+
puts "The config file #{options[:config]} uses symbols as keys"
|
155
|
+
puts " Change them to be ordinary strings"
|
156
|
+
exit(1)
|
157
|
+
end
|
158
|
+
if c = cfg[ENV["API_DRIVER"]]
|
159
|
+
ENV["API_PROVIDER"] ||= c["provider"]
|
160
|
+
ENV["API_USER"] ||= c["user"]
|
161
|
+
ENV["API_PASSWORD"] ||= c["password"]
|
157
162
|
end
|
158
163
|
end
|
159
164
|
|
@@ -234,7 +239,8 @@ else
|
|
234
239
|
argv_opts.unshift "thin"
|
235
240
|
command = argv_opts.join(" ")
|
236
241
|
Dir::chdir($top_srcdir)
|
237
|
-
rerun = Rerun::Runner.new(command,
|
242
|
+
rerun = Rerun::Runner.new(command,
|
243
|
+
:dir => File::join($top_srcdir, "lib", "deltacloud"))
|
238
244
|
rerun.start
|
239
245
|
rerun.join
|
240
246
|
else
|
data/config.ru
CHANGED
@@ -24,7 +24,7 @@ load File.join(File.dirname(__FILE__), 'lib', 'deltacloud_rack.rb')
|
|
24
24
|
|
25
25
|
Deltacloud::configure do |server|
|
26
26
|
server.root_url '/api'
|
27
|
-
server.version
|
27
|
+
server.version Deltacloud::API_VERSION
|
28
28
|
server.klass 'Deltacloud::API'
|
29
29
|
server.logger Rack::DeltacloudLogger.setup(ENV['API_LOG'], ENV['API_VERBOSE'])
|
30
30
|
server.default_driver ENV['API_DRIVER']
|
@@ -32,14 +32,14 @@ end
|
|
32
32
|
|
33
33
|
Deltacloud::configure(:cimi) do |server|
|
34
34
|
server.root_url '/cimi'
|
35
|
-
server.version
|
35
|
+
server.version Deltacloud::API_VERSION
|
36
36
|
server.klass 'CIMI::API'
|
37
37
|
server.logger Rack::DeltacloudLogger.setup(ENV['API_LOG'], ENV['API_VERBOSE'])
|
38
38
|
server.default_driver ENV['API_DRIVER']
|
39
39
|
end
|
40
40
|
|
41
41
|
Deltacloud::configure(:ec2) do |server|
|
42
|
-
server.root_url '/'
|
42
|
+
server.root_url '/ec2'
|
43
43
|
server.version '2012-04-01'
|
44
44
|
server.klass 'Deltacloud::EC2::API'
|
45
45
|
server.logger Rack::DeltacloudLogger.setup(ENV['API_LOG'], ENV['API_VERBOSE'])
|
data/deltacloud-core.gemspec
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
# License for the specific language governing permissions and limitations
|
15
15
|
# under the License.
|
16
16
|
|
17
|
-
|
17
|
+
Kernel::load File::join(File::dirname(__FILE__), './lib/deltacloud/version.rb')
|
18
18
|
|
19
19
|
Gem::Specification.new do |s|
|
20
20
|
s.author = 'The Apache Software Foundation'
|
@@ -29,10 +29,10 @@ Gem::Specification.new do |s|
|
|
29
29
|
which implements the REST interface.
|
30
30
|
EOF
|
31
31
|
|
32
|
-
s.version =
|
32
|
+
s.version = Deltacloud::API_VERSION
|
33
33
|
s.date = Time.now
|
34
34
|
s.summary = %q{Deltacloud REST API}
|
35
|
-
s.files =
|
35
|
+
s.files = [
|
36
36
|
'Rakefile',
|
37
37
|
'*.gemspec',
|
38
38
|
'config.ru',
|
@@ -58,17 +58,17 @@ Gem::Specification.new do |s|
|
|
58
58
|
'public/stylesheets/images/*.png',
|
59
59
|
'public/stylesheets/compiled/*.css',
|
60
60
|
'bin/deltacloudd'
|
61
|
-
].
|
61
|
+
].map { |f| Dir[f] }.flatten
|
62
62
|
|
63
63
|
s.bindir = 'bin'
|
64
64
|
s.executables = 'deltacloudd'
|
65
65
|
s.test_files= Dir.glob("tests/**/*_test.rb")
|
66
66
|
s.extra_rdoc_files = Dir["LICENSE", "DISCLAIMER", "NOTICE"]
|
67
|
-
s.required_ruby_version = '>= 1.8.
|
67
|
+
s.required_ruby_version = '>= 1.8.6'
|
68
68
|
s.has_rdoc = 'false'
|
69
69
|
s.add_dependency('rake', '>= 0.8.7')
|
70
70
|
s.add_dependency('haml', '>= 2.2.17')
|
71
|
-
s.add_dependency('sinatra', '>=
|
71
|
+
s.add_dependency('sinatra', '>= 1.3.0')
|
72
72
|
s.add_dependency('sinatra-rabbit', '>= 1.0.10')
|
73
73
|
s.add_dependency('crack')
|
74
74
|
s.add_dependency('rack', '>= 1.0.0')
|
@@ -79,33 +79,39 @@ Gem::Specification.new do |s|
|
|
79
79
|
s.add_dependency('nokogiri', '>= 1.4.3')
|
80
80
|
s.add_dependency('require_relative') if RUBY_VERSION < '1.9'
|
81
81
|
|
82
|
-
# dependencies for various cloud providers:
|
83
|
-
# RHEV-M
|
84
|
-
s.add_dependency('rbovirt', '>=0.0.6')
|
82
|
+
# dependencies for various cloud providers:
|
85
83
|
|
86
|
-
#
|
84
|
+
# RHEV-M and oVirt
|
85
|
+
s.add_dependency('rbovirt', '>=0.0.12')
|
86
|
+
|
87
|
+
# Amazon EC2 S3
|
87
88
|
s.add_dependency('aws', '>=2.5.4')
|
88
|
-
# Microsoft Azure
|
89
|
+
# Microsoft Azure
|
89
90
|
s.add_dependency('waz-storage', '>=1.1.0')
|
90
91
|
|
91
|
-
# Rackspace Cloudservers Cloudfiles
|
92
|
+
# Rackspace Cloudservers Cloudfiles
|
92
93
|
s.add_dependency('cloudservers')
|
93
94
|
s.add_dependency('cloudfiles')
|
94
95
|
|
95
|
-
# Terremark Vcloud Express
|
96
|
+
# Terremark Vcloud Express
|
96
97
|
s.add_dependency('fog', '>= 1.4.0')
|
97
98
|
s.add_dependency('excon', '>= 0.14.2' )
|
98
99
|
|
99
|
-
# Rhevm and Condor Cloud
|
100
|
+
# Rhevm and Condor Cloud
|
100
101
|
s.add_dependency('rest-client')
|
101
102
|
|
102
|
-
# Condor Cloud
|
103
|
+
# Condor Cloud
|
103
104
|
s.add_dependency('uuidtools', '>= 2.1.1')
|
104
105
|
|
105
|
-
# Openstack Compute and Object-Storage
|
106
|
-
s.add_dependency('openstack', '>= 1.0.
|
106
|
+
# Openstack Compute and Object-Storage
|
107
|
+
s.add_dependency('openstack', '>= 1.0.4')
|
107
108
|
|
108
|
-
# Aruba Cloud
|
109
|
+
# Aruba Cloud
|
109
110
|
s.add_dependency('savon', '>= 1.0.0')
|
110
111
|
|
112
|
+
# VSphere
|
113
|
+
s.add_dependency('rbvmomi')
|
114
|
+
|
115
|
+
|
116
|
+
|
111
117
|
end
|
@@ -16,11 +16,11 @@
|
|
16
16
|
module CIMI::Collections
|
17
17
|
class AddressTemplates < Base
|
18
18
|
|
19
|
-
|
19
|
+
set :capability, lambda { |m| driver.respond_to? m }
|
20
20
|
|
21
21
|
collection :address_templates do
|
22
22
|
|
23
|
-
operation :index do
|
23
|
+
operation :index, :with_capability => :address_templates do
|
24
24
|
description 'List all AddressTemplates in the AddressTemplateCollection'
|
25
25
|
param :CIMISelect, :string, :optional
|
26
26
|
control do
|
@@ -32,7 +32,7 @@ module CIMI::Collections
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
operation :show do
|
35
|
+
operation :show, :with_capability => :address_template do
|
36
36
|
description 'Show a specific AddressTemplate'
|
37
37
|
control do
|
38
38
|
address_template = CIMI::Model::AddressTemplate.find(params[:id], self)
|
@@ -16,12 +16,13 @@
|
|
16
16
|
module CIMI::Collections
|
17
17
|
class Addresses < Base
|
18
18
|
|
19
|
-
|
19
|
+
set :capability, lambda { |m| driver.respond_to? m }
|
20
|
+
|
20
21
|
collection :addresses do
|
21
22
|
|
22
23
|
description 'An Address represents an IP address, and its associated metdata, for a particular Network.'
|
23
24
|
|
24
|
-
operation :index do
|
25
|
+
operation :index, :with_capability => :addresses do
|
25
26
|
description 'List all Addresses in the AddressCollection'
|
26
27
|
param :CIMISelect, :string, :optional
|
27
28
|
control do
|
@@ -33,7 +34,7 @@ module CIMI::Collections
|
|
33
34
|
end
|
34
35
|
end
|
35
36
|
|
36
|
-
operation :show do
|
37
|
+
operation :show, :with_capability => :address do
|
37
38
|
description 'Show a specific Address'
|
38
39
|
control do
|
39
40
|
address = CIMI::Model::Address.find(params[:id], self)
|
@@ -44,7 +45,7 @@ module CIMI::Collections
|
|
44
45
|
end
|
45
46
|
end
|
46
47
|
|
47
|
-
operation :create do
|
48
|
+
operation :create, :with_capability => :create_address do
|
48
49
|
description "Create a new Address"
|
49
50
|
control do
|
50
51
|
if request.content_type.end_with?("json")
|
@@ -59,7 +60,7 @@ module CIMI::Collections
|
|
59
60
|
end
|
60
61
|
end
|
61
62
|
|
62
|
-
operation :destroy do
|
63
|
+
operation :destroy, :with_capability => :delete_address do
|
63
64
|
description "Delete a specified Address"
|
64
65
|
param :id, :string, :required
|
65
66
|
control do
|
@@ -16,12 +16,12 @@
|
|
16
16
|
module CIMI::Collections
|
17
17
|
class MachineAdmins < Base
|
18
18
|
|
19
|
-
|
19
|
+
set :capability, lambda { |m| driver.respond_to? m }
|
20
20
|
|
21
21
|
collection :machine_admins do
|
22
22
|
description 'Machine Admin entity'
|
23
23
|
|
24
|
-
operation :index do
|
24
|
+
operation :index, :with_capability => :keys do
|
25
25
|
description "List all machine admins"
|
26
26
|
param :CIMISelect, :string, :optional
|
27
27
|
control do
|
@@ -33,7 +33,7 @@ module CIMI::Collections
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
operation :show do
|
36
|
+
operation :show, :with_capability => :key do
|
37
37
|
description "Show specific machine admin"
|
38
38
|
control do
|
39
39
|
machine_admin = MachineAdmin.find(params[:id], self)
|
@@ -44,7 +44,7 @@ module CIMI::Collections
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
operation :create do
|
47
|
+
operation :create, :with_capability => :create_key do
|
48
48
|
description "Show specific machine admin"
|
49
49
|
control do
|
50
50
|
if request.content_type.end_with?("+json")
|
@@ -60,7 +60,7 @@ module CIMI::Collections
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
operation :delete do
|
63
|
+
operation :delete, :with_capability => :destroy_key do
|
64
64
|
description "Delete specified MachineAdmin entity"
|
65
65
|
control do
|
66
66
|
MachineAdmin.delete!(params[:id], self)
|
@@ -21,7 +21,7 @@ module CIMI::Collections
|
|
21
21
|
collection :machine_configurations do
|
22
22
|
description 'List all machine configurations'
|
23
23
|
|
24
|
-
operation :index do
|
24
|
+
operation :index, :with_capability => :hardware_profiles do
|
25
25
|
param :CIMISelect, :string, :optional
|
26
26
|
description "List all machine configurations"
|
27
27
|
control do
|
@@ -33,7 +33,7 @@ module CIMI::Collections
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
operation :show do
|
36
|
+
operation :show, :with_capability => :hardware_profile do
|
37
37
|
control do
|
38
38
|
machine_conf = MachineConfiguration.find(params[:id], self)
|
39
39
|
respond_to do |format|
|
@@ -16,12 +16,12 @@
|
|
16
16
|
module CIMI::Collections
|
17
17
|
class MachineImages < Base
|
18
18
|
|
19
|
-
|
19
|
+
set :capability, lambda { |m| driver.respond_to? m }
|
20
20
|
|
21
21
|
collection :machine_images do
|
22
22
|
description 'List all machine images'
|
23
23
|
|
24
|
-
operation :index do
|
24
|
+
operation :index, :with_capability => :images do
|
25
25
|
description "List all machine configurations"
|
26
26
|
param :CIMISelect, :string, :optional
|
27
27
|
control do
|
@@ -33,7 +33,7 @@ module CIMI::Collections
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
operation :show do
|
36
|
+
operation :show, :with_capability => :image do
|
37
37
|
description "Show specific machine image."
|
38
38
|
control do
|
39
39
|
machine_image = MachineImage.find(params[:id], self)
|
@@ -16,12 +16,12 @@
|
|
16
16
|
module CIMI::Collections
|
17
17
|
class Machines < Base
|
18
18
|
|
19
|
-
|
19
|
+
set :capability, lambda { |m| driver.respond_to? m }
|
20
20
|
|
21
21
|
collection :machines do
|
22
22
|
description 'List all machine'
|
23
23
|
|
24
|
-
operation :index do
|
24
|
+
operation :index, :with_capability => :instances do
|
25
25
|
param :CIMISelect, :string, :optional
|
26
26
|
description "List all machines"
|
27
27
|
control do
|
@@ -33,7 +33,7 @@ module CIMI::Collections
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
operation :show do
|
36
|
+
operation :show, :with_capability => :instance do
|
37
37
|
description "Show specific machine."
|
38
38
|
control do
|
39
39
|
machine = Machine.find(params[:id], self)
|
@@ -44,7 +44,7 @@ module CIMI::Collections
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
operation :create do
|
47
|
+
operation :create, :with_capability => :create_instance do
|
48
48
|
description "Create a new Machine entity."
|
49
49
|
control do
|
50
50
|
if request.content_type.end_with?("+json")
|
@@ -60,7 +60,7 @@ module CIMI::Collections
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
operation :destroy do
|
63
|
+
operation :destroy, :with_capability => :destroy_instance do
|
64
64
|
description "Delete a specified machine."
|
65
65
|
param :id, :string, :required
|
66
66
|
control do
|
@@ -69,7 +69,7 @@ module CIMI::Collections
|
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
|
-
action :stop do
|
72
|
+
action :stop, :with_capability => :stop_instance do
|
73
73
|
description "Stop specific machine."
|
74
74
|
control do
|
75
75
|
machine = Machine.find(params[:id], self)
|
@@ -85,7 +85,7 @@ module CIMI::Collections
|
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
-
action :restart do
|
88
|
+
action :restart, :with_capability => :restart_instance do
|
89
89
|
description "Start specific machine."
|
90
90
|
control do
|
91
91
|
machine = Machine.find(params[:id], self)
|
@@ -101,7 +101,7 @@ module CIMI::Collections
|
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
104
|
-
action :start do
|
104
|
+
action :start, :with_capability => :start_instance do
|
105
105
|
description "Start specific machine."
|
106
106
|
control do
|
107
107
|
machine = Machine.find(params[:id], self)
|
@@ -117,10 +117,32 @@ module CIMI::Collections
|
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
120
|
+
operation :disks, :with_capability => :hardware_profiles do
|
121
|
+
description "Retrieve the Machine's DiskCollection"
|
122
|
+
control do
|
123
|
+
disks = DiskCollection.default(params[:id], self)
|
124
|
+
respond_to do |format|
|
125
|
+
format.json {disks.to_json}
|
126
|
+
format.xml {disks.to_xml}
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
operation :volumes, :with_capability => :storage_volumes do
|
132
|
+
description "Retrieve the Machine's MachineVolumeCollection"
|
133
|
+
control do
|
134
|
+
volumes = MachineVolumeCollection.default(params[:id], self)
|
135
|
+
respond_to do |format|
|
136
|
+
format.json {volumes.to_json}
|
137
|
+
format.xml {volumes.to_xml}
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
120
142
|
#NOTE: The routes for attach/detach used here are NOT as specified by CIMI
|
121
143
|
#will likely move later. CIMI specifies PUT of the whole Machine description
|
122
144
|
#with inclusion/ommission of the volumes you want [att|det]ached
|
123
|
-
action :attach_volume, :http_method => :put do
|
145
|
+
action :attach_volume, :http_method => :put, :with_capability => :attach_storage_volume do
|
124
146
|
description "Attach CIMI Volume(s) to a machine."
|
125
147
|
control do
|
126
148
|
if request.content_type.end_with?("+json")
|
@@ -136,7 +158,7 @@ module CIMI::Collections
|
|
136
158
|
end
|
137
159
|
end
|
138
160
|
|
139
|
-
action :detach_volume, :http_method => :put do
|
161
|
+
action :detach_volume, :http_method => :put, :with_capability => :detach_storage_volume do
|
140
162
|
description "Detach CIMI Volume(s) from a machine."
|
141
163
|
control do
|
142
164
|
if request.content_type.end_with?("+json")
|
@@ -16,10 +16,11 @@
|
|
16
16
|
module CIMI::Collections
|
17
17
|
class NetworkConfigurations < Base
|
18
18
|
|
19
|
-
|
19
|
+
set :capability, lambda { |m| driver.respond_to? m }
|
20
|
+
|
20
21
|
collection :network_configurations do
|
21
22
|
|
22
|
-
operation :index do
|
23
|
+
operation :index, :with_capability => :network_configurations do
|
23
24
|
description 'List all NetworkConfigurations'
|
24
25
|
param :CIMISelect, :string, :optional
|
25
26
|
control do
|
@@ -31,7 +32,7 @@ module CIMI::Collections
|
|
31
32
|
end
|
32
33
|
end
|
33
34
|
|
34
|
-
operation :show do
|
35
|
+
operation :show, :with_capability => :network_configuration do
|
35
36
|
description 'Show a specific NetworkConfiguration'
|
36
37
|
control do
|
37
38
|
network_config = NetworkConfiguration.find(params[:id], self)
|