Class: Chef::Knife::ClcDatacenterList

Inherits:
Chef::Knife show all
Includes:
ClcBase
Defined in:
lib/chef/knife/clc_datacenter_list.rb

Instance Method Summary collapse

Methods included from ClcBase

included

Instance Method Details

#executeObject



10
11
12
13
# File 'lib/chef/knife/clc_datacenter_list.rb', line 10

def execute
  context[:datacenters] = connection.list_datacenters
  render
end

#fieldsObject



15
16
17
# File 'lib/chef/knife/clc_datacenter_list.rb', line 15

def fields
  %w(name id)
end

#headersObject



19
20
21
22
23
24
# File 'lib/chef/knife/clc_datacenter_list.rb', line 19

def headers
  {
    'name' => 'Name',
    'id' => 'ID'
  }
end

#renderObject



26
27
28
29
30
31
32
# File 'lib/chef/knife/clc_datacenter_list.rb', line 26

def render
  ui.info Hirb::Helpers::AutoTable.render(context[:datacenters],
    :fields => fields,
    :headers => headers,
    :resize => false,
    :description => false)
end