Skip to content

Commit ea82ec4

Browse files
committed
removed unnecessary foreach in Remove-SGWAccount and logging output in New-SGWAccountS3AccessKey
1 parent f13ad3c commit ea82ec4

1 file changed

Lines changed: 10 additions & 14 deletions

File tree

src/StorageGRID-Webscale.psm1

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -390,19 +390,16 @@ function Global:Remove-SGWAccount {
390390
}
391391

392392
Process {
393-
$id = @($id)
394-
foreach ($id in $id) {
395-
$Uri = $Server.BaseURI + "/api/v1/grid/accounts/$id"
396-
$Method = "DELETE"
393+
$Uri = $Server.BaseURI + "/api/v1/grid/accounts/$id"
394+
$Method = "DELETE"
397395

398-
try {
399-
$Result = Invoke-RestMethod -Method $Method -Uri $Uri -Headers $Server.Headers
400-
Write-Host "Successfully deleted account with ID $id"
401-
}
402-
catch {
403-
$ResponseBody = ParseExceptionBody $_.Exception.Response
404-
Write-Error "$Method to $Uri failed with Exception $($_.Exception.Message) `n $responseBody"
405-
}
396+
try {
397+
$Result = Invoke-RestMethod -Method $Method -Uri $Uri -Headers $Server.Headers
398+
Write-Host "Successfully deleted account with ID $id"
399+
}
400+
catch {
401+
$ResponseBody = ParseExceptionBody $_.Exception.Response
402+
Write-Error "$Method to $Uri failed with Exception $($_.Exception.Message) `n $responseBody"
406403
}
407404
}
408405
}
@@ -869,7 +866,6 @@ function Global:New-SGWAccountS3AccessKey {
869866
}
870867

871868
try {
872-
$Body
873869
$Result = Invoke-RestMethod -Method $Method -Uri $Uri -Headers $Server.Headers -Body $Body -ContentType "application/json"
874870
}
875871
catch {
@@ -887,7 +883,7 @@ function Global:New-SGWAccountS3AccessKey {
887883
.DESCRIPTION
888884
Delete a StorageGRID Webscale Account S3 Access Key
889885
#>
890-
function Global:Delete-SGWAccountS3AccessKey {
886+
function Global:Remove-SGWAccountS3AccessKey {
891887
[CmdletBinding()]
892888

893889
PARAM (

0 commit comments

Comments
 (0)