1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/hp/models/lb/algorithms.rb

26 lines
553 B
Ruby
Raw Normal View History

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
data = service.list_algorithms.body['algorithms']
2013-03-01 14:26:52 -06:00
load(data)
end
def get(name)
data = service.list_algorithms.body['algorithms']
algorithm = data.find {|algo| algo['name'] == name}
new(algorithm)
2013-03-01 14:26:52 -06:00
rescue Fog::HP::LB::NotFound
nil
end
end
end
end
end