class Chef::Knife::OciImageList

List available images

Public Instance Methods

run() click to toggle source
# File lib/chef/knife/oci_image_list.rb, line 24
def run
  options = {}
  options[:limit] = config[:limit] if config[:limit]

  columns = ['Display Name', 'ID', 'OS', 'OS Version']

  list_for_display = config[:format] == 'summary' ? bold(columns) : []
  list_data, last_response = get_display_results(options) do |client_options|
    response = compute_client.list_images(compartment_id, client_options)

    items = response_to_list(response) do |image|
      [image.display_name, image.id, image.operating_system, image.operating_system_version]
    end
    [response, items]
  end
  list_for_display += list_data

  display_list_from_array(list_for_display, columns.length)
  warn_if_page_is_truncated(last_response)
end