VaporShell.KMS.Classes.ps1

using namespace System
using namespace System.Collections
using namespace System.Collections.Generic
using namespace System.IO
using namespace System.Management.Automation
[CmdletBinding()]
Param()

Write-Verbose "Importing class 'KMSKey'"

class KMSKey : VSResource {
    hidden [string] $_vsFunctionName = 'New-VSKMSKey'
    hidden [string] $_awsDocumentation = 'http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-key.html'

    hidden [string[]] $_attributes = @('Arn','KeyId')
    hidden [object] $_condition

    [string] $Type = 'AWS::KMS::Key'
    [string] $Description
    [bool] $Enabled
    [bool] $EnableKeyRotation
    [VSJson] $KeyPolicy
    [string] $KeyUsage
    [string] $KeySpec
    [int] $PendingWindowInDays
    [VSTag[]] $Tags
    [VSJson] $Metadata
    [UpdatePolicy] $UpdatePolicy
    [string] $Condition

    hidden [void] _addAccessors() {
        $this._addBaseAccessors()
        $this | Add-Member -Force -MemberType ScriptProperty -Name Description -Value {
            $this.Properties['Description']
        } -SecondValue {
            param([ValidateType(([string], [int], [IntrinsicFunction], [ConditionFunction]))] [object] $value)
            $this.Properties['Description'] = if ($value -is [int]) {
                $value.ToString()
            }
            else {
                $value
            }
        }
        $this | Add-Member -Force -MemberType ScriptProperty -Name Enabled -Value {
            $this.Properties['Enabled']
        } -SecondValue {
            param([ValidateType(([bool], [IntrinsicFunction], [ConditionFunction]))] [object] $value)
            $this.Properties['Enabled'] = $value
        }
        $this | Add-Member -Force -MemberType ScriptProperty -Name EnableKeyRotation -Value {
            $this.Properties['EnableKeyRotation']
        } -SecondValue {
            param([ValidateType(([bool], [IntrinsicFunction], [ConditionFunction]))] [object] $value)
            $this.Properties['EnableKeyRotation'] = $value
        }
        $this | Add-Member -Force -MemberType ScriptProperty -Name KeyPolicy -Value {
            $this.Properties['KeyPolicy']
        } -SecondValue {
            param([ValidateType(([string], [VSJson], [VSYaml], [psobject], [IDictionary]))][object] $value)
            $this.Properties['KeyPolicy'] = if ($value -is [VSJson]) {
                $value
            }
            else {
                [VSJson]::new($value)
            }
        }
        $this | Add-Member -Force -MemberType ScriptProperty -Name KeyUsage -Value {
            $this.Properties['KeyUsage']
        } -SecondValue {
            param([ValidateType(([string], [int], [IntrinsicFunction], [ConditionFunction]))] [object] $value)
            $this.Properties['KeyUsage'] = if ($value -is [int]) {
                $value.ToString()
            }
            else {
                $value
            }
        }
        $this | Add-Member -Force -MemberType ScriptProperty -Name KeySpec -Value {
            $this.Properties['KeySpec']
        } -SecondValue {
            param([ValidateType(([string], [int], [IntrinsicFunction], [ConditionFunction]))] [object] $value)
            $this.Properties['KeySpec'] = if ($value -is [int]) {
                $value.ToString()
            }
            else {
                $value
            }
        }
        $this | Add-Member -Force -MemberType ScriptProperty -Name PendingWindowInDays -Value {
            $this.Properties['PendingWindowInDays']
        } -SecondValue {
            param([ValidateType(([string], [int], [IntrinsicFunction], [ConditionFunction]))] [object] $value)
            $this.Properties['PendingWindowInDays'] = if ($cast = $value -as [int]) {
                $cast
            }
            else {
                $value
            }
        }
        $this | Add-Member -Force -MemberType ScriptProperty -Name Tags -Value {
            $this.Properties['Tags']
        } -SecondValue {
            param([TransformTag()] [ValidateType(([IDictionary], [psobject], [VSTag]))] [object] $value)
            $this.Properties['Tags'] = [VSTag]::TransformTag($value)
        }
        $this | Add-Member -Force -MemberType ScriptProperty -Name Condition -Value {
            $this._condition
        } -SecondValue {
            param(
                [ValidateType(([string], [IntrinsicFunction], [ConditionFunction]))] [object]
                $value
            )
            $this._condition = $value
        }
    }

    KMSKey() : base() {}
    KMSKey([IDictionary] $props) : base($props) {}
    KMSKey([psobject] $props) : base($props) {}
}

Write-Verbose "Importing class 'KMSAlias'"

class KMSAlias : VSResource {
    hidden [string] $_vsFunctionName = 'New-VSKMSAlias'
    hidden [string] $_awsDocumentation = 'http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-alias.html'

    hidden [object] $_condition

    [string] $Type = 'AWS::KMS::Alias'
    [string] $AliasName
    [string] $TargetKeyId
    [VSJson] $Metadata
    [UpdatePolicy] $UpdatePolicy
    [string] $Condition

    hidden [void] _addAccessors() {
        $this._addBaseAccessors()
        $this | Add-Member -Force -MemberType ScriptProperty -Name AliasName -Value {
            $this.Properties['AliasName']
        } -SecondValue {
            param([ValidateType(([string], [int], [IntrinsicFunction], [ConditionFunction]))] [object] $value)
            $this.Properties['AliasName'] = if ($value -is [int]) {
                $value.ToString()
            }
            else {
                $value
            }
        }
        $this | Add-Member -Force -MemberType ScriptProperty -Name TargetKeyId -Value {
            $this.Properties['TargetKeyId']
        } -SecondValue {
            param([ValidateType(([string], [int], [IntrinsicFunction], [ConditionFunction]))] [object] $value)
            $this.Properties['TargetKeyId'] = if ($value -is [int]) {
                $value.ToString()
            }
            else {
                $value
            }
        }
        $this | Add-Member -Force -MemberType ScriptProperty -Name Condition -Value {
            $this._condition
        } -SecondValue {
            param(
                [ValidateType(([string], [IntrinsicFunction], [ConditionFunction]))] [object]
                $value
            )
            $this._condition = $value
        }
    }

    KMSAlias() : base() {}
    KMSAlias([IDictionary] $props) : base($props) {}
    KMSAlias([psobject] $props) : base($props) {}
}