Public/Get-IAMCoreIdentityRelationship.ps1
|
<# .SYNOPSIS Gets CoreIdentityRelationship objects from the IAM Core API. .DESCRIPTION This function retrieves CoreIdentityRelationship objects from the IAM Core API. .EXAMPLE Get-IAMCoreIdentityRelationship #> function Get-IAMCoreIdentityRelationship { [CmdletBinding(DefaultParameterSetName = "Default")] param ( [Parameter(Mandatory = $true, ParameterSetName = "Single", ValueFromPipelineByPropertyName = $true, ValueFromPipeline = $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}$", ErrorMessage = "Id must be a valid GUID.")] # Is a guid connector object id [string] $Id ) process { $Uri = "$Script:APIRoot/sync/coreobjects/identities/$Id/relationships" Write-Verbose "Getting IAM Core identity relationships from URI: $Uri" $Result = Invoke-RestMethod -Uri $Uri -Headers (Get-IAMCoreHeader) -SkipHttpErrorCheck -StatusCodeVariable StatusCode -Verbose:$false -ConnectionTimeoutSeconds 60 -OperationTimeoutSeconds 60 if ($StatusCode -ne 200) { if ($Result.Errors) { throw "Failed to get relationships for identity $($Id): $($Result.Errors -join ', ')" } else { throw "Failed to get relationships for identity $($Id): Status code $StatusCode, Response: $($Result)" } } return $Result.Data } } |