63 lines
2.4 KiB
PowerShell
63 lines
2.4 KiB
PowerShell
function Test-AlkamiManifestGeneral10 {
|
|
<#
|
|
.SYNOPSIS
|
|
Please don't use this file by hand, please use Test-AlkamiManifest
|
|
This function is intended to validate the General portion of an AlkamiManifest dotted object/hashtable so we can ensure that the values provided meet a minimum standard of valid
|
|
|
|
.PARAMETER General
|
|
A dotted object ([xml](Get-Content -Path $somePath)) or hashtable of values
|
|
#>
|
|
[CmdletBinding()]
|
|
[OutputType([System.Collections.Hashtable])]
|
|
Param(
|
|
[Parameter(Position = 0, Mandatory = $true)]
|
|
[ValidateNotNullOrEmpty()]
|
|
[object]$General
|
|
)
|
|
|
|
$success = $true
|
|
$resultMessages = @()
|
|
|
|
if ([string]::IsNullOrWhiteSpace($General.creatorCode)) {
|
|
$resultMessages += 'The packageManifest/general/creatorCode tag in this file is missing or empty. This should be present.'
|
|
$success = $false
|
|
}
|
|
|
|
if ([string]::IsNullOrWhiteSpace($General.element)) {
|
|
$resultMessages += 'The packageManifest/general/element tag in this file is missing or empty. This should be present.'
|
|
$success = $false
|
|
}
|
|
|
|
if (-not [string]::IsNullOrWhiteSpace($General.releaseManagement.alwaysDeploy) -and -not (@('true','false') -contains $General.releaseManagement.alwaysDeploy)) {
|
|
$resultMessages += "packageManifest/general/releaseManagement/alwaysDeploy must be true or false, if a releaseManagement node is provided"
|
|
$success = $false
|
|
}
|
|
|
|
if (-not (Test-IsCollectionNullOrEmpty $General.bankIdentifiers)) {
|
|
foreach($bankIdentifier in $General.bankIdentifiers.bankIdentifier) {
|
|
$guid = $bankIdentifier.'#text'
|
|
$name = $bankIdentifier.name
|
|
if (-not $name) {
|
|
$resultMessages += 'Bank identifier should have a name so that it can be resolved to the expected FI during investigation of errors.'
|
|
$success = $false
|
|
}
|
|
if (-not $guid) {
|
|
$resultMessages += 'The bankIdentifier value must be specified'
|
|
$success = $false
|
|
}
|
|
try {
|
|
## Force the guid value to a guid type. This will error if it's invalid
|
|
([Guid]$guid) | Out-Null
|
|
}
|
|
catch {
|
|
$resultMessages += 'The bankIdentifier guid must be parseable as a valid guid'
|
|
$success = $false
|
|
}
|
|
}
|
|
}
|
|
|
|
return @{
|
|
success = $success
|
|
results = $resultMessages
|
|
}
|
|
} |