deltacloud-core 0.5.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/NOTICE +1 -1
- data/Rakefile +63 -21
- data/bin/deltacloudd +10 -6
- data/config.ru +62 -6
- data/config/drivers/ec2.yaml +8 -0
- data/config/drivers/fgcp.yaml +13 -0
- data/deltacloud-core.gemspec +10 -2
- data/lib/cimi/collections.rb +58 -0
- data/lib/cimi/collections/address_templates.rb +49 -0
- data/lib/cimi/collections/addresses.rb +74 -0
- data/lib/cimi/collections/cloud_entry_point.rb +37 -0
- data/lib/{deltacloud/helpers/conversion_helper.rb → cimi/collections/entity_metadata.rb} +24 -16
- data/lib/cimi/collections/machine_admins.rb +74 -0
- data/lib/cimi/collections/machine_configurations.rb +49 -0
- data/lib/cimi/collections/machine_images.rb +50 -0
- data/lib/cimi/collections/machines.rb +157 -0
- data/lib/cimi/collections/network_configurations.rb +47 -0
- data/lib/cimi/collections/network_templates.rb +48 -0
- data/lib/cimi/collections/networks.rb +125 -0
- data/lib/cimi/collections/routing_group_templates.rb +47 -0
- data/lib/cimi/collections/routing_groups.rb +48 -0
- data/lib/cimi/collections/volume_configurations.rb +48 -0
- data/lib/cimi/collections/volume_images.rb +50 -0
- data/lib/cimi/collections/volumes.rb +80 -0
- data/lib/cimi/collections/vsp_configurations.rb +48 -0
- data/lib/cimi/collections/vsp_templates.rb +50 -0
- data/lib/cimi/collections/vsps.rb +108 -0
- data/lib/cimi/dependencies.rb +1 -0
- data/lib/cimi/helpers.rb +116 -0
- data/lib/cimi/helpers/cimi_helper.rb +6 -2
- data/lib/cimi/models.rb +72 -0
- data/lib/cimi/{model → models}/action.rb +1 -1
- data/lib/cimi/models/address.rb +72 -0
- data/lib/cimi/models/address_collection.rb +34 -0
- data/lib/cimi/models/address_template.rb +54 -0
- data/lib/cimi/models/address_template_collection.rb +34 -0
- data/lib/cimi/{model → models}/base.rb +2 -2
- data/lib/cimi/{model → models}/cloud_entry_point.rb +3 -5
- data/lib/cimi/{model → models}/entity_metadata.rb +7 -6
- data/lib/cimi/{model → models}/entity_metadata_collection.rb +2 -2
- data/lib/cimi/{model → models}/errors.rb +8 -0
- data/lib/cimi/{model → models}/machine.rb +10 -10
- data/lib/cimi/{model → models}/machine_admin.rb +1 -1
- data/lib/cimi/{model → models}/machine_admin_collection.rb +2 -2
- data/lib/cimi/{model → models}/machine_collection.rb +2 -2
- data/lib/cimi/{model → models}/machine_configuration.rb +9 -6
- data/lib/cimi/{model → models}/machine_configuration_collection.rb +2 -2
- data/lib/cimi/{model → models}/machine_image.rb +1 -1
- data/lib/cimi/{model → models}/machine_image_collection.rb +2 -2
- data/lib/cimi/{model → models}/machine_template.rb +0 -0
- data/lib/cimi/{model → models}/machine_template_collection.rb +2 -2
- data/lib/cimi/models/network.rb +109 -0
- data/lib/cimi/{model → models}/network_collection.rb +2 -2
- data/lib/cimi/{model → models}/network_configuration.rb +3 -4
- data/lib/cimi/{model → models}/network_configuration_collection.rb +2 -2
- data/lib/cimi/models/network_template.rb +36 -0
- data/lib/cimi/models/network_template_collection.rb +35 -0
- data/lib/cimi/models/routing_group.rb +34 -0
- data/lib/cimi/models/routing_group_collection.rb +34 -0
- data/lib/cimi/models/routing_group_template.rb +34 -0
- data/lib/cimi/models/routing_group_template_collection.rb +35 -0
- data/lib/cimi/{model → models}/schema.rb +0 -0
- data/lib/cimi/{model → models}/volume.rb +4 -4
- data/lib/cimi/{model → models}/volume_collection.rb +2 -2
- data/lib/cimi/{model → models}/volume_configuration.rb +1 -1
- data/lib/cimi/{model → models}/volume_configuration_collection.rb +2 -2
- data/lib/cimi/{model → models}/volume_image.rb +1 -1
- data/lib/cimi/{model → models}/volume_image_collection.rb +2 -2
- data/lib/cimi/{model → models}/volume_template.rb +0 -0
- data/lib/cimi/{model → models}/volume_template_collection.rb +2 -2
- data/lib/cimi/models/vsp.rb +102 -0
- data/lib/cimi/models/vsp_collection.rb +34 -0
- data/lib/cimi/models/vsp_configuration.rb +40 -0
- data/lib/cimi/models/vsp_configuration_collection.rb +34 -0
- data/lib/cimi/models/vsp_template.rb +34 -0
- data/lib/cimi/models/vsp_template_collection.rb +34 -0
- data/lib/cimi/server.rb +27 -549
- data/lib/deltacloud/api.rb +79 -0
- data/lib/deltacloud/collections.rb +54 -0
- data/lib/deltacloud/collections/addresses.rb +91 -0
- data/lib/deltacloud/collections/buckets.rb +273 -0
- data/lib/deltacloud/collections/drivers.rb +51 -0
- data/lib/deltacloud/collections/firewalls.rb +116 -0
- data/lib/deltacloud/collections/hardware_profiles.rb +29 -0
- data/lib/deltacloud/collections/images.rb +73 -0
- data/lib/deltacloud/collections/instance_states.rb +59 -0
- data/lib/deltacloud/collections/instances.rb +113 -0
- data/lib/deltacloud/collections/keys.rb +61 -0
- data/lib/deltacloud/collections/load_balancers.rb +102 -0
- data/lib/deltacloud/collections/metrics.rb +28 -0
- data/lib/deltacloud/collections/realms.rb +28 -0
- data/lib/deltacloud/collections/storage_snapshots.rb +51 -0
- data/lib/deltacloud/collections/storage_volumes.rb +99 -0
- data/lib/deltacloud/core_ext.rb +14 -6
- data/lib/deltacloud/core_ext/string.rb +17 -5
- data/lib/deltacloud/drivers.rb +6 -42
- data/lib/deltacloud/drivers/azure/azure_driver.rb +0 -4
- data/lib/deltacloud/{base_driver → drivers}/base_driver.rb +56 -18
- data/lib/deltacloud/drivers/condor/condor_driver.rb +1 -8
- data/lib/deltacloud/drivers/ec2/ec2_driver.rb +142 -33
- data/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb +2 -6
- data/lib/deltacloud/{base_driver → drivers}/exceptions.rb +25 -2
- data/lib/deltacloud/drivers/features.rb +154 -0
- data/lib/deltacloud/drivers/fgcp/fgcp_client.rb +387 -0
- data/lib/deltacloud/drivers/fgcp/fgcp_driver.rb +1435 -0
- data/lib/deltacloud/drivers/gogrid/gogrid_driver.rb +8 -11
- data/lib/deltacloud/drivers/google/google_driver.rb +2 -5
- data/lib/deltacloud/drivers/mock/data/keys/test-key.yml +28 -0
- data/lib/deltacloud/drivers/mock/mock_client.rb +2 -2
- data/lib/deltacloud/drivers/mock/mock_driver.rb +58 -40
- data/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb +145 -0
- data/lib/deltacloud/drivers/opennebula/cloud_client.rb +107 -73
- data/lib/deltacloud/drivers/opennebula/occi_client.rb +285 -145
- data/lib/deltacloud/drivers/opennebula/opennebula_driver.rb +189 -126
- data/lib/deltacloud/drivers/openstack/openstack_driver.rb +427 -8
- data/lib/deltacloud/drivers/rackspace/rackspace_driver.rb +7 -9
- data/lib/deltacloud/drivers/rhevm/rhevm_driver.rb +48 -66
- data/lib/deltacloud/drivers/rimuhosting/rimuhosting_client.rb +44 -51
- data/lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb +7 -8
- data/lib/deltacloud/drivers/sbc/sbc_client.rb +1 -1
- data/lib/deltacloud/drivers/sbc/sbc_driver.rb +3 -3
- data/lib/deltacloud/drivers/terremark/terremark_driver.rb +8 -8
- data/lib/deltacloud/drivers/vsphere/vsphere_driver.rb +39 -13
- data/lib/deltacloud/drivers/vsphere/vsphere_filemanager.rb +1 -0
- data/lib/deltacloud/helpers.rb +79 -7
- data/lib/{sinatra/lazy_auth.rb → deltacloud/helpers/auth_helper.rb} +5 -9
- data/lib/deltacloud/helpers/{blob_stream.rb → blob_stream_helper.rb} +7 -7
- data/lib/deltacloud/helpers/deltacloud_helper.rb +286 -0
- data/lib/deltacloud/helpers/driver_helper.rb +58 -0
- data/lib/deltacloud/helpers/rabbit_helper.rb +34 -0
- data/lib/{sinatra/url_for.rb → deltacloud/helpers/url_helper.rb} +31 -9
- data/lib/deltacloud/models.rb +19 -17
- data/lib/deltacloud/models/bucket.rb +4 -0
- data/lib/deltacloud/{hardware_profile.rb → models/hardware_profile.rb} +4 -2
- data/lib/deltacloud/models/image.rb +1 -0
- data/lib/deltacloud/models/instance.rb +4 -2
- data/lib/deltacloud/models/instance_address.rb +4 -0
- data/lib/deltacloud/models/key.rb +4 -0
- data/lib/deltacloud/models/metric.rb +40 -0
- data/lib/deltacloud/{state_machine.rb → models/state_machine.rb} +18 -1
- data/lib/deltacloud/server.rb +41 -1222
- data/lib/deltacloud_rack.rb +79 -0
- data/lib/{cimi/model/network_template.rb → ec2/helpers.rb} +7 -10
- data/lib/{deltacloud/backend_capability.rb → ec2/helpers/errors.rb} +24 -29
- data/lib/ec2/helpers/result.rb +31 -0
- data/lib/ec2/query_parser.rb +152 -0
- data/lib/ec2/server.rb +70 -0
- data/lib/{deltacloud.rb → sinatra.rb} +7 -12
- data/lib/sinatra/rack_accept.rb +13 -7
- data/lib/sinatra/rack_driver_select.rb +1 -1
- data/lib/sinatra/rack_matrix_params.rb +1 -3
- data/public/images/metric.png +0 -0
- data/public/javascripts/jquery.mobile-1.0.1.min.js +177 -0
- data/public/stylesheets/jquery.mobile-1.0.1.min.css +2 -0
- data/public/stylesheets/new.css +10 -0
- data/support/fedora/deltacloud-core.spec +1 -1
- data/tests/api/common.rb +1 -0
- data/tests/api/driver_test.rb +79 -0
- data/tests/api/library_test.rb +48 -0
- data/tests/cimi/features/step_definitions/common_steps.rb +2 -2
- data/tests/cimi/features/step_definitions/machines_steps.rb +5 -4
- data/tests/cimi/features/step_definitions/volumes_steps.rb +8 -8
- data/tests/cimi/features/support/env.rb +33 -11
- data/tests/common.rb +7 -8
- data/tests/drivers/ec2/api_test.rb +19 -0
- data/tests/drivers/ec2/common.rb +23 -0
- data/tests/drivers/ec2/drivers_test.rb +120 -0
- data/tests/drivers/ec2/hardware_profiles_test.rb +224 -0
- data/tests/drivers/ec2/images_test.rb +230 -0
- data/tests/drivers/ec2/instances_test.rb +356 -0
- data/tests/drivers/ec2/keys_test.rb +181 -0
- data/tests/drivers/ec2/realms_test.rb +146 -0
- data/tests/drivers/fgcp/api_test.rb +47 -0
- data/tests/drivers/fgcp/hardware_profiles_test.rb +54 -0
- data/tests/drivers/fgcp/realms_test.rb +42 -0
- data/tests/drivers/{rackspace → fgcp}/setup.rb +5 -6
- data/tests/drivers/google/api_test.rb +10 -26
- data/tests/drivers/google/buckets_test.rb +79 -95
- data/tests/drivers/google/common.rb +54 -0
- data/tests/drivers/mock/api_test.rb +4 -127
- data/tests/drivers/mock/buckets_test.rb +195 -0
- data/tests/drivers/mock/common.rb +7 -0
- data/tests/drivers/mock/drivers_test.rb +123 -0
- data/tests/drivers/mock/hardware_profiles_test.rb +190 -100
- data/tests/drivers/mock/images_test.rb +162 -103
- data/tests/drivers/mock/instances_test.rb +310 -220
- data/tests/drivers/mock/keys_test.rb +161 -0
- data/tests/drivers/mock/realms_test.rb +109 -70
- data/tests/drivers/mock/storage_snapshots_test.rb +114 -0
- data/tests/drivers/mock/storage_volumes_test.rb +122 -0
- data/tests/drivers/openstack/api_test.rb +8 -3
- data/tests/drivers/openstack/common.rb +21 -0
- data/tests/drivers/openstack/hardware_profiles_test.rb +20 -9
- data/tests/drivers/openstack/images_test.rb +11 -5
- data/tests/drivers/openstack/instances_test.rb +61 -16
- data/tests/drivers/openstack/realms_test.rb +11 -7
- data/tests/drivers/rackspace/api_test.rb +7 -2
- data/tests/drivers/rackspace/buckets_test.rb +7 -2
- data/tests/drivers/rackspace/common.rb +16 -0
- data/tests/drivers/rackspace/hardware_profiles_test.rb +7 -2
- data/tests/drivers/rackspace/images_test.rb +7 -2
- data/tests/drivers/rackspace/instances_test.rb +10 -5
- data/tests/drivers/rackspace/realms_test.rb +7 -2
- data/tests/drivers/rhevm/api_test.rb +12 -6
- data/tests/drivers/rhevm/{setup.rb → common.rb} +8 -1
- data/tests/drivers/rhevm/hardware_profiles_test.rb +7 -2
- data/tests/drivers/rhevm/images_test.rb +8 -2
- data/tests/drivers/rhevm/instances_test.rb +7 -2
- data/tests/drivers/rhevm/realms_test.rb +7 -2
- data/tests/minitest_common.rb +58 -0
- data/tests/minitest_common_api_test.rb +115 -0
- data/views/addresses/associate.html.haml +1 -1
- data/views/addresses/index.html.haml +1 -1
- data/views/addresses/show.html.haml +2 -3
- data/views/api/show.html.haml +22 -9
- data/views/api/show.xml.haml +8 -7
- data/views/blobs/show.xml.haml +7 -4
- data/views/buckets/new.html.haml +2 -2
- data/views/cimi/errors/401.xml.haml +1 -1
- data/views/error.html.haml +3 -3
- data/views/errors/400.html.haml +1 -1
- data/views/errors/400.xml.haml +1 -2
- data/views/errors/401.html.haml +8 -7
- data/views/errors/401.xml.haml +1 -1
- data/views/errors/404.xml.haml +1 -0
- data/views/errors/500.xml.haml +4 -2
- data/views/{cimi/errors/403.html.haml → errors/501.html.haml} +4 -2
- data/views/errors/501.xml.haml +1 -0
- data/views/errors/502.xml.haml +1 -7
- data/views/{cimi/errors/500.html.haml → errors/504.html.haml} +0 -0
- data/views/errors/504.xml.haml +1 -0
- data/views/firewalls/new.html.haml +2 -2
- data/views/firewalls/new_rule.html.haml +1 -1
- data/views/firewalls/show.html.haml +1 -1
- data/views/hardware_profiles/index.html.haml +3 -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 +3 -3
- data/views/images/show.html.haml +5 -0
- data/views/images/show.xml.haml +6 -1
- data/views/instance_states/show.html.haml +1 -1
- data/views/instances/index.html.haml +1 -1
- data/views/instances/new.html.haml +54 -39
- data/views/instances/run_command.html.haml +24 -15
- data/views/instances/show.html.haml +7 -3
- data/views/instances/show.xml.haml +2 -2
- data/views/keys/show.xml.haml +1 -0
- data/views/layout.html.haml +5 -9
- data/views/load_balancers/show.html.haml +12 -6
- data/views/metrics/index.html.haml +13 -0
- data/views/metrics/index.xml.haml +5 -0
- data/views/metrics/show.html.haml +23 -0
- data/views/metrics/show.xml.haml +9 -0
- data/views/realms/show.xml.haml +2 -1
- data/views/root/index.html.haml +1 -1
- data/views/storage_snapshots/show.html.haml +1 -1
- data/views/storage_snapshots/show.xml.haml +1 -0
- data/views/storage_volumes/attach.html.haml +1 -2
- data/views/storage_volumes/index.html.haml +1 -1
- data/views/storage_volumes/new.html.haml +22 -16
- data/views/storage_volumes/show.html.haml +10 -4
- data/views/storage_volumes/show.xml.haml +3 -4
- metadata +547 -519
- data/DISCLAIMER +0 -8
- data/lib/cimi/model.rb +0 -52
- data/lib/cimi/model/network.rb +0 -69
- data/lib/deltacloud/base_driver.rb +0 -18
- data/lib/deltacloud/base_driver/features.rb +0 -262
- data/lib/deltacloud/base_driver/mock_driver.rb +0 -78
- data/lib/deltacloud/drivers/ec2/ec2_mock_driver.rb +0 -186
- data/lib/deltacloud/drivers/rhevm/rhevm_client.rb +0 -521
- data/lib/deltacloud/helpers/application_helper.rb +0 -267
- data/lib/deltacloud/helpers/hardware_profiles_helper.rb +0 -50
- data/lib/deltacloud/helpers/json_helper.rb +0 -31
- data/lib/deltacloud/method_serializer.rb +0 -83
- data/lib/deltacloud/validation.rb +0 -107
- data/lib/sinatra/rabbit.rb +0 -441
- data/lib/sinatra/rack_runtime.rb +0 -47
- data/lib/sinatra/rack_syslog.rb +0 -86
- data/lib/sinatra/sinatra_verbose.rb +0 -73
- data/lib/sinatra/static_assets.rb +0 -99
- data/public/javascripts/jquery.mobile-1.0rc1.min.js +0 -170
- data/public/stylesheets/jquery.mobile-1.0rc1.min.css +0 -12
- data/tests/drivers/google/setup.rb +0 -38
- data/tests/drivers/mock/instance_states_test.rb +0 -71
- data/tests/drivers/mock/setup.rb +0 -3
- data/tests/drivers/mock/url_for_test.rb +0 -67
- data/tests/drivers/openstack/setup.rb +0 -20
- data/views/cimi/errors/400.html.haml +0 -41
- data/views/cimi/errors/401.html.haml +0 -41
- data/views/cimi/errors/404.html.haml +0 -29
- data/views/cimi/errors/405.html.haml +0 -29
- data/views/cimi/errors/502.html.haml +0 -43
- data/views/cimi/errors/backend_capability_failure.html.haml +0 -29
@@ -0,0 +1,34 @@
|
|
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
|
+
class CIMI::Model::VSPCollection < CIMI::Model::Base
|
17
|
+
|
18
|
+
CIMI::Model.register_as_root_entity! "VSPs"
|
19
|
+
|
20
|
+
array :vsps do
|
21
|
+
scalar :href
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.default(context)
|
25
|
+
self.new(
|
26
|
+
:id => context.vsps_url,
|
27
|
+
:name => 'default',
|
28
|
+
:created => Time.now,
|
29
|
+
:description => "#{context.driver.name.capitalize} VSPCollection",
|
30
|
+
:vsps => CIMI::Model::VSP.all_uri(context)
|
31
|
+
)
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,40 @@
|
|
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
|
+
class CIMI::Model::VSPConfiguration < CIMI::Model::Base
|
17
|
+
|
18
|
+
text :bandwidth_reservation
|
19
|
+
|
20
|
+
text :traffic_priority
|
21
|
+
|
22
|
+
text :max_traffic_delay
|
23
|
+
|
24
|
+
text :max_traffic_loss
|
25
|
+
|
26
|
+
text :max_traffic_jitter
|
27
|
+
|
28
|
+
array :operations do
|
29
|
+
scalar :rel, :href
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.find(id, context)
|
33
|
+
if id==:all
|
34
|
+
context.driver.vsp_configurations(context.credentials, {:env=>context})
|
35
|
+
else
|
36
|
+
context.driver.vsp_configurations(context.credentials, {:env=>context, :id=>id})
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
@@ -0,0 +1,34 @@
|
|
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
|
+
class CIMI::Model::VSPConfigurationCollection < CIMI::Model::Base
|
17
|
+
|
18
|
+
CIMI::Model.register_as_root_entity! "VSPConfigurations"
|
19
|
+
|
20
|
+
array :vsp_configurations do
|
21
|
+
scalar :href
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.default(context)
|
25
|
+
self.new(
|
26
|
+
:id => context.vsp_configurations_url,
|
27
|
+
:name => 'default',
|
28
|
+
:created => Time.now,
|
29
|
+
:description => "#{context.driver.name.capitalize} VSPConfigurationCollection",
|
30
|
+
:vsp_configurations => CIMI::Model::VSPConfiguration.all_uri(context)
|
31
|
+
)
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,34 @@
|
|
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
|
+
class CIMI::Model::VSPTemplate < CIMI::Model::Base
|
17
|
+
|
18
|
+
href :network
|
19
|
+
|
20
|
+
href :vsp_config
|
21
|
+
|
22
|
+
array :operations do
|
23
|
+
scalar :rel, :href
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.find(id, context)
|
27
|
+
if id==:all
|
28
|
+
context.driver.vsp_templates(context.credentials, {:env=>context})
|
29
|
+
else
|
30
|
+
context.driver.vsp_templates(context.credentials, {:env=>context, :id=>id})
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,34 @@
|
|
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
|
+
class CIMI::Model::VSPTemplateCollection < CIMI::Model::Base
|
17
|
+
|
18
|
+
CIMI::Model.register_as_root_entity! "VSPTemplates"
|
19
|
+
|
20
|
+
array :vsp_templates do
|
21
|
+
scalar :href
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.default(context)
|
25
|
+
self.new(
|
26
|
+
:id => context.vsp_templates_url,
|
27
|
+
:name => 'default',
|
28
|
+
:created => Time.now,
|
29
|
+
:description => "#{context.driver.name.capitalize} VSPTemplateCollection",
|
30
|
+
:vsp_templates => CIMI::Model::VSPTemplate.all_uri(context)
|
31
|
+
)
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
data/lib/cimi/server.rb
CHANGED
@@ -13,563 +13,41 @@
|
|
13
13
|
# License for the specific language governing permissions and limitations
|
14
14
|
# under the License.
|
15
15
|
|
16
|
-
require '
|
17
|
-
require '
|
18
|
-
require '
|
16
|
+
require 'rubygems'
|
17
|
+
require 'crack'
|
18
|
+
require 'json'
|
19
|
+
require 'yaml'
|
20
|
+
require 'haml'
|
21
|
+
require 'sinatra/base'
|
22
|
+
require 'sinatra/rabbit'
|
23
|
+
require_relative '../sinatra'
|
19
24
|
|
20
|
-
|
25
|
+
require_relative './helpers'
|
26
|
+
require_relative './collections'
|
21
27
|
|
22
|
-
|
23
|
-
include CIMI::Model
|
28
|
+
CMWG_NAMESPACE = "http://www.dmtf.org/cimi"
|
24
29
|
|
25
|
-
|
30
|
+
module CIMI
|
31
|
+
class API < Collections::Base
|
26
32
|
|
27
|
-
|
33
|
+
# Enable logging
|
34
|
+
use Rack::CommonLogger
|
35
|
+
use Rack::Date
|
36
|
+
use Rack::ETag
|
37
|
+
use Rack::MatrixParams
|
38
|
+
use Rack::DriverSelect
|
39
|
+
use Rack::Accept
|
40
|
+
use Rack::MediaType
|
28
41
|
|
29
|
-
|
30
|
-
use Rack::Runtime
|
31
|
-
use Rack::MatrixParams
|
32
|
-
use Rack::DriverSelect
|
33
|
-
use Rack::MediaType
|
34
|
-
use Rack::Date
|
42
|
+
helpers CIMIHelper
|
35
43
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
set :public_folder, File::join($top_srcdir, 'public')
|
40
|
-
driver
|
41
|
-
end
|
42
|
-
|
43
|
-
configure :production do
|
44
|
-
use Rack::SyslogLogger
|
45
|
-
disable :logging
|
46
|
-
enable :show_errors
|
47
|
-
set :dump_errors, false
|
48
|
-
$stdout = SyslogFile.new
|
49
|
-
$stderr = $stdout
|
50
|
-
end
|
51
|
-
|
52
|
-
configure :development do
|
53
|
-
set :raise_errors => false
|
54
|
-
set :show_exceptions, false
|
55
|
-
$stdout.sync = true
|
56
|
-
$stderr.sync = true
|
57
|
-
end
|
58
|
-
|
59
|
-
# You could use $API_HOST environment variable to change your hostname to
|
60
|
-
# whatever you want (eg. if you running API behind NAT)
|
61
|
-
HOSTNAME=ENV['API_HOST'] ? ENV['API_HOST'] : nil
|
62
|
-
|
63
|
-
error do
|
64
|
-
report_error
|
65
|
-
end
|
66
|
-
|
67
|
-
get "/" do
|
68
|
-
redirect settings.root_url
|
69
|
-
end
|
70
|
-
|
71
|
-
get "#{settings.root_url}\/?" do
|
72
|
-
halt 401 if params[:force_auth] and not driver.valid_credentials?(credentials)
|
73
|
-
redirect cloudEntryPoint_url, 301
|
74
|
-
end
|
75
|
-
|
76
|
-
global_collection :cloudEntryPoint do
|
77
|
-
description 'Cloud entry point'
|
78
|
-
operation :index do
|
79
|
-
description "list all resources of the cloud"
|
80
|
-
control do
|
81
|
-
entry_point = CloudEntryPoint.create(self)
|
82
|
-
respond_to do |format|
|
83
|
-
format.xml { entry_point.to_xml }
|
84
|
-
format.json { entry_point.to_json }
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
global_collection :machine_configurations do
|
91
|
-
description 'List all machine configurations'
|
92
|
-
|
93
|
-
operation :index do
|
94
|
-
param :CIMISelect, :string, :optional
|
95
|
-
description "List all machine configurations"
|
96
|
-
control do
|
97
|
-
machine_configs = MachineConfigurationCollection.default(self).filter_by(params[:CIMISelect])
|
98
|
-
respond_to do |format|
|
99
|
-
format.xml { machine_configs.to_xml }
|
100
|
-
format.json { machine_configs.to_json }
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
operation :show do
|
106
|
-
|
107
|
-
description "The Machine Configuration entity represents the set of configuration values "+
|
108
|
-
"that define the (virtual) hardware resources of a to-be-realized Machine Instance.."
|
109
|
-
|
110
|
-
param :id, :string, :required
|
111
|
-
|
112
|
-
control do
|
113
|
-
machine_conf = MachineConfiguration.find(params[:id], self)
|
114
|
-
respond_to do |format|
|
115
|
-
format.xml { machine_conf.to_xml }
|
116
|
-
format.json { machine_conf.to_json }
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
global_collection :machine_images do
|
124
|
-
description 'List all machine images'
|
44
|
+
include Deltacloud::Helpers
|
45
|
+
include CIMI::Collections
|
46
|
+
include CIMI::Model
|
125
47
|
|
126
|
-
|
127
|
-
|
128
|
-
param :CIMISelect, :string, :optional
|
129
|
-
control do
|
130
|
-
machine_images = MachineImageCollection.default(self).filter_by(params[:CIMISelect])
|
131
|
-
respond_to do |format|
|
132
|
-
format.xml { machine_images.to_xml }
|
133
|
-
format.json { machine_images.to_json }
|
134
|
-
end
|
48
|
+
get Deltacloud[:cimi].root_url do
|
49
|
+
redirect Deltacloud[:cimi].root_url + '/cloudEntryPoint', 301
|
135
50
|
end
|
136
|
-
end
|
137
51
|
|
138
|
-
operation :show do
|
139
|
-
description "Show specific machine image."
|
140
|
-
param :id, :string, :required
|
141
|
-
control do
|
142
|
-
machine_image = MachineImage.find(params[:id], self)
|
143
|
-
respond_to do |format|
|
144
|
-
format.xml { machine_image.to_xml }
|
145
|
-
format.json { machine_image.to_json }
|
146
|
-
end
|
147
|
-
end
|
148
52
|
end
|
149
|
-
|
150
|
-
end
|
151
|
-
|
152
|
-
global_collection :machine_admins do
|
153
|
-
description 'Machine Admin entity'
|
154
|
-
|
155
|
-
operation :index do
|
156
|
-
description "List all machine admins"
|
157
|
-
param :CIMISelect, :string, :optional
|
158
|
-
with_capability :keys
|
159
|
-
control do
|
160
|
-
machine_admins = MachineAdminCollection.default(self).filter_by(params[:CIMISelect])
|
161
|
-
respond_to do |format|
|
162
|
-
format.xml { machine_admins.to_xml }
|
163
|
-
format.json { machine_admins.to_json }
|
164
|
-
end
|
165
|
-
end
|
166
|
-
end
|
167
|
-
|
168
|
-
operation :show do
|
169
|
-
description "Show specific machine admin"
|
170
|
-
param :id, :string, :required
|
171
|
-
with_capability :key
|
172
|
-
control do
|
173
|
-
machine_admin = MachineAdmin.find(params[:id], self)
|
174
|
-
respond_to do |format|
|
175
|
-
format.xml { machine_admin.to_xml }
|
176
|
-
format.json { machine_admin.to_json }
|
177
|
-
end
|
178
|
-
end
|
179
|
-
end
|
180
|
-
|
181
|
-
operation :create do
|
182
|
-
description "Show specific machine admin"
|
183
|
-
with_capability :create_key
|
184
|
-
control do
|
185
|
-
if request.content_type.end_with?("+json")
|
186
|
-
new_admin = MachineAdmin.create_from_json(request.body.read, self)
|
187
|
-
else
|
188
|
-
new_admin = MachineAdmin.create_from_xml(request.body.read, self)
|
189
|
-
end
|
190
|
-
status 201 # Created
|
191
|
-
respond_to do |format|
|
192
|
-
format.json { new_admin.to_json }
|
193
|
-
format.xml { new_admin.to_xml }
|
194
|
-
end
|
195
|
-
end
|
196
|
-
end
|
197
|
-
|
198
|
-
operation :delete, :method => :delete, :member => true do
|
199
|
-
description "Delete specified MachineAdmin entity"
|
200
|
-
param :id, :string, :required
|
201
|
-
control do
|
202
|
-
MachineAdmin.delete!(params[:id], self)
|
203
|
-
no_content_with_status(200)
|
204
|
-
end
|
205
|
-
end
|
206
|
-
|
207
|
-
end
|
208
|
-
|
209
|
-
global_collection :machines do
|
210
|
-
description 'List all machine'
|
211
|
-
|
212
|
-
operation :index do
|
213
|
-
param :CIMISelect, :string, :optional
|
214
|
-
description "List all machines"
|
215
|
-
control do
|
216
|
-
machines = MachineCollection.default(self).filter_by(params[:CIMISelect])
|
217
|
-
respond_to do |format|
|
218
|
-
format.xml { machines.to_xml }
|
219
|
-
format.json { machines.to_json }
|
220
|
-
end
|
221
|
-
end
|
222
|
-
end
|
223
|
-
|
224
|
-
operation :show do
|
225
|
-
description "Show specific machine."
|
226
|
-
param :id, :string, :required
|
227
|
-
control do
|
228
|
-
machine = Machine.find(params[:id], self)
|
229
|
-
respond_to do |format|
|
230
|
-
format.xml { machine.to_xml }
|
231
|
-
format.json { machine.to_json }
|
232
|
-
end
|
233
|
-
end
|
234
|
-
end
|
235
|
-
|
236
|
-
operation :create do
|
237
|
-
description "Create a new Machine entity."
|
238
|
-
control do
|
239
|
-
if request.content_type.end_with?("+json")
|
240
|
-
new_machine = Machine.create_from_json(request.body.read, self)
|
241
|
-
else
|
242
|
-
new_machine = Machine.create_from_xml(request.body.read, self)
|
243
|
-
end
|
244
|
-
status 201 # Created
|
245
|
-
respond_to do |format|
|
246
|
-
format.json { new_machine.to_json }
|
247
|
-
format.xml { new_machine.to_xml }
|
248
|
-
end
|
249
|
-
end
|
250
|
-
end
|
251
|
-
|
252
|
-
operation :destroy do
|
253
|
-
description "Delete a specified machine."
|
254
|
-
param :id, :string, :required
|
255
|
-
control do
|
256
|
-
Machine.delete!(params[:id], self)
|
257
|
-
no_content_with_status(200)
|
258
|
-
end
|
259
|
-
end
|
260
|
-
|
261
|
-
operation :stop, :method => :post, :member => true do
|
262
|
-
description "Stop specific machine."
|
263
|
-
param :id, :string, :required
|
264
|
-
control do
|
265
|
-
machine = Machine.find(params[:id], self)
|
266
|
-
if request.content_type.end_with?("+json")
|
267
|
-
action = Action.from_json(request.body.read)
|
268
|
-
else
|
269
|
-
action = Action.from_xml(request.body.read)
|
270
|
-
end
|
271
|
-
machine.perform(action, self) do |operation|
|
272
|
-
no_content_with_status(202) if operation.success?
|
273
|
-
# Handle errors using operation.failure?
|
274
|
-
end
|
275
|
-
end
|
276
|
-
end
|
277
|
-
|
278
|
-
operation :restart, :method => :post, :member => true do
|
279
|
-
description "Start specific machine."
|
280
|
-
param :id, :string, :required
|
281
|
-
control do
|
282
|
-
machine = Machine.find(params[:id], self)
|
283
|
-
if request.content_type.end_with?("+json")
|
284
|
-
action = Action.from_json(request.body.read)
|
285
|
-
else
|
286
|
-
action = Action.from_xml(request.body.read)
|
287
|
-
end
|
288
|
-
machine.perform(action, self) do |operation|
|
289
|
-
no_content_with_status(202) if operation.success?
|
290
|
-
# Handle errors using operation.failure?
|
291
|
-
end
|
292
|
-
end
|
293
|
-
end
|
294
|
-
|
295
|
-
operation :start, :method => :post, :member => true do
|
296
|
-
description "Start specific machine."
|
297
|
-
param :id, :string, :required
|
298
|
-
control do
|
299
|
-
machine = Machine.find(params[:id], self)
|
300
|
-
if request.content_type.end_with?("+json")
|
301
|
-
action = Action.from_json(request.body.read)
|
302
|
-
else
|
303
|
-
action = Action.from_xml(request.body.read)
|
304
|
-
end
|
305
|
-
machine.perform(action, self) do |operation|
|
306
|
-
no_content_with_status(202) if operation.success?
|
307
|
-
# Handle errors using operation.failure?
|
308
|
-
end
|
309
|
-
end
|
310
|
-
end
|
311
|
-
|
312
|
-
#NOTE: The routes for attach/detach used here are NOT as specified by CIMI
|
313
|
-
#will likely move later. CIMI specifies PUT of the whole Machine description
|
314
|
-
#with inclusion/ommission of the volumes you want [att|det]ached
|
315
|
-
operation :attach_volume, :method => :put, :member => true do
|
316
|
-
description "Attach CIMI Volume(s) to a machine."
|
317
|
-
param :id, :string, :required
|
318
|
-
control do
|
319
|
-
if request.content_type.end_with?("+json")
|
320
|
-
volumes_to_attach = Volume.find_to_attach_from_json(request.body.read, self)
|
321
|
-
else
|
322
|
-
volumes_to_attach = Volume.find_to_attach_from_xml(request.body.read, self)
|
323
|
-
end
|
324
|
-
machine = Machine.attach_volumes(volumes_to_attach, self)
|
325
|
-
respond_to do |format|
|
326
|
-
format.json{ machine.to_json}
|
327
|
-
format.xml{machine.to_xml}
|
328
|
-
end
|
329
|
-
end
|
330
|
-
end
|
331
|
-
|
332
|
-
operation :detach_volume, :method => :put, :member => true do
|
333
|
-
description "Detach CIMI Volume(s) from a machine."
|
334
|
-
param :id, :string, :required
|
335
|
-
control do
|
336
|
-
if request.content_type.end_with?("+json")
|
337
|
-
volumes_to_detach = Volume.find_to_attach_from_json(request.body.read, self)
|
338
|
-
else
|
339
|
-
volumes_to_detach = Volume.find_to_attach_from_xml(request.body.read, self)
|
340
|
-
end
|
341
|
-
machine = Machine.detach_volumes(volumes_to_detach, self)
|
342
|
-
respond_to do |format|
|
343
|
-
format.json{ machine.to_json}
|
344
|
-
format.xml{machine.to_xml}
|
345
|
-
end
|
346
|
-
end
|
347
|
-
end
|
348
|
-
end
|
349
|
-
|
350
|
-
global_collection :volumes do
|
351
|
-
description "Volume represents storage at either the block or file-system level. Volumes can be attached to Machines. Once attached, Volumes can be accessed by processes on that Machine"
|
352
|
-
|
353
|
-
operation :index do
|
354
|
-
description "List all volumes"
|
355
|
-
param :CIMISelect, :string, :optional
|
356
|
-
control do
|
357
|
-
volumes = VolumeCollection.default(self).filter_by(params[:CIMISelect])
|
358
|
-
respond_to do |format|
|
359
|
-
format.xml { volumes.to_xml }
|
360
|
-
format.json { volumes.to_json }
|
361
|
-
end
|
362
|
-
end
|
363
|
-
end
|
364
|
-
|
365
|
-
operation :show do
|
366
|
-
description "Show specific Volume."
|
367
|
-
param :id, :string, :required
|
368
|
-
control do
|
369
|
-
volume = Volume.find(params[:id], self)
|
370
|
-
if volume
|
371
|
-
respond_to do |format|
|
372
|
-
format.xml { volume.to_xml }
|
373
|
-
format.json { volume.to_json }
|
374
|
-
end
|
375
|
-
else
|
376
|
-
report_error(404)
|
377
|
-
end
|
378
|
-
end
|
379
|
-
end
|
380
|
-
|
381
|
-
operation :create do
|
382
|
-
description "Create a new Volume."
|
383
|
-
control do
|
384
|
-
content_type = (request.content_type.end_with?("+json") ? :json : :xml)
|
385
|
-
#((request.content_type.end_with?("+xml")) ? :xml : report_error(415) ) FIXME
|
386
|
-
case content_type
|
387
|
-
when :json
|
388
|
-
new_volume = Volume.create_from_json(request.body.read, self)
|
389
|
-
when :xml
|
390
|
-
new_volume = Volume.create_from_xml(request.body.read, self)
|
391
|
-
end
|
392
|
-
respond_to do |format|
|
393
|
-
format.json { new_volume.to_json }
|
394
|
-
format.xml { new_volume.to_xml }
|
395
|
-
end
|
396
|
-
end
|
397
|
-
end
|
398
|
-
|
399
|
-
operation :destroy do
|
400
|
-
description "Delete a specified Volume"
|
401
|
-
param :id, :string, :required
|
402
|
-
control do
|
403
|
-
Volume.delete!(params[:id], self)
|
404
|
-
no_content_with_status(200)
|
405
|
-
end
|
406
|
-
end
|
407
|
-
|
408
|
-
end
|
409
|
-
|
410
|
-
global_collection :volume_configurations do
|
411
|
-
description "The Volume Configuration entity represents the set of configuration values needed to create a Volume with certain characteristics. Volume Configurations are created by Providers and MAY, at the Providers discretion, be created by Consumers"
|
412
|
-
|
413
|
-
operation :index do
|
414
|
-
description "Get list all VolumeConfigurations"
|
415
|
-
param :CIMISelect, :string, :optional
|
416
|
-
control do
|
417
|
-
volume_configuration = VolumeConfigurationCollection.default(self).filter_by(params[:CIMISelect])
|
418
|
-
respond_to do |format|
|
419
|
-
format.xml { volume_configuration.to_xml }
|
420
|
-
format.json { volume_configuration.to_json }
|
421
|
-
end
|
422
|
-
end
|
423
|
-
end
|
424
|
-
|
425
|
-
operation :show do
|
426
|
-
description "Get a specific VolumeConfiguration"
|
427
|
-
param :id, :required, :string
|
428
|
-
control do
|
429
|
-
volume_config = VolumeConfiguration.find(params[:id], self)
|
430
|
-
respond_to do |format|
|
431
|
-
format.xml { volume_config.to_xml }
|
432
|
-
format.json { volume_config.json }
|
433
|
-
end
|
434
|
-
end
|
435
|
-
end
|
436
|
-
|
437
|
-
global_collection :volume_images do
|
438
|
-
description 'This entity represents an image that could be place on a pre-loaded volume.'
|
439
|
-
|
440
|
-
operation :index do
|
441
|
-
description "List all volumes images"
|
442
|
-
param :CIMISelect, :string, :optional
|
443
|
-
control do
|
444
|
-
volume_images = VolumeImageCollection.default(self).filter_by(params[:CIMISelect])
|
445
|
-
respond_to do |format|
|
446
|
-
format.xml { volume_images.to_xml }
|
447
|
-
format.json { volume_images.to_json }
|
448
|
-
end
|
449
|
-
end
|
450
|
-
end
|
451
|
-
|
452
|
-
operation :show do
|
453
|
-
description "Show a specific volume image"
|
454
|
-
param :id, :string, :required
|
455
|
-
control do
|
456
|
-
volume_image = VolumeImage.find(params[:id], self)
|
457
|
-
respond_to do |format|
|
458
|
-
format.xml { volume_image.to_xml }
|
459
|
-
format.json { volume_image.to_json }
|
460
|
-
end
|
461
|
-
end
|
462
|
-
end
|
463
|
-
|
464
|
-
end
|
465
|
-
|
466
|
-
|
467
|
-
global_collection :entity_metadata do
|
468
|
-
description 'This allows for the discovery of Provider defined constraints on the CIMI defined attributes as well as discovery of any new extension attributes that the Provider may have defined.'
|
469
|
-
|
470
|
-
operation :index do
|
471
|
-
description "List all entity metadata defined for this provider"
|
472
|
-
control do
|
473
|
-
entity_metadata = EntityMetadataCollection.default(self)
|
474
|
-
respond_to do |format|
|
475
|
-
format.xml{entity_metadata.to_xml}
|
476
|
-
format.json{entity_metadata.to_json}
|
477
|
-
end
|
478
|
-
end
|
479
|
-
end
|
480
|
-
|
481
|
-
operation :show do
|
482
|
-
description "Get the entity metadata for a specific collection"
|
483
|
-
param :id, :required, :string
|
484
|
-
control do
|
485
|
-
entity_metadata = EntityMetadata.find(params[:id], self)
|
486
|
-
respond_to do |format|
|
487
|
-
format.xml{entity_metadata.to_xml}
|
488
|
-
format.json{entity_metadata.to_json}
|
489
|
-
end
|
490
|
-
end
|
491
|
-
end
|
492
|
-
|
493
|
-
end
|
494
|
-
|
495
|
-
global_collection :networks do
|
496
|
-
description 'A Network represents an abstraction of a layer 2 broadcast domain'
|
497
|
-
|
498
|
-
operation :index do
|
499
|
-
description "List all Networks"
|
500
|
-
param :CIMISelect, :string, :optional
|
501
|
-
control do
|
502
|
-
networks = NetworkCollection.default(self).filter_by(params[:CIMISelect])
|
503
|
-
respond_to do |format|
|
504
|
-
format.xml { networks.to_xml }
|
505
|
-
format.json { networks.to_json }
|
506
|
-
end
|
507
|
-
end
|
508
|
-
end
|
509
|
-
|
510
|
-
operation :show do
|
511
|
-
description "Show a specific Network"
|
512
|
-
param :id, :string, :required
|
513
|
-
control do
|
514
|
-
network = Network.find(params[:id], self)
|
515
|
-
respond_to do |format|
|
516
|
-
format.xml { network.to_xml }
|
517
|
-
format.json { network.to_json }
|
518
|
-
end
|
519
|
-
end
|
520
|
-
end
|
521
|
-
|
522
|
-
operation :create do
|
523
|
-
description "Create a new Network"
|
524
|
-
control do
|
525
|
-
if request.content_type.end_with("+json")
|
526
|
-
network = Network.create_from_json(request.body.read, self)
|
527
|
-
else
|
528
|
-
network = Network.create_from_xml(request.body.read, self)
|
529
|
-
end
|
530
|
-
respond_to do |format|
|
531
|
-
format.xml { network.to_xml}
|
532
|
-
format.json { network.to_json }
|
533
|
-
end
|
534
|
-
end
|
535
|
-
end
|
536
|
-
|
537
|
-
operation :destroy do
|
538
|
-
description "Delete a specified Network"
|
539
|
-
param :id, :string, :required
|
540
|
-
control do
|
541
|
-
Network.delete!(params[:id], self)
|
542
|
-
no_content_with_status(200)
|
543
|
-
end
|
544
|
-
end
|
545
|
-
|
546
|
-
end
|
547
|
-
|
548
|
-
global_collection :network_configurations do
|
549
|
-
description 'Network Configurations contain the set of configuration values representing the information needed to create a Network with certain characteristics'
|
550
|
-
|
551
|
-
operation :index do
|
552
|
-
description 'List all NetworkConfigurations'
|
553
|
-
param :CIMISelect, :string, :optional
|
554
|
-
control do
|
555
|
-
network_configurations = NetworkConfigurationCollection.default(self).filter_by(params[:CIMISelect])
|
556
|
-
respond_to do |format|
|
557
|
-
format.xml { network_configurations.to_xml }
|
558
|
-
format.json { network_configurations.to_json }
|
559
|
-
end
|
560
|
-
end
|
561
|
-
end
|
562
|
-
|
563
|
-
operation :show do
|
564
|
-
description 'Show a specific NetworkConfiguration'
|
565
|
-
param :id, :string, :required
|
566
|
-
control do
|
567
|
-
network_config = NetworkConfiguration.find(params[:id], self)
|
568
|
-
respond_to do
|
569
|
-
format.xml { network_config.to_xml }
|
570
|
-
format.json { network_config.to_json }
|
571
|
-
end
|
572
|
-
end
|
573
|
-
end
|
574
|
-
end
|
575
53
|
end
|