Sha256: 6bcc862216c386087e575af611982ce1a8377432686ca77fb6aa3c4f7f1d76f5

Contents?: true

Size: 843 Bytes

Versions: 42

Compression:

Stored size: 843 Bytes

Contents

module Kontena::Cli::Certificate
  class ExportCommand < Kontena::Command
    include Kontena::Cli::Common
    include Kontena::Cli::GridOptions

    parameter "SUBJECT", "Certificate subject"

    requires_current_master
    requires_current_master_token
    requires_current_grid

    option ['--certificate', '--cert'], :flag, "Output certificate"
    option ['--chain'], :flag, "Output chain"
    option ['--private-key', '--key'], :flag, "Output private key"

    def bundle?
      ![certificate?, chain?, private_key?].any?
    end

    def execute
      certificate = client.get("certificates/#{current_grid}/#{self.subject}/export")

      puts certificate['certificate'] if certificate? || bundle?
      puts certificate['chain'] if chain? || bundle?
      puts certificate['private_key'] if private_key? || bundle?
    end
  end
end

Version data entries

42 entries across 42 versions & 2 rubygems

Version Path
krates-1.7.11 lib/kontena/cli/certificate/export_command.rb
krates-1.7.10 lib/kontena/cli/certificate/export_command.rb
krates-1.7.9 lib/kontena/cli/certificate/export_command.rb
krates-1.7.8 lib/kontena/cli/certificate/export_command.rb
krates-1.7.7 lib/kontena/cli/certificate/export_command.rb
krates-1.7.6 lib/kontena/cli/certificate/export_command.rb
krates-1.7.5 lib/kontena/cli/certificate/export_command.rb
krates-1.7.4 lib/kontena/cli/certificate/export_command.rb
krates-1.7.3 lib/kontena/cli/certificate/export_command.rb
krates-1.7.2 lib/kontena/cli/certificate/export_command.rb
krates-1.7.1 lib/kontena/cli/certificate/export_command.rb
krates-1.7.0 lib/kontena/cli/certificate/export_command.rb
krates-1.6.9 lib/kontena/cli/certificate/export_command.rb
krates-1.6.8 lib/kontena/cli/certificate/export_command.rb
krates-1.6.7 lib/kontena/cli/certificate/export_command.rb
krates-1.6.6 lib/kontena/cli/certificate/export_command.rb
krates-1.6.5 lib/kontena/cli/certificate/export_command.rb
krates-1.6.4 lib/kontena/cli/certificate/export_command.rb
krates-1.6.3 lib/kontena/cli/certificate/export_command.rb
krates-1.6.2 lib/kontena/cli/certificate/export_command.rb