deltacloud-client 1.0.0 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/Rakefile +6 -46
  2. data/lib/base_object.rb +1 -1
  3. data/lib/client_bucket_methods.rb +2 -2
  4. data/lib/deltacloud.rb +8 -7
  5. metadata +81 -127
  6. data/bin/deltacloudc +0 -243
  7. data/lib/plain_formatter.rb +0 -145
  8. data/specs/buckets_spec.rb +0 -148
  9. data/specs/content_spec.rb +0 -137
  10. data/specs/data/images/img1.yml +0 -4
  11. data/specs/data/images/img2.yml +0 -4
  12. data/specs/data/images/img3.yml +0 -4
  13. data/specs/data/instances/inst0.yml +0 -16
  14. data/specs/data/instances/inst1.yml +0 -9
  15. data/specs/data/instances/inst2.yml +0 -9
  16. data/specs/data/storage_snapshots/snap1.yml +0 -4
  17. data/specs/data/storage_snapshots/snap2.yml +0 -4
  18. data/specs/data/storage_snapshots/snap3.yml +0 -4
  19. data/specs/data/storage_volumes/vol1.yml +0 -7
  20. data/specs/data/storage_volumes/vol2.yml +0 -7
  21. data/specs/data/storage_volumes/vol3.yml +0 -7
  22. data/specs/errors_spec.rb +0 -59
  23. data/specs/fixtures/images/img1.yml +0 -4
  24. data/specs/fixtures/images/img2.yml +0 -4
  25. data/specs/fixtures/images/img3.yml +0 -4
  26. data/specs/fixtures/instances/inst0.yml +0 -16
  27. data/specs/fixtures/instances/inst1.yml +0 -9
  28. data/specs/fixtures/instances/inst2.yml +0 -9
  29. data/specs/fixtures/storage_snapshots/snap1.yml +0 -4
  30. data/specs/fixtures/storage_snapshots/snap2.yml +0 -4
  31. data/specs/fixtures/storage_snapshots/snap3.yml +0 -4
  32. data/specs/fixtures/storage_volumes/vol1.yml +0 -7
  33. data/specs/fixtures/storage_volumes/vol2.yml +0 -7
  34. data/specs/fixtures/storage_volumes/vol3.yml +0 -7
  35. data/specs/hardware_profiles_spec.rb +0 -80
  36. data/specs/images_spec.rb +0 -107
  37. data/specs/initialization_spec.rb +0 -64
  38. data/specs/instance_states_spec.rb +0 -80
  39. data/specs/instances_spec.rb +0 -210
  40. data/specs/keys_spec.rb +0 -97
  41. data/specs/realms_spec.rb +0 -66
  42. data/specs/shared/resources.rb +0 -30
  43. data/specs/spec_helper.rb +0 -53
  44. data/specs/storage_snapshot_spec.rb +0 -81
  45. data/specs/storage_volume_spec.rb +0 -91
