Method: App42::Command::Base#vscale_or_vdescale_app
- Defined in:
- lib/app42/command/base.rb
#vscale_or_vdescale_app(what, kontena, app_name) ⇒ Object
vertical scale or descale application by no of kontena, expect what as operation and kontena as no of kontena
744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 |
# File 'lib/app42/command/base.rb', line 744 def vscale_or_vdescale_app what, kontena, app_name begin body = {'app42' => {"request"=> { 'appName' => app_name, "kontenaPower" => kontena.to_s }}}.to_json query_params = params query_params.store('body', body) response = with_progress( Paint[ what.to_s == 'vscale' ? "Scaling Application '#{app_name}' by kontena(s) #{kontena}" : "Descaling Application '#{app_name}' by kontena(s) #{kontena}", :yellow]) do |s| build_post_request body, query_params, "app", what end check_transaction_status response["transactionId"], previous_completed = 0, "#{what}d" if response["success"] == true && response["transactionId"] response['success'] ? (return true) : ( "#{response['description']}", true, 'red') rescue Interrupt puts Paint[" Command cancelled.", :red] exit! rescue Exception => e puts e exit! end end |