Sha256: 1e407599b785178bcaeda51fed338f065ef8fbe1febdfb732711800c305c14ec

Contents?: true

Size: 748 Bytes

Versions: 30

Compression:

Stored size: 748 Bytes

Contents

module Kontena::Cli::Vault
  class ListCommand < Kontena::Command
    include Kontena::Cli::Common
    include Kontena::Cli::GridOptions

    option '--return', :flag, "Return the keys", hidden: true

    def execute
      require_api_url
      require_current_grid

      token = require_token
      result = client(token).get("grids/#{current_grid}/secrets")

      return result['secrets'].map { |s| s['name'] } if return?

      column_width_paddings = '%-54s %-25.25s %-25.25s'
      puts column_width_paddings % ['NAME', 'CREATED AT', 'UPDATED AT']
      result['secrets'].sort_by { |s| s['name'] }.each do |secret|
        puts column_width_paddings % [secret['name'], secret['created_at'], secret['updated_at']]
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
kontena-cli-1.3.0.pre1 lib/kontena/cli/vault/list_command.rb
kontena-cli-1.2.2 lib/kontena/cli/vault/list_command.rb
kontena-cli-1.2.2.rc2 lib/kontena/cli/vault/list_command.rb
kontena-cli-1.2.2.rc1 lib/kontena/cli/vault/list_command.rb
kontena-cli-1.2.1 lib/kontena/cli/vault/list_command.rb
kontena-cli-1.2.1.rc1 lib/kontena/cli/vault/list_command.rb
kontena-cli-1.2.0 lib/kontena/cli/vault/list_command.rb
kontena-cli-1.2.0.rc3 lib/kontena/cli/vault/list_command.rb
kontena-cli-1.2.0.rc2 lib/kontena/cli/vault/list_command.rb
kontena-cli-1.2.0.rc1 lib/kontena/cli/vault/list_command.rb
kontena-cli-1.2.0.pre3 lib/kontena/cli/vault/list_command.rb
kontena-cli-1.2.0.pre2 lib/kontena/cli/vault/list_command.rb
kontena-cli-1.1.6 lib/kontena/cli/vault/list_command.rb
kontena-cli-1.2.0.pre1 lib/kontena/cli/vault/list_command.rb
kontena-cli-1.1.5 lib/kontena/cli/vault/list_command.rb
kontena-cli-1.1.5.rc3 lib/kontena/cli/vault/list_command.rb
kontena-cli-1.1.5.rc2 lib/kontena/cli/vault/list_command.rb
kontena-cli-1.1.5.rc1 lib/kontena/cli/vault/list_command.rb
kontena-cli-1.1.4 lib/kontena/cli/vault/list_command.rb
kontena-cli-1.2.0.dev1 lib/kontena/cli/vault/list_command.rb