Class: Chef::Knife::OciVcnList
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::OciVcnList
- Includes:
- OciCommonOptions, OciHelper
- Defined in:
- lib/chef/knife/oci_vcn_list.rb
Overview
List OCI VCNs. Note that this lists all VCNs in a compartment, not just those that are set up as Chef nodes.
Instance Method Summary collapse
Methods included from OciCommonOptions
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
#run ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/chef/knife/oci_vcn_list.rb', line 24 def run = {} [:limit] = config[:limit] if config[:limit] columns = ['Display Name', 'ID', 'CIDR Block', 'State'] list_for_display = config[:format] == 'summary' ? bold(columns) : [] list_data, last_response = get_display_results() do || response = network_client.list_vcns(compartment_id, ) items = response_to_list(response) do |item| [item.display_name, item.id, item.cidr_block, item.lifecycle_state] 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 |