Public/New-PegasusAdminConnector.ps1

<#
.SYNOPSIS
Gets all generic data from the Pegasus API.

.EXAMPLE
Get-PegasusAdminGenericData

#>

function New-PegasusAdminConnector {
    [CmdletBinding(SupportsShouldProcess = $true)]

    Param
    (
        [Parameter(Mandatory = $true)]
        [ValidatePattern("^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$")]
        [string]$ObjectId,

        [Parameter(Mandatory = $true)]
        [ValidatePattern("^[a-zA-Z0-9-]{1,36}$")]
        [string]$Partition
    )
    
    Process {
        if ($PSCmdlet.ShouldProcess("Pegasus Admin Connector (ObjectId: $ObjectId, Partition: $Partition)", "Create")) {
            Invoke-PegasusRequest -Endpoint "/admin/connectors" -Method POST -InputObject @{
                connectortype = 0
                objectid      = $ObjectId
                partition     = $Partition
            } | ForEach-Object { $_ }
        }
    }
}