Public/Confirm-PegasusSyncOperationStatistics.ps1
|
function Confirm-PegasusSyncOperationStatistics { [CmdletBinding()] Param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true)] [System.Collections.Hashtable] $Statistics, [Parameter(Mandatory = $false, ValueFromPipeline = $false)] [ValidateRange(-1, [int]::MaxValue)] [int] $Delete = 100, [Parameter(Mandatory = $false, ValueFromPipeline = $false)] [ValidateRange(-1, [int]::MaxValue)] [int] $Update = 1000, [Parameter(Mandatory = $false, ValueFromPipeline = $false)] [ValidateRange(-1, [int]::MaxValue)] [int] $Create = -1, [Parameter(Mandatory = $false, ValueFromPipeline = $false)] [ValidateRange(-1, [int]::MaxValue)] [int] $DeletePosition = -1, [Parameter(Mandatory = $false, ValueFromPipeline = $false)] [ValidateRange(-1, [int]::MaxValue)] [int] $UpdatePerson = -1, [Parameter(Mandatory = $false, ValueFromPipeline = $false)] [ValidateRange(-1, [int]::MaxValue)] [int] $UpdatePosition = -1, [Parameter(Mandatory = $false, ValueFromPipeline = $false)] [ValidateRange(-1, [int]::MaxValue)] [int] $CreatePosition = -1, [Parameter(Mandatory = $false, ValueFromPipeline = $false)] [ValidateRange(-1, [int]::MaxValue)] [int] $DeleteOrgUnit = -1, [Parameter(Mandatory = $false, ValueFromPipeline = $false)] [ValidateRange(-1, [int]::MaxValue)] [int] $DeletePerson = -1, [Parameter(Mandatory = $false, ValueFromPipeline = $false)] [ValidateRange(-1, [int]::MaxValue)] [int] $UpdateOrgUnit = -1, [Parameter(Mandatory = $false, ValueFromPipeline = $false)] [ValidateRange(-1, [int]::MaxValue)] [int] $CreatePerson = -1, [Parameter(Mandatory = $false, ValueFromPipeline = $false)] [ValidateRange(-1, [int]::MaxValue)] [int] $CreateOrgUnit = -1 ) Process { if (($Delete -ne -1) -and ($Statistics."Delete" -gt $Delete)) { throw "Delete operations exceeded the limit of $Delete. Actual: $($Statistics."Delete")" } if (($Update -ne -1) -and ($Statistics."Update" -gt $Update)) { throw "Update operations exceeded the limit of $Update. Actual: $($Statistics."Update")" } if (($Create -ne -1) -and ($Statistics."Create" -gt $Create)) { throw "Create operations exceeded the limit of $Create. Actual: $($Statistics."Create")" } # Position operations if (($DeletePosition -ne -1) -and ($Statistics."Delete position" -gt $DeletePosition)) { throw "Delete position operations exceeded the limit of $DeletePosition. Actual: $($Statistics."Delete position")" } if (($UpdatePosition -ne -1) -and ($Statistics."Update position" -gt $UpdatePosition)) { throw "Update position operations exceeded the limit of $UpdatePosition. Actual: $($Statistics."Update position")" } if (($CreatePosition -ne -1) -and ($Statistics."Create position" -gt $CreatePosition)) { throw "Create position operations exceeded the limit of $CreatePosition. Actual: $($Statistics."Create position")" } # Org unit operations if (($DeleteOrgUnit -ne -1) -and ($Statistics."Delete orgunit" -gt $DeleteOrgUnit)) { throw "Delete orgunit operations exceeded the limit of $DeleteOrgUnit. Actual: $($Statistics."Delete orgunit")" } if (($UpdateOrgUnit -ne -1) -and ($Statistics."Update orgunit" -gt $UpdateOrgUnit)) { throw "Update orgunit operations exceeded the limit of $UpdateOrgUnit. Actual: $($Statistics."Update orgunit")" } if (($CreateOrgUnit -ne -1) -and ($Statistics."Create orgunit" -gt $CreateOrgUnit)) { throw "Create orgunit operations exceeded the limit of $CreateOrgUnit. Actual: $($Statistics."Create orgunit")" } # Person operations if (($CreatePerson -ne -1) -and ($Statistics."Create person" -gt $CreatePerson)) { throw "Create person operations exceeded the limit of $CreatePerson. Actual: $($Statistics."Create person")" } if (($UpdatePerson -ne -1) -and ($Statistics."Update person" -gt $UpdatePerson)) { throw "Update person operations exceeded the limit of $UpdatePerson. Actual: $($Statistics."Update person")" } if (($DeletePerson -ne -1) -and ($Statistics."Delete person" -gt $DeletePerson)) { throw "Delete person operations exceeded the limit of $DeletePerson. Actual: $($Statistics."Delete person")" } } } |