Sha256: c665a2aa20accf3de6936921a42cfeee6caf2208fb8b3acb89d4b3a563aa4a5a

Contents?: true

Size: 688 Bytes

Versions: 22

Compression:

Stored size: 688 Bytes

Contents

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

    parameter 'NAME', 'Secret name'
    parameter '[VALUE]', 'Secret value'

    def execute
      require_api_url
      require_current_grid

      token = require_token
      secret = value
      if secret.to_s == ''
        secret = STDIN.read
      end
      exit_with_error('No value provided') if secret.to_s == ''
      data = {
          name: name,
          value: secret
      }
      spinner "Writing #{name.colorize(:cyan)} to the vault " do
        client(token).post("grids/#{current_grid}/secrets", data)
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
kontena-cli-1.0.0.pre1 lib/kontena/cli/vault/write_command.rb
kontena-cli-0.17.0.pre5 lib/kontena/cli/vault/write_command.rb
kontena-cli-0.17.0.pre4 lib/kontena/cli/vault/write_command.rb
kontena-cli-0.17.0.pre3 lib/kontena/cli/vault/write_command.rb
kontena-cli-0.17.0.pre2 lib/kontena/cli/vault/write_command.rb
kontena-cli-0.17.0.pre1 lib/kontena/cli/vault/write_command.rb
kontena-cli-0.16.3 lib/kontena/cli/vault/write_command.rb
kontena-cli-0.16.3.rc1 lib/kontena/cli/vault/write_command.rb
kontena-cli-0.16.2 lib/kontena/cli/vault/write_command.rb
kontena-cli-0.16.2.rc1 lib/kontena/cli/vault/write_command.rb
kontena-cli-0.16.1 lib/kontena/cli/vault/write_command.rb
kontena-cli-0.16.1.rc3 lib/kontena/cli/vault/write_command.rb
kontena-cli-0.16.1.rc2 lib/kontena/cli/vault/write_command.rb
kontena-cli-0.16.1.rc1 lib/kontena/cli/vault/write_command.rb
kontena-cli-0.16.0 lib/kontena/cli/vault/write_command.rb
kontena-cli-0.16.0.rc3 lib/kontena/cli/vault/write_command.rb
kontena-cli-0.16.0.rc2 lib/kontena/cli/vault/write_command.rb
kontena-cli-0.16.0.rc1 lib/kontena/cli/vault/write_command.rb
kontena-cli-0.16.0.pre9 lib/kontena/cli/vault/write_command.rb
kontena-cli-0.16.0.pre8 lib/kontena/cli/vault/write_command.rb