public/Add-DuoPhone.ps1
|
<# .Synopsis Retrieve DUO Phones .DESCRIPTION .EXAMPLE Add-DuoPhone .EXAMPLE Add-DuoPhone -phone_id .INPUTS [string]phone_id .OUTPUTS [PSCustomObject]DuoRequest .NOTES .COMPONENT PSDuo .FUNCTIONALITY The functionality that best describes this cmdlet #> function Add-DuoPhone(){ [CmdletBinding()] param ( [parameter(Mandatory = $true)] [String]$phone_id, [parameter(Mandatory = $true)] [String]$user_id ) [string]$method = "POST" [string]$path = "/admin/v1/users/$($user_id)/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 } |