2011-03-01 16:37:27 -05:00
|
|
|
require 'fog/core/model'
|
|
|
|
|
|
|
|
module Fog
|
2011-06-16 19:28:54 -04:00
|
|
|
module Compute
|
|
|
|
class Linode
|
2011-03-01 16:37:27 -05:00
|
|
|
class Ip < Fog::Model
|
|
|
|
identity :id
|
|
|
|
attribute :ip
|
|
|
|
attribute :public
|
2011-03-07 16:05:20 -05:00
|
|
|
|
|
|
|
def save
|
|
|
|
requires :server
|
|
|
|
raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if identity
|
|
|
|
|
|
|
|
connection.linode_ip_addprivate server.id
|
|
|
|
server.ips.all.find { |ip| !ip.public }
|
|
|
|
end
|
|
|
|
|
|
|
|
def server
|
|
|
|
@server
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
def server=(server)
|
|
|
|
@server = server
|
|
|
|
end
|
2011-03-01 16:37:27 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|