class DTK::Client::Operation::Service::Destroy

Public Class Methods

execute(args = Args.new) click to toggle source
# File lib/client/operation/service/destroy.rb, line 21
def self.execute(args = Args.new)
  wrap_operation(args) do |args|
    service_instance = args.required(:service_instance)

    unless args[:skip_prompt]
      return false unless Console.prompt_yes_no("Are you sure you want to destroy the infrastructure associated with '#{service_instance}' and delete this service instance from the server?", :add_options => true)
    end

    post_body = PostBody.new(:service_instance => service_instance)
    rest_post("#{BaseRoute}/delete", post_body)

    ClientModuleDir.rm_f(args[:directory_path]) if args[:purge]

    OsUtil.print_info("DTK module '#{service_instance}' has been deleted successfully.")
  end
end