Skip to content

Commit e5edfd3

Browse files
committed
Improved Update-SgwAccount to properly allow updating individual properties
1 parent fab5f8e commit e5edfd3

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/StorageGRID-Webscale.psm1

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3389,11 +3389,11 @@ function Global:Update-SgwAccount {
33893389
[parameter(
33903390
Mandatory = $False,
33913391
Position = 5,
3392-
HelpMessage = "Use account identity source (supported since StorageGRID 10.4).")][Boolean]$UseAccountIdentitySource = $true,
3392+
HelpMessage = "Use account identity source (supported since StorageGRID 10.4).")][ValidateSet('true','false')][String]$UseAccountIdentitySource,
33933393
[parameter(
33943394
Mandatory = $False,
33953395
Position = 6,
3396-
HelpMessage = "Allow platform services to be used (supported since StorageGRID 11.0).")][Boolean]$AllowPlatformServices = $false,
3396+
HelpMessage = "Allow platform services to be used (supported since StorageGRID 11.0).")][ValidateSet('true','false')][String]$AllowPlatformServices,
33973397
[parameter(
33983398
Mandatory = $False,
33993399
Position = 7,
@@ -3446,12 +3446,23 @@ function Global:Update-SgwAccount {
34463446
}
34473447

34483448
if ($Server.APIVersion -ge 2) {
3449-
$Body.policy = @{ "useAccountIdentitySource" = $UseAccountIdentitySource }
3449+
if ($UseAccountIdentitySource) {
3450+
$Body.policy = @{}
3451+
$Body.policy["useAccountIdentitySource"] = [System.Convert]::ToBoolean($UseAccountIdentitySource)
3452+
}
34503453
if ($Server.APIVersion -ge 2.1) {
3451-
$Body.policy["allowPlatformServices"] = $AllowPlatformServices
3454+
if ($AllowPlatformServices) {
3455+
if (!$Body.Poliy) {
3456+
$Body.policy = @{}
3457+
}
3458+
$Body.policy["allowPlatformServices"] = [System.Convert]::ToBoolean($AllowPlatformServices)
3459+
}
34523460
}
34533461
if ($Quota) {
3454-
$Body.policy.quotaObjectBytes = $Quota
3462+
if (!$Body.Poliy) {
3463+
$Body.policy = @{}
3464+
}
3465+
$Body.policy["quotaObjectBytes"] = $Quota
34553466
}
34563467
}
34573468

@@ -4434,7 +4445,6 @@ function global:Connect-SgwServer {
44344445
try {
44354446
$Response = Invoke-WebRequest -Method Options -Uri "$EndpointDomainName" -SkipCertificateCheck -UseBasicParsing -TimeoutSec 3
44364447
if ($Response.Headers["x-amz-request-id"]) {
4437-
Write-Verbose "Test"
44384448
$Server.S3EndpointUrl = [System.UriBuilder]::new($EndpointDomainName)
44394449
break
44404450
}

0 commit comments

Comments
 (0)