1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/ecloud/models/compute/virtual_machine_assigned_ip.rb
Todd Willey 4ffab4b18f [ecloud|compute] Replace /cloudapi/ecloud with a configurable path.
This is so the Live Specification can be accessed, which is expecially
helpful in learning the ins and outs of Verizon's Enterprise Cloud. The
Live Specification is available at /cloudapi/spec, and the hardcoded
paths were hindering using it.
2013-10-29 01:09:04 -04:00

32 lines
880 B
Ruby

module Fog
module Compute
class Ecloud
class VirtualMachineAssignedIp < Fog::Ecloud::Model
identity :href
attribute :network, :aliases => :Networks
attribute :address
def id
href.scan(/\d+/)[0]
end
def network=(network)
network = network.dup
network_address = network[:Network]
@network = self.service.networks.new(network_address)
network_id = @network.href.match(/(\d+)$/)[1]
address_ip = network_address[:IpAddresses][:IpAddress]
@address = self.service.ip_addresses.new(
:href => "#{service.base_path}/ipaddresses/networks/#{network_id}/#{address_ip}",
:name => address_ip
)
end
attr_reader :network
def address=(address); end
attr_reader :address
end
end
end
end