Skip to content

Commit ec2fa79

Browse files
committed
Updated Expansion Cmdlets to support Profiles
1 parent 62d4886 commit ec2fa79

1 file changed

Lines changed: 80 additions & 6 deletions

File tree

src/StorageGRID-Webscale.psm1

Lines changed: 80 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6873,24 +6873,42 @@ function Global:Get-SgwEcSchemes {
68736873

68746874
## expansion ##
68756875

6876-
# complete as of API 2.1
6876+
# complete as of API 2.2
68776877

68786878
<#
68796879
.SYNOPSIS
68806880
Cancels the expansion procedure and resets all user configuration of expansion grid nodes
68816881
.DESCRIPTION
68826882
Cancels the expansion procedure and resets all user configuration of expansion grid nodes
6883+
.PARAMETER Server
6884+
StorageGRID Webscale Management Server object. If not specified, global CurrentSgwServer object will be used.
6885+
.PARAMETER ProfileName
6886+
StorageGRID Profile to use for connection.
68836887
#>
68846888
function Global:Stop-SgwExpansion {
68856889
[CmdletBinding()]
68866890

68876891
PARAM (
68886892
[parameter(Mandatory = $False,
68896893
Position = 0,
6890-
HelpMessage = "StorageGRID Webscale Management Server object. If not specified, global CurrentSgwServer object will be used.")][PSCustomObject]$Server
6894+
HelpMessage = "StorageGRID Webscale Management Server object. If not specified, global CurrentSgwServer object will be used.")][PSCustomObject]$Server,
6895+
[parameter(Mandatory = $False,
6896+
Position = 1,
6897+
HelpMessage = "StorageGRID Profile to use for connection.")][Alias("Profile")][String]$ProfileName="default"
68916898
)
68926899

