1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

added to bin for provider

This commit is contained in:
Mike Hagedorn 2013-03-01 14:26:52 -06:00 committed by Rupak Ganguly
parent a5e67616ea
commit 1f16149748
15 changed files with 306 additions and 0 deletions

View file

@ -3,6 +3,8 @@ class HP < Fog::Bin
def class_for(key)
case key
when :dns
Fog::HP::DNS
when :block_storage
Fog::HP::BlockStorage
when :cdn
@ -19,6 +21,8 @@ class HP < Fog::Bin
def [](service)
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :dns
Fog::HP::DNS.new
when :block_storage
Fog::HP::BlockStorage.new
when :cdn

View file

@ -0,0 +1,14 @@
require 'fog/core/model'
module Fog
module HP
class LB
class Algorithm
identity :name
end
end
end
end

View file

@ -0,0 +1,25 @@
require 'fog/core/collection'
require 'lib/fog/hp/models/lb/algorithm'
module Fog
module HP
class LB
class Algorithms < Fog::Collection
model Fog::HP::LB::Algorithms
def all
data = connection.list_algorithms.body['algorithms']
load(data)
end
def get(record_id)
record = connection.get_algorithm_details(record_id).body['algorithm']
new(record)
rescue Fog::HP::LB::NotFound
nil
end
end
end
end
end

View file

@ -0,0 +1,17 @@
require 'fog/core/model'
module Fog
module HP
class LB
class Limit
identity :id
attribute :max_load_balancer_name_length, :aliases => 'maxLoadBalancerNameLength'
attribute :max_load_balancers, :aliases => 'maxLoadBalancers'
attribute :max_nodes_per_load_balancer, :aliases => 'maxNodesPerLoadBalancer'
attribute :max_vips_per_load_balancer, :aliases => 'maxVIPsPerLoadBalancer'
end
end
end
end

View file

@ -0,0 +1,32 @@
require 'fog/core/collection'
require 'lib/fog/hp/models/lb/load_balancer'
module Fog
module HP
class LB
class Limits < Fog::Collection
model Fog::HP::LB::Limit
#{
# "limits" : {
# "absolute" : {
# "values" : {
# "maxLoadBalancerNameLength" : 128,
# "maxLoadBalancers" : 20,
# "maxNodesPerLoadBalancer" : 5,
# "maxVIPsPerLoadBalancer" : 1
#}
#}
#}
#}
def all
data = connection.list_load_limits.body['limits']['absolute']['values']
load(data)
end
end
end
end
end

View file

@ -0,0 +1,28 @@
require 'fog/core/model'
module Fog
module HP
class LB
#"name" : "lb-site1",
# "id" : "71",
# "protocol" : "HTTP",
# "port" : "80",
# "algorithm" : "LEAST_CONNECTIONS",
# "status" : "ACTIVE",
# "created" : "2010-11-30T03:23:42Z",
# "updated" : "2010-11-30T03:23:44Z"
class LoadBalancer
identity :id
attribute :name
attribute :protocol
attribute :port
attribute :algorithm
attribute :status
attribute :created_at, :aliases => 'created'
attribute :updated_at , :aliases => 'updated'
end
end
end
end

View file

@ -0,0 +1,25 @@
require 'fog/core/collection'
require 'lib/fog/hp/models/lb/load_balancer'
module Fog
module HP
class LB
class LoadBalancers < Fog::Collection
model Fog::HP::LB::LoadBalancer
def all
data = connection.list_load_balancers.body['load_balancers']
load(data)
end
def get(record_id)
record = connection.get_load_balancer_details(record_id).body['load_balancer']
new(record)
rescue Fog::HP::LB::NotFound
nil
end
end
end
end
end

View file

@ -0,0 +1,18 @@
require 'fog/core/model'
module Fog
module HP
class LB
class Node
identity :id
attribute :address
attribute :port
attribute :condition
attribute :status
end
end
end
end

View file

@ -0,0 +1,25 @@
require 'fog/core/collection'
require 'lib/fog/hp/models/lb/node'
module Fog
module HP
class LB
class Nodes < Fog::Collection
model Fog::HP::LB::Node
def all
data = connection.list_nodes.body['nodes']
load(data)
end
def get(record_id)
record = connection.get_node_details(record_id).body['node']
new(record)
rescue Fog::HP::LB::NotFound
nil
end
end
end
end
end

View file

@ -0,0 +1,12 @@
require 'fog/core/model'
module Fog
module HP
class LB
class Protocol
identifier :name
attribute :port
end
end
end
end

View file

@ -0,0 +1,25 @@
require 'fog/core/collection'
require 'lib/fog/hp/models/lb/protocol'
module Fog
module HP
class LB
class Protocols < Fog::Collection
model Fog::HP::LB::Protocol
def all
data = connection.list_protocols.body['protocols']
load(data)
end
def get(record_id)
record = connection.get_protocol_details(record_id).body['protocol']
new(record)
rescue Fog::HP::LB::NotFound
nil
end
end
end
end
end

View file

@ -0,0 +1,15 @@
require 'fog/core/model'
module Fog
module HP
class LB
class Version
identity :id
attribute :status
attribute :updated_at, :alias => "updated"
end
end
end
end

View file

@ -0,0 +1,25 @@
require 'fog/core/collection'
require 'lib/fog/hp/models/lb/version'
module Fog
module HP
class LB
class Versions < Fog::Collection
model Fog::HP::LB::Version
def all
data = connection.list_versions.body['versions']
load(data)
end
def get(record_id)
record = connection.get_versions(record_id).body['version']
new(record)
rescue Fog::HP::LB::NotFound
nil
end
end
end
end
end

View file

@ -0,0 +1,16 @@
require 'fog/core/model'
module Fog
module HP
class LB
class VirtualIp
identity :id
attribute :address ,
"type" : "PUBLIC",
"ipVersion" : "IPV4"
end
end
end
end

View file

@ -0,0 +1,25 @@
require 'fog/core/collection'
require 'lib/fog/hp/models/lb/virtual_ip'
module Fog
module HP
class LB
class VirtualIps < Fog::Collection
model Fog::HP::LB::VirtualIp
def all
data = connection.list_virtual_ips.body['virtual_ips']
load(data)
end
def get(record_id)
record = connection.get_virtual_ip_details(record_id).body['virtual_ip']
new(record)
rescue Fog::HP::LB::NotFound
nil
end
end
end
end
end