Sha256: 9d87377c39b4c1a33083e606459e8a0993da1177d1688d7df51d7da6f070050f
Contents?: true
Size: 1.47 KB
Versions: 11
Compression:
Stored size: 1.47 KB
Contents
require "vmc/cli/domain/base" module VMC::Domain class DeleteDomain < Base desc "Delete a domain" group :domains input(:domain, :argument => :optional, :from_given => find_by_name("domain"), :desc => "URL to map to the application") { |domains| fail "No domains." if domains.empty? ask "Which domain?", :choices => domains.sort_by(&:name), :display => proc(&:name) } input :organization, :aliases => ["--org", "-o"], :from_given => by_name("organization"), :desc => "Organization to delete the domain from" input(:really, :type => :boolean, :forget => true, :default => proc { force? || interact }) { |name, color| ask("Really delete #{c(name, color)}?", :default => false) } input :all, :type => :boolean, :default => false, :desc => "Delete all domains" def delete_domain target = input[:organization] || client if input[:all] return unless input[:really, "ALL DOMAINS", :bad] target.domains.each do |r| begin invoke :delete_domain, :domain => r, :really => true rescue CFoundry::APIError => e err "#{e.class}: #{e.message}" end end return end domain = input[:domain, target.domains] return unless input[:really, domain.name, :name] with_progress("Deleting domain #{c(domain.name, :name)}") do domain.delete! end end end end
Version data entries
11 entries across 11 versions & 1 rubygems