Class: Lhj::Command::OSS::ListBucket

Inherits:
Lhj::Command::OSS show all
Defined in:
lib/lhj/command/oss/list_bucket.rb

Instance Method Summary collapse

Methods inherited from Lhj::Command

#auto_spin, #begin_title, #initialize, #run, #stop

Constructor Details

This class inherits a constructor from Lhj::Command

Instance Method Details

#handleObject



8
9
10
11
12
13
14
15
16
17
# File 'lib/lhj/command/oss/list_bucket.rb', line 8

def handle
  helper = Lhj::OSS::Helper.instance
  objects = helper.list_bucket
  bucket_list = []
  objects.each do |o|
    bucket_list << { 'name' => o.name, 'location' => o.location, 'creation_time' => o.creation_time }
  end
  print_obj = { 'oss_bucket_list' => bucket_list }
  puts print_obj.to_yaml
end