Sha256: 4c6a07508280855bb7481cae943d4807709816bf8ce64470be9f7d9db06e98c4

Contents?: true

Size: 912 Bytes

Versions: 10

Compression:

Stored size: 912 Bytes

Contents

require 'kontena/plugin/digital_ocean/prompts'

module Kontena::Plugin::DigitalOcean::Master
  class TerminateCommand < Kontena::Command
    include Kontena::Cli::Common
    include Kontena::Cli::GridOptions
    include Kontena::Plugin::DigitalOcean::Prompts

    parameter "NAME", "Master name"
    option "--token", "TOKEN", "DigitalOcean API token", environment_variable: "DO_TOKEN"
    option "--force", :flag, "Force remove", default: false, attribute_name: :forced

    def execute
      suppress_warnings # until DO merges resource_kit pr #32
      require 'kontena/machine/digital_ocean'
      do_token = ask_do_token
      confirm_command(name) unless forced?
      destroyer = destroyer(do_token)
      destroyer.run!(name)
    ensure
      resume_warnings
    end

    # @param [String] token
    def destroyer(token)
      Kontena::Machine::DigitalOcean::MasterDestroyer.new(token)
    end
  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
krates-plugin-digitalocean-0.3.11 lib/kontena/plugin/digital_ocean/master/terminate_command.rb
krates-plugin-digitalocean-0.3.10 lib/kontena/plugin/digital_ocean/master/terminate_command.rb
krates-plugin-digitalocean-0.3.9 lib/kontena/plugin/digital_ocean/master/terminate_command.rb
krates-plugin-digitalocean-0.3.8 lib/kontena/plugin/digital_ocean/master/terminate_command.rb
staticpages-plugin-digitalocean-0.3.7 lib/kontena/plugin/digital_ocean/master/terminate_command.rb
staticpages-plugin-digitalocean-0.3.6 lib/kontena/plugin/digital_ocean/master/terminate_command.rb
staticpages-plugin-digitalocean-0.3.5 lib/kontena/plugin/digital_ocean/master/terminate_command.rb
kontena-plugin-digitalocean-0.3.3 lib/kontena/plugin/digital_ocean/master/terminate_command.rb
kontena-plugin-digitalocean-0.3.2 lib/kontena/plugin/digital_ocean/master/terminate_command.rb
kontena-plugin-digitalocean-0.3.1 lib/kontena/plugin/digital_ocean/master/terminate_command.rb