2011-08-10 09:03:51 -04:00
|
|
|
require 'fog/core/model'
|
|
|
|
|
|
|
|
module Fog
|
2013-02-01 08:36:57 -05:00
|
|
|
module Compute
|
|
|
|
class Glesys
|
2011-08-10 09:03:51 -04:00
|
|
|
|
|
|
|
class Ip < Fog::Model
|
2013-02-01 08:36:57 -05:00
|
|
|
|
2011-08-10 09:03:51 -04:00
|
|
|
extend Fog::Deprecation
|
|
|
|
|
2013-02-01 08:41:45 -05:00
|
|
|
identity :ip
|
2011-08-10 09:03:51 -04:00
|
|
|
|
2013-02-01 08:41:45 -05:00
|
|
|
attribute :ip, :aliases => "ipaddress"
|
2011-08-10 09:03:51 -04:00
|
|
|
attribute :datacenter
|
2013-02-01 08:41:45 -05:00
|
|
|
attribute :version, :aliases => "ipversion"
|
2011-08-10 09:03:51 -04:00
|
|
|
attribute :platform
|
2013-02-01 08:41:45 -05:00
|
|
|
attribute :netmask
|
|
|
|
attribute :broadcast
|
|
|
|
attribute :gateway
|
|
|
|
attribute :nameservers
|
|
|
|
attribute :serverid
|
|
|
|
attribute :reserved
|
|
|
|
attribute :ptr
|
|
|
|
attribute :cost
|
2011-08-10 09:03:51 -04:00
|
|
|
|
|
|
|
def list_own
|
2012-12-22 18:27:08 -05:00
|
|
|
service.list_own
|
2011-08-10 09:03:51 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def list_free
|
|
|
|
requires :version, :datacenter, :platform
|
2012-12-22 18:27:08 -05:00
|
|
|
service.ip_list_free(
|
2011-08-10 09:03:51 -04:00
|
|
|
:ipversion => version,
|
|
|
|
:platform => platform,
|
|
|
|
:datacenter => datacenter
|
|
|
|
).body['response']['iplist']
|
|
|
|
end
|
|
|
|
|
|
|
|
def details
|
|
|
|
requires :version, :ip
|
2012-12-22 18:27:08 -05:00
|
|
|
service.ip_details(
|
2011-08-10 09:03:51 -04:00
|
|
|
:ipversion => version,
|
|
|
|
:ipaddress => ip
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def take
|
|
|
|
requires :version, :ip
|
2012-12-22 18:27:08 -05:00
|
|
|
service.ip_take(
|
2011-08-10 09:03:51 -04:00
|
|
|
:ipversion => version,
|
|
|
|
:ipaddress => ip
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def release
|
|
|
|
requires :version, :ip
|
2012-12-22 18:27:08 -05:00
|
|
|
service.ip_release(
|
2011-08-10 09:03:51 -04:00
|
|
|
:ipversion => version,
|
|
|
|
:ipaddress => ip
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def add
|
|
|
|
requires :serverid, :version, :ip
|
2012-12-22 18:27:08 -05:00
|
|
|
service.ip_add(
|
2011-08-10 09:03:51 -04:00
|
|
|
:serverid => serverid,
|
|
|
|
:ipversion => version,
|
|
|
|
:ipaddress => ip
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def remove
|
|
|
|
requires :serverid, :version, :ip
|
2012-12-22 18:27:08 -05:00
|
|
|
service.ip_remove(
|
2011-08-10 09:03:51 -04:00
|
|
|
:serverid => serverid,
|
|
|
|
:ipversion => version,
|
|
|
|
:ipaddress => ip
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|