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.3.0.rc2 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.3.0.rc1 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.3.0.pre2 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.3.0.pre1 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.2.2 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.2.2.rc2 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.2.2.rc1 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.2.1 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.2.1.rc1 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.2.0 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.2.0.rc3 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.2.0.rc2 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.2.0.rc1 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.2.0.pre3 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.2.0.pre2 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.1.6 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.2.0.pre1 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.1.5 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.1.5.rc3 lib/kontena/cli/services/secrets/link_command.rb
kontena-cli-1.1.5.rc2 lib/kontena/cli/services/secrets/link_command.rb