Class: Legate::CLI::AuthCommands

Inherits:
BaseCommand show all
Defined in:
lib/legate/cli/auth_commands.rb

Overview

Main auth commands class that registers subcommands

Instance Method Summary collapse

Methods inherited from BaseCommand

#tree

Instance Method Details

#statusObject



497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
# File 'lib/legate/cli/auth_commands.rb', line 497

def status
  manager = Legate::Auth::Manager.instance
  manager.load_from_store

  schemes = manager.instance_variable_get(:@schemes) || {}
  credentials = manager.instance_variable_get(:@credentials) || {}
  mappings = manager.instance_variable_get(:@url_mappings) || []

  puts ::CLI::UI.fmt('{{bold:Authentication System Status}}')
  puts
  puts ::CLI::UI.fmt("  Schemes:     {{cyan:#{schemes.size}}}")
  puts ::CLI::UI.fmt("  Credentials: {{cyan:#{credentials.size}}}")
  puts ::CLI::UI.fmt("  Mappings:    {{cyan:#{mappings.size}}}")
  puts

  puts ::CLI::UI.fmt('  {{gray:Scheme types:}} ' + schemes.values.map(&:scheme_type).uniq.join(', ')) if schemes.any?

  return unless credentials.any?

  puts ::CLI::UI.fmt('  {{gray:Credential types:}} ' + credentials.values.map(&:auth_type).uniq.join(', '))
end