Skip to content
This repository has been archived by the owner on Oct 21, 2023. It is now read-only.

Commit

Permalink
!deploy - Added native template validation and credential management,…
Browse files Browse the repository at this point in the history
… plus cleaned up unnecessary PSScriptAnalyzer rules
  • Loading branch information
scrthq committed Aug 20, 2017
1 parent 5f4295e commit d8ed27e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Tests/Vaporshell.Tests.ps1
Expand Up @@ -42,7 +42,7 @@ Describe "Module tests: $ModuleName" {
$newFunctionCount -ge $currentFunctionCount | Should Be $true
}
It 'Should set the credentials correctly on the shared file' {
Set-VSCredentials -AccessKey $Env:AWS_ACCESS_KEY_ID -SecretKey $Env:AWS_SECRET_ACCESS_KEY -Region $Env:AWS_DEFAULT_REGION
Set-VSCredentials -AccessKey $Env:AWS_ACCESS_KEY_ID -SecretKey $Env:AWS_SECRET_ACCESS_KEY -Region "USWest1"
}
}
Context 'Strict mode' {
Expand Down
4 changes: 2 additions & 2 deletions Vaporshell/Private/Convert-SpecToFunction.ps1
Expand Up @@ -9,7 +9,7 @@ function Convert-SpecToFunction {
[String]
$ResourceType
)
$ModPath = $((Get-Module Vaporshell).ModuleBase)
$ModPath = $Script:VaporshellPath
$folder = "$($ModPath)\Public"
$Name = $Resource.Name
$Link = $Resource.Value.Documentation
Expand Down Expand Up @@ -395,5 +395,5 @@ $scriptContents += @"
}
"@
}
Set-Content -Value $scriptContents -Path $PS1Path -Force
Set-Content -Value $scriptContents -Path $PS1Path -Encoding UTF8 -Force
}
34 changes: 13 additions & 21 deletions Vaporshell/Public/SDK Wrappers/Set-VSCredentials.ps1
@@ -1,29 +1,21 @@
function Set-VSCredentials {
[cmdletbinding()]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingPlainTextForPassword","CredentialStore")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingUserNameAndPasswordParams","")]
Param
(
[parameter(Mandatory=$false,Position=0)]
[String]
$ProfileName = "default",
[parameter(Mandatory=$false)]
[String]
$AccessKey,
[parameter(Mandatory=$false)]
[String]
$SecretKey
[parameter(Mandatory = $false,Position = 0)]
[String]
$ProfileName = "default",
[parameter(Mandatory = $false)]
[String]
$AccessKey,
[parameter(Mandatory = $false)]
[String]
$SecretKey,
[parameter(Mandatory = $false)]
[ValidateSet("APNortheast1","APNortheast2","APSouth1","APSoutheast1","APSoutheast2","CACentral1","CNNorth1","EUCentral1","EUWest1","EUWest2","SAEast1","USEast1","USEast2","USGovCloudWest1","USWest1","USWest2")]
[String]
$Region
)
DynamicParam {
$ParamAttrib = New-Object System.Management.Automation.ParameterAttribute -Property @{Mandatory = $false;ParameterSetName = '__AllParameterSets'}
$AttribColl = New-Object System.Collections.ObjectModel.Collection[System.Attribute]
$AttribColl.Add($ParamAttrib)
$AttribColl.Add((New-Object System.Management.Automation.ValidateSetAttribute(([Amazon.RegionEndpoint]).GetFields().Name)))
$RuntimeParam = New-Object System.Management.Automation.RuntimeDefinedParameter('Region', [string], $AttribColl)
$RuntimeParamDic = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary
$RuntimeParamDic.Add('Region', $RuntimeParam)
return $RuntimeParamDic
}
Begin {
$optProps = @{}
if ($PSBoundParameters.Keys -contains "AccessKey") {
Expand Down

0 comments on commit d8ed27e

Please sign in to comment.