Skip to content

Commit 45ff38e

Browse files
author
Emile
authored
Updated parameters and method for Remove-
Remove-ITGluePasswords: Only DELETE method is used when removing password, corrected that. I also removed $data parameter from the parameter set "destroy" because only ID is a valid parameter when deleting a single password.
1 parent 5750df6 commit 45ff38e

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

ITGlueAPI/Resources/Passwords.ps1

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,13 +216,11 @@ function Remove-ITGluePasswords {
216216
[Parameter(ParameterSetName = 'bulk_destroy')]
217217
[String]$filter_cached_resource_name = '',
218218

219-
[Parameter(ParameterSetName = 'update', Mandatory = $true)]
220219
[Parameter(ParameterSetName = 'bulk_destroy', Mandatory = $true)]
221220
$data
222221
)
223222

224223
$resource_uri = ('/passwords/{0}' -f $id)
225-
$method = 'DELETE'
226224

227225
$body = @{}
228226

@@ -245,7 +243,6 @@ function Remove-ITGluePasswords {
245243
if ($filter_cached_resource_name) {
246244
$body += @{'filter[cached_resource_name]' = $filter_cached_resource_name}
247245
}
248-
$method = 'PATCH'
249246

250247
$body += @{'data' = $data}
251248

@@ -254,7 +251,7 @@ function Remove-ITGluePasswords {
254251

255252
try {
256253
$ITGlue_Headers.Add('x-api-key', (New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList 'N/A', $ITGlue_API_Key).GetNetworkCredential().Password)
257-
$rest_output = Invoke-RestMethod -method $method -uri ($ITGlue_Base_URI + $resource_uri) -headers $ITGlue_Headers `
254+
$rest_output = Invoke-RestMethod -method 'DELETE' -uri ($ITGlue_Base_URI + $resource_uri) -headers $ITGlue_Headers `
258255
-body $body -ErrorAction Stop -ErrorVariable $web_error
259256
} catch {
260257
Write-Error $_

0 commit comments

Comments
 (0)