-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[rackspace|lb] added error page requests
- Loading branch information
1 parent
9c3bf8e
commit 87778f5
Showing
6 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
lib/fog/rackspace/requests/load_balancers/get_error_page.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module Fog | ||
module Rackspace | ||
class LoadBalancers | ||
class Real | ||
def get_error_page(load_balancer_id) | ||
request( | ||
:expects => 200, | ||
:path => "loadbalancers/#{load_balancer_id}/errorpage", | ||
:method => 'GET' | ||
) | ||
end | ||
end | ||
end | ||
end | ||
end |
15 changes: 15 additions & 0 deletions
15
lib/fog/rackspace/requests/load_balancers/remove_error_page.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module Fog | ||
module Rackspace | ||
class LoadBalancers | ||
class Real | ||
def remove_error_page(load_balancer_id) | ||
request( | ||
:expects => [200, 202], | ||
:path => "loadbalancers/#{load_balancer_id}/errorpage", | ||
:method => 'DELETE' | ||
) | ||
end | ||
end | ||
end | ||
end | ||
end |
21 changes: 21 additions & 0 deletions
21
lib/fog/rackspace/requests/load_balancers/set_error_page.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module Fog | ||
module Rackspace | ||
class LoadBalancers | ||
class Real | ||
def set_error_page(load_balancer_id, content) | ||
data = { | ||
'errorpage' => { | ||
'content' => content | ||
} | ||
} | ||
request( | ||
:body => MultiJson.encode(data), | ||
:expects => [200, 202], | ||
:path => "loadbalancers/#{load_balancer_id}/errorpage", | ||
:method => 'PUT' | ||
) | ||
end | ||
end | ||
end | ||
end | ||
end |
31 changes: 31 additions & 0 deletions
31
tests/rackspace/requests/load_balancers/error_page_tests.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Shindo.tests('Fog::Rackspace::LoadBalancers | error_page', ['rackspace', 'loadbalancers']) do | ||
|
||
pending if Fog.mocking? | ||
|
||
given_a_load_balancer_service do | ||
given_a_load_balancer do | ||
tests('success') do | ||
|
||
@lb.wait_for { ready? } | ||
tests("#get_error_page(#{@lb.id})").formats(ERROR_PAGE_FORMAT) do | ||
@service.get_error_page(@lb.id).body | ||
end | ||
|
||
@lb.wait_for { ready? } | ||
tests("#set_error_page(#{@lb.id}, '<html><body>hi!</body></html>')").succeeds do | ||
@service.set_error_page(@lb.id, '<html><body>hi!</body></html>') | ||
end | ||
|
||
@lb.wait_for { ready? } | ||
tests("#get_error_page(#{@lb.id})").formats(ERROR_PAGE_FORMAT) do | ||
@service.get_error_page(@lb.id).body | ||
end | ||
|
||
@lb.wait_for { ready? } | ||
tests("#remove_error_page()").succeeds do | ||
@service.remove_error_page(@lb.id) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters