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

[Brightbox] Adds update firewall request

This commit is contained in:
Paul Thornthwaite 2012-12-17 10:16:59 +00:00
parent 21b8f59f90
commit 39aee91e8e
3 changed files with 33 additions and 0 deletions

View file

@ -125,6 +125,7 @@ module Fog
request :update_api_client request :update_api_client
request :update_application request :update_application
request :update_cloud_ip request :update_cloud_ip
request :update_firewall_policy
request :update_firewall_rule request :update_firewall_rule
request :update_image request :update_image
request :update_load_balancer request :update_load_balancer

View file

@ -0,0 +1,25 @@
module Fog
module Compute
class Brightbox
class Real
# Updates details of the firewall policy
#
# @param [String] identifier Unique reference to identify the resource
# @param [Hash] options
# @option options [String] :name Editable label
# @option options [String] :description Longer editable description
#
# @return [Hash, nil] The JSON response parsed to a Hash or nil if no options passed
#
# @see https://api.gb1.brightbox.com/1.0/#firewall_policy_update_firewall_policy
#
def update_firewall_policy(identifier, options)
return nil if identifier.nil? || identifier == ""
return nil if options.empty? || options.nil?
request("put", "/1.0/firewall_policies/#{identifier}", [200], options)
end
end
end
end
end

View file

@ -25,6 +25,13 @@ Shindo.tests('Fog::Compute[:brightbox] | firewall policy requests', ['brightbox'
end end
end end
update_options = {:name => "Fog test policy B"}
tests("#update_firewall_policy('#{@firewall_policy_id}', #{update_options.inspect})") do
result = Fog::Compute[:brightbox].update_firewall_policy(@firewall_policy_id, update_options)
formats(Brightbox::Compute::Formats::Full::FIREWALL_POLICY, false) { result }
returns("Fog test policy B") { result["name"] }
end
tests("#destroy_firewall_policy('#{@firewall_policy_id}')") do tests("#destroy_firewall_policy('#{@firewall_policy_id}')") do
result = Fog::Compute[:brightbox].destroy_firewall_policy(@firewall_policy_id) result = Fog::Compute[:brightbox].destroy_firewall_policy(@firewall_policy_id)
formats(Brightbox::Compute::Formats::Full::FIREWALL_POLICY, false) { result } formats(Brightbox::Compute::Formats::Full::FIREWALL_POLICY, false) { result }