Class: Brightbox::Volume
- Inherits:
-
Api
- Object
- Api
- Brightbox::Volume
show all
- Defined in:
- lib/brightbox-cli/volume.rb
Instance Attribute Summary
Attributes inherited from Api
#id
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Api
cache_all!, cached_get, conn, #created_on, #exists?, find, find_all_or_warn, find_by_handle, find_or_call, #fog_attributes, #fog_model, #initialize, klass_name, #method_missing, #respond_to_missing?, #to_row, #to_s
Constructor Details
This class inherits a constructor from Brightbox::Api
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Brightbox::Api
Class Method Details
.all ⇒ Object
5
6
7
|
# File 'lib/brightbox-cli/volume.rb', line 5
def self.all
conn.volumes
end
|
.create(options) ⇒ Object
9
10
11
|
# File 'lib/brightbox-cli/volume.rb', line 9
def self.create(options)
new(conn.volumes.create(options))
end
|
.default_field_order ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/brightbox-cli/volume.rb', line 17
def self.default_field_order
%i[
id
type
size
status
server
boot
name
]
end
|
.detailed_fields ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/brightbox-cli/volume.rb', line 29
def self.detailed_fields
%i[
id
name
description
type
size
status
created_at
encrypted
serial
locked
filesystem_label
filesystem_type
image
source
source_type
server
boot
delete_with_server
zone
]
end
|
.get(id) ⇒ Object
13
14
15
|
# File 'lib/brightbox-cli/volume.rb', line 13
def self.get(id)
conn.volumes.get(id)
end
|
.require_account? ⇒ Boolean
3
|
# File 'lib/brightbox-cli/volume.rb', line 3
def self.require_account?; true; end
|
Instance Method Details
#attach(server:, boot: false) ⇒ Object
53
54
55
56
57
|
# File 'lib/brightbox-cli/volume.rb', line 53
def attach(server:, boot: false)
self.class.conn.attach_volume(id, server: server, boot: boot)
reload
self
end
|
#attributes ⇒ Object
59
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/brightbox-cli/volume.rb', line 59
def attributes
super.merge(
id: fog_model.id,
image: image_id,
locked: locked?,
server: server_id,
status: state,
type: storage_type,
zone: zone_id
)
end
|
#update(options) ⇒ Object
71
72
73
74
75
|
# File 'lib/brightbox-cli/volume.rb', line 71
def update(options)
self.class.conn.update_volume(id, options)
reload
self
end
|