mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Enable and implemented delete_security_groups method in requets layer for compute services.
This commit is contained in:
parent
e32d1c32e9
commit
950fc37af8
2 changed files with 37 additions and 10 deletions
|
@ -27,6 +27,7 @@ module Fog
|
|||
request :create_server
|
||||
request :delete_image
|
||||
request :delete_key_pair
|
||||
request :delete_security_group
|
||||
request :delete_server
|
||||
request :get_flavor_details
|
||||
request :get_image_details
|
||||
|
@ -62,16 +63,7 @@ module Fog
|
|||
},
|
||||
:images => {},
|
||||
:key_pairs => {},
|
||||
:security_groups => {
|
||||
'default' => {
|
||||
'id' => Fog::Mock.random_numbers(3),
|
||||
'name' => "default",
|
||||
'description' => "default security group",
|
||||
'tenant_id' => Fog::HP::Mock.user_id,
|
||||
'rules' => [ {"from_port"=>22, "group"=>{}, "ip_protocol"=>"tcp", "to_port"=>22, "parent_group_id"=>"#{Fog::Mock.random_numbers(3)}", "ip_range"=>{ "cidr"=>"0.0.0.0/0" }, "id"=>"#{Fog::Mock.random_numbers(3)}"},
|
||||
{"from_port"=>-1, "group"=>{}, "ip_protocol"=>"icmp", "to_port"=>-1, "parent_group_id"=>"#{Fog::Mock.random_numbers(3)}", "ip_range"=>{ "cidr"=>"0.0.0.0/0" }, "id"=>"#{Fog::Mock.random_numbers(3)}"} ]
|
||||
}
|
||||
},
|
||||
:security_groups => {},
|
||||
:servers => {}
|
||||
}
|
||||
end
|
||||
|
|
35
lib/fog/hp/requests/compute/delete_security_group.rb
Normal file
35
lib/fog/hp/requests/compute/delete_security_group.rb
Normal file
|
@ -0,0 +1,35 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class HP
|
||||
class Real
|
||||
|
||||
# Delete a security group
|
||||
#
|
||||
# ==== Parameters
|
||||
# * id<~Integer> - Id of the security group to delete
|
||||
#
|
||||
def delete_security_group(security_group_id)
|
||||
request(
|
||||
:expects => 202,
|
||||
:method => 'DELETE',
|
||||
:path => "os-security-groups/#{security_group_id}"
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def delete_security_group(security_group_id)
|
||||
response = Excon::Response.new
|
||||
self.data[:last_modified][:security_groups].delete(security_group_id)
|
||||
self.data[:security_groups].delete(security_group_id)
|
||||
response.status = 202
|
||||
response.body = "202 Accepted\n\nThe request is accepted for processing.\n\n "
|
||||
response
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue