Class: Chef::Knife::OciShapeList

Inherits:
Chef::Knife show all
Includes:
OciCommonOptions, OciHelper
Defined in:
lib/chef/knife/oci_shape_list.rb

Overview

List available shapes

Instance Method Summary collapse

Methods included from OciCommonOptions

included

Methods included from OciHelper

#_non_summary_list, #_summary_list, #bold, #check_can_access_instance, #compartment_id, #compute_client, #config_file_location, #config_file_profile, #confirm, #display_list_from_array, #error_and_exit, #get_display_results, #identity_client, #network_client, #next_page_token, #oci_config, #response_to_list, #validate_required_params, #warn_if_page_is_truncated

Instance Method Details

#runObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/chef/knife/oci_shape_list.rb', line 32

def run
  options = {}
  options[:availability_domain] = config[:availability_domain] if config[:availability_domain]
  options[:image_id] = config[:image_id] if config[:image_id]
  options[:limit] = config[:limit] if config[:limit]

  columns = []

  list_for_display, last_response = get_display_results(options) do |client_options|
    response = compute_client.list_shapes(compartment_id, client_options)

    items = response_to_list(response) do |item|
      [item.shape]
    end
    [response, items]
  end

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