Class: Chef::Knife::OneandoneBlockStorageList
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::OneandoneBlockStorageList
- Includes:
- OneandoneBase
- Defined in:
- lib/chef/knife/oneandone_block_storage_list.rb
Instance Method Summary collapse
Methods included from OneandoneBase
#formated_output, included, #init_client
Instance Method Details
#run ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/chef/knife/oneandone_block_storage_list.rb', line 10 def run $stdout.sync = true init_client response = OneAndOne::BlockStorage.new.list formated_output(response, true) block_storages = [ ui.color('ID', :bold), ui.color('Name', :bold), ui.color('Size', :bold), ui.color('State', :bold), ui.color('Datacenter', :bold), ui.color('Server ID', :bold), ui.color('Server Name', :bold) ] response.each do |blks| block_storages << blks['id'] block_storages << blks['name'] block_storages << blks['size'].to_s block_storages << blks['state'] block_storages << blks['datacenter']['country_code'] block_storages << (blks['server'].nil? ? '' : blks['server']['id']) block_storages << (blks['server'].nil? ? '' : blks['server']['name']) end puts ui.list(block_storages, :uneven_columns_across, 7) end |