mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Merge remote-tracking branch 'justinbarry/rackspace_ssl_termination' into rackspace_ssl_termination
This commit is contained in:
commit
94e4bcb4f7
5 changed files with 59 additions and 0 deletions
|
@ -29,6 +29,8 @@ module Fog
|
|||
model :access_rule
|
||||
|
||||
request_path 'fog/rackspace/requests/load_balancers'
|
||||
request :get_ssl_termination
|
||||
request :set_ssl_termination
|
||||
request :create_load_balancer
|
||||
request :get_load_balancer
|
||||
request :list_load_balancers
|
||||
|
|
|
@ -27,6 +27,7 @@ module Fog
|
|||
attribute :name
|
||||
attribute :state, :aliases => 'status'
|
||||
attribute :nodes
|
||||
attribute :ssl_termination, :aliases => 'ssltermination'
|
||||
|
||||
def initialize(attributes)
|
||||
#HACK - Since we are hacking how sub-collections work, we have to make sure the connection is valid first.
|
||||
|
@ -58,6 +59,17 @@ module Fog
|
|||
nodes.load(new_nodes)
|
||||
end
|
||||
|
||||
def ssl_termination
|
||||
requires :identity
|
||||
ssl_termination = connection.get_ssl_termination(identity)
|
||||
(ssl_termination.status == 404) ? nil : ssl_termination.body["sslTermination"]
|
||||
end
|
||||
|
||||
def enable_ssl_termination(securePort, privatekey, certificate, enabled=true, secureTrafficOnly=false)
|
||||
requires :identity
|
||||
connection.set_ssl_termination(identity, securePort, privatekey, certificate, enabled, secureTrafficOnly)
|
||||
end
|
||||
|
||||
def virtual_ips
|
||||
@virtual_ips ||= begin
|
||||
Fog::Rackspace::LoadBalancers::VirtualIps.new({
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
module Fog
|
||||
module Rackspace
|
||||
class LoadBalancers
|
||||
class Real
|
||||
def get_ssl_termination(load_balancer_id)
|
||||
request(
|
||||
:expects => [200,404],
|
||||
:path => "loadbalancers/#{load_balancer_id}/ssltermination",
|
||||
:method => 'GET'
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,22 @@
|
|||
module Fog
|
||||
module Rackspace
|
||||
class LoadBalancers
|
||||
class Real
|
||||
def set_ssl_termination(load_balancer_id, securePort, privatekey, certificate, enabled, secureTrafficOnly)
|
||||
data = {
|
||||
securePort: securePort,
|
||||
privatekey: privatekey,
|
||||
certificate: certificate,
|
||||
#intermediatecertificate: intermediatecertificate
|
||||
}
|
||||
request(
|
||||
:body => MultiJson.encode(data),
|
||||
:expects => [202,404],
|
||||
:path => "loadbalancers/#{load_balancer_id}/ssltermination",
|
||||
:method => 'PUT'
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -47,6 +47,14 @@ Shindo.tests('Fog::Rackspace::LoadBalancers | load_balancer_tests', ['rackspace'
|
|||
@service.update_load_balancer(@lb_id, { :port => 80 }).body
|
||||
end
|
||||
|
||||
tests("#ssl_termination(#{@lb_id})").succeeds do
|
||||
@service.ssl_termination(@lb_id).body
|
||||
end
|
||||
|
||||
tests("#enable_ssl_termination(#{@lb_id})").succeeds do
|
||||
@service.enable_ssl_termination(@lb_id, "443", "private", "public", true, false).body
|
||||
end
|
||||
|
||||
until @service.get_load_balancer(@lb_id).body["loadBalancer"]["status"] == STATUS_ACTIVE
|
||||
sleep 10
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue