Sha256: 4daba31b6e8bfdc8d113b032e105e46b83ef12ebd3db4deb9059b41f07739989

Contents?: true

Size: 1.38 KB

Versions: 7

Compression:

Stored size: 1.38 KB

Contents

module ThreeScaleToolbox
  module Commands
    module ProxyConfigCommand
      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

7 entries across 7 versions & 1 rubygems

Version Path
3scale_toolbox-0.19.3 lib/3scale_toolbox/commands/proxy_config_command/deploy_command.rb
3scale_toolbox-0.19.2 lib/3scale_toolbox/commands/proxy_config_command/deploy_command.rb
3scale_toolbox-0.19.1 lib/3scale_toolbox/commands/proxy_config_command/deploy_command.rb
3scale_toolbox-0.19.0 lib/3scale_toolbox/commands/proxy_config_command/deploy_command.rb
3scale_toolbox-0.18.3 lib/3scale_toolbox/commands/proxy_config_command/deploy_command.rb
3scale_toolbox-0.18.2 lib/3scale_toolbox/commands/proxy_config_command/deploy_command.rb
3scale_toolbox-0.18.0 lib/3scale_toolbox/commands/proxy_config_command/deploy_command.rb