public/New-DuoGroup.ps1

<#
.Synopsis
   create new application
.DESCRIPTION
 
.EXAMPLE
    New-DuoIntegration
.EXAMPLE
 
.INPUTS
 
.OUTPUTS
   [PSCustomObject]DuoRequest
.NOTES
 
.COMPONENT
    PSDuo
.FUNCTIONALITY
 
#>


function New-DuoGroup(){
    [cmdletbinding()]
    param(
        [parameter(Mandatory = $true)]
        [String]$name,

        [parameter(Mandatory = $false)]
        [String]$desc

    )

    [string]$method = "POST"
    [string]$path = '/admin/v1/groups'
    $APiParams = $MyInvocation.BoundParameters


    $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
}