Class: Chef::Knife::Cloud::VraCatalogList

Inherits:
ResourceListCommand
  • Object
show all
Includes:
VraServiceHelpers, VraServiceOptions
Defined in:
lib/chef/knife/vra_catalog_list.rb

Instance Method Summary collapse

Methods included from VraServiceOptions

included

Methods included from VraServiceHelpers

#check_for_missing_config_values!, #create_service_instance, #validate!, #verify_ssl?, #wait_for_request

Instance Method Details

#before_exec_commandObject



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/chef/knife/vra_catalog_list.rb', line 40

def before_exec_command
  @columns_with_info = [
    { label: 'Catalog ID',  key: 'id' },
    { label: 'Name',        key: 'name' },
    { label: 'Description', key: 'description' },
    { label: 'Status',      key: 'status', value_callback: method(:format_status_value) },
    { label: 'Subtenant',   key: 'subtenant_name' }
  ]

  @sort_by_field = 'name'
end

#format_status_value(status) ⇒ Object



56
57
58
59
60
61
62
63
64
65
# File 'lib/chef/knife/vra_catalog_list.rb', line 56

def format_status_value(status)
  status = status.downcase
  if status == 'published'
    color = :green
  else
    color = :red
  end

  ui.color(status, color)
end

#query_resourceObject



52
53
54
# File 'lib/chef/knife/vra_catalog_list.rb', line 52

def query_resource
  @service.list_catalog_items(locate_config_value(:entitled))
end