deltacloud-core 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +23 -0
- data/NOTICE +3 -0
- data/Rakefile +32 -20
- data/bin/deltacloudd +1 -1
- data/config.ru +25 -32
- data/deltacloud-core.gemspec +1 -1
- data/lib/cimi/collections.rb +4 -1
- data/lib/cimi/collections/address_templates.rb +2 -2
- data/lib/cimi/collections/addresses.rb +1 -1
- data/lib/cimi/collections/base.rb +64 -0
- data/lib/cimi/collections/{machine_admins.rb → credentials.rb} +12 -12
- data/lib/cimi/collections/{vsp_templates.rb → forwarding_group_templates.rb} +12 -16
- data/lib/cimi/collections/{vsp_configurations.rb → forwarding_groups.rb} +12 -13
- data/lib/cimi/collections/machine_configurations.rb +2 -2
- data/lib/cimi/collections/machine_images.rb +1 -1
- data/lib/cimi/collections/machines.rb +8 -2
- data/lib/cimi/collections/network_configurations.rb +2 -2
- data/lib/cimi/collections/{routing_groups.rb → network_port_configurations.rb} +12 -12
- data/lib/cimi/collections/{routing_group_templates.rb → network_port_templates.rb} +15 -12
- data/lib/cimi/collections/{vsps.rb → network_ports.rb} +33 -32
- data/lib/cimi/collections/network_templates.rb +2 -2
- data/lib/cimi/collections/networks.rb +17 -2
- data/lib/cimi/collections/{entity_metadata.rb → resource_metadata.rb} +10 -10
- data/lib/cimi/collections/volume_configurations.rb +1 -1
- data/lib/cimi/collections/volume_images.rb +1 -1
- data/lib/cimi/collections/volumes.rb +1 -2
- data/lib/cimi/dependencies.rb +1 -1
- data/lib/cimi/helpers.rb +3 -84
- data/lib/cimi/helpers/cimi_helper.rb +15 -14
- data/lib/cimi/models.rb +20 -36
- data/lib/cimi/models/address.rb +32 -4
- data/lib/cimi/models/address_template.rb +2 -2
- data/lib/cimi/models/base.rb +24 -5
- data/lib/cimi/models/cloud_entry_point.rb +4 -9
- data/lib/cimi/models/collection.rb +101 -0
- data/lib/cimi/models/{machine_admin.rb → credential.rb} +6 -4
- data/lib/cimi/models/disk_collection.rb +1 -2
- data/lib/cimi/models/{routing_group_template.rb → forwarding_group.rb} +5 -3
- data/lib/cimi/models/{routing_group.rb → forwarding_group_template.rb} +5 -3
- data/lib/cimi/models/machine.rb +9 -7
- data/lib/cimi/models/machine_configuration.rb +2 -0
- data/lib/cimi/models/machine_image.rb +2 -0
- data/lib/cimi/models/machine_template.rb +3 -1
- data/lib/cimi/models/machine_volume_collection.rb +1 -1
- data/lib/cimi/models/network.rb +2 -0
- data/lib/cimi/models/network_configuration.rb +4 -8
- data/lib/cimi/models/{vsp.rb → network_port.rb} +7 -11
- data/lib/cimi/models/{network_configuration_collection.rb → network_port_collection.rb} +25 -8
- data/lib/cimi/models/{vsp_configuration.rb → network_port_configuration.rb} +6 -10
- data/lib/cimi/models/{network_collection.rb → network_port_configuration_collection.rb} +9 -9
- data/lib/cimi/models/{vsp_template.rb → network_port_template.rb} +6 -4
- data/lib/cimi/models/{network_template_collection.rb → network_port_template_collection.rb} +10 -8
- data/lib/cimi/models/network_template.rb +3 -1
- data/lib/cimi/models/{entity_metadata.rb → resource_metadata.rb} +16 -15
- data/lib/cimi/models/schema.rb +23 -12
- data/lib/cimi/models/volume.rb +2 -0
- data/lib/cimi/models/volume_configuration.rb +2 -0
- data/lib/cimi/models/volume_image.rb +2 -0
- data/lib/cimi/models/volume_template.rb +2 -0
- data/lib/cimi/server.rb +10 -6
- data/lib/deltacloud/collections.rb +7 -2
- data/lib/deltacloud/collections/addresses.rb +3 -1
- data/lib/deltacloud/collections/base.rb +64 -0
- data/lib/deltacloud/collections/buckets.rb +14 -4
- data/lib/deltacloud/collections/drivers.rb +1 -1
- data/lib/deltacloud/collections/firewalls.rb +1 -1
- data/lib/deltacloud/collections/instances.rb +5 -1
- data/lib/deltacloud/collections/keys.rb +1 -1
- data/lib/deltacloud/collections/load_balancers.rb +2 -0
- data/lib/deltacloud/collections/storage_volumes.rb +3 -5
- data/lib/deltacloud/core_ext.rb +1 -0
- data/lib/deltacloud/core_ext/hash.rb +8 -0
- data/lib/deltacloud/core_ext/ordered_hash.rb +222 -0
- data/lib/deltacloud/core_ext/string.rb +9 -0
- data/lib/deltacloud/drivers/aruba/aruba_driver.rb +0 -9
- data/lib/deltacloud/drivers/base_driver.rb +22 -4
- data/lib/deltacloud/drivers/ec2/ec2_driver.rb +0 -4
- data/lib/deltacloud/drivers/exceptions.rb +30 -13
- data/lib/deltacloud/drivers/features.rb +7 -0
- data/lib/deltacloud/drivers/fgcp/fgcp_driver.rb +1 -9
- data/lib/deltacloud/drivers/google/google_driver.rb +13 -0
- data/lib/deltacloud/drivers/mock/data/addresses/192.168.0.1.yml +3 -0
- data/lib/deltacloud/drivers/mock/data/addresses/192.168.0.2.yml +3 -0
- data/lib/deltacloud/drivers/mock/data/addresses/192.168.0.3.yml +3 -0
- data/lib/deltacloud/drivers/mock/data/addresses/192.168.0.4.yml +3 -0
- data/lib/deltacloud/drivers/mock/mock_driver.rb +65 -1
- data/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb +55 -32
- data/lib/deltacloud/drivers/openstack/openstack_driver.rb +18 -6
- data/lib/deltacloud/helpers.rb +0 -75
- data/lib/deltacloud/helpers/deltacloud_helper.rb +66 -28
- data/lib/deltacloud/helpers/driver_helper.rb +7 -0
- data/lib/deltacloud/helpers/rabbit_helper.rb +51 -0
- data/lib/deltacloud/server.rb +12 -14
- data/lib/deltacloud/version.rb +1 -1
- data/lib/deltacloud_rack.rb +26 -2
- data/lib/ec2/query_parser.rb +18 -3
- data/lib/sinatra/rack_accept.rb +7 -2
- data/lib/sinatra/rack_matrix_params.rb +14 -14
- data/public/javascripts/cmwgapp.js +2 -2
- data/tests/cimi/collections/cloud_entry_point_test.rb +3 -3
- data/tests/cimi/collections/machine_images_test.rb +2 -2
- data/tests/cimi/collections/machines_test.rb +1 -1
- data/tests/cimi/collections/url_helper_test.rb +31 -0
- data/tests/cimi/spec/cimi/model/{machine_admin_spec.rb → credential_spec.rb} +4 -4
- data/tests/deltacloud/base_collection_test.rb +0 -5
- data/tests/deltacloud/collections/buckets_collection_test.rb +1 -1
- data/tests/deltacloud/collections/drivers_collection_test.rb +1 -1
- data/tests/deltacloud/collections/hardware_profiles_collection_test.rb +1 -1
- data/tests/deltacloud/collections/images_collection_test.rb +1 -1
- data/tests/deltacloud/collections/instance_states_collection_test.rb +1 -1
- data/tests/deltacloud/collections/instances_collection_test.rb +1 -1
- data/tests/deltacloud/collections/keys_collection_test.rb +1 -4
- data/tests/deltacloud/deltacloud_helper_test.rb +0 -9
- data/tests/deltacloud/server_test.rb +1 -1
- data/tests/drivers/base/base_driver_test.rb +30 -0
- data/tests/drivers/base/common.rb +14 -0
- data/tests/drivers/base/exceptions_test.rb +64 -0
- data/tests/drivers/ec2/buckets_test.rb +45 -0
- data/tests/drivers/ec2/keys_test.rb +1 -1
- data/tests/drivers/google/buckets_test.rb +2 -2
- data/tests/drivers/google/common.rb +3 -3
- data/tests/test_helper.rb +28 -0
- data/views/api/show.html.haml +2 -2
- data/views/api/show.xml.haml +1 -1
- data/views/buckets/index.html.haml +1 -1
- data/views/cimi/cloudEntryPoint/index.xml.haml +1 -1
- data/views/cimi/collection/index.html.haml +3 -3
- data/views/cimi/collection/response.xml.haml +1 -1
- data/views/cimi/error.html.haml +1 -1
- data/views/cimi/errors/500.xml.haml +1 -1
- data/views/cimi/layout.html.haml +1 -1
- data/views/cimi/machine_configurations/show.html.haml +2 -2
- data/views/cimi/machine_configurations/show.xml.haml +1 -1
- data/views/cimi/machine_images/show.html.haml +2 -2
- data/views/cimi/machine_images/show.xml.haml +1 -1
- data/views/cimi/machines/show.html.haml +2 -2
- data/views/cimi/machines/show.xml.haml +1 -1
- data/views/cimi/volumes/show.html.haml +2 -2
- data/views/cimi/volumes/show.xml.haml +1 -1
- data/views/docs/collection.html.haml +1 -1
- data/views/docs/collection.xml.haml +2 -2
- data/views/docs/index.html.haml +1 -1
- data/views/docs/index.xml.haml +1 -1
- data/views/docs/operation.xml.haml +1 -1
- data/views/error.html.haml +1 -1
- data/views/errors/500.html.haml +7 -4
- data/views/firewalls/index.html.haml +1 -1
- data/views/firewalls/show.html.haml +1 -1
- data/views/images/show.html.haml +2 -2
- data/views/index.html.haml +9 -0
- data/views/instance_states/show.html.haml +1 -1
- data/views/instances/run_command.html.haml +1 -1
- data/views/instances/show.html.haml +2 -2
- data/views/keys/index.html.haml +1 -1
- data/views/layout.html.haml +1 -1
- data/views/load_balancers/index.html.haml +1 -1
- data/views/load_balancers/show.html.haml +3 -3
- data/views/storage_snapshots/show.html.haml +1 -1
- data/views/storage_volumes/attach.html.haml +1 -1
- data/views/storage_volumes/index.html.haml +1 -1
- data/views/storage_volumes/show.html.haml +4 -4
- metadata +40 -43
- data/lib/cimi/models/address_collection.rb +0 -34
- data/lib/cimi/models/address_template_collection.rb +0 -34
- data/lib/cimi/models/entity_metadata_collection.rb +0 -31
- data/lib/cimi/models/machine_admin_collection.rb +0 -34
- data/lib/cimi/models/machine_collection.rb +0 -37
- data/lib/cimi/models/machine_configuration_collection.rb +0 -36
- data/lib/cimi/models/machine_image_collection.rb +0 -36
- data/lib/cimi/models/machine_template_collection.rb +0 -36
- data/lib/cimi/models/routing_group_collection.rb +0 -34
- data/lib/cimi/models/routing_group_template_collection.rb +0 -35
- data/lib/cimi/models/volume_collection.rb +0 -36
- data/lib/cimi/models/volume_configuration_collection.rb +0 -36
- data/lib/cimi/models/volume_image_collection.rb +0 -36
- data/lib/cimi/models/volume_template_collection.rb +0 -36
- data/lib/cimi/models/vsp_collection.rb +0 -34
- data/lib/cimi/models/vsp_configuration_collection.rb +0 -34
- data/lib/cimi/models/vsp_template_collection.rb +0 -34
- data/lib/deltacloud/helpers/url_helper.rb +0 -115
@@ -16,7 +16,7 @@
|
|
16
16
|
module CIMI::Collections
|
17
17
|
class MachineConfigurations < Base
|
18
18
|
|
19
|
-
|
19
|
+
set :capability => lambda { |m| driver.respond_to? m }
|
20
20
|
|
21
21
|
collection :machine_configurations do
|
22
22
|
description 'List all machine configurations'
|
@@ -25,7 +25,7 @@ module CIMI::Collections
|
|
25
25
|
param :CIMISelect, :string, :optional
|
26
26
|
description "List all machine configurations"
|
27
27
|
control do
|
28
|
-
machine_configs =
|
28
|
+
machine_configs = MachineConfiguration.list(self).filter_by(params[:CIMISelect])
|
29
29
|
respond_to do |format|
|
30
30
|
format.xml { machine_configs.to_xml }
|
31
31
|
format.json { machine_configs.to_json }
|
@@ -25,7 +25,7 @@ module CIMI::Collections
|
|
25
25
|
description "List all machine configurations"
|
26
26
|
param :CIMISelect, :string, :optional
|
27
27
|
control do
|
28
|
-
machine_images =
|
28
|
+
machine_images = MachineImage.list(self).filter_by(params[:CIMISelect])
|
29
29
|
respond_to do |format|
|
30
30
|
format.xml { machine_images.to_xml }
|
31
31
|
format.json { machine_images.to_json }
|
@@ -25,7 +25,7 @@ module CIMI::Collections
|
|
25
25
|
param :CIMISelect, :string, :optional
|
26
26
|
description "List all machines"
|
27
27
|
control do
|
28
|
-
machines =
|
28
|
+
machines = Machine.list(self).filter_by(params[:CIMISelect])
|
29
29
|
respond_to do |format|
|
30
30
|
format.xml { machines.to_xml }
|
31
31
|
format.json { machines.to_json }
|
@@ -62,7 +62,6 @@ module CIMI::Collections
|
|
62
62
|
|
63
63
|
operation :destroy, :with_capability => :destroy_instance do
|
64
64
|
description "Delete a specified machine."
|
65
|
-
param :id, :string, :required
|
66
65
|
control do
|
67
66
|
Machine.delete!(params[:id], self)
|
68
67
|
no_content_with_status(200)
|
@@ -71,6 +70,7 @@ module CIMI::Collections
|
|
71
70
|
|
72
71
|
action :stop, :with_capability => :stop_instance do
|
73
72
|
description "Stop specific machine."
|
73
|
+
param :id, :string, :required
|
74
74
|
control do
|
75
75
|
machine = Machine.find(params[:id], self)
|
76
76
|
if request.content_type.end_with?("+json")
|
@@ -87,6 +87,7 @@ module CIMI::Collections
|
|
87
87
|
|
88
88
|
action :restart, :with_capability => :restart_instance do
|
89
89
|
description "Start specific machine."
|
90
|
+
param :id, :string, :required
|
90
91
|
control do
|
91
92
|
machine = Machine.find(params[:id], self)
|
92
93
|
if request.content_type.end_with?("+json")
|
@@ -103,6 +104,7 @@ module CIMI::Collections
|
|
103
104
|
|
104
105
|
action :start, :with_capability => :start_instance do
|
105
106
|
description "Start specific machine."
|
107
|
+
param :id, :string, :required
|
106
108
|
control do
|
107
109
|
machine = Machine.find(params[:id], self)
|
108
110
|
if request.content_type.end_with?("+json")
|
@@ -119,6 +121,7 @@ module CIMI::Collections
|
|
119
121
|
|
120
122
|
operation :disks, :with_capability => :hardware_profiles do
|
121
123
|
description "Retrieve the Machine's DiskCollection"
|
124
|
+
param :id, :string, :required
|
122
125
|
control do
|
123
126
|
disks = DiskCollection.default(params[:id], self)
|
124
127
|
respond_to do |format|
|
@@ -130,6 +133,7 @@ module CIMI::Collections
|
|
130
133
|
|
131
134
|
operation :volumes, :with_capability => :storage_volumes do
|
132
135
|
description "Retrieve the Machine's MachineVolumeCollection"
|
136
|
+
param :id, :string, :required
|
133
137
|
control do
|
134
138
|
volumes = MachineVolumeCollection.default(params[:id], self)
|
135
139
|
respond_to do |format|
|
@@ -144,6 +148,7 @@ module CIMI::Collections
|
|
144
148
|
#with inclusion/ommission of the volumes you want [att|det]ached
|
145
149
|
action :attach_volume, :http_method => :put, :with_capability => :attach_storage_volume do
|
146
150
|
description "Attach CIMI Volume(s) to a machine."
|
151
|
+
param :id, :string, :required
|
147
152
|
control do
|
148
153
|
if request.content_type.end_with?("+json")
|
149
154
|
volumes_to_attach = Volume.find_to_attach_from_json(request.body.read, self)
|
@@ -160,6 +165,7 @@ module CIMI::Collections
|
|
160
165
|
|
161
166
|
action :detach_volume, :http_method => :put, :with_capability => :detach_storage_volume do
|
162
167
|
description "Detach CIMI Volume(s) from a machine."
|
168
|
+
param :id, :string, :required
|
163
169
|
control do
|
164
170
|
if request.content_type.end_with?("+json")
|
165
171
|
volumes_to_detach = Volume.find_to_attach_from_json(request.body.read, self)
|
@@ -24,7 +24,7 @@ module CIMI::Collections
|
|
24
24
|
description 'List all NetworkConfigurations'
|
25
25
|
param :CIMISelect, :string, :optional
|
26
26
|
control do
|
27
|
-
network_configurations =
|
27
|
+
network_configurations = NetworkConfiguration.list(self).filter_by(params[:CIMISelect])
|
28
28
|
respond_to do |format|
|
29
29
|
format.xml { network_configurations.to_xml }
|
30
30
|
format.json { network_configurations.to_json }
|
@@ -32,7 +32,7 @@ module CIMI::Collections
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
operation :show, :with_capability => :
|
35
|
+
operation :show, :with_capability => :network_configurations do
|
36
36
|
description 'Show a specific NetworkConfiguration'
|
37
37
|
control do
|
38
38
|
network_config = NetworkConfiguration.find(params[:id], self)
|
@@ -14,31 +14,31 @@
|
|
14
14
|
# under the License.
|
15
15
|
|
16
16
|
module CIMI::Collections
|
17
|
-
class
|
17
|
+
class NetworkPortConfigurations < Base
|
18
18
|
|
19
19
|
set :capability, lambda { |m| driver.respond_to? m }
|
20
20
|
|
21
|
-
collection :
|
21
|
+
collection :network_port_configurations do
|
22
22
|
|
23
|
-
operation :index, :with_capability => :
|
24
|
-
description 'List all
|
23
|
+
operation :index, :with_capability => :network_port_configurations do
|
24
|
+
description 'List all NetworkPortConfigurations in the NetworkPortConfigurationCollection'
|
25
25
|
param :CIMISelect, :string, :optional
|
26
26
|
control do
|
27
|
-
|
27
|
+
net_port_configs = NetworkPortConfiguration.list(self).filter_by(params[:CIMISelect])
|
28
28
|
respond_to do |format|
|
29
|
-
format.xml {
|
30
|
-
format.json {
|
29
|
+
format.xml {net_port_configs.to_xml}
|
30
|
+
format.json {net_port_configs.to_json}
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
operation :show, :with_capability => :
|
36
|
-
description 'Show a specific
|
35
|
+
operation :show, :with_capability => :network_port_configurations do
|
36
|
+
description 'Show a specific NetworkPortConfiguration'
|
37
37
|
control do
|
38
|
-
|
38
|
+
net_port_config = NetworkPortConfiguration.find(params[:id], self)
|
39
39
|
respond_to do |format|
|
40
|
-
format.xml {
|
41
|
-
format.json {
|
40
|
+
format.xml {net_port_config.to_xml}
|
41
|
+
format.json {net_port_config.to_json}
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
@@ -14,34 +14,37 @@
|
|
14
14
|
# under the License.
|
15
15
|
|
16
16
|
module CIMI::Collections
|
17
|
-
class
|
17
|
+
class NetworkPortTemplates < Base
|
18
18
|
|
19
19
|
set :capability, lambda { |m| driver.respond_to? m }
|
20
20
|
|
21
|
-
collection :
|
21
|
+
collection :network_port_templates do
|
22
22
|
|
23
|
-
|
24
|
-
|
23
|
+
description 'The NetworkPort Template is a set of Configuration values for realizing a NetworkPort. A NetworkPort Template may be used to create multiple NetworkPorts'
|
24
|
+
|
25
|
+
operation :index, :with_capability => :network_port_templates do
|
26
|
+
description 'List all NetworkPortTemplates in the NetworkPortTemplateCollection'
|
25
27
|
param :CIMISelect, :string, :optional
|
26
28
|
control do
|
27
|
-
|
29
|
+
network_port_templates = NetworkPortTemplate.list(self).filter_by(params[:CIMISelect])
|
28
30
|
respond_to do |format|
|
29
|
-
format.xml {
|
30
|
-
format.json {
|
31
|
+
format.xml {network_port_templates.to_xml}
|
32
|
+
format.json {network_port_templates.to_json}
|
31
33
|
end
|
32
34
|
end
|
33
35
|
end
|
34
36
|
|
35
|
-
operation :show, :with_capability => :
|
36
|
-
description 'Show a specific
|
37
|
+
operation :show, :with_capability => :network_port_templates do
|
38
|
+
description 'Show a specific NetworkPortTemplate'
|
37
39
|
control do
|
38
|
-
|
40
|
+
network_port_template = NetworkPortTemplate.find(params[:id], self)
|
39
41
|
respond_to do |format|
|
40
|
-
format.xml {
|
41
|
-
format.json {
|
42
|
+
format.xml {network_port_template.to_xml}
|
43
|
+
format.json {network_port_template.to_json}
|
42
44
|
end
|
43
45
|
end
|
44
46
|
end
|
47
|
+
|
45
48
|
end
|
46
49
|
|
47
50
|
end
|
@@ -14,89 +14,90 @@
|
|
14
14
|
# under the License.
|
15
15
|
|
16
16
|
module CIMI::Collections
|
17
|
-
class
|
17
|
+
class NetworkPorts < Base
|
18
18
|
|
19
19
|
set :capability, lambda { |m| driver.respond_to? m }
|
20
20
|
|
21
|
-
collection :
|
21
|
+
collection :network_ports do
|
22
22
|
|
23
|
-
description 'A
|
23
|
+
description 'A NetworkPort is a realized connection point between a Network and a resource - such as a Machine.'
|
24
24
|
|
25
|
-
operation :index, :with_capability => :
|
26
|
-
description 'List all
|
25
|
+
operation :index, :with_capability => :network_ports do
|
26
|
+
description 'List all NetworkPorts in the NetworkPortCollection'
|
27
27
|
param :CIMISelect, :string, :optional
|
28
28
|
control do
|
29
|
-
|
29
|
+
network_ports = NetworkPort.list(self).filter_by(params[:CIMISelect])
|
30
30
|
respond_to do |format|
|
31
|
-
format.xml {
|
32
|
-
format.json {
|
31
|
+
format.xml {network_ports.to_xml}
|
32
|
+
format.json {network_ports.to_json}
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
operation :show, :with_capability => :
|
38
|
-
description 'Show a specific
|
37
|
+
operation :show, :with_capability => :network_ports do
|
38
|
+
description 'Show a specific NetworkPort'
|
39
39
|
control do
|
40
|
-
|
40
|
+
network_port = NetworkPort.find(params[:id], self)
|
41
41
|
respond_to do |format|
|
42
|
-
format.xml {
|
43
|
-
format.json {
|
42
|
+
format.xml {network_port.to_xml}
|
43
|
+
format.json {network_port.to_json}
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
operation :create, :with_capability => :
|
49
|
-
description "Create a new
|
48
|
+
operation :create, :with_capability => :create_network_port do
|
49
|
+
description "Create a new NetworkPort"
|
50
50
|
control do
|
51
51
|
if request.content_type.end_with?("json")
|
52
|
-
|
52
|
+
network_port = CIMI::Model::NetworkPort.create(request.body.read, self, :json)
|
53
53
|
else
|
54
|
-
|
54
|
+
network_port = CIMI::Model::NetworkPort.create(request.body.read, self, :xml)
|
55
55
|
end
|
56
56
|
respond_to do |format|
|
57
|
-
format.xml {
|
58
|
-
format.json {
|
57
|
+
format.xml { network_port.to_xml }
|
58
|
+
format.json { network_port.to_json }
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
operation :destroy, :with_capability => :
|
64
|
-
description "Delete a specified
|
63
|
+
operation :destroy, :with_capability => :delete_network_port do
|
64
|
+
description "Delete a specified NetworkPort"
|
65
65
|
control do
|
66
|
-
CIMI::Model::
|
66
|
+
CIMI::Model::NetworkPort.delete!(params[:id], self)
|
67
67
|
no_content_with_status(200)
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
-
action :start, :with_capability => :
|
72
|
-
description "Start specific
|
71
|
+
action :start, :with_capability => :start_network_port do
|
72
|
+
description "Start specific NetworkPort."
|
73
73
|
param :id, :string, :required
|
74
74
|
control do
|
75
|
-
|
76
|
-
report_error(404) unless
|
75
|
+
network_port = NetworkPort.find(params[:id], self)
|
76
|
+
report_error(404) unless network_port
|
77
77
|
if request.content_type.end_with?("json")
|
78
78
|
action = Action.from_json(request.body.read)
|
79
79
|
else
|
80
80
|
action = Action.from_xml(request.body.read)
|
81
81
|
end
|
82
|
-
|
82
|
+
network_port.perform(action, self) do |operation|
|
83
83
|
no_content_with_status(202) if operation.success?
|
84
84
|
# Handle errors using operation.failure?
|
85
85
|
end
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
|
-
action :stop, :with_capability => :
|
90
|
-
description "Stop specific
|
89
|
+
action :stop, :with_capability => :stop_network_port do
|
90
|
+
description "Stop specific NetworkPort."
|
91
|
+
param :id, :string, :required
|
91
92
|
control do
|
92
|
-
|
93
|
-
report_error(404) unless
|
93
|
+
network_port = NetworkPort.find(params[:id], self)
|
94
|
+
report_error(404) unless network_port
|
94
95
|
if request.content_type.end_with?("json")
|
95
96
|
action = Action.from_json(request.body.read)
|
96
97
|
else
|
97
98
|
action = Action.from_xml(request.body.read)
|
98
99
|
end
|
99
|
-
|
100
|
+
network_port.perform(action, self) do |operation|
|
100
101
|
no_content_with_status(202) if operation.success?
|
101
102
|
# Handle errors using operation.failure?
|
102
103
|
end
|
@@ -24,7 +24,7 @@ module CIMI::Collections
|
|
24
24
|
description 'List all Network Templates in the NetworkTemplateCollection'
|
25
25
|
param :CIMISelect, :string, :optional
|
26
26
|
control do
|
27
|
-
network_templates =
|
27
|
+
network_templates = NetworkTemplate.list(self).filter_by(params[:CIMISelect])
|
28
28
|
respond_to do |format|
|
29
29
|
format.xml {network_templates.to_xml}
|
30
30
|
format.json {network_templates.to_json}
|
@@ -32,7 +32,7 @@ module CIMI::Collections
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
operation :show, :with_capability => :
|
35
|
+
operation :show, :with_capability => :network_templates do
|
36
36
|
description 'Show a specific Network Template'
|
37
37
|
control do
|
38
38
|
network_template = NetworkTemplate.find(params[:id], self)
|
@@ -25,7 +25,7 @@ module CIMI::Collections
|
|
25
25
|
description "List all Networks"
|
26
26
|
param :CIMISelect, :string, :optional
|
27
27
|
control do
|
28
|
-
networks =
|
28
|
+
networks = Network.list(self).filter_by(params[:CIMISelect])
|
29
29
|
respond_to do |format|
|
30
30
|
format.xml { networks.to_xml }
|
31
31
|
format.json { networks.to_json }
|
@@ -61,7 +61,6 @@ module CIMI::Collections
|
|
61
61
|
|
62
62
|
operation :destroy, :with_capability => :delete_network do
|
63
63
|
description "Delete a specified Network"
|
64
|
-
param :id, :string, :required
|
65
64
|
control do
|
66
65
|
Network.delete!(params[:id], self)
|
67
66
|
no_content_with_status(200)
|
@@ -70,6 +69,7 @@ module CIMI::Collections
|
|
70
69
|
|
71
70
|
action :start, :with_capability => :start_network do
|
72
71
|
description "Start specific network."
|
72
|
+
param :id, :string, :required
|
73
73
|
control do
|
74
74
|
network = Network.find(params[:id], self)
|
75
75
|
report_error(404) unless network
|
@@ -87,6 +87,7 @@ module CIMI::Collections
|
|
87
87
|
|
88
88
|
action :stop, :with_capability => :stop_network do
|
89
89
|
description "Stop specific network."
|
90
|
+
param :id, :string, :required
|
90
91
|
control do
|
91
92
|
network = Network.find(params[:id], self)
|
92
93
|
report_error(404) unless network
|
@@ -104,6 +105,7 @@ module CIMI::Collections
|
|
104
105
|
|
105
106
|
action :suspend, :with_capability => :suspend_network do
|
106
107
|
description "Suspend specific network."
|
108
|
+
param :id, :string, :required
|
107
109
|
control do
|
108
110
|
network = Network.find(params[:id], self)
|
109
111
|
report_error(404) unless network
|
@@ -119,6 +121,19 @@ module CIMI::Collections
|
|
119
121
|
end
|
120
122
|
end
|
121
123
|
|
124
|
+
operation :network_ports, :with_capability => :network_ports do
|
125
|
+
description "Retrieve the Network's NetworkPortCollection"
|
126
|
+
param :id, :string, :required
|
127
|
+
control do
|
128
|
+
network_ports = NetworkPortCollection.for_network(params[:id], self)
|
129
|
+
respond_to do |format|
|
130
|
+
format.json {network_ports.to_json}
|
131
|
+
format.xml {network_ports.to_xml}
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
|
122
137
|
end
|
123
138
|
|
124
139
|
end
|
@@ -14,28 +14,28 @@
|
|
14
14
|
# under the License.
|
15
15
|
|
16
16
|
module CIMI::Collections
|
17
|
-
class
|
17
|
+
class ResourceMetadata < Base
|
18
18
|
|
19
|
-
collection :
|
19
|
+
collection :resource_metadata do
|
20
20
|
|
21
21
|
operation :index do
|
22
|
-
description "List all
|
22
|
+
description "List all resource metadata defined for this provider"
|
23
23
|
control do
|
24
|
-
|
24
|
+
resource_metadata = CIMI::Model::ResourceMetadata.list(self)
|
25
25
|
respond_to do |format|
|
26
|
-
format.xml{
|
27
|
-
format.json{
|
26
|
+
format.xml{resource_metadata.to_xml}
|
27
|
+
format.json{resource_metadata.to_json}
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
operation :show do
|
33
|
-
description "Get the
|
33
|
+
description "Get the resource metadata for a specific collection"
|
34
34
|
control do
|
35
|
-
|
35
|
+
resource_metadata = ResourceMetadata.find(params[:id], self)
|
36
36
|
respond_to do |format|
|
37
|
-
format.xml{
|
38
|
-
format.json{
|
37
|
+
format.xml{resource_metadata.to_xml}
|
38
|
+
format.json{resource_metadata.to_json}
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|