Sha256: 09e25d93236e60e5b67a873fd624399d09e7f40ca252a5a8a4f21531377432b7

Contents?: true

Size: 1.38 KB

Versions: 3

Compression:

Stored size: 1.38 KB

Contents

module ThreeScaleToolbox
  module Commands
    module ProxyCommand
      class DeploySubcommand < Cri::CommandRunner
        include ThreeScaleToolbox::Command

        def self.command
          Cri::Command.define do
            name        'deploy'
            usage       'deploy <remote> <service>'
            summary     'Promotes the APIcast configuration to the Staging Environment'
            description 'Promotes the APIcast configuration to the Staging Environment (Production Environment in case of Service Mesh).'

            param :remote
            param :service_ref

            ThreeScaleToolbox::CLI.output_flag(self)

            runner DeploySubcommand
          end
        end

        def run
          printer.print_record service.proxy_deploy
        end

        private

        def remote
          @remote ||= threescale_client(arguments[:remote])
        end

        def service_ref
          arguments[:service_ref]
        end

        def find_service
          Entities::Service.find(remote: remote,
                                 ref: service_ref).tap do |svc|
            raise ThreeScaleToolbox::Error, "Service #{service_ref} does not exist" if svc.nil?
          end
        end

        def service
          @service ||= find_service
        end

        def printer
          options.fetch(:output, CLI::JsonPrinter.new)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
3scale_toolbox-1.0.1 lib/3scale_toolbox/commands/proxy_command/deploy_command.rb
3scale_toolbox-1.0.0 lib/3scale_toolbox/commands/proxy_command/deploy_command.rb
3scale_toolbox-0.20.0 lib/3scale_toolbox/commands/proxy_command/deploy_command.rb