IGNORE/CfnTypes.ps1

<#
We define this type hierarchy to be able to support and enforce
some type safety on Resource properties which allow assignment
of a typed value literal or an invocation to a function call.
#>


Add-Type -TypeDefinition @"
namespace POSH.AwsCfn {
    public class CfnPropertyValue {
        public object Value
        { get; protected set; }
      
        protected CfnPropertyValue() {
        }
 
        //public static CfnPropertyValue From(object value) {
        // return new CfnPropertyValue { Value = value };
        //}
    }
 
    public class CfnPropertyFnValue : CfnPropertyValue {
        public CfnPropertyFnValue(object value) {
            Value = value;
        }
    }
 
    public class CfnPropertyTypedValue<T> : CfnPropertyValue {
        public T TypedValue
        { get; private set; }
     
        protected CfnPropertyTypedValue() {
        }
 
        public CfnPropertyTypedValue(T value) {
            TypedValue = value;
            Value = value;
            if ((Value != null) && !(Value is string)) {
                Value = Value.ToString();
            }
        }
 
        public static implicit operator CfnPropertyTypedValue<T>(CfnPropertyFnValue fn) {
            return new CfnPropertyTypedValue<T> { Value = fn.Value };
        }
 
        public static implicit operator CfnPropertyTypedValue<T>(T value) {
            return new CfnPropertyTypedValue<T>(value);
        }
    }
 
    public class CfnPropertyTypedArrayValue<T> : CfnPropertyTypedValue<T[]> {
        public CfnPropertyTypedArrayValue(T[] value) : base(value)
        { }
 
        public static implicit operator CfnPropertyTypedArrayValue<T>(T value) {
            return new CfnPropertyTypedArrayValue<T>(new T[] { value });
        }
    }
}
"@