Class: BunBun::CLI::StorageZones

Inherits:
Command
  • Object
show all
Defined in:
lib/bunbun/cli/storage_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
# File 'lib/bunbun/cli/storage_zones.rb', line 4

def call
  items = client.storage_zone.list

  print_table(items.sort_by { _1['Name'] }) do |t|
    t.add_column('ID', align_header: :right) { _1['Id'] }
    t.add_column('Name', align_header: :left) { _1['Name'] }
    t.add_column('Region', align_header: :left) { _1['Region'] }
    t.add_column('Hostname', align_header: :left) { _1['StorageHostname'] }
    t.add_column('Size', align_header: :left) { format_bytesize(_1['StorageUsed']) }
    t.add_column('Files', align_header: :right) { _1['FilesStored'] }
    t.add_column('Modified', align_header: :right) { format_timestamp(_1['DateModified']) }
  end
end