2012-11-27 19:57:16 -05:00
|
|
|
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]
|
2013-01-11 16:06:58 -05:00
|
|
|
@network = self.service.networks.new(network_address)
|
2012-11-27 19:57:16 -05:00
|
|
|
network_id = @network.href.match(/(\d+)$/)[1]
|
|
|
|
address_ip = network_address[:IpAddresses][:IpAddress]
|
2013-01-11 16:06:58 -05:00
|
|
|
@address = self.service.ip_addresses.new(
|
2012-11-27 19:57:16 -05:00
|
|
|
:href => "/cloudapi/ecloud/ipaddresses/networks/#{network_id}/#{address_ip}",
|
|
|
|
:name => address_ip
|
|
|
|
)
|
|
|
|
end
|
|
|
|
attr_reader :network
|
|
|
|
|
|
|
|
def address=(address); end
|
|
|
|
attr_reader :address
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|