Public/Test-IAMCoreSyncRuleExpression.ps1
|
function Test-IAMCoreSyncRuleExpression { [CmdletBinding()] Param( [Parameter(Mandatory = $true)] [ValidatePattern("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$")] # Is a guid connector object id [string]$ConnectorId, [Parameter(Mandatory = $true)] [ValidatePattern("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$")] # Is a guid connector object id [string]$ConnectorObjectId, [Parameter(Mandatory = $true)] [System.Collections.Specialized.OrderedDictionary] $Expression ) Process { if (-not $Script:APIRoot -or -not $Script:AccessTokenProfile) { throw "Not connected to IAM Core. Please run Connect-IAMCore first." } $Result = Invoke-RestMethod -Uri "$Script:APIRoot/sync/connectors/$($ConnectorId)/data/$($ConnectorObjectId)/testsyncruleexpression" -Headers (Get-IAMCoreHeader) -Method POST -Body ($Expression | ConvertTo-Json -Depth 100) -ContentType "application/json" if ($Result.IsSuccess) { return $Result.Data } else { throw "Failed to test IAM Core sync rule expression: $($Result.ErrorMessage)" } } } |