Sha256: b8ecfb7c81b4cea93f41eead5cf94d657f0083b6a76bcbe82d970b0cc0d45827

Contents?: true

Size: 919 Bytes

Versions: 74

Compression:

Stored size: 919 Bytes

Contents

module Kontena::Cli::Cloud::Master
  class ListCommand < Kontena::Command

    include Kontena::Cli::Common

    callback_matcher 'cloud-master', 'list'

    option '--return', :flag, 'Return the list', hidden: true

    requires_current_account_token

    def execute
      response = cloud_client.get('user/masters')
      unless response && response.kind_of?(Hash) && response['data'].kind_of?(Array)
        abort "Listing masters failed".colorize(:red)
      end

      if response['data'].empty?
        return [] if self.return?
        puts "No masters registered"
      else
        return response['data'] if self.return?
        puts '%-26.26s %-24s %-12s %s' % ['ID', 'NAME', 'OWNER', 'URL']
        response['data'].each do |data|
          attr = data['attributes']
          puts '%-26.26s %-24s %-12s %s' % [data['id'], attr['name'], attr['owner'], attr['url']]
        end
      end
    end
  end
end

Version data entries

74 entries across 74 versions & 1 rubygems

Version Path
kontena-cli-1.3.0.pre1 lib/kontena/cli/cloud/master/list_command.rb
kontena-cli-1.2.2 lib/kontena/cli/cloud/master/list_command.rb
kontena-cli-1.2.2.rc2 lib/kontena/cli/cloud/master/list_command.rb
kontena-cli-1.2.2.rc1 lib/kontena/cli/cloud/master/list_command.rb
kontena-cli-1.2.1 lib/kontena/cli/cloud/master/list_command.rb
kontena-cli-1.2.1.rc1 lib/kontena/cli/cloud/master/list_command.rb
kontena-cli-1.2.0 lib/kontena/cli/cloud/master/list_command.rb
kontena-cli-1.2.0.rc3 lib/kontena/cli/cloud/master/list_command.rb
kontena-cli-1.2.0.rc2 lib/kontena/cli/cloud/master/list_command.rb
kontena-cli-1.2.0.rc1 lib/kontena/cli/cloud/master/list_command.rb
kontena-cli-1.2.0.pre3 lib/kontena/cli/cloud/master/list_command.rb
kontena-cli-1.2.0.pre2 lib/kontena/cli/cloud/master/list_command.rb
kontena-cli-1.1.6 lib/kontena/cli/cloud/master/list_command.rb
kontena-cli-1.2.0.pre1 lib/kontena/cli/cloud/master/list_command.rb
kontena-cli-1.1.5 lib/kontena/cli/cloud/master/list_command.rb
kontena-cli-1.1.5.rc3 lib/kontena/cli/cloud/master/list_command.rb
kontena-cli-1.1.5.rc2 lib/kontena/cli/cloud/master/list_command.rb
kontena-cli-1.1.5.rc1 lib/kontena/cli/cloud/master/list_command.rb
kontena-cli-1.1.4 lib/kontena/cli/cloud/master/list_command.rb
kontena-cli-1.2.0.dev1 lib/kontena/cli/cloud/master/list_command.rb