Sha256: 694957d77b8b9ae36f95359c10fa53eed55997eb8f5f4f4cb58f09be2934709d

Contents?: true

Size: 1.27 KB

Versions: 2

Compression:

Stored size: 1.27 KB

Contents

require 'trollop'

module SimpleDeploy
  module CLI
    class Protect
      def protect
        opts = Trollop::options do
          version SimpleDeploy::VERSION
          banner <<-EOS

Protect a stack.

simple_deploy protect -n STACK_NAME -e ENVIRONMENT -p on_off

EOS
          opt :help, "Display Help"
          opt :environment, "Set the target environment", :type => :string
          opt :protection, "Enable/Disable protection using on/off", :type  => :string
          opt :log_level, "Log level:  debug, info, warn, error", :type    => :string,
                                                                  :default => 'info'
          opt :name, "Stack name of stack to protect", :type => :string
        end

        CLI::Shared.valid_options? :provided => opts,
                                   :required => [:environment, :name]

        config = Config.new.environment opts[:environment]

        logger = SimpleDeployLogger.new :log_level => opts[:log_level]

        stack = Stack.new :environment => opts[:environment],
                          :name        => opts[:name],
                          :config      => config,
                          :logger      => logger
        stack.update :attributes => [{ 'protection' => opts[:protection] }]
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simple_deploy-0.5.2 lib/simple_deploy/cli/protect.rb
simple_deploy-0.5.1 lib/simple_deploy/cli/protect.rb