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