deltacloud-core 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/deltacloud-core.gemspec +4 -7
- data/lib/cimi/collections/address_templates.rb +4 -42
- data/lib/cimi/collections/addresses.rb +5 -43
- data/lib/cimi/collections/base.rb +11 -3
- data/lib/cimi/collections/cloud_entry_point.rb +1 -1
- data/lib/cimi/collections/credentials.rb +4 -43
- data/lib/cimi/collections/forwarding_group_templates.rb +2 -20
- data/lib/cimi/collections/forwarding_groups.rb +2 -21
- data/lib/cimi/collections/machine_configurations.rb +2 -20
- data/lib/cimi/collections/machine_images.rb +4 -42
- data/lib/cimi/collections/machine_templates.rb +4 -42
- data/lib/cimi/collections/machines.rb +14 -64
- data/lib/cimi/collections/network_configurations.rb +2 -20
- data/lib/cimi/collections/network_port_configurations.rb +2 -21
- data/lib/cimi/collections/network_port_templates.rb +2 -23
- data/lib/cimi/collections/network_ports.rb +6 -46
- data/lib/cimi/collections/network_templates.rb +2 -21
- data/lib/cimi/collections/networks.rb +4 -40
- data/lib/cimi/collections/resource_metadata.rb +2 -21
- data/lib/cimi/collections/system_templates.rb +4 -45
- data/lib/cimi/collections/systems.rb +65 -82
- data/lib/cimi/collections/volume_configurations.rb +4 -45
- data/lib/cimi/collections/volume_images.rb +4 -42
- data/lib/cimi/collections/volume_templates.rb +5 -44
- data/lib/cimi/collections/volumes.rb +4 -48
- data/lib/cimi/helpers.rb +1 -0
- data/lib/cimi/helpers/cimi_helper.rb +1 -1
- data/lib/cimi/helpers/cimi_rabbit_helper.rb +113 -0
- data/lib/cimi/helpers/database_helper.rb +1 -2
- data/lib/cimi/models.rb +12 -11
- data/lib/cimi/models/action.rb +0 -4
- data/lib/cimi/models/address.rb +0 -38
- data/lib/cimi/models/address_create.rb +0 -31
- data/lib/cimi/models/address_template.rb +0 -47
- data/lib/cimi/models/address_template_create.rb +0 -16
- data/lib/cimi/models/base.rb +2 -74
- data/lib/cimi/models/cloud_entry_point.rb +2 -30
- data/lib/cimi/models/collection.rb +8 -25
- data/lib/cimi/models/credential.rb +0 -34
- data/lib/cimi/models/credential_create.rb +0 -26
- data/lib/cimi/models/credential_template.rb +0 -2
- data/lib/cimi/models/disk.rb +0 -56
- data/lib/cimi/models/forwarding_group.rb +0 -8
- data/lib/cimi/models/forwarding_group_template.rb +0 -8
- data/lib/cimi/models/machine.rb +4 -129
- data/lib/cimi/models/machine_configuration.rb +0 -31
- data/lib/cimi/models/machine_create.rb +1 -29
- data/lib/cimi/models/machine_image.rb +0 -28
- data/lib/cimi/models/machine_image_create.rb +0 -19
- data/lib/cimi/models/machine_template.rb +5 -39
- data/lib/cimi/models/machine_template_create.rb +0 -12
- data/lib/cimi/models/machine_volume.rb +0 -65
- data/lib/cimi/models/network.rb +0 -32
- data/lib/cimi/models/network_configuration.rb +0 -15
- data/lib/cimi/models/network_create.rb +0 -23
- data/lib/cimi/models/network_port.rb +0 -73
- data/lib/cimi/models/network_port_configuration.rb +0 -8
- data/lib/cimi/models/network_port_template.rb +0 -8
- data/lib/cimi/models/network_template.rb +2 -12
- data/lib/cimi/models/resource.rb +0 -6
- data/lib/cimi/models/resource_metadata.rb +1 -95
- data/lib/cimi/models/schema.rb +28 -32
- data/lib/cimi/models/system.rb +15 -39
- data/lib/cimi/models/system_address.rb +26 -0
- data/lib/cimi/models/system_create.rb +20 -0
- data/lib/cimi/models/system_credential.rb +26 -0
- data/lib/cimi/models/system_forwarding_group.rb +26 -0
- data/lib/cimi/models/system_machine.rb +26 -0
- data/lib/cimi/models/system_network.rb +26 -0
- data/lib/cimi/models/system_network_port.rb +26 -0
- data/lib/cimi/models/system_system.rb +26 -0
- data/lib/cimi/models/system_template.rb +15 -31
- data/lib/cimi/models/system_volume.rb +26 -0
- data/lib/cimi/models/volume.rb +0 -59
- data/lib/cimi/models/volume_configuration.rb +1 -64
- data/lib/cimi/models/volume_configuration_create.rb +22 -0
- data/lib/cimi/models/volume_create.rb +0 -38
- data/lib/cimi/models/volume_image.rb +0 -30
- data/lib/cimi/models/volume_image_create.rb +0 -25
- data/lib/cimi/models/volume_template.rb +2 -43
- data/lib/cimi/models/volume_template_create.rb +0 -12
- data/lib/cimi/service.rb +82 -0
- data/lib/cimi/service/action.rb +21 -0
- data/lib/cimi/service/address.rb +56 -0
- data/lib/cimi/service/address_create.rb +45 -0
- data/lib/cimi/service/address_template.rb +71 -0
- data/lib/cimi/service/address_template_create.rb +34 -0
- data/lib/cimi/service/base.rb +266 -0
- data/lib/cimi/service/cloud_entry_point.rb +53 -0
- data/lib/cimi/service/credential.rb +52 -0
- data/lib/cimi/service/credential_create.rb +38 -0
- data/lib/cimi/service/credential_template.rb +20 -0
- data/lib/cimi/service/disk.rb +75 -0
- data/lib/cimi/service/forwarding_group.rb +26 -0
- data/lib/cimi/service/forwarding_group_template.rb +26 -0
- data/lib/cimi/service/machine.rb +154 -0
- data/lib/cimi/service/machine_configuration.rb +54 -0
- data/lib/cimi/service/machine_create.rb +49 -0
- data/lib/cimi/service/machine_image.rb +47 -0
- data/lib/cimi/service/machine_image_create.rb +35 -0
- data/lib/cimi/service/machine_template.rb +61 -0
- data/lib/cimi/service/machine_template_create.rb +29 -0
- data/lib/cimi/service/machine_volume.rb +74 -0
- data/lib/cimi/service/network.rb +51 -0
- data/lib/cimi/service/network_configuration.rb +36 -0
- data/lib/cimi/service/network_create.rb +39 -0
- data/lib/cimi/service/network_port.rb +97 -0
- data/lib/cimi/service/network_port_configuration.rb +26 -0
- data/lib/cimi/service/network_port_template.rb +26 -0
- data/lib/cimi/service/network_template.rb +28 -0
- data/lib/cimi/service/resource_metadata.rb +44 -0
- data/lib/cimi/service/system.rb +45 -0
- data/lib/cimi/service/system_address.rb +34 -0
- data/lib/cimi/service/system_create.rb +39 -0
- data/lib/cimi/service/system_credential.rb +34 -0
- data/lib/cimi/service/system_forwarding_group.rb +34 -0
- data/lib/cimi/service/system_machine.rb +34 -0
- data/lib/cimi/service/system_network.rb +34 -0
- data/lib/cimi/service/system_network_port.rb +34 -0
- data/lib/cimi/service/system_system.rb +34 -0
- data/lib/cimi/service/system_template.rb +32 -0
- data/lib/cimi/service/system_volume.rb +34 -0
- data/lib/cimi/service/volume.rb +81 -0
- data/lib/cimi/service/volume_configuration.rb +92 -0
- data/lib/cimi/service/volume_configuration_create.rb +29 -0
- data/lib/cimi/service/volume_create.rb +47 -0
- data/lib/cimi/service/volume_image.rb +44 -0
- data/lib/cimi/service/volume_image_create.rb +42 -0
- data/lib/cimi/service/volume_template.rb +61 -0
- data/lib/cimi/service/volume_template_create.rb +29 -0
- data/lib/db/entity.rb +16 -1
- data/lib/deltacloud/collections/addresses.rb +2 -2
- data/lib/deltacloud/collections/buckets.rb +16 -18
- data/lib/deltacloud/collections/drivers.rb +4 -4
- data/lib/deltacloud/collections/firewalls.rb +5 -5
- data/lib/deltacloud/collections/images.rb +3 -3
- data/lib/deltacloud/collections/instance_states.rb +4 -4
- data/lib/deltacloud/collections/instances.rb +22 -13
- data/lib/deltacloud/collections/keys.rb +2 -2
- data/lib/deltacloud/collections/load_balancers.rb +16 -13
- data/lib/deltacloud/collections/storage_snapshots.rb +3 -3
- data/lib/deltacloud/collections/storage_volumes.rb +5 -5
- data/lib/deltacloud/core_ext/ordered_hash.rb +0 -4
- data/lib/deltacloud/drivers/fgcp/fgcp_client.rb +8 -0
- data/lib/deltacloud/drivers/fgcp/fgcp_driver.rb +4 -3
- data/lib/deltacloud/drivers/fgcp/fgcp_driver_cimi_methods.rb +266 -19
- data/lib/deltacloud/drivers/google/google_driver.rb +6 -0
- data/lib/deltacloud/drivers/mock/mock_driver.rb +2 -2
- data/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb +166 -54
- data/lib/deltacloud/drivers/rhevm/rhevm_driver.rb +2 -0
- data/lib/deltacloud/helpers/blob_stream_helper.rb +0 -2
- data/lib/deltacloud/helpers/deltacloud_helper.rb +22 -22
- data/lib/deltacloud/helpers/driver_helper.rb +4 -7
- data/lib/deltacloud/helpers/rabbit_helper.rb +5 -0
- data/lib/deltacloud/server.rb +4 -4
- data/lib/deltacloud/version.rb +1 -1
- data/lib/deltacloud_rack.rb +6 -1
- data/lib/ec2/server.rb +6 -1
- data/tests/cimi/collections/common.rb +33 -0
- data/tests/cimi/collections/machines_test.rb +19 -0
- data/tests/cimi/collections/system_templates_test.rb +47 -0
- data/tests/cimi/collections/volumes_test.rb +42 -0
- data/tests/cimi/db/database_helper_test.rb +7 -4
- data/tests/deltacloud/drivers_test.rb +1 -1
- data/tests/drivers/ec2/common.rb +4 -1
- data/tests/drivers/fgcp/common.rb +1 -2
- data/tests/drivers/gogrid/common.rb +1 -2
- data/tests/drivers/google/common.rb +1 -1
- data/tests/drivers/models/address_test.rb +2 -2
- data/tests/drivers/models/base_test.rb +2 -2
- data/tests/drivers/models/blob_test.rb +2 -2
- data/tests/drivers/models/instance_address_test.rb +8 -8
- data/tests/drivers/models/instance_profile_test.rb +2 -2
- data/tests/drivers/models/keys_test.rb +4 -4
- data/tests/drivers/models/metrics_test.rb +3 -3
- data/tests/drivers/openstack/common.rb +1 -2
- data/views/addresses/_address.html.haml +3 -3
- data/views/addresses/associate.html.haml +3 -3
- data/views/addresses/index.html.haml +2 -2
- data/views/addresses/index.xml.haml +2 -2
- data/views/addresses/show.html.haml +7 -7
- data/views/addresses/show.xml.haml +9 -9
- data/views/api/show.html.haml +2 -2
- data/views/api/show.xml.haml +1 -1
- data/views/blobs/new.html.haml +1 -1
- data/views/blobs/show.html.haml +8 -8
- data/views/blobs/show.xml.haml +7 -7
- data/views/buckets/index.html.haml +1 -1
- data/views/buckets/index.xml.haml +2 -2
- data/views/buckets/show.html.haml +7 -7
- data/views/buckets/show.xml.haml +6 -6
- data/views/drivers/index.html.haml +1 -1
- data/views/drivers/index.xml.haml +1 -1
- data/views/drivers/show.html.haml +6 -6
- data/views/drivers/show.xml.haml +5 -5
- data/views/error.html.haml +2 -2
- data/views/errors/backend_capability_failure.xml.haml +3 -3
- data/views/errors/common.html.haml +7 -7
- data/views/errors/common.xml.haml +5 -5
- data/views/firewalls/index.html.haml +1 -1
- data/views/firewalls/index.xml.haml +1 -1
- data/views/firewalls/new_rule.html.haml +1 -1
- data/views/firewalls/show.html.haml +8 -8
- data/views/firewalls/show.xml.haml +9 -9
- data/views/hardware_profiles/index.html.haml +1 -1
- data/views/hardware_profiles/index.xml.haml +2 -2
- data/views/hardware_profiles/show.html.haml +3 -3
- data/views/hardware_profiles/show.xml.haml +4 -4
- data/views/images/index.html.haml +1 -1
- data/views/images/index.xml.haml +2 -2
- data/views/images/new.html.haml +2 -2
- data/views/images/show.html.haml +14 -14
- data/views/images/show.xml.haml +14 -14
- data/views/instance_states/show.html.haml +1 -1
- data/views/instance_states/show.png.erb +2 -2
- data/views/instance_states/show.xml.haml +1 -1
- data/views/instances/index.html.haml +1 -1
- data/views/instances/index.xml.haml +2 -2
- data/views/instances/new.html.haml +22 -14
- data/views/instances/run.html.haml +2 -2
- data/views/instances/run.xml.haml +3 -3
- data/views/instances/run_command.html.haml +4 -4
- data/views/instances/show.html.haml +27 -27
- data/views/instances/show.xml.haml +37 -37
- data/views/keys/index.html.haml +1 -1
- data/views/keys/index.xml.haml +2 -2
- data/views/keys/show.html.haml +10 -10
- data/views/keys/show.xml.haml +12 -12
- data/views/load_balancers/index.html.haml +1 -1
- data/views/load_balancers/index.xml.haml +2 -2
- data/views/load_balancers/new.html.haml +1 -8
- data/views/load_balancers/show.html.haml +10 -10
- data/views/load_balancers/show.xml.haml +9 -9
- data/views/metrics/index.html.haml +1 -1
- data/views/metrics/index.xml.haml +2 -2
- data/views/metrics/show.html.haml +2 -2
- data/views/metrics/show.xml.haml +3 -3
- data/views/realms/index.html.haml +1 -1
- data/views/realms/index.xml.haml +2 -2
- data/views/realms/show.html.haml +6 -6
- data/views/realms/show.xml.haml +5 -5
- data/views/storage_snapshots/index.html.haml +1 -1
- data/views/storage_snapshots/index.xml.haml +2 -2
- data/views/storage_snapshots/show.html.haml +6 -6
- data/views/storage_snapshots/show.xml.haml +4 -4
- data/views/storage_volumes/attach.html.haml +2 -2
- data/views/storage_volumes/index.html.haml +1 -1
- data/views/storage_volumes/index.xml.haml +2 -2
- data/views/storage_volumes/show.html.haml +19 -19
- data/views/storage_volumes/show.xml.haml +21 -21
- metadata +77 -65
- data/views/cimi/cloudEntryPoint/index.html.haml +0 -5
- data/views/cimi/cloudEntryPoint/index.xml.haml +0 -9
- data/views/cimi/collection/index.html.haml +0 -45
- data/views/cimi/collection/response.xml.haml +0 -3
- data/views/cimi/error.html.haml +0 -31
- data/views/cimi/errors/400.xml.haml +0 -3
- data/views/cimi/errors/401.xml.haml +0 -2
- data/views/cimi/errors/403.xml.haml +0 -2
- data/views/cimi/errors/404.xml.haml +0 -2
- data/views/cimi/errors/405.xml.haml +0 -5
- data/views/cimi/errors/500.xml.haml +0 -6
- data/views/cimi/errors/502.xml.haml +0 -7
- data/views/cimi/layout.html.haml +0 -32
- data/views/cimi/machine_configurations/show.html.haml +0 -159
- data/views/cimi/machine_configurations/show.xml.haml +0 -27
- data/views/cimi/machine_images/show.html.haml +0 -79
- data/views/cimi/machine_images/show.xml.haml +0 -17
- data/views/cimi/machines/show.html.haml +0 -177
- data/views/cimi/machines/show.xml.haml +0 -28
- data/views/cimi/volumes/show.html.haml +0 -68
- data/views/cimi/volumes/show.xml.haml +0 -17
- data/views/docs/collection.html.haml +0 -26
- data/views/docs/collection.xml.haml +0 -14
- data/views/docs/index.html.haml +0 -11
- data/views/docs/index.xml.haml +0 -5
- data/views/docs/operation.html.haml +0 -33
- data/views/docs/operation.xml.haml +0 -10
- data/views/root/index.html.haml +0 -4
@@ -21,60 +21,18 @@ module CIMI::Collections
|
|
21
21
|
collection :machines do
|
22
22
|
description 'List all machine'
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
respond_to do |format|
|
29
|
-
format.xml { machines.to_xml }
|
30
|
-
format.json { machines.to_json }
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
operation :show, :with_capability => :instance do
|
36
|
-
description "Show specific machine."
|
37
|
-
control do
|
38
|
-
machine = Machine.find(params[:id], self)
|
39
|
-
respond_to do |format|
|
40
|
-
format.xml { machine.to_xml }
|
41
|
-
format.json { machine.to_json }
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
operation :create, :with_capability => :create_instance do
|
47
|
-
description "Create a new Machine entity."
|
48
|
-
control do
|
49
|
-
mc = MachineCreate.parse(request.body, request.content_type)
|
50
|
-
new_machine = mc.create(self)
|
51
|
-
headers_for_create new_machine
|
52
|
-
respond_to do |format|
|
53
|
-
format.json { new_machine.to_json }
|
54
|
-
format.xml { new_machine.to_xml }
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
operation :destroy, :with_capability => :destroy_instance do
|
60
|
-
description "Delete a specified machine."
|
61
|
-
control do
|
62
|
-
Machine.delete!(params[:id], self)
|
63
|
-
no_content_with_status(200)
|
64
|
-
end
|
65
|
-
end
|
24
|
+
generate_show_operation :with_capability => :instance
|
25
|
+
generate_index_operation :with_capability => :instances
|
26
|
+
generate_delete_operation :with_capability => :destroy_instance
|
27
|
+
generate_create_operation :with_capability => :create_instance
|
66
28
|
|
67
29
|
action :stop, :with_capability => :stop_instance do
|
68
30
|
description "Stop specific machine."
|
69
31
|
param :id, :string, :required
|
70
32
|
control do
|
71
33
|
machine = Machine.find(params[:id], self)
|
72
|
-
|
73
|
-
|
74
|
-
else
|
75
|
-
action = Action.from_xml(request.body.read)
|
76
|
-
end
|
77
|
-
machine.perform(action, self) do |operation|
|
34
|
+
action = Action.parse(self)
|
35
|
+
machine.perform(action) do |operation|
|
78
36
|
no_content_with_status(202) if operation.success?
|
79
37
|
# Handle errors using operation.failure?
|
80
38
|
end
|
@@ -86,12 +44,8 @@ module CIMI::Collections
|
|
86
44
|
param :id, :string, :required
|
87
45
|
control do
|
88
46
|
machine = Machine.find(params[:id], self)
|
89
|
-
|
90
|
-
|
91
|
-
else
|
92
|
-
action = Action.from_xml(request.body.read.gsub("restart", "reboot"))
|
93
|
-
end
|
94
|
-
machine.perform(action, self) do |operation|
|
47
|
+
action = Action.parse(self)
|
48
|
+
machine.perform(action) do |operation|
|
95
49
|
no_content_with_status(202) if operation.success?
|
96
50
|
# Handle errors using operation.failure?
|
97
51
|
end
|
@@ -103,12 +57,8 @@ module CIMI::Collections
|
|
103
57
|
param :id, :string, :required
|
104
58
|
control do
|
105
59
|
machine = Machine.find(params[:id], self)
|
106
|
-
|
107
|
-
|
108
|
-
else
|
109
|
-
action = Action.from_xml(request.body.read)
|
110
|
-
end
|
111
|
-
machine.perform(action, self) do |operation|
|
60
|
+
action = Action.parse(self)
|
61
|
+
machine.perform(action) do |operation|
|
112
62
|
no_content_with_status(202) if operation.success?
|
113
63
|
# Handle errors using operation.failure?
|
114
64
|
end
|
@@ -119,7 +69,7 @@ module CIMI::Collections
|
|
119
69
|
description "Retrieve the Machine's DiskCollection"
|
120
70
|
param :id, :string, :required
|
121
71
|
control do
|
122
|
-
disks =
|
72
|
+
disks = Disk.collection_for_instance(params[:id], self)
|
123
73
|
respond_to do |format|
|
124
74
|
format.json {disks.to_json}
|
125
75
|
format.xml {disks.to_xml}
|
@@ -133,7 +83,7 @@ module CIMI::Collections
|
|
133
83
|
operation :index, :with_capability => :storage_volumes do
|
134
84
|
description "Retrieve the Machine's MachineVolumeCollection"
|
135
85
|
control do
|
136
|
-
volumes =
|
86
|
+
volumes = MachineVolume.collection_for_instance(params[:id], self)
|
137
87
|
respond_to do |format|
|
138
88
|
format.json {volumes.to_json}
|
139
89
|
format.xml {volumes.to_xml}
|
@@ -144,7 +94,7 @@ module CIMI::Collections
|
|
144
94
|
operation :show, :with_capability => :storage_volumes do
|
145
95
|
description "Retrieve a Machine's specific MachineVolume"
|
146
96
|
control do
|
147
|
-
volume =
|
97
|
+
volume = MachineVolume.find(params[:id], self, params[:vol_id])
|
148
98
|
respond_to do |format|
|
149
99
|
format.json {volume.to_json}
|
150
100
|
format.xml {volume.to_xml}
|
@@ -155,7 +105,7 @@ module CIMI::Collections
|
|
155
105
|
operation :destroy, :with_capability => :detach_storage_volume do
|
156
106
|
description "Remove/detach a volume from the Machine's MachineVolumeCollection"
|
157
107
|
control do
|
158
|
-
machine_volume =
|
108
|
+
machine_volume = MachineVolume.find(params[:id], self, params[:vol_id])
|
159
109
|
location = machine_volume.initial_location
|
160
110
|
machine_volumes = Machine.detach_volume(params[:vol_id], location, self)
|
161
111
|
respond_to do |format|
|
@@ -20,27 +20,9 @@ module CIMI::Collections
|
|
20
20
|
|
21
21
|
collection :network_configurations do
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
control do
|
26
|
-
network_configurations = NetworkConfiguration.list(self).select_by(params['$select'])
|
27
|
-
respond_to do |format|
|
28
|
-
format.xml { network_configurations.to_xml }
|
29
|
-
format.json { network_configurations.to_json }
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
23
|
+
generate_show_operation :with_capability => :network_configurations
|
24
|
+
generate_index_operation :with_capability => :network_configurations
|
33
25
|
|
34
|
-
operation :show, :with_capability => :network_configurations do
|
35
|
-
description 'Show a specific NetworkConfiguration'
|
36
|
-
control do
|
37
|
-
network_config = NetworkConfiguration.find(params[:id], self)
|
38
|
-
respond_to do |format|
|
39
|
-
format.xml { network_config.to_xml }
|
40
|
-
format.json { network_config.to_json }
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
26
|
end
|
45
27
|
|
46
28
|
end
|
@@ -20,27 +20,8 @@ module CIMI::Collections
|
|
20
20
|
|
21
21
|
collection :network_port_configurations do
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
control do
|
26
|
-
net_port_configs = NetworkPortConfiguration.list(self).select_by(params['$select'])
|
27
|
-
respond_to do |format|
|
28
|
-
format.xml {net_port_configs.to_xml}
|
29
|
-
format.json {net_port_configs.to_json}
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
operation :show, :with_capability => :network_port_configurations do
|
35
|
-
description 'Show a specific NetworkPortConfiguration'
|
36
|
-
control do
|
37
|
-
net_port_config = NetworkPortConfiguration.find(params[:id], self)
|
38
|
-
respond_to do |format|
|
39
|
-
format.xml {net_port_config.to_xml}
|
40
|
-
format.json {net_port_config.to_json}
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
23
|
+
generate_index_operation :with_capability => :network_port_configurations
|
24
|
+
generate_show_operation :with_capability => :network_port_configurations
|
44
25
|
|
45
26
|
end
|
46
27
|
|
@@ -20,29 +20,8 @@ module CIMI::Collections
|
|
20
20
|
|
21
21
|
collection :network_port_templates do
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
operation :index, :with_capability => :network_port_templates do
|
26
|
-
description 'List all NetworkPortTemplates in the NetworkPortTemplateCollection'
|
27
|
-
control do
|
28
|
-
network_port_templates = NetworkPortTemplate.list(self).select_by(params['$select'])
|
29
|
-
respond_to do |format|
|
30
|
-
format.xml {network_port_templates.to_xml}
|
31
|
-
format.json {network_port_templates.to_json}
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
operation :show, :with_capability => :network_port_templates do
|
37
|
-
description 'Show a specific NetworkPortTemplate'
|
38
|
-
control do
|
39
|
-
network_port_template = NetworkPortTemplate.find(params[:id], self)
|
40
|
-
respond_to do |format|
|
41
|
-
format.xml {network_port_template.to_xml}
|
42
|
-
format.json {network_port_template.to_json}
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
23
|
+
generate_show_operation :with_capability => :network_port_templates
|
24
|
+
generate_index_operation :with_capability => :network_port_templates
|
46
25
|
|
47
26
|
end
|
48
27
|
|
@@ -19,53 +19,13 @@ module CIMI::Collections
|
|
19
19
|
set :capability, lambda { |m| driver.respond_to? m }
|
20
20
|
|
21
21
|
collection :network_ports do
|
22
|
+
description 'A NetworkPort is a realized connection point between a Network'+
|
23
|
+
' and a resource - such as a Machine.'
|
22
24
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
control do
|
28
|
-
network_ports = NetworkPort.list(self).select_by(params['$select'])
|
29
|
-
respond_to do |format|
|
30
|
-
format.xml {network_ports.to_xml}
|
31
|
-
format.json {network_ports.to_json}
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
operation :show, :with_capability => :network_ports do
|
37
|
-
description 'Show a specific NetworkPort'
|
38
|
-
control do
|
39
|
-
network_port = NetworkPort.find(params[:id], self)
|
40
|
-
respond_to do |format|
|
41
|
-
format.xml {network_port.to_xml}
|
42
|
-
format.json {network_port.to_json}
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
operation :create, :with_capability => :create_network_port do
|
48
|
-
description "Create a new NetworkPort"
|
49
|
-
control do
|
50
|
-
if current_content_type == :json
|
51
|
-
network_port = CIMI::Model::NetworkPort.create(request.body.read, self, :json)
|
52
|
-
else
|
53
|
-
network_port = CIMI::Model::NetworkPort.create(request.body.read, self, :xml)
|
54
|
-
end
|
55
|
-
respond_to do |format|
|
56
|
-
format.xml { network_port.to_xml }
|
57
|
-
format.json { network_port.to_json }
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
operation :destroy, :with_capability => :delete_network_port do
|
63
|
-
description "Delete a specified NetworkPort"
|
64
|
-
control do
|
65
|
-
CIMI::Model::NetworkPort.delete!(params[:id], self)
|
66
|
-
no_content_with_status(200)
|
67
|
-
end
|
68
|
-
end
|
25
|
+
generate_show_operation :with_capability => :network_port
|
26
|
+
generate_index_operation :with_capability => :networks_ports
|
27
|
+
generate_create_operation :with_capability => :create_network_port
|
28
|
+
generate_delete_operation :with_capability => :destroy_network_port
|
69
29
|
|
70
30
|
action :start, :with_capability => :start_network_port do
|
71
31
|
description "Start specific NetworkPort."
|
@@ -20,27 +20,8 @@ module CIMI::Collections
|
|
20
20
|
|
21
21
|
collection :network_templates do
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
control do
|
26
|
-
network_templates = NetworkTemplate.list(self).select_by(params['$select'])
|
27
|
-
respond_to do |format|
|
28
|
-
format.xml {network_templates.to_xml}
|
29
|
-
format.json {network_templates.to_json}
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
operation :show, :with_capability => :network_templates do
|
35
|
-
description 'Show a specific Network Template'
|
36
|
-
control do
|
37
|
-
network_template = NetworkTemplate.find(params[:id], self)
|
38
|
-
respond_to do |format|
|
39
|
-
format.xml {network_template.to_xml}
|
40
|
-
format.json {network_template.to_json}
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
23
|
+
generate_index_operation :with_capability => :network_templates
|
24
|
+
generate_show_operation :with_capability => :network_templates
|
44
25
|
|
45
26
|
end
|
46
27
|
|
@@ -21,47 +21,11 @@ module CIMI::Collections
|
|
21
21
|
collection :networks do
|
22
22
|
description 'A Network represents an abstraction of a layer 2 broadcast domain'
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
respond_to do |format|
|
29
|
-
format.xml { networks.to_xml }
|
30
|
-
format.json { networks.to_json }
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
24
|
+
generate_show_operation :with_capability => :networks
|
25
|
+
generate_index_operation :with_capability => :networks
|
26
|
+
generate_delete_operation :with_capability => :destroy_network
|
27
|
+
generate_create_operation :with_capability => :create_network
|
34
28
|
|
35
|
-
operation :show, :with_capability => :networks do
|
36
|
-
description "Show a specific Network"
|
37
|
-
control do
|
38
|
-
network = Network.find(params[:id], self)
|
39
|
-
respond_to do |format|
|
40
|
-
format.xml { network.to_xml }
|
41
|
-
format.json { network.to_json }
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
operation :create, :with_capability => :create_network do
|
47
|
-
description "Create a new Network"
|
48
|
-
control do
|
49
|
-
n = CIMI::Model::NetworkCreate.parse(request.body, request.content_type)
|
50
|
-
network = n.create(self)
|
51
|
-
respond_to do |format|
|
52
|
-
format.xml { network.to_xml}
|
53
|
-
format.json { network.to_json }
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
operation :destroy, :with_capability => :delete_network do
|
59
|
-
description "Delete a specified Network"
|
60
|
-
control do
|
61
|
-
Network.delete!(params[:id], self)
|
62
|
-
no_content_with_status(200)
|
63
|
-
end
|
64
|
-
end
|
65
29
|
|
66
30
|
action :start, :with_capability => :start_network do
|
67
31
|
description "Start specific network."
|
@@ -18,27 +18,8 @@ module CIMI::Collections
|
|
18
18
|
|
19
19
|
collection :resource_metadata do
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
control do
|
24
|
-
resource_metadata = CIMI::Model::ResourceMetadata.list(self)
|
25
|
-
respond_to do |format|
|
26
|
-
format.xml{resource_metadata.to_xml}
|
27
|
-
format.json{resource_metadata.to_json}
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
operation :show do
|
33
|
-
description "Get the resource metadata for a specific collection"
|
34
|
-
control do
|
35
|
-
resource_metadata = CIMI::Model::ResourceMetadata.find(params[:id], self)
|
36
|
-
respond_to do |format|
|
37
|
-
format.xml{resource_metadata.to_xml}
|
38
|
-
format.json{resource_metadata.to_json}
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
21
|
+
generate_index_operation
|
22
|
+
generate_show_operation
|
42
23
|
|
43
24
|
end
|
44
25
|
|
@@ -20,51 +20,10 @@ module CIMI::Collections
|
|
20
20
|
|
21
21
|
collection :system_templates do
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
respond_to do |format|
|
28
|
-
format.xml { system_templates.to_xml }
|
29
|
-
format.json { system_templates.to_json }
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
operation :show, :with_capability => :system_templates do
|
35
|
-
description "Show specific system template"
|
36
|
-
control do
|
37
|
-
system_template = CIMI::Model::SystemTemplate.find(params[:id], self)
|
38
|
-
respond_to do |format|
|
39
|
-
format.xml { system_template.to_xml }
|
40
|
-
format.json { system_template.to_json }
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
operation :create, :with_capability => :create_system_template do
|
46
|
-
description "Create new system template"
|
47
|
-
control do
|
48
|
-
if grab_content_type(request.content_type, request.body) == :json
|
49
|
-
new_system_template = CIMI::Model::SystemTemplate.create_from_json(request.body.read, self)
|
50
|
-
else
|
51
|
-
new_system_template = CIMI::Model::SystemTemplate.create_from_xml(request.body.read, self)
|
52
|
-
end
|
53
|
-
headers_for_create new_system_template
|
54
|
-
respond_to do |format|
|
55
|
-
format.json { new_system_template.to_json }
|
56
|
-
format.xml { new_system_template.to_xml }
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
operation :destroy, :with_capability => :destroy_system_template do
|
62
|
-
description "Delete a specified system template"
|
63
|
-
control do
|
64
|
-
CIMI::Model::SystemTemplate.delete!(params[:id], self)
|
65
|
-
no_content_with_status(200)
|
66
|
-
end
|
67
|
-
end
|
23
|
+
generate_index_operation :with_capability => :system_templates
|
24
|
+
generate_show_operation :with_capability => :system_templates
|
25
|
+
generate_create_operation :with_capability => :create_system_template
|
26
|
+
generate_delete_operation :with_capability => :destroy_system_template
|
68
27
|
|
69
28
|
end
|
70
29
|
|