Sha256: bff2efbc7ede038dafcd9a7b6473c45ba661cfe18fd15f70eb994a29fc348cda

Contents?: true

Size: 838 Bytes

Versions: 3

Compression:

Stored size: 838 Bytes

Contents

# frozen_string_literal: true

module Command
  class PsStop < Base
    NAME = "ps:stop"
    OPTIONS = [
      app_option(required: true),
      workload_option
    ].freeze
    DESCRIPTION = "Stops workloads in app"
    LONG_DESCRIPTION = <<~DESC
      - Stops workloads in app
    DESC
    EXAMPLES = <<~EX
      ```sh
      # Stops all workloads in app.
      cpl ps:stop -a $APP_NAME

      # Stops a specific workload in app.
      cpl ps:stop -a $APP_NAME -w $WORKLOAD_NAME
      ```
    EX

    def call
      workloads = [config.options[:workload]] if config.options[:workload]
      workloads ||= config[:app_workloads] + config[:additional_workloads]

      workloads.each do |workload|
        step("Stopping workload '#{workload}'") do
          cp.workload_set_suspend(workload, true)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cpl-0.6.0 lib/command/ps_stop.rb
cpl-0.5.1 lib/command/ps_stop.rb
cpl-0.5.0 lib/command/ps_stop.rb