Sha256: 28f973685f46828e981d774db02723a2d928c23e413bd26ed8d9fdc23293be74

Contents?: true

Size: 734 Bytes

Versions: 3

Compression:

Stored size: 734 Bytes

Contents

module Humidifier
  # Represents a CFN stack parameter
  class Parameter
    # The allowed properties of all stack parameters
    PROPERTIES = Utils.underscored(%w[AllowedPattern AllowedValues ConstraintDescription Default Description
                                      MaxLength MaxValue MinLength MinValue NoEcho])

    attr_accessor :type, *PROPERTIES.values

    def initialize(opts = {})
      PROPERTIES.each_value { |prop| send(:"#{prop}=", opts[prop]) }
      self.type = opts.fetch(:type, 'String')
    end

    # CFN stack syntax
    def to_cf
      cf = { 'Type' => type }
      PROPERTIES.each do |name, prop|
        val = send(prop)
        cf[name] = Serializer.dump(val) if val
      end
      cf
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
humidifier-1.8.0 lib/humidifier/parameter.rb
humidifier-1.7.0 lib/humidifier/parameter.rb
humidifier-1.6.1 lib/humidifier/parameter.rb