From fe4760f772681c9cf6fbb57dd209d61d0163db58 Mon Sep 17 00:00:00 2001 From: Rupak Ganguly Date: Thu, 21 Mar 2013 16:37:27 -0400 Subject: [PATCH] [hp|network] Add request method for delete_network. --- lib/fog/hp/network.rb | 2 +- lib/fog/hp/requests/network/delete_network.rb | 34 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 lib/fog/hp/requests/network/delete_network.rb diff --git a/lib/fog/hp/network.rb b/lib/fog/hp/network.rb index 05e3bc9f4..086074d03 100644 --- a/lib/fog/hp/network.rb +++ b/lib/fog/hp/network.rb @@ -14,7 +14,7 @@ module Fog request_path 'fog/hp/requests/network' request :create_network - #request :delete_network + request :delete_network request :get_network request :list_networks #request :update_network diff --git a/lib/fog/hp/requests/network/delete_network.rb b/lib/fog/hp/requests/network/delete_network.rb new file mode 100644 index 000000000..d5690bca8 --- /dev/null +++ b/lib/fog/hp/requests/network/delete_network.rb @@ -0,0 +1,34 @@ +module Fog + module HP + class Network + + class Real + # Delete an existing network + # + # ==== Parameters + # * network_id<~String> - UUId for the network to delete + def delete_network(network_id) + request( + :expects => 204, + :method => 'DELETE', + :path => "networks/#{network_id}" + ) + end + end + + class Mock + def delete_network(network_id) + response = Excon::Response.new + if list_networks.body['networks'].detect {|_| _['id'] == network_id} + self.data[:networks].delete(network_id) + response.status = 204 + response + else + raise Fog::HP::Network::NotFound + end + end + end + + end + end +end \ No newline at end of file