Class: Brightbox::CloudIP
- Inherits:
-
Api
- Object
- Api
- Brightbox::CloudIP
show all
- Defined in:
- lib/bbcloud/cloud_ips.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, #exists?, find, find_by_handle, find_or_call, #fog_model, #initialize, #method_missing, #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
7
8
9
|
# File 'lib/bbcloud/cloud_ips.rb', line 7
def self.all
conn.cloud_ips
end
|
.create ⇒ Object
11
12
13
14
15
16
17
18
|
# File 'lib/bbcloud/cloud_ips.rb', line 11
def self.create
r = conn.create_cloud_ip
new(r["id"])
rescue Excon::Errors::Forbidden => e
response = JSON.parse(e.response.body) rescue {}
response = response.fetch("error", {})
raise Forbidden, "#{response["details"]}: #{response["summary"]}"
end
|
.default_field_order ⇒ Object
38
39
40
|
# File 'lib/bbcloud/cloud_ips.rb', line 38
def self.default_field_order
[:id, :status, :public_ip, :destination, :reverse_dns]
end
|
.get(id) ⇒ Object
3
4
5
|
# File 'lib/bbcloud/cloud_ips.rb', line 3
def self.get id
conn.cloud_ips.get id
end
|
Instance Method Details
#<=>(b) ⇒ Object
42
43
44
|
# File 'lib/bbcloud/cloud_ips.rb', line 42
def <=>(b)
self.status <=> b.status
end
|
#attributes ⇒ Object
20
21
22
23
24
25
26
27
28
|
# File 'lib/bbcloud/cloud_ips.rb', line 20
def attributes
a = fog_model.attributes
if a["load_balancer"]
a[:destination] = a["load_balancer"]["id"]
else
a[:destination] = a[:server_id]
end
a
end
|
#mapped? ⇒ Boolean
34
35
36
|
# File 'lib/bbcloud/cloud_ips.rb', line 34
def mapped?
status == 'mapped'
end
|
#to_row ⇒ Object
30
31
32
|
# File 'lib/bbcloud/cloud_ips.rb', line 30
def to_row
attributes
end
|