Sha256: f3b13d2ee4912060a1ef5c9af35774bdbb6ec0fb7ff2145f5c2757880db143e6

Contents?: true

Size: 826 Bytes

Versions: 119

Compression:

Stored size: 826 Bytes

Contents

require_relative '../services_helper'

module Kontena::Cli::Services::Secrets
  class LinkCommand < Kontena::Command
    include Kontena::Cli::Common
    include Kontena::Cli::GridOptions
    include Kontena::Cli::Services::ServicesHelper

    parameter "NAME", "Service name"
    parameter "SECRET", "Secret to be added from Vault (format: secret:name:type)"

    def execute
      require_api_url
      token = require_token
      spinner "Linking #{secret.colorize(:cyan)} from Vault to #{name.colorize(:cyan)} " do
        result = client(token).get("services/#{parse_service_id(name)}")
        secrets = result['secrets']
        secrets << parse_secrets([secret])[0]
        data = {
          secrets: secrets
        }
        client(token).put("services/#{parse_service_id(name)}", data)
      end
    end
  end
end

Version data entries

119 entries across 119 versions & 1 rubygems

Version Path
kontena-cli-1.4.3 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.4.3.rc1 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.4.2 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.4.2.rc1 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.4.2.pre1 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.4.1 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.4.1.rc1 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.4.1.pre1 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.3.5 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.3.5.rc1 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.4.0 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.4.0.rc2 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.4.0.rc1 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.4.0.pre14 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.4.0.pre13 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.4.0.pre12 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.4.0.pre11 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.4.0.pre10 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.4.0.pre9 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.4.0.pre8 lib/kontena/cli/services/secrets/link_command.rb