deltacloud-client 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +11 -7
- data/bin/deltacloudc +9 -6
- data/lib/deltacloud.rb +412 -322
- data/lib/documentation.rb +97 -0
- data/lib/plain_formatter.rb +86 -0
- data/specs/instances_spec.rb +14 -14
- data/specs/realms_spec.rb +0 -2
- data/specs/spec_helper.rb +2 -5
- data/specs/storage_volume_spec.rb +2 -2
- metadata +20 -18
- data/credentials.yml +0 -2
- data/lib/dcloud/base_model.rb +0 -80
- data/lib/dcloud/hardware_profile.rb +0 -124
- data/lib/dcloud/image.rb +0 -56
- data/lib/dcloud/instance.rb +0 -142
- data/lib/dcloud/realm.rb +0 -57
- data/lib/dcloud/state.rb +0 -30
- data/lib/dcloud/storage_snapshot.rb +0 -59
- data/lib/dcloud/storage_volume.rb +0 -63
- data/lib/dcloud/transition.rb +0 -35
@@ -1,63 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (C) 2009 Red Hat, Inc.
|
3
|
-
#
|
4
|
-
# This library is free software; you can redistribute it and/or
|
5
|
-
# modify it under the terms of the GNU Lesser General Public
|
6
|
-
# License as published by the Free Software Foundation; either
|
7
|
-
# version 2.1 of the License, or (at your option) any later version.
|
8
|
-
#
|
9
|
-
# This library is distributed in the hope that it will be useful,
|
10
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
-
# Lesser General Public License for more details.
|
13
|
-
#
|
14
|
-
# You should have received a copy of the GNU Lesser General Public
|
15
|
-
# License along with this library; if not, write to the Free Software
|
16
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
|
-
|
18
|
-
require 'dcloud/base_model'
|
19
|
-
|
20
|
-
module DCloud
|
21
|
-
class StorageVolume < BaseModel
|
22
|
-
|
23
|
-
xml_tag_name :storage_volume
|
24
|
-
|
25
|
-
attribute :created
|
26
|
-
attribute :state
|
27
|
-
attribute :capacity
|
28
|
-
attribute :device
|
29
|
-
attribute :instance
|
30
|
-
|
31
|
-
def initialize(client, uri, xml=nil)
|
32
|
-
super( client, uri, xml )
|
33
|
-
end
|
34
|
-
|
35
|
-
def to_plain
|
36
|
-
sprintf("%-10s | %15s GB | %-10s | %-10s | %-15s",
|
37
|
-
self.id[0,10],
|
38
|
-
self.capacity ? self.capacity.to_s[0,15] : 'unknown',
|
39
|
-
self.device ? self.device[0,10] : 'unknown',
|
40
|
-
self.state ? self.state[0,10] : 'unknown',
|
41
|
-
self.instance ? self.instance.name[0,15] : 'unknown'
|
42
|
-
)
|
43
|
-
end
|
44
|
-
|
45
|
-
def load_payload(xml=nil)
|
46
|
-
super(xml)
|
47
|
-
unless xml.nil?
|
48
|
-
@created = xml.text( 'created' )
|
49
|
-
@state = xml.text( 'state' )
|
50
|
-
@capacity = xml.text( 'capacity' ).to_f
|
51
|
-
@device = xml.text( 'device' )
|
52
|
-
instances = xml.get_elements( 'instance' )
|
53
|
-
if ( ! instances.empty? )
|
54
|
-
instance = instances.first
|
55
|
-
instance_href = instance.attributes['href']
|
56
|
-
if ( instance_href )
|
57
|
-
@instance = Instance.new( @client, instance_href )
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
data/lib/dcloud/transition.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (C) 2009 Red Hat, Inc.
|
3
|
-
#
|
4
|
-
# This library is free software; you can redistribute it and/or
|
5
|
-
# modify it under the terms of the GNU Lesser General Public
|
6
|
-
# License as published by the Free Software Foundation; either
|
7
|
-
# version 2.1 of the License, or (at your option) any later version.
|
8
|
-
#
|
9
|
-
# This library is distributed in the hope that it will be useful,
|
10
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
-
# Lesser General Public License for more details.
|
13
|
-
#
|
14
|
-
# You should have received a copy of the GNU Lesser General Public
|
15
|
-
# License along with this library; if not, write to the Free Software
|
16
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
|
-
|
18
|
-
|
19
|
-
module DCloud
|
20
|
-
class Transition
|
21
|
-
|
22
|
-
attr_accessor :to
|
23
|
-
attr_accessor :action
|
24
|
-
|
25
|
-
def initialize(to, action)
|
26
|
-
@to = to
|
27
|
-
@action = action
|
28
|
-
end
|
29
|
-
|
30
|
-
def auto?()
|
31
|
-
@action.nil?
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
35
|
-
end
|