Public/New-IAMCoreConnector.ps1
|
function New-IAMCoreConnector { [CmdletBinding(SupportsShouldProcess = $true)] param ( [Parameter(Mandatory = $true)] [string]$Description, [Parameter(Mandatory = $true)] [string]$TemplateId, [Parameter(Mandatory = $false)] [System.Collections.Hashtable] $Configuration = @{}, [Parameter(Mandatory = $false)] [System.Collections.Hashtable] $Secrets = @{} ) if ($PSCmdlet.ShouldProcess("Creating IAM Core connector '$Description'")) { $Body = @{ description = $Description type = $TemplateId configuration = $Configuration secrets = $Secrets } | ConvertTo-Json -Depth 10 $Result = Invoke-RestMethod -Uri "$Script:APIRoot/sync/connectors" -Headers (Get-IAMCoreHeader) -Method Post -Body $Body -ContentType "application/json" if ($Result.IsSuccess) { return $Result.Data } else { throw "Failed to create IAM Core connector: $($Result.ErrorMessage)" } } } |