Sha256: 8cbb27be6b8b23498674d3b98d3dfef77b0939d954ce4d979bdb75cd6c225e81

Contents?: true

Size: 746 Bytes

Versions: 44

Compression:

Stored size: 746 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'

    option '--silent', :flag, "Reduce output verbosity"

    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
      }
      vspinner "Writing #{name.colorize(:cyan)} to the vault " do
        client(token).post("grids/#{current_grid}/secrets", data)
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
kontena-cli-1.2.0.pre3 lib/kontena/cli/vault/write_command.rb
kontena-cli-1.2.0.pre2 lib/kontena/cli/vault/write_command.rb
kontena-cli-1.1.6 lib/kontena/cli/vault/write_command.rb
kontena-cli-1.2.0.pre1 lib/kontena/cli/vault/write_command.rb
kontena-cli-1.1.5 lib/kontena/cli/vault/write_command.rb
kontena-cli-1.1.5.rc3 lib/kontena/cli/vault/write_command.rb
kontena-cli-1.1.5.rc2 lib/kontena/cli/vault/write_command.rb
kontena-cli-1.1.5.rc1 lib/kontena/cli/vault/write_command.rb
kontena-cli-1.1.4 lib/kontena/cli/vault/write_command.rb
kontena-cli-1.2.0.dev1 lib/kontena/cli/vault/write_command.rb
kontena-cli-1.1.3 lib/kontena/cli/vault/write_command.rb
kontena-cli-1.1.2 lib/kontena/cli/vault/write_command.rb
kontena-cli-1.1.2.rc2 lib/kontena/cli/vault/write_command.rb
kontena-cli-1.1.2.rc1 lib/kontena/cli/vault/write_command.rb
kontena-cli-1.1.1 lib/kontena/cli/vault/write_command.rb
kontena-cli-1.1.1.rc1 lib/kontena/cli/vault/write_command.rb
kontena-cli-1.1.0 lib/kontena/cli/vault/write_command.rb
kontena-cli-1.1.0.rc2 lib/kontena/cli/vault/write_command.rb
kontena-cli-1.1.0.rc1 lib/kontena/cli/vault/write_command.rb
kontena-cli-1.1.0.pre1 lib/kontena/cli/vault/write_command.rb