2013-03-01 14:26:52 -06:00
|
|
|
require 'fog/core/collection'
|
2013-03-06 11:01:54 -06:00
|
|
|
require 'fog/hp/models/lb/algorithm'
|
2013-03-01 14:26:52 -06:00
|
|
|
|
|
|
|
module Fog
|
|
|
|
module HP
|
|
|
|
class LB
|
|
|
|
class Algorithms < Fog::Collection
|
2013-03-06 11:01:54 -06:00
|
|
|
model Fog::HP::LB::Algorithm
|
2013-03-01 14:26:52 -06:00
|
|
|
|
|
|
|
def all
|
2013-05-21 15:09:13 -06:00
|
|
|
data = service.list_algorithms.body['algorithms']
|
2013-03-01 14:26:52 -06:00
|
|
|
load(data)
|
|
|
|
end
|
|
|
|
|
2013-10-15 17:35:30 -04:00
|
|
|
def get(name)
|
|
|
|
data = service.list_algorithms.body['algorithms']
|
2014-05-23 02:40:43 +01:00
|
|
|
algorithm = data.find {|algo| algo['name'] == name}
|
2013-10-15 17:35:30 -04:00
|
|
|
new(algorithm)
|
2013-03-01 14:26:52 -06:00
|
|
|
rescue Fog::HP::LB::NotFound
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2013-05-21 15:09:13 -06:00
|
|
|
end
|