Class: BunBun::CLI::Zones

Inherits:
Command
  • Object
show all
Defined in:
lib/bunbun/cli/zones.rb

Instance Attribute Summary

Attributes inherited from Command

#options

Instance Method Summary collapse

Methods inherited from Command

argument_count, argument_names, option, #option_parser, options

Instance Method Details

#callObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/bunbun/cli/zones.rb', line 4

def call
  items = client.pull_zone.list

  print_table(items) do |t|
    t.add_column('ID', align_header: :right) { _1['Id'] }
    t.add_column('Name', align_header: :left) { _1['Name'] }
    t.add_column('Storage Zone', align_header: :right) { _1['StorageZoneId'] }
    t.add_column('Bandwidth') { format_bytesize(_1['MonthlyBandwidthUsed']) }
    t.add_column('Domain', align_header: :left) { |zone|
      hostnames = zone['Hostnames'].reject { _1['IsSystemHostname'] || _1['IsManagedHostname'] }
      hostnames.map { _1['Value'] }.first
    }
  end
end