data/specs/realms_spec.rb DELETED
@@ -1,66 +0,0 @@
1
- #
2
- # Copyright (C) 2009 Red Hat, Inc.
3
- #
4
- # Licensed to the Apache Software Foundation (ASF) under one or more
5
- # contributor license agreements. See the NOTICE file distributed with
6
- # this work for additional information regarding copyright ownership. The
7
- # ASF licenses this file to you under the Apache License, Version 2.0 (the
8
- # "License"); you may not use this file except in compliance with the
9
- # License. You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15
- # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16
- # License for the specific language governing permissions and limitations
17
- # under the License.
18
-
19
- require 'specs/spec_helper'
20
-
21
- describe "realms" do
22
-
23
- it_should_behave_like "all resources"
24
-
25
- it "should allow retrieval of all realms" do
26
- [API_URL, API_URL_REDIRECT].each do |entry_point|
27
- DeltaCloud.new( API_NAME, API_PASSWORD, entry_point ) do |client|
28
- realms = client.realms
29
- realms.should_not be_empty
30
- realms.each do |realm|
31
- realm.uri.should_not be_nil
32
- realm.uri.should be_a(String)
33
- realm.id.should_not be_nil
34
- realm.id.should be_a(String)
35
- realm.name.should_not be_nil
36
- realm.name.should be_a(String)
37
- end
38
- end
39
- end
40
- end
41
-
42
-
43
- it "should allow fetching a realm by id" do
44
- DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
45
- realm = client.realm( 'us' )
46
- realm.should_not be_nil
47
- realm.id.should eql( 'us' )
48
- realm.name.should eql( 'United States' )
49
- realm.state.should eql( 'AVAILABLE' )
50
- realm = client.realm( 'eu' )
51
- realm.should_not be_nil
52
- realm.id.should eql( 'eu' )
53
- realm.name.should eql( 'Europe' )
54
- realm.state.should eql( 'AVAILABLE' )
55
- end
56
- end
57
-
58
- it "should allow fetching a realm by URI" do
59
- DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
60
- realm = client.fetch_realm( API_URL + '/realms/us' )
61
- realm.should_not be_nil
62
- realm.id.should eql( 'us' )
63
- end
64
- end
65
-
66
- end
@@ -1,30 +0,0 @@
1
- #
2
- # Copyright (C) 2009 Red Hat, Inc.
3
- #
4
- # Licensed to the Apache Software Foundation (ASF) under one or more
5
- # contributor license agreements. See the NOTICE file distributed with
6
- # this work for additional information regarding copyright ownership. The
7
- # ASF licenses this file to you under the Apache License, Version 2.0 (the
8
- # "License"); you may not use this file except in compliance with the
9
- # License. You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15
- # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16
- # License for the specific language governing permissions and limitations
17
- # under the License.
18
-
19
-
20
- shared_examples_for "all resources" do
21
-
22
- before(:each) do
23
- reload_fixtures
24
- end
25
-
26
- after(:each) do
27
- #clean_fixtures
28
- end
29
-
30
- end
data/specs/spec_helper.rb DELETED
@@ -1,53 +0,0 @@
1
- #
2
- # Copyright (C) 2009 Red Hat, Inc.
3
- #
4
- # Licensed to the Apache Software Foundation (ASF) under one or more
5
- # contributor license agreements. See the NOTICE file distributed with
6
- # this work for additional information regarding copyright ownership. The
7
- # ASF licenses this file to you under the Apache License, Version 2.0 (the
8
- # "License"); you may not use this file except in compliance with the
9
- # License. You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15
- # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16
- # License for the specific language governing permissions and limitations
17
- # under the License.
18
-
19
- require 'rubygems'
20
- require 'yaml'
21
- require 'fileutils'
22
-
23
- api_host = ENV['API_HOST']
24
- ( api_host = 'localhost' ) if api_host.nil?
25
- ( api_host = 'localhost' ) if api_host == ''
26
-
27
- api_port = ENV['API_PORT']
28
- ( api_port = 3001 ) if api_port.nil?
29
- ( api_port = 3001 ) if api_port == ''
30
-
31
- API_HOST = api_host
32
- API_PORT = api_port
33
- API_PATH = '/api'
34
-
35
- API_URL = "http://#{API_HOST}:#{API_PORT}#{API_PATH}"
36
- API_URL_REDIRECT = "http://#{API_HOST}:#{API_PORT}"
37
- API_NAME = 'mockuser'
38
- API_PASSWORD = 'mockpassword'
39
-
40
- $: << File.dirname( __FILE__ ) + '/../lib'
41
- require 'deltacloud'
42
-
43
- def clean_fixtures
44
- FileUtils.rm_rf( File.dirname( __FILE__ ) + '/data' )
45
- end
46
-
47
- def reload_fixtures
48
- clean_fixtures
49
- FileUtils.cp_r( File.dirname( __FILE__) + '/fixtures', File.dirname( __FILE__ ) + '/data' )
50
- end
51
-
52
- $: << File.dirname( __FILE__ )
53
- require 'shared/resources'
@@ -1,81 +0,0 @@
1
- #
2
- # Copyright (C) 2009 Red Hat, Inc.
3
- #
4
- # Licensed to the Apache Software Foundation (ASF) under one or more
5
- # contributor license agreements. See the NOTICE file distributed with
6
- # this work for additional information regarding copyright ownership. The
7
- # ASF licenses this file to you under the Apache License, Version 2.0 (the
8
- # "License"); you may not use this file except in compliance with the
9
- # License. You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15
- # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16
- # License for the specific language governing permissions and limitations
17
- # under the License.
18
-
19
-
20
- require 'specs/spec_helper'
21
-
22
- describe "storage snapshot" do
23
-
24
- it_should_behave_like "all resources"
25
-
26
- it "allow retrieval of all storage volumes owned by the current user" do
27
- [API_URL, API_URL_REDIRECT].each do |entry_point|
28
- client = DeltaCloud.new( API_NAME, API_PASSWORD, entry_point )
29
- client.connect do |client|
30
- storage_snapshots = client.storage_snapshots
31
- storage_snapshots.should_not be_nil
32
- storage_snapshots.should_not be_empty
33
- ids = storage_snapshots.collect{|e| e.id}
34
- ids.size.should eql( 3 )
35
- ids.should include( 'snap2' )
36
- ids.should include( 'snap3' )
37
- end
38
- end
39
- end
40
-
41
- it "should allow fetching of storage volume by id" do
42
- client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
43
- client.connect do |client|
44
- storage_snapshot = client.storage_snapshot( 'snap2' )
45
- storage_snapshot.should_not be_nil
46
- storage_snapshot.id.should eql( 'snap2' )
47
- storage_snapshot.storage_volume.capacity.should eql( 1.0 )
48
- storage_snapshot.storage_volume.id.should eql( 'vol2' )
49
- end
50
- end
51
-
52
- it "should allow fetching of storage volume by URI" do
53
- client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
54
- client.connect do |client|
55
- storage_snapshot = client.fetch_storage_snapshot( API_URL + '/storage_snapshots/snap2' )
56
- storage_snapshot.should_not be_nil
57
- storage_snapshot.id.should eql( 'snap2' )
58
- storage_snapshot.storage_volume.capacity.should eql( 1.0 )
59
- storage_snapshot.storage_volume.id.should eql( 'vol2' )
60
- end
61
- end
62
-
63
- it "should return nil for unknown storage volume by ID" do
64
- client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
65
- lambda {
66
- client.connect do |client|
67
- client.storage_snapshot( "bogus" )
68
- end
69
- }.should raise_error(DeltaCloud::HTTPError::NotFound)
70
- end
71
-
72
- it "should return nil for unknown storage volume by URI" do
73
- client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
74
- lambda {
75
- client.connect do |client|
76
- client.fetch_storage_snapshot( API_URL + '/storage_snapshots/bogus' )
77
- end
78
- }.should raise_error(DeltaCloud::HTTPError::NotFound)
79
- end
80
-
81
- end
@@ -1,91 +0,0 @@
1
- #
2
- # Copyright (C) 2009 Red Hat, Inc.
3
- #
4
- # Licensed to the Apache Software Foundation (ASF) under one or more
5
- # contributor license agreements. See the NOTICE file distributed with
6
- # this work for additional information regarding copyright ownership. The
7
- # ASF licenses this file to you under the Apache License, Version 2.0 (the
8
- # "License"); you may not use this file except in compliance with the
9
- # License. You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15
- # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16
- # License for the specific language governing permissions and limitations
17
- # under the License.
18
-
19
-
20
- require 'specs/spec_helper'
21
-
22
- describe "storage volumes" do
23
-
24
- it_should_behave_like "all resources"
25
-
26
- it "allow retrieval of all storage volumes owned by the current user" do
27
- [API_URL, API_URL_REDIRECT].each do |entry_point|
28
- client = DeltaCloud.new( API_NAME, API_PASSWORD, entry_point )
29
- client.connect do |client|
30
- storage_volumes = client.storage_volumes
31
- storage_volumes.should_not be_nil
32
- storage_volumes.should_not be_empty
33
- ids = storage_volumes.collect{|e| e.id}
34
- ids.size.should eql( 3 )
35
- ids.should include( 'vol2' )
36
- ids.should include( 'vol3' )
37
- end
38
- end
39
- end
40
-
41
- it "should allow fetching of storage volume by id" do
42
- client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
43
- client.connect do |client|
44
- storage_volume = client.storage_volume( 'vol3' )
45
- storage_volume.id.should eql( 'vol3' )
46
- storage_volume.uri.should eql( API_URL + '/storage_volumes/vol3' )
47
- storage_volume.capacity.should eql( 1.0 )
48
- storage_volume.device.should eql( '/dev/sda1' )
49
- storage_volume.instance.should_not be_nil
50
- storage_volume.instance.id.should eql( 'inst1' )
51
- ip = storage_volume.instance
52
- ip.hardware_profile.architecture.value.should eql( 'i386' )
53
- end
54
- end
55
-
56
- it "should allow fetching of storage volume by URI" do
57
- client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
58
- client.connect do |client|
59
- storage_volume = client.fetch_storage_volume( API_URL + '/storage_volumes/vol3' )
60
- storage_volume.should_not be_nil
61
- storage_volume.id.should eql( 'vol3' )
62
- storage_volume.uri.should eql( API_URL + '/storage_volumes/vol3' )
63
- storage_volume.capacity.should eql( 1.0 )
64
- storage_volume.device.should eql( '/dev/sda1' )
65
- storage_volume.instance.should_not be_nil
66
- storage_volume.instance.id.should eql( 'inst1' )
67
- ip = storage_volume.instance
68
- ip.hardware_profile.architecture.value.should eql( 'i386' )
69
- end
70
- end
71
-
72
- it "should raise exception for unknown storage volume by ID" do
73
- client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
74
- lambda {
75
- client.connect do |client|
76
- client.storage_volume( 'bogus' )
77
- end
78
- }.should raise_error(DeltaCloud::HTTPError::NotFound)
79
- end
80
-
81
- it "should raise exception for unknown storage volume by URI" do
82
- client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
83
- lambda {
84
- client.connect do |client|
85
- client.fetch_storage_volume( API_URL + '/storage_volumes/bogus' )
86
- end
87
- }.should raise_error(DeltaCloud::HTTPError::NotFound)
88
- end
89
-
90
-
91
- end