Sha256: d2e3b2ec788f6bdba5eb3dc2ce772569852e223138009eef635a1fa6ec03dc03

Contents?: true

Size: 676 Bytes

Versions: 32

Compression:

Stored size: 676 Bytes

Contents

require_relative 'common'

module Kontena::Cli::Grids
  class RemoveCommand < Clamp::Command
    include Kontena::Cli::Common
    include Common

    parameter "NAME", "Grid name"

    def execute
      require_api_url
      token = require_token
      grid = find_grid_by_name(name)

      if !grid.nil?
        response = client(token).delete("grids/#{grid['id']}")
        if response
          clear_current_grid if grid['id'] == current_grid
          puts "removed #{grid['name'].cyan}"
        end
      else
        abort "Could not resolve grid by name [#{name}]. For a list of existing grids please run: kontena grid list".colorize(:red)
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
kontena-cli-0.13.4 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.13.3 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.13.2 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.13.1 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.13.0.1 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.13.0 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.12.3 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.12.2 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.12.1 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.12.0 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.11.7 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.11.6 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.11.5 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.11.4 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.11.3 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.11.2 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.11.1 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.11.0 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.10.3 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.10.2 lib/kontena/cli/grids/remove_command.rb