Sha256: 9ad7b8828167af383714b046748262c581fec58fe2005a651eb20809311289df

Contents?: true

Size: 1.74 KB

Versions: 15

Compression:

Stored size: 1.74 KB

Contents

module AutoCanary24
  class Configuration
    # Defines what should happen with the inactive stack
    attr_accessor :keep_inactive_stack
    # If true a instance from current stack gets removed whenever a new instance from the new stack is added.
    attr_accessor :keep_instances_balanced
    # Percent of instances which are added at once (depends on the actual number of instances, read from desired)
    attr_accessor :scaling_instance_percent
    # Timeout in seconds to wait for checking AWS operations are done before do a rollback
    attr_accessor :wait_timeout

    def initialize(**params)

      @keep_inactive_stack = false
      unless params[:keep_inactive_stack].nil?
        raise "ERR: inactive_stack_state should be a boolean" unless [true, false].include? params[:keep_inactive_stack]
        @keep_inactive_stack = params[:keep_inactive_stack]
      end

      @keep_instances_balanced = false
      unless params[:keep_instances_balanced].nil?
        raise 'ERR: keep_instances_balanced needs to a boolean' unless [true, false].include? params[:keep_instances_balanced]
        @keep_instances_balanced = params[:keep_instances_balanced]
      end

      @scaling_instance_percent = 100
      unless params[:scaling_instance_percent].nil?
        raise 'ERR: scaling_instance_percent needs to be a number between 1 and 100' unless params[:scaling_instance_percent].is_a?(Integer) && (1..100).include?(params[:scaling_instance_percent])
        @scaling_instance_percent = params[:scaling_instance_percent]
      end

      @wait_timeout = 300
      unless params[:wait_timeout].nil?
        raise 'ERR: wait_timeout needs to be a number' unless params[:wait_timeout].is_a?(Integer)
        @wait_timeout = params[:wait_timeout]
      end

    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
autocanary24-0.6.1 lib/autocanary24/configuration.rb
autocanary24-0.6.0 lib/autocanary24/configuration.rb
autocanary24-0.5.0 lib/autocanary24/configuration.rb
autocanary24-0.4.4 lib/autocanary24/configuration.rb
autocanary24-0.4.3 lib/autocanary24/configuration.rb
autocanary24-0.4.2 lib/autocanary24/configuration.rb
autocanary24-0.4.1 lib/autocanary24/configuration.rb
autocanary24-0.4.0 lib/autocanary24/configuration.rb
autocanary24-0.3.0 lib/autocanary24/configuration.rb
autocanary24-0.2.1 lib/autocanary24/configuration.rb
autocanary24-0.2.0 lib/autocanary24/configuration.rb
autocanary24-0.1.3 lib/autocanary24/configuration.rb
autocanary24-0.1.2 lib/autocanary24/configuration.rb
autocanary24-0.1.1 lib/autocanary24/configuration.rb
autocanary24-0.1.0 lib/autocanary24/configuration.rb