Sha256: e37976d3953c604b284a3ea3531a8348a94c2159e2529cfc4b78bb05c98cf426

Contents?: true

Size: 882 Bytes

Versions: 15

Compression:

Stored size: 882 Bytes

Contents

require 'sfn'

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

      # 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 parameter_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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
sfn-3.0.28 lib/sfn/utils/stack_parameter_scrubber.rb
sfn-3.0.26 lib/sfn/utils/stack_parameter_scrubber.rb
sfn-3.0.24 lib/sfn/utils/stack_parameter_scrubber.rb
sfn-3.0.22 lib/sfn/utils/stack_parameter_scrubber.rb
sfn-3.0.20 lib/sfn/utils/stack_parameter_scrubber.rb
sfn-3.0.18 lib/sfn/utils/stack_parameter_scrubber.rb
sfn-3.0.16 lib/sfn/utils/stack_parameter_scrubber.rb
sfn-3.0.14 lib/sfn/utils/stack_parameter_scrubber.rb
sfn-3.0.12 lib/sfn/utils/stack_parameter_scrubber.rb
sfn-3.0.10 lib/sfn/utils/stack_parameter_scrubber.rb
sfn-3.0.8 lib/sfn/utils/stack_parameter_scrubber.rb
sfn-3.0.6 lib/sfn/utils/stack_parameter_scrubber.rb
sfn-3.0.4 lib/sfn/utils/stack_parameter_scrubber.rb
sfn-3.0.2 lib/sfn/utils/stack_parameter_scrubber.rb
sfn-3.0.0 lib/sfn/utils/stack_parameter_scrubber.rb