68936900
Begin {
6901+
if (!$ProfileName -and !$Server -and !$CurrentSgwServer.Name) {
6902+
$ProfileName = "default"
6903+
}
6904+
if ($ProfileName) {
6905+
$Profile = Get-SgwProfile -ProfileName $ProfileName
6906+
if (!$Profile.Name) {
6907+
Throw "Profile $ProfileName not found. Create a profile using New-SgwProfile or connect to a StorageGRID Server using Connect-SgwServer"
6908+
}
6909+
$Server = Connect-SgwServer -Name $Profile.Name -Credential $Profile.Credential -AccountId $Profile.AccountId -SkipCertificateCheck:$Profile.SkipCertificateCheck -DisableAutomaticAccessKeyGeneration:$Profile.disalble_automatic_access_key_generation -TemporaryAccessKeyExpirationTime $Profile.temporary_access_key_expiration_time -S3EndpointUrl $Profile.S3EndpointUrl -SwiftEndpointUrl $Profile.SwiftEndpointUrl -Transient
6910+
}
6911+
68946912
if (!$Server) {
68956913
$Server = $Global:CurrentSgwServer
68966914
}
@@ -6923,17 +6941,35 @@ function Global:Stop-SgwExpansion {
69236941
Retrieves the status of the current expansion procedure
69246942
.DESCRIPTION
69256943
Retrieves the status of the current expansion procedure
6944+
.PARAMETER Server
6945+
StorageGRID Webscale Management Server object. If not specified, global CurrentSgwServer object will be used.
6946+
.PARAMETER ProfileName
6947+
StorageGRID Profile to use for connection.
69266948
#>
69276949
function Global:Get-SgwExpansion {
69286950
[CmdletBinding()]
69296951

69306952
PARAM (
69316953
[parameter(Mandatory = $False,
69326954
Position = 0,
6933-
HelpMessage = "StorageGRID Webscale Management Server object. If not specified, global CurrentSgwServer object will be used.")][PSCustomObject]$Server
6955+
HelpMessage = "StorageGRID Webscale Management Server object. If not specified, global CurrentSgwServer object will be used.")][PSCustomObject]$Server,
6956+
[parameter(Mandatory = $False,
6957+
Position = 1,
6958+
HelpMessage = "StorageGRID Profile to use for connection.")][Alias("Profile")][String]$ProfileName="default"
69346959
)
69356960

69366961
Begin {
6962+
if (!$ProfileName -and !$Server -and !$CurrentSgwServer.Name) {
6963+
$ProfileName = "default"
6964+
}
6965+
if ($ProfileName) {
6966+
$Profile = Get-SgwProfile -ProfileName $ProfileName
6967+
if (!$Profile.Name) {
6968+
Throw "Profile $ProfileName not found. Create a profile using New-SgwProfile or connect to a StorageGRID Server using Connect-SgwServer"
6969+
}
6970+
$Server = Connect-SgwServer -Name $Profile.Name -Credential $Profile.Credential -AccountId $Profile.AccountId -SkipCertificateCheck:$Profile.SkipCertificateCheck -DisableAutomaticAccessKeyGeneration:$Profile.disalble_automatic_access_key_generation -TemporaryAccessKeyExpirationTime $Profile.temporary_access_key_expiration_time -S3EndpointUrl $Profile.S3EndpointUrl -SwiftEndpointUrl $Profile.SwiftEndpointUrl -Transient
6971+
}
6972+
69376973
if (!$Server) {
69386974
$Server = $Global:CurrentSgwServer
69396975
}
@@ -6966,17 +7002,35 @@ function Global:Get-SgwExpansion {
69667002
Initiates the expansion procedure, allowing configuration of the expansion grid nodes
69677003
.DESCRIPTION
69687004
Initiates the expansion procedure, allowing configuration of the expansion grid nodes
7005+
.PARAMETER Server
7006+
StorageGRID Webscale Management Server object. If not specified, global CurrentSgwServer object will be used.
7007+
.PARAMETER ProfileName
7008+
StorageGRID Profile to use for connection.
69697009
#>
69707010
function Global:Start-SgwExpansion {
69717011
[CmdletBinding()]
69727012

69737013
PARAM (
69747014
[parameter(Mandatory = $False,
69757015
Position = 0,
6976-
HelpMessage = "StorageGRID Webscale Management Server object. If not specified, global CurrentSgwServer object will be used.")][PSCustomObject]$Server
7016+
HelpMessage = "StorageGRID Webscale Management Server object. If not specified, global CurrentSgwServer object will be used.")][PSCustomObject]$Server,
7017+
[parameter(Mandatory = $False,
7018+
Position = 1,
7019+
HelpMessage = "StorageGRID Profile to use for connection.")][Alias("Profile")][String]$ProfileName="default"
69777020
)
69787021

69797022
Begin {
7023+
if (!$ProfileName -and !$Server -and !$CurrentSgwServer.Name) {
7024+
$ProfileName = "default"
7025+
}
7026+
if ($ProfileName) {
7027+
$Profile = Get-SgwProfile -ProfileName $ProfileName
7028+
if (!$Profile.Name) {
7029+
Throw "Profile $ProfileName not found. Create a profile using New-SgwProfile or connect to a StorageGRID Server using Connect-SgwServer"
7030+
}
7031+
$Server = Connect-SgwServer -Name $Profile.Name -Credential $Profile.Credential -AccountId $Profile.AccountId -SkipCertificateCheck:$Profile.SkipCertificateCheck -DisableAutomaticAccessKeyGeneration:$Profile.disalble_automatic_access_key_generation -TemporaryAccessKeyExpirationTime $Profile.temporary_access_key_expiration_time -S3EndpointUrl $Profile.S3EndpointUrl -SwiftEndpointUrl $Profile.SwiftEndpointUrl -Transient
7032+
}
7033+
69807034
if (!$Server) {
69817035
$Server = $Global:CurrentSgwServer
69827036
}
@@ -7009,20 +7063,40 @@ function Global:Start-SgwExpansion {
70097063
Executes the expansion procedure, adding configured grid nodes to the grid
70107064
.DESCRIPTION
70117065
Executes the expansion procedure, adding configured grid nodes to the grid
7066+
.PARAMETER Server
7067+
StorageGRID Webscale Management Server object. If not specified, global CurrentSgwServer object will be used.
7068+
.PARAMETER ProfileName
7069+
StorageGRID Profile to use for connection.
7070+
.PARAMETER Passphrase
7071+
StorageGRID Passphrase
70127072
#>
70137073
function Global:Invoke-SgwExpansion {
70147074
[CmdletBinding()]
70157075

70167076
PARAM (
70177077
[parameter(Mandatory = $False,
70187078
Position = 0,
7019-
HelpMessage = "StorageGRID Passphrase.")][String]$Passphrase,
7079+
HelpMessage = "StorageGRID Webscale Management Server object. If not specified, global CurrentSgwServer object will be used.")][PSCustomObject]$Server,
70207080
[parameter(Mandatory = $False,
70217081
Position = 1,
7022-
HelpMessage = "StorageGRID Webscale Management Server object. If not specified, global CurrentSgwServer object will be used.")][PSCustomObject]$Server
7082+
HelpMessage = "StorageGRID Profile to use for connection.")][Alias("Profile")][String]$ProfileName="default",
7083+
[parameter(Mandatory = $False,
7084+
Position = 2,
7085+
HelpMessage = "StorageGRID Passphrase.")][String]$Passphrase,
70237086
)
70247087

70257088
Begin {
7089+
if (!$ProfileName -and !$Server -and !$CurrentSgwServer.Name) {
7090+
$ProfileName = "default"
7091+
}
7092+
if ($ProfileName) {
7093+
$Profile = Get-SgwProfile -ProfileName $ProfileName
7094+
if (!$Profile.Name) {
7095+
Throw "Profile $ProfileName not found. Create a profile using New-SgwProfile or connect to a StorageGRID Server using Connect-SgwServer"
7096+
}
7097+
$Server = Connect-SgwServer -Name $Profile.Name -Credential $Profile.Credential -AccountId $Profile.AccountId -SkipCertificateCheck:$Profile.SkipCertificateCheck -DisableAutomaticAccessKeyGeneration:$Profile.disalble_automatic_access_key_generation -TemporaryAccessKeyExpirationTime $Profile.temporary_access_key_expiration_time -S3EndpointUrl $Profile.S3EndpointUrl -SwiftEndpointUrl $Profile.SwiftEndpointUrl -Transient
7098+
}
7099+
70267100
if (!$Server) {
70277101
$Server = $Global:CurrentSgwServer
70287102
}

0 commit comments

Comments
 (0)