2010-09-08 13:56:38 -04:00
|
|
|
module Fog
|
2011-06-16 19:28:54 -04:00
|
|
|
module Compute
|
|
|
|
class Linode
|
2010-09-08 13:56:38 -04:00
|
|
|
class Real
|
2011-05-24 18:02:59 -04:00
|
|
|
|
|
|
|
# Get available plans
|
|
|
|
#
|
|
|
|
# ==== Parameters
|
|
|
|
# * linodeplanId<~Integer>: id to limit results to
|
|
|
|
#
|
|
|
|
# ==== Returns
|
|
|
|
# * response<~Excon::Response>:
|
|
|
|
# * body<~Array>:
|
|
|
|
# TODO: docs
|
2010-10-13 20:54:14 -04:00
|
|
|
def avail_linodeplans(linodeplan_id = nil)
|
2010-09-08 13:56:38 -04:00
|
|
|
options = {}
|
|
|
|
if linodeplan_id
|
|
|
|
options.merge!(:planId => linodeplan_id)
|
|
|
|
end
|
2011-03-01 11:10:59 -05:00
|
|
|
result = request(
|
2010-09-08 13:56:38 -04:00
|
|
|
:expects => 200,
|
|
|
|
:method => 'GET',
|
|
|
|
:query => { :api_action => 'avail.linodeplans' }.merge!(options)
|
|
|
|
)
|
2011-03-01 11:10:59 -05:00
|
|
|
|
|
|
|
#hack for plans not filtering by id like they should above, remove when they fix it.
|
|
|
|
result.body["DATA"] = result.body["DATA"].select { |item| item['PLANID'] == linodeplan_id } if linodeplan_id
|
|
|
|
result
|
2010-09-08 13:56:38 -04:00
|
|
|
end
|
2011-06-16 19:28:54 -04:00
|
|
|
|
2010-09-08 13:56:38 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|