Public/License/Set-R1License.ps1

# .ExternalHelp psRadiantOne-help.xml
function Set-R1License {
    [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')]
    [OutputType([void])]
    param(
        [parameter(
            Mandatory = $true,
            ValueFromPipelineByPropertyName = $true
        )]
        [ValidateNotNullOrEmpty()]
        [string]$license
    )

    Begin {

        Assert-R1Session -RequireToken

    }#begin

    Process {

        $URI = Resolve-R1ServiceUrl -Service Settings -Path 'license'

        $Body = $PSBoundParameters | Get-Parameter | ConvertTo-R1JsonBody

        if ($PSCmdlet.ShouldProcess($Script:psRadiantOneSession.BaseURI, 'Apply License')) {

            $null = Invoke-R1RestMethod -Uri $URI -Method PUT -Body $Body

        }

    }#process

    End { }#end

}