Sha256: aa5d926cc0a1b9fbef22edf1d7420e83ba38a324ebf6b801f33aa672aab1daa1

Contents?: true

Size: 946 Bytes

Versions: 40

Compression:

Stored size: 946 Bytes

Contents

require 'sfn'

module Sfn
  module Utils
    # Helper for scrubbing stack parameters
    class StackParameterScrubber

      class << self

        # Validate attributes within Parameter blocks
        ALLOWED_PARAMETER_ATTRIBUTES = %w(
          Type Default NoEcho AllowedValues AllowedPattern
          MaxLength MinLength MaxValue MinValue Description
          ConstraintDescription
        )

        # Clean the parameters of the template
        #
        # @param template [Hash]
        # @return [Hash] template
        def scrub!(template)
          parameters = template['Parameters']
          if(parameters)
            parameters.each do |name, options|
              options.delete_if do |attribute, value|
                !ALLOWED_PARAMETER_ATTRIBUTES.include?(attribute)
              end
            end
            template['Parameters'] = parameters
          end
          template
        end

      end
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
sfn-2.2.0 lib/sfn/utils/stack_parameter_scrubber.rb
sfn-2.1.12 lib/sfn/utils/stack_parameter_scrubber.rb
sfn-2.1.10 lib/sfn/utils/stack_parameter_scrubber.rb
sfn-2.1.8 lib/sfn/utils/stack_parameter_scrubber.rb
sfn-2.1.6 lib/sfn/utils/stack_parameter_scrubber.rb
sfn-2.1.4 lib/sfn/utils/stack_parameter_scrubber.rb
sfn-2.1.2 lib/sfn/utils/stack_parameter_scrubber.rb
sfn-2.1.0 lib/sfn/utils/stack_parameter_scrubber.rb
sfn-2.0.6 lib/sfn/utils/stack_parameter_scrubber.rb
sfn-2.0.4 lib/sfn/utils/stack_parameter_scrubber.rb
sfn-2.0.2 lib/sfn/utils/stack_parameter_scrubber.rb
sfn-2.0.0 lib/sfn/utils/stack_parameter_scrubber.rb
sfn-1.2.0 lib/sfn/utils/stack_parameter_scrubber.rb
sfn-1.1.16 lib/sfn/utils/stack_parameter_scrubber.rb
sfn-1.1.14 lib/sfn/utils/stack_parameter_scrubber.rb
sfn-1.1.12 lib/sfn/utils/stack_parameter_scrubber.rb
sfn-1.1.10 lib/sfn/utils/stack_parameter_scrubber.rb
sfn-1.1.8 lib/sfn/utils/stack_parameter_scrubber.rb
sfn-1.1.6 lib/sfn/utils/stack_parameter_scrubber.rb
sfn-1.1.4 lib/sfn/utils/stack_parameter_scrubber.rb