public/New-DuoPhone.ps1
|
<# .Synopsis Retrieve DUO Phones .DESCRIPTION Returns a list of phones. If no number or extension parameters are provided, the list will contain all phones. Otherwise, the list will contain either single phone (if a match was found), or no phones. .EXAMPLE New-DuoPhone .EXAMPLE New-DuoPhone -number ###-###-#### .INPUTS .OUTPUTS [PSCustomObject]DuoRequest .NOTES .COMPONENT PSDuo .FUNCTIONALITY The functionality that best describes this cmdlet #> function New-DuoPhone(){ [CmdletBinding( )] param ( [parameter(Mandatory = $true)] [String]$number, [parameter(Mandatory = $true)] [String]$platform, [parameter(Mandatory = $true)] [String]$type ) [string]$method = "POST" [string]$path = "/admin/v1/phones" $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:"+($APiParams | Out-String) Write-Warning "Method:$method Path:$path" } $Output = $Response | Select-Object -ExpandProperty Response Write-Output $Output } |