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.
@@ -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
@@ -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