Sha256: 95460d6bca352ae64382a5ca9652691641886eb13aa4fe648f13a9ab4eaa33e1

Contents?: true

Size: 875 Bytes

Versions: 1

Compression:

Stored size: 875 Bytes

Contents

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
      do_token = ask_do_token
      confirm_command(name) unless forced?

      require_relative '../../../machine/digital_ocean'
      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

1 entries across 1 versions & 1 rubygems

Version Path
kontena-plugin-digitalocean-0.3.1.rc1 lib/kontena/plugin/digital_ocean/master/terminate_command.rb