Class: Chef::Knife::OneandoneDatacenterList

Inherits:
Chef::Knife
  • Object
show all
Includes:
OneandoneBase
Defined in:
lib/chef/knife/oneandone_datacenter_list.rb

Instance Method Summary collapse

Methods included from OneandoneBase

#formated_output, included, #init_client

Instance Method Details

#runObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/chef/knife/oneandone_datacenter_list.rb', line 10

def run
  $stdout.sync = true

  init_client

  response = OneAndOne::Datacenter.new.list
  formated_output(response, true)

  datacenters = [
    ui.color('ID', :bold),
    ui.color('Location', :bold),
    ui.color('Country Code', :bold)
  ]
  response.each do |dc|
    datacenters << dc['id']
    datacenters << dc['location']
    datacenters << dc['country_code']
  end

  puts ui.list(datacenters, :uneven_columns_across, 3)
end