-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8be693c
commit bc3f6fd
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
function Remove-HaloSupplier { | ||
<# | ||
.SYNOPSIS | ||
Removes a supplier from the Halo API. | ||
.DESCRIPTION | ||
Deletes a specific supplier from Halo. | ||
.OUTPUTS | ||
A powershell object containing the response. | ||
#> | ||
[cmdletbinding( SupportsShouldProcess = $True, ConfirmImpact = 'High' )] | ||
[OutputType([Object])] | ||
Param( | ||
# The Supplier ID | ||
[Parameter( Mandatory, ParameterSetName = 'Single' )] | ||
[int64]$SupplierID | ||
) | ||
Invoke-HaloPreFlightCheck | ||
try { | ||
$ObjectToDelete = Get-HaloSupplier -SupplierID $SupplierID | ||
if ($ObjectToDelete) { | ||
if ($PSCmdlet.ShouldProcess("Action '$($ObjectToDelete.id)' by '$($ObjectToDelete.who)'", 'Delete')) { | ||
$Resource = "api/supplier/$($SupplierID)" | ||
$SupplierResults = New-HaloDELETERequest -Resource $Resource | ||
Return $SupplierResults | ||
} | ||
} else { | ||
Throw 'Supplier was not found in Halo to delete.' | ||
} | ||
} catch { | ||
New-HaloError -ErrorRecord $_ | ||
} | ||
} |