mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[brightbox] Make Cloud IP model's map nicer to use
* API accepts a load balancer or interface ID * Model accepts a Server and figures out a suitable interface
This commit is contained in:
parent
6fb4247c07
commit
bea5bfe80a
1 changed files with 10 additions and 2 deletions
|
@ -23,9 +23,17 @@ module Fog
|
|||
attribute :server_id, :aliases => "server", :squash => "id"
|
||||
attribute :load_balancer, :alias => "load_balancer", :squash => "id"
|
||||
|
||||
def map(interface_to_map)
|
||||
def map(destination)
|
||||
requires :identity
|
||||
connection.map_cloud_ip(identity, :interface => interface_to_map)
|
||||
case destination
|
||||
when Fog::Compute::Brightbox::Server
|
||||
final_destination = destination.interfaces.first["id"]
|
||||
when Fog::Compute::Brightbox::LoadBalancer
|
||||
final_destination = destination.id
|
||||
else
|
||||
final_destination = destination
|
||||
end
|
||||
connection.map_cloud_ip(identity, :destination => final_destination)
|
||||
end
|
||||
|
||||
def mapped?
|
||||
|
|
Loading…
Add table
Reference in a new issue