functions/Set-BBDataSource.ps1

function Set-BBDataSource
{
    [CmdletBinding(SupportsShouldProcess)]
    [Alias()]
    Param
    (
        [string]$DataSourceId,
        [string]$externalId,
        [string]$Description
    )

    Begin
    {

    }
    Process
    {
        $Body = @{
            externalId = $externalId
            description = $Description
        }


        if($(!$DataSourceId -eq "")){
            Invoke-BBRestMethod -API "/learn/api/public/v1/dataSources/DataSourceId" `
                -Method Patch `
                -ContentType application/json `
                -Body $Body
        }elseif (!$externalId -eq ""){
            Invoke-BBRestMethod -API "/learn/api/public/v1/dataSources/$externalId"`
                -Method Patch `
                -ContentType application/json `
                -Body $Body
        }

    }
    End
    {
    }
}