ps/Modules/Alkami.DevOps.Common/Public/Get-AlkamiAwsProfileList.ps1

121 lines
2.3 KiB
PowerShell
Raw Normal View History

2023-05-30 22:51:22 -07:00
function Get-AlkamiAwsProfileList {
<#
.SYNOPSIS
Retrieves a list of all Alkami AWS profile names.
.DESCRIPTION
Retrieves a list of all Alkami AWS profile names. Will prepend 'temp-' to the profile names if not running
through a TeamCity process; this logic can be bypassed using the '-RawOutput' argument.
.PARAMETER RawOutput
[switch] Flag indicating that the profiles should not have 'temp-' prepended to them.
.PARAMETER IncludeSubsidiaries
[switch] Flag indicating that the profile names for Alkami subsidiaries should also be included.
.EXAMPLE
Get-AlkamiAwsProfileList
temp-corp
temp-dev
temp-loadtest
temp-mgmt
temp-mp
temp-prod
temp-qa
temp-sandbox
temp-security
temp-transit
temp-transitnp
temp-workspaces
.EXAMPLE
Get-AlkamiAwsProfileList -RawOutput
Corp
Dev
Loadtest
Mgmt
Mp
Prod
Qa
Sandbox
Security
Transit
Transitnp
Workspaces
.EXAMPLE
Get-AlkamiAwsProfileList -IncludeSubsidiaries
temp-achdev
temp-corp
temp-dev
temp-loadtest
temp-mgmt
temp-mp
temp-prod
temp-qa
temp-sandbox
temp-security
temp-transit
temp-transitnp
temp-workspaces
#>
[OutputType([string[]])]
[CmdletBinding()]
param (
[Parameter(Mandatory = $false)]
[switch] $RawOutput,
[Parameter(Mandatory = $false)]
[Alias("All")]
[switch] $IncludeSubsidiaries
)
# Define the standard list of AWS profiles for Alkami.
$awsProfileList = @(
"Corp",
"Dev",
"Loadtest",
"Mgmt",
"Mp",
"Prod",
"Qa",
"Sandbox",
"Security",
"Transit",
"Transitnp",
"Workspaces"
)
# Define the standard list of AWS profiles for Alkami subsidiaries.
$awsProfileListSubsidiaries = @(
'AchDev'
'IgniteDev',
'IgniteMerchantsProd',
'IgniteIam',
'IgniteBanksProd',
'IgniteBanksTest',
'IgniteBanksQa'
)
$result = $awsProfileList
if ( $IncludeSubsidiaries ) {
$result += $awsProfileListSubsidiaries
}
if (( $false -eq ( Test-IsTeamCityProcess ) ) -and ( $false -eq $RawOutput.IsPresent ) ) {
# Prepend 'temp-' to the profile name if we aren't on TeamCity and the user didn't specify
# that they wanted raw output.
$result = $result.ForEach( { "temp-" + $_.ToLower() } )
}
return ( $result | Sort-Object )
}