Class: Chef::Knife::Cloud::OraclecloudOrchestrationList

Inherits:
ResourceListCommand
  • Object
show all
Includes:
OraclecloudServiceHelpers, OraclecloudServiceOptions
Defined in:
lib/chef/knife/oraclecloud_orchestration_list.rb

Instance Method Summary collapse

Methods included from OraclecloudServiceOptions

included

Methods included from OraclecloudServiceHelpers

#check_for_missing_config_values!, #create_service_instance, #verify_ssl?

Instance Method Details

#before_exec_commandObject



36
37
38
39
40
41
42
43
44
45
# File 'lib/chef/knife/oraclecloud_orchestration_list.rb', line 36

def before_exec_command
  @columns_with_info = [
    { label: 'Orchestration ID',  key: 'name_with_container' },
    { label: 'Description',       key: 'description' },
    { label: 'Status',            key: 'status', value_callback: method(:format_status_value) },
    { label: 'Instance Count',    key: 'instance_count' }
  ]

  @sort_by_field = 'name_with_container'
end

#format_status_value(status) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/chef/knife/oraclecloud_orchestration_list.rb', line 51

def format_status_value(status)
  status = status.downcase
  status_color = case status
                 when 'ready'
                   :green
                 when 'stopped'
                   :red
                 else
                   :yellow
                 end

  ui.color(status, status_color)
end

#query_resourceObject



47
48
49
# File 'lib/chef/knife/oraclecloud_orchestration_list.rb', line 47

def query_resource
  service.list_orchestrations
end