From 5c24cfd1883388e1c54f81760585a97dd7e64e2a Mon Sep 17 00:00:00 2001 From: Nate Ferrell Date: Thu, 4 Jun 2020 01:45:47 -0500 Subject: [PATCH] corrected docs issue with New-VaporCondition ## 2.12.2 - 2020-06-04 * [Issue #79](https://github.com/SCRT-HQ/VaporShell/issues/79) * Fixed: Documentation on `New-VaporCondition` --- CHANGELOG.md | 6 ++ README.md | 2 +- .../Primary Functions/New-VaporCondition.ps1 | 12 +-- ...EndpointFederatedAuthenticationRequest.ps1 | 54 ++++++++++++ ...hoseDeliveryStreamRedshiftRetryOptions.ps1 | 54 ++++++++++++ ...FirehoseDeliveryStreamVpcConfiguration.ps1 | 72 ++++++++++++++++ ...onsStateMachineDefinitionSubstitutions.ps1 | 38 ++++++++ ...-VSStepFunctionsStateMachineS3Location.ps1 | 86 +++++++++++++++++++ 8 files changed, 317 insertions(+), 7 deletions(-) create mode 100644 VaporShell/Public/Resource Property Types/Add-VSEC2ClientVpnEndpointFederatedAuthenticationRequest.ps1 create mode 100644 VaporShell/Public/Resource Property Types/Add-VSKinesisFirehoseDeliveryStreamRedshiftRetryOptions.ps1 create mode 100644 VaporShell/Public/Resource Property Types/Add-VSKinesisFirehoseDeliveryStreamVpcConfiguration.ps1 create mode 100644 VaporShell/Public/Resource Property Types/Add-VSStepFunctionsStateMachineDefinitionSubstitutions.ps1 create mode 100644 VaporShell/Public/Resource Property Types/Add-VSStepFunctionsStateMachineS3Location.ps1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f91964d8..a24ba38ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ +* [2.12.2 - 2020-06-04](#2122---2020-06-04) * [2.12.1 - 2020-05-05](#2121---2020-05-05) * [2.12.0 - 2020-05-03](#2120---2020-05-03) * [2.11.1 - 2020-03-09](#2111---2020-03-09) @@ -56,6 +57,11 @@ +## 2.12.2 - 2020-06-04 + +* [Issue #79](https://github.com/SCRT-HQ/VaporShell/issues/79) + * Fixed: Documentation on `New-VaporCondition` + ## 2.12.1 - 2020-05-05 * Miscellaneous diff --git a/README.md b/README.md index a4f5847e8..5f3c6a462 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,7 @@ Install-Module VaporShell -Scope CurrentUser **[Alternative]** Not on PowerShell 5+, can't install PowerShellGet, or policies blocking installation from remote sources? You're covered as well: -1. Head to the [Releases](https://github.com/scrthq/VaporShell/releases) section in the repo +1. Head to the [Releases](https://github.com/SCRT-HQ/VaporShell/releases) section in the repo 2. Download the *VaporShell.zip* file attached to the latest release. 3. **If on Windows**: Right-click the downloaded zip, select Properties, then unblock the file. > _This is to prevent having to unblock each file individually after unzipping._ diff --git a/VaporShell/Public/Primary Functions/New-VaporCondition.ps1 b/VaporShell/Public/Primary Functions/New-VaporCondition.ps1 index b03524e31..2093529ca 100644 --- a/VaporShell/Public/Primary Functions/New-VaporCondition.ps1 +++ b/VaporShell/Public/Primary Functions/New-VaporCondition.ps1 @@ -2,7 +2,7 @@ function New-VaporCondition { <# .SYNOPSIS Adds a Condition object to the template - + .DESCRIPTION The optional Conditions section includes statements that define when a resource is created or when a property is defined. For example, you can compare whether a value is equal to another value. Based on the result of that condition, you can conditionally create resources. If you have multiple conditions, separate them with commas. @@ -28,20 +28,20 @@ function New-VaporCondition { .LINK http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/conditions-section-structure.html - + .PARAMETER LogicalId An identifier for the current condition. The logical ID must be alphanumeric (a-z, A-Z, 0-9) and unique within the template. - + .PARAMETER Condition Logical ID of the condition that this resource needs to be true in order to be provisioned. .EXAMPLE $template = Initialize-Vaporshell -Description "Testing Condition addition" - $template.AddResource(( + $template.AddCondition(( New-VaporCondition -LogicalId "CreateProdResources" -Condition (Add-ConEquals -FirstValue (Add-FnRef -Ref "EnvType") -SecondValue "prod") )) - When the template is exported, this will convert to: + When the template is exported, this will convert to: { "AWSTemplateFormatVersion": "2010-09-09", "Description": "Testing Condition addition", @@ -101,4 +101,4 @@ function New-VaporCondition { } $obj | Add-ObjectDetail -TypeName 'Vaporshell.Condition' Write-Verbose "Resulting JSON from $($MyInvocation.MyCommand): `n`n`t$(@{$obj.LogicalId = $obj.Props} | ConvertTo-Json -Depth 5 -Compress)`n" -} \ No newline at end of file +} diff --git a/VaporShell/Public/Resource Property Types/Add-VSEC2ClientVpnEndpointFederatedAuthenticationRequest.ps1 b/VaporShell/Public/Resource Property Types/Add-VSEC2ClientVpnEndpointFederatedAuthenticationRequest.ps1 new file mode 100644 index 000000000..e0ff5d76d --- /dev/null +++ b/VaporShell/Public/Resource Property Types/Add-VSEC2ClientVpnEndpointFederatedAuthenticationRequest.ps1 @@ -0,0 +1,54 @@ +function Add-VSEC2ClientVpnEndpointFederatedAuthenticationRequest { + <# + .SYNOPSIS + Adds an AWS::EC2::ClientVpnEndpoint.FederatedAuthenticationRequest resource property to the template. + + .DESCRIPTION + Adds an AWS::EC2::ClientVpnEndpoint.FederatedAuthenticationRequest resource property to the template. + + + .LINK + http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-clientvpnendpoint-federatedauthenticationrequest.html + + .PARAMETER SAMLProviderArn + Documentation: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-clientvpnendpoint-federatedauthenticationrequest.html#cfn-ec2-clientvpnendpoint-federatedauthenticationrequest-samlproviderarn + PrimitiveType: String + UpdateType: Mutable + + .FUNCTIONALITY + Vaporshell + #> + [OutputType('Vaporshell.Resource.EC2.ClientVpnEndpoint.FederatedAuthenticationRequest')] + [cmdletbinding()] + Param + ( + [parameter(Mandatory = $true)] + [ValidateScript( { + $allowedTypes = "System.String","Vaporshell.Function","Vaporshell.Condition" + if ([string]$($_.PSTypeNames) -match "($(($allowedTypes|ForEach-Object{[RegEx]::Escape($_)}) -join '|'))") { + $true + } + else { + $PSCmdlet.ThrowTerminatingError((New-VSError -String "This parameter only accepts the following types: $($allowedTypes -join ", "). The current types of the value are: $($_.PSTypeNames -join ", ").")) + } + })] + $SAMLProviderArn + ) + Begin { + $obj = [PSCustomObject]@{} + $commonParams = @('Verbose','Debug','ErrorAction','WarningAction','InformationAction','ErrorVariable','WarningVariable','InformationVariable','OutVariable','OutBuffer','PipelineVariable') + } + Process { + foreach ($key in $PSBoundParameters.Keys | Where-Object {$commonParams -notcontains $_}) { + switch ($key) { + Default { + $obj | Add-Member -MemberType NoteProperty -Name $key -Value $PSBoundParameters.$key + } + } + } + } + End { + $obj | Add-ObjectDetail -TypeName 'Vaporshell.Resource.EC2.ClientVpnEndpoint.FederatedAuthenticationRequest' + Write-Verbose "Resulting JSON from $($MyInvocation.MyCommand): `n`n$($obj | ConvertTo-Json -Depth 5)`n" + } +} diff --git a/VaporShell/Public/Resource Property Types/Add-VSKinesisFirehoseDeliveryStreamRedshiftRetryOptions.ps1 b/VaporShell/Public/Resource Property Types/Add-VSKinesisFirehoseDeliveryStreamRedshiftRetryOptions.ps1 new file mode 100644 index 000000000..16815c10e --- /dev/null +++ b/VaporShell/Public/Resource Property Types/Add-VSKinesisFirehoseDeliveryStreamRedshiftRetryOptions.ps1 @@ -0,0 +1,54 @@ +function Add-VSKinesisFirehoseDeliveryStreamRedshiftRetryOptions { + <# + .SYNOPSIS + Adds an AWS::KinesisFirehose::DeliveryStream.RedshiftRetryOptions resource property to the template. + + .DESCRIPTION + Adds an AWS::KinesisFirehose::DeliveryStream.RedshiftRetryOptions resource property to the template. + + + .LINK + http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-redshiftretryoptions.html + + .PARAMETER DurationInSeconds + Documentation: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-redshiftretryoptions.html#cfn-kinesisfirehose-deliverystream-redshiftretryoptions-durationinseconds + UpdateType: Mutable + PrimitiveType: Integer + + .FUNCTIONALITY + Vaporshell + #> + [OutputType('Vaporshell.Resource.KinesisFirehose.DeliveryStream.RedshiftRetryOptions')] + [cmdletbinding()] + Param + ( + [parameter(Mandatory = $false)] + [ValidateScript( { + $allowedTypes = "System.Int32","Vaporshell.Function" + if ([string]$($_.PSTypeNames) -match "($(($allowedTypes|ForEach-Object{[RegEx]::Escape($_)}) -join '|'))") { + $true + } + else { + $PSCmdlet.ThrowTerminatingError((New-VSError -String "This parameter only accepts the following types: $($allowedTypes -join ", "). The current types of the value are: $($_.PSTypeNames -join ", ").")) + } + })] + $DurationInSeconds + ) + Begin { + $obj = [PSCustomObject]@{} + $commonParams = @('Verbose','Debug','ErrorAction','WarningAction','InformationAction','ErrorVariable','WarningVariable','InformationVariable','OutVariable','OutBuffer','PipelineVariable') + } + Process { + foreach ($key in $PSBoundParameters.Keys | Where-Object {$commonParams -notcontains $_}) { + switch ($key) { + Default { + $obj | Add-Member -MemberType NoteProperty -Name $key -Value $PSBoundParameters.$key + } + } + } + } + End { + $obj | Add-ObjectDetail -TypeName 'Vaporshell.Resource.KinesisFirehose.DeliveryStream.RedshiftRetryOptions' + Write-Verbose "Resulting JSON from $($MyInvocation.MyCommand): `n`n$($obj | ConvertTo-Json -Depth 5)`n" + } +} diff --git a/VaporShell/Public/Resource Property Types/Add-VSKinesisFirehoseDeliveryStreamVpcConfiguration.ps1 b/VaporShell/Public/Resource Property Types/Add-VSKinesisFirehoseDeliveryStreamVpcConfiguration.ps1 new file mode 100644 index 000000000..4fa9f2731 --- /dev/null +++ b/VaporShell/Public/Resource Property Types/Add-VSKinesisFirehoseDeliveryStreamVpcConfiguration.ps1 @@ -0,0 +1,72 @@ +function Add-VSKinesisFirehoseDeliveryStreamVpcConfiguration { + <# + .SYNOPSIS + Adds an AWS::KinesisFirehose::DeliveryStream.VpcConfiguration resource property to the template. + + .DESCRIPTION + Adds an AWS::KinesisFirehose::DeliveryStream.VpcConfiguration resource property to the template. + + + .LINK + http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-vpcconfiguration.html + + .PARAMETER RoleARN + Documentation: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-vpcconfiguration.html#cfn-kinesisfirehose-deliverystream-vpcconfiguration-rolearn + UpdateType: Immutable + PrimitiveType: String + + .PARAMETER SubnetIds + Documentation: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-vpcconfiguration.html#cfn-kinesisfirehose-deliverystream-vpcconfiguration-subnetids + UpdateType: Immutable + Type: List + PrimitiveItemType: String + DuplicatesAllowed: False + + .PARAMETER SecurityGroupIds + Documentation: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-vpcconfiguration.html#cfn-kinesisfirehose-deliverystream-vpcconfiguration-securitygroupids + UpdateType: Immutable + Type: List + PrimitiveItemType: String + DuplicatesAllowed: False + + .FUNCTIONALITY + Vaporshell + #> + [OutputType('Vaporshell.Resource.KinesisFirehose.DeliveryStream.VpcConfiguration')] + [cmdletbinding()] + Param + ( + [parameter(Mandatory = $true)] + [ValidateScript( { + $allowedTypes = "System.String","Vaporshell.Function","Vaporshell.Condition" + if ([string]$($_.PSTypeNames) -match "($(($allowedTypes|ForEach-Object{[RegEx]::Escape($_)}) -join '|'))") { + $true + } + else { + $PSCmdlet.ThrowTerminatingError((New-VSError -String "This parameter only accepts the following types: $($allowedTypes -join ", "). The current types of the value are: $($_.PSTypeNames -join ", ").")) + } + })] + $RoleARN, + [parameter(Mandatory = $true)] + $SubnetIds, + [parameter(Mandatory = $true)] + $SecurityGroupIds + ) + Begin { + $obj = [PSCustomObject]@{} + $commonParams = @('Verbose','Debug','ErrorAction','WarningAction','InformationAction','ErrorVariable','WarningVariable','InformationVariable','OutVariable','OutBuffer','PipelineVariable') + } + Process { + foreach ($key in $PSBoundParameters.Keys | Where-Object {$commonParams -notcontains $_}) { + switch ($key) { + Default { + $obj | Add-Member -MemberType NoteProperty -Name $key -Value $PSBoundParameters.$key + } + } + } + } + End { + $obj | Add-ObjectDetail -TypeName 'Vaporshell.Resource.KinesisFirehose.DeliveryStream.VpcConfiguration' + Write-Verbose "Resulting JSON from $($MyInvocation.MyCommand): `n`n$($obj | ConvertTo-Json -Depth 5)`n" + } +} diff --git a/VaporShell/Public/Resource Property Types/Add-VSStepFunctionsStateMachineDefinitionSubstitutions.ps1 b/VaporShell/Public/Resource Property Types/Add-VSStepFunctionsStateMachineDefinitionSubstitutions.ps1 new file mode 100644 index 000000000..33c5daca0 --- /dev/null +++ b/VaporShell/Public/Resource Property Types/Add-VSStepFunctionsStateMachineDefinitionSubstitutions.ps1 @@ -0,0 +1,38 @@ +function Add-VSStepFunctionsStateMachineDefinitionSubstitutions { + <# + .SYNOPSIS + Adds an AWS::StepFunctions::StateMachine.DefinitionSubstitutions resource property to the template. + + .DESCRIPTION + Adds an AWS::StepFunctions::StateMachine.DefinitionSubstitutions resource property to the template. + + + .LINK + + + .FUNCTIONALITY + Vaporshell + #> + [OutputType('Vaporshell.Resource.StepFunctions.StateMachine.DefinitionSubstitutions')] + [cmdletbinding()] + Param + ( + ) + Begin { + $obj = [PSCustomObject]@{} + $commonParams = @('Verbose','Debug','ErrorAction','WarningAction','InformationAction','ErrorVariable','WarningVariable','InformationVariable','OutVariable','OutBuffer','PipelineVariable') + } + Process { + foreach ($key in $PSBoundParameters.Keys | Where-Object {$commonParams -notcontains $_}) { + switch ($key) { + Default { + $obj | Add-Member -MemberType NoteProperty -Name $key -Value $PSBoundParameters.$key + } + } + } + } + End { + $obj | Add-ObjectDetail -TypeName 'Vaporshell.Resource.StepFunctions.StateMachine.DefinitionSubstitutions' + Write-Verbose "Resulting JSON from $($MyInvocation.MyCommand): `n`n$($obj | ConvertTo-Json -Depth 5)`n" + } +} diff --git a/VaporShell/Public/Resource Property Types/Add-VSStepFunctionsStateMachineS3Location.ps1 b/VaporShell/Public/Resource Property Types/Add-VSStepFunctionsStateMachineS3Location.ps1 new file mode 100644 index 000000000..de4487b77 --- /dev/null +++ b/VaporShell/Public/Resource Property Types/Add-VSStepFunctionsStateMachineS3Location.ps1 @@ -0,0 +1,86 @@ +function Add-VSStepFunctionsStateMachineS3Location { + <# + .SYNOPSIS + Adds an AWS::StepFunctions::StateMachine.S3Location resource property to the template. + + .DESCRIPTION + Adds an AWS::StepFunctions::StateMachine.S3Location resource property to the template. + + + .LINK + http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-stepfunctions-statemachine-s3location.html + + .PARAMETER Bucket + Documentation: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-stepfunctions-statemachine-s3location.html#cfn-stepfunctions-statemachine-s3location-bucket + PrimitiveType: String + UpdateType: Mutable + + .PARAMETER Version + Documentation: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-stepfunctions-statemachine-s3location.html#cfn-stepfunctions-statemachine-s3location-version + PrimitiveType: String + UpdateType: Mutable + + .PARAMETER Key + Documentation: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-stepfunctions-statemachine-s3location.html#cfn-stepfunctions-statemachine-s3location-key + PrimitiveType: String + UpdateType: Mutable + + .FUNCTIONALITY + Vaporshell + #> + [OutputType('Vaporshell.Resource.StepFunctions.StateMachine.S3Location')] + [cmdletbinding()] + Param + ( + [parameter(Mandatory = $true)] + [ValidateScript( { + $allowedTypes = "System.String","Vaporshell.Function","Vaporshell.Condition" + if ([string]$($_.PSTypeNames) -match "($(($allowedTypes|ForEach-Object{[RegEx]::Escape($_)}) -join '|'))") { + $true + } + else { + $PSCmdlet.ThrowTerminatingError((New-VSError -String "This parameter only accepts the following types: $($allowedTypes -join ", "). The current types of the value are: $($_.PSTypeNames -join ", ").")) + } + })] + $Bucket, + [parameter(Mandatory = $false)] + [ValidateScript( { + $allowedTypes = "System.String","Vaporshell.Function","Vaporshell.Condition" + if ([string]$($_.PSTypeNames) -match "($(($allowedTypes|ForEach-Object{[RegEx]::Escape($_)}) -join '|'))") { + $true + } + else { + $PSCmdlet.ThrowTerminatingError((New-VSError -String "This parameter only accepts the following types: $($allowedTypes -join ", "). The current types of the value are: $($_.PSTypeNames -join ", ").")) + } + })] + $Version, + [parameter(Mandatory = $true)] + [ValidateScript( { + $allowedTypes = "System.String","Vaporshell.Function","Vaporshell.Condition" + if ([string]$($_.PSTypeNames) -match "($(($allowedTypes|ForEach-Object{[RegEx]::Escape($_)}) -join '|'))") { + $true + } + else { + $PSCmdlet.ThrowTerminatingError((New-VSError -String "This parameter only accepts the following types: $($allowedTypes -join ", "). The current types of the value are: $($_.PSTypeNames -join ", ").")) + } + })] + $Key + ) + Begin { + $obj = [PSCustomObject]@{} + $commonParams = @('Verbose','Debug','ErrorAction','WarningAction','InformationAction','ErrorVariable','WarningVariable','InformationVariable','OutVariable','OutBuffer','PipelineVariable') + } + Process { + foreach ($key in $PSBoundParameters.Keys | Where-Object {$commonParams -notcontains $_}) { + switch ($key) { + Default { + $obj | Add-Member -MemberType NoteProperty -Name $key -Value $PSBoundParameters.$key + } + } + } + } + End { + $obj | Add-ObjectDetail -TypeName 'Vaporshell.Resource.StepFunctions.StateMachine.S3Location' + Write-Verbose "Resulting JSON from $($MyInvocation.MyCommand): `n`n$($obj | ConvertTo-Json -Depth 5)`n" + } +}