public/Remove-DuoGroup.ps1

<#
.Synopsis
   remove a duo group
.DESCRIPTION
 
.EXAMPLE
    Remove-DuoGroup -group_id
.EXAMPLE
 
.INPUTS
 
.OUTPUTS
   [PSCustomObject]DuoRequest
.NOTES
 
.COMPONENT
    PSDuo
.FUNCTIONALITY
 
#>


function Remove-DuoGroup(){
    [cmdletbinding()]
    param(
        [parameter(Mandatory = $true)]
        [String]$group_id

    )

    [string]$method = "DELETE"
    [string]$path = "/admin/v1/groups/$($group_id)"
    $APiParams = $MyInvocation.BoundParameters
    $APiParams.Remove('group_id') # duo request doesnt need a parameter, only a group_id inside the http delete url


    $DuoRequest = Convertto-DUORequest -DuoMethodPath $path -Method $method -ApiParams $ApiParams
    $Response = Invoke-RestMethod @DuoRequest -SkipHeaderValidation:$true
    If ($Response.stat -ne 'OK') {
        Write-Warning 'DUO REST Call Failed'
        Write-Warning ($APiParams | Out-String)
        Write-Warning "Method:$method Path:$path"
    }
    $Output = $Response | Select-Object -ExpandProperty Response
    Write-Output $Output
}