Skip to content

Commit f4a8a69

Browse files
committed
Improved New-SgwAccount Cmdlet and corrected default values for policy attributes
1 parent f6c47af commit f4a8a69

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

src/StorageGRID-Webscale.psm1

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,7 @@ function Global:New-SgwAccount {
11031103
Position = 5,
11041104
ValueFromPipeline = $True,
11051105
ValueFromPipelineByPropertyName = $True,
1106-
HelpMessage = "Allow platform services to be used (default: true - supported since StorageGRID 11.0).")][Boolean]$AllowPlatformServices = $true,
1106+
HelpMessage = "Allow platform services to be used (default: true - supported since StorageGRID 11.0).")][Boolean]$AllowPlatformServices = $false,
11071107
[parameter(
11081108
Mandatory = $False,
11091109
Position = 6,
@@ -1162,13 +1162,9 @@ function Global:New-SgwAccount {
11621162
if ($Server.APIVersion -ge 2) {
11631163
$Body.password = $Password
11641164
$Body.policy = $Policy
1165-
if ($UseAccountIdentitySource) {
1166-
$Body.policy.useAccountIdentitySource = $UseAccountIdentitySource
1167-
}
1165+
$Body.policy.useAccountIdentitySource = $UseAccountIdentitySource
11681166
if ($Server.APIVersion -ge 2.1) {
1169-
if ($AllowPlatformServices) {
1170-
$Body.policy.allowPlatformServices = $AllowPlatformServices
1171-
}
1167+
$Body.policy.allowPlatformServices = $AllowPlatformServices
11721168
}
11731169
if ($Quota) {
11741170
$Body.policy.quotaObjectBytes = $Quota
@@ -1190,6 +1186,9 @@ function Global:New-SgwAccount {
11901186
$Account | Add-Member -MemberType AliasProperty -Name accountId -Value id
11911187
$Account | Add-Member -MemberType AliasProperty -Name tenant -Value name
11921188
$Account | Add-Member -MemberType NoteProperty -Name tenantPortal -Value "https://$( $Server.Name )/?accountId=$( $Account.id )"
1189+
$Account | Add-Member -MemberType ScriptProperty -Name useAccountIdentitySource -Value { $this.Policy.useAccountIdentitySource }
1190+
$Account | Add-Member -MemberType ScriptProperty -Name allowPlatformServices -Value { $this.Policy.allowPlatformServices }
1191+
$Account | Add-Member -MemberType ScriptProperty -Name quota -Value { $this.Policy.quotaObjectBytes }
11931192

11941193
Write-Output $Account
11951194
}
@@ -1210,7 +1209,7 @@ function Global:Remove-SgwAccount {
12101209
Position = 0,
12111210
HelpMessage = "ID of a StorageGRID Webscale Account to delete.",
12121211
ValueFromPipeline = $True,
1213-
ValueFromPipelineByPropertyName = $True)][String]$id,
1212+
ValueFromPipelineByPropertyName = $True)][Alias("AccountId")][String]$id,
12141213
[parameter(Mandatory = $False,
12151214
Position = 1,
12161215
HelpMessage = "StorageGRID Profile to use for connection.")][Alias("Profile")][String]$ProfileName="default",
@@ -1270,7 +1269,7 @@ function Global:Get-SgwAccount {
12701269
ParameterSetName = "id",
12711270
HelpMessage = "ID of a StorageGRID Webscale Account to get information for.",
12721271
ValueFromPipeline = $True,
1273-
ValueFromPipelineByPropertyName = $True)][Alias("Id")][String]$AccountId,
1272+
ValueFromPipelineByPropertyName = $True)][Alias("AccountId")][String]$Id,
12741273
[parameter(
12751274
Mandatory = $True,
12761275
Position = 2,

0 commit comments

Comments
 (0)