From d8179ed29e8a5a7fe09e3bbcb0d6725680fed977 Mon Sep 17 00:00:00 2001 From: rsalm Date: Wed, 18 Sep 2013 09:15:09 +0300 Subject: [PATCH 1/2] [vcloud_director] Added support for deleting vApps. --- lib/fog/vcloud_director/compute.rb | 1 + lib/fog/vcloud_director/models/compute/vdc.rb | 5 +++++ .../requests/compute/delete_vapp.rb | 20 +++++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 lib/fog/vcloud_director/requests/compute/delete_vapp.rb diff --git a/lib/fog/vcloud_director/compute.rb b/lib/fog/vcloud_director/compute.rb index 7d7eb123a..481928b7d 100644 --- a/lib/fog/vcloud_director/compute.rb +++ b/lib/fog/vcloud_director/compute.rb @@ -105,6 +105,7 @@ module Fog request :get_vm request :post_task_cancel request :post_vapp_undeploy + request :delete_vapp class Model < Fog::Model def initialize(attrs={}) diff --git a/lib/fog/vcloud_director/models/compute/vdc.rb b/lib/fog/vcloud_director/models/compute/vdc.rb index 46c361d22..868c0beee 100644 --- a/lib/fog/vcloud_director/models/compute/vdc.rb +++ b/lib/fog/vcloud_director/models/compute/vdc.rb @@ -27,6 +27,11 @@ module Fog service.vapps(:vdc => self) end + def delete_vapp(vapp_id) + response = service.delete_vapp(vapp_id) + service.process_task(response.body) + end + end end end diff --git a/lib/fog/vcloud_director/requests/compute/delete_vapp.rb b/lib/fog/vcloud_director/requests/compute/delete_vapp.rb new file mode 100644 index 000000000..acf00b574 --- /dev/null +++ b/lib/fog/vcloud_director/requests/compute/delete_vapp.rb @@ -0,0 +1,20 @@ +module Fog + module Compute + class VcloudDirector + class Real + + def delete_vapp(vapp_id) + + request( + :expects => 202, + :method => 'DELETE', + :parser => Fog::ToHashDocument.new, + :path => "vApp/#{vapp_id}" + ) + end + + end + end + end +end + From d612a03b34a794e8c945615bb6f028adbd8da705 Mon Sep 17 00:00:00 2001 From: rsalm Date: Fri, 20 Sep 2013 10:29:31 +0300 Subject: [PATCH 2/2] [vcloud_director] Implement vapp.destroy and get rid off vdc.delete_vapp --- lib/fog/vcloud_director/models/compute/vapp.rb | 5 +++++ lib/fog/vcloud_director/models/compute/vdc.rb | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/fog/vcloud_director/models/compute/vapp.rb b/lib/fog/vcloud_director/models/compute/vapp.rb index 69bae1980..ad758b089 100644 --- a/lib/fog/vcloud_director/models/compute/vapp.rb +++ b/lib/fog/vcloud_director/models/compute/vapp.rb @@ -45,6 +45,11 @@ module Fog service.process_task(response.body) end + def destroy + response = service.delete_vapp(id) + service.process_task(response.body) + end + end end end diff --git a/lib/fog/vcloud_director/models/compute/vdc.rb b/lib/fog/vcloud_director/models/compute/vdc.rb index 868c0beee..46c361d22 100644 --- a/lib/fog/vcloud_director/models/compute/vdc.rb +++ b/lib/fog/vcloud_director/models/compute/vdc.rb @@ -27,11 +27,6 @@ module Fog service.vapps(:vdc => self) end - def delete_vapp(vapp_id) - response = service.delete_vapp(vapp_id) - service.process_task(response.body) - end - end end end