Class: NeetoDeploy::CLI::AutoscalingConfig::List
- Defined in:
- lib/neeto_deploy/cli/autoscaling_config/list.rb
Constant Summary
Constants included from Session
Instance Attribute Summary collapse
-
#app_slug ⇒ Object
readonly
Returns the value of attribute app_slug.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(options:) ⇒ List
constructor
A new instance of List.
- #run ⇒ Object
Methods included from Constants
Methods included from Session
#auth_headers, #console_executable_name, #json_auth_headers, #os, require_app_option, #send_delete_request, #send_get_request, #send_patch_request, #send_post_request
Methods inherited from Base
Constructor Details
#initialize(options:) ⇒ List
Returns a new instance of List.
18 19 20 21 |
# File 'lib/neeto_deploy/cli/autoscaling_config/list.rb', line 18 def initialize(options:) super() @app_slug = [:app] end |
Instance Attribute Details
#app_slug ⇒ Object (readonly)
Returns the value of attribute app_slug.
16 17 18 |
# File 'lib/neeto_deploy/cli/autoscaling_config/list.rb', line 16 def app_slug @app_slug end |
Instance Method Details
#run ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/neeto_deploy/cli/autoscaling_config/list.rb', line 23 def run ui.execute_with_loading("Fetching autoscaling configs...") do @response = send_get_request(autoscaling_configs_url(app_slug), { app_slug: }) end ui.error(@response["error"] || @response.) and return unless @response.success? status = JSON.parse(@response.body)["autoscaling_status"] if status.nil? || status.empty? ui.info("No autoscaling configs found for #{app_slug}.") return end rows = status.map { |process_type, config| [process_type, config&.[]("enabled") ? "Yes" : "No", config&.[]("type") || "-"] } table = Terminal::Table.new(headings: ["Process Type", "Enabled", "Type"], rows: rows) ui.info(table) end |