@@ -5403,6 +5403,288 @@ function Global:Update-SgwDeactivatedFeatures {
54035403 }
54045404}
54055405
5406+ # # decomissioning ##
5407+
5408+ # complete as of API 2.2
5409+
5410+ <#
5411+ . SYNOPSIS
5412+ Get decomission status
5413+ . DESCRIPTION
5414+ Get decomission status
5415+ . PARAMETER Server
5416+ StorageGRID Webscale Management Server object. If not specified, global CurrentSgwServer object will be used.
5417+ . PARAMETER ProfileName
5418+ StorageGRID Profile to use for connection.
5419+ #>
5420+ function Global :Get-SgwDecommission {
5421+ [CmdletBinding ()]
5422+
5423+ PARAM (
5424+ [parameter (Mandatory = $False ,
5425+ Position = 0 ,
5426+ HelpMessage = " StorageGRID Webscale Management Server object. If not specified, global CurrentSgwServer object will be used." )][PSCustomObject ]$Server ,
5427+ [parameter (Mandatory = $False ,
5428+ Position = 1 ,
5429+ HelpMessage = " StorageGRID Profile to use for connection." )][Alias (" Profile" )][String ]$ProfileName
5430+ )
5431+
5432+ Begin {
5433+ if (! $ProfileName -and ! $Server -and ! $CurrentSgwServer.Name ) {
5434+ $ProfileName = " default"
5435+ }
5436+ if ($ProfileName ) {
5437+ $Profile = Get-SgwProfile - ProfileName $ProfileName
5438+ if (! $Profile.Name ) {
5439+ Throw " Profile $ProfileName not found. Create a profile using New-SgwProfile or connect to a StorageGRID Server using Connect-SgwServer"
5440+ }
5441+ $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
5442+ }
5443+
5444+ if (! $Server ) {
5445+ $Server = $Global :CurrentSgwServer
5446+ }
5447+ if (! $Server ) {
5448+ Throw " No StorageGRID Webscale Management Server management server found. Please run Connect-SgwServer to continue."
5449+ }
5450+ if ($Server.AccountId ) {
5451+ Throw " Operation not supported when connected as tenant. Use Connect-SgwServer without the AccountId parameter to connect as grid administrator and then rerun this command."
5452+ }
5453+
5454+ Write-Warning " This is currently a private REST API and may change in future versions"
5455+ }
5456+
5457+ Process {
5458+ $Uri = $Server.BaseURI + " /private/decommission"
5459+ $Method = " GET"
5460+
5461+ try {
5462+ $Response = Invoke-SgwRequest - WebSession $Server.Session - Method $Method - Uri $Uri - Headers $Server.Headers - SkipCertificateCheck:$Server.SkipCertificateCheck
5463+ }
5464+ catch {
5465+ $ResponseBody = ParseErrorForResponseBody $_
5466+ Throw " $Method to $Uri failed with Exception $ ( $_.Exception.Message ) `n $responseBody "
5467+ }
5468+
5469+ Write-Output $Response.Json.data
5470+ }
5471+ }
5472+
5473+ <#
5474+ . SYNOPSIS
5475+ Start decomission
5476+ . DESCRIPTION
5477+ Start decomission
5478+ . PARAMETER Server
5479+ StorageGRID Webscale Management Server object. If not specified, global CurrentSgwServer object will be used.
5480+ . PARAMETER ProfileName
5481+ StorageGRID Profile to use for connection.
5482+ . PARAMETER NodeIds
5483+ List of Node IDs to be decommissioned.
5484+ . PARAMETER Passphrase
5485+ StorageGRID Passphrase.
5486+ . PARAMETER Force
5487+ Force decommission of nodes.
5488+ #>
5489+ function Global :Start-SgwDecommission {
5490+ [CmdletBinding ()]
5491+
5492+ PARAM (
5493+ [parameter (Mandatory = $False ,
5494+ Position = 0 ,
5495+ HelpMessage = " StorageGRID Webscale Management Server object. If not specified, global CurrentSgwServer object will be used." )][PSCustomObject ]$Server ,
5496+ [parameter (Mandatory = $False ,
5497+ Position = 1 ,
5498+ HelpMessage = " StorageGRID Profile to use for connection." )][Alias (" Profile" )][String ]$ProfileName ,
5499+ [parameter (Mandatory = $True ,
5500+ Position = 2 ,
5501+ HelpMessage = " List of Node IDs to be decommissioned." )][String []]$NodeIds ,
5502+ [parameter (Mandatory = $True ,
5503+ Position = 3 ,
5504+ HelpMessage = " StorageGRID Passphrase." )][String ]$Passphrase ,
5505+ [parameter (Mandatory = $False ,
5506+ Position = 4 ,
5507+ HelpMessage = " Force decommission of nodes." )][Switch ]$Force
5508+ )
5509+
5510+ Begin {
5511+ if (! $ProfileName -and ! $Server -and ! $CurrentSgwServer.Name ) {
5512+ $ProfileName = " default"
5513+ }
5514+ if ($ProfileName ) {
5515+ $Profile = Get-SgwProfile - ProfileName $ProfileName
5516+ if (! $Profile.Name ) {
5517+ Throw " Profile $ProfileName not found. Create a profile using New-SgwProfile or connect to a StorageGRID Server using Connect-SgwServer"
5518+ }
5519+ $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
5520+ }
5521+
5522+ if (! $Server ) {
5523+ $Server = $Global :CurrentSgwServer
5524+ }
5525+ if (! $Server ) {
5526+ Throw " No StorageGRID Webscale Management Server management server found. Please run Connect-SgwServer to continue."
5527+ }
5528+ if ($Server.AccountId ) {
5529+ Throw " Operation not supported when connected as tenant. Use Connect-SgwServer without the AccountId parameter to connect as grid administrator and then rerun this command."
5530+ }
5531+
5532+ Write-Warning " This is currently a private REST API and may change in future versions"
5533+ }
5534+
5535+ Process {
5536+ $Uri = $Server.BaseURI + " /private/decommission"
5537+ $Method = " POST"
5538+
5539+ $Decommission = @ {}
5540+ if ($Force.IsPresent ) {
5541+ $Decommission.forceNodeIds = $NodeIds
5542+ }
5543+ else {
5544+ $Decommission.nodeIds = $NodeIds
5545+ }
5546+ $Decommission.passphrase = $Passphrase
5547+
5548+ $Body = ConvertTo-Json - InputObject $Decommission
5549+
5550+ try {
5551+ $Response = Invoke-SgwRequest - WebSession $Server.Session - Method $Method - Uri $Uri - Headers $Server.Headers - Body $Body - SkipCertificateCheck:$Server.SkipCertificateCheck
5552+ }
5553+ catch {
5554+ $ResponseBody = ParseErrorForResponseBody $_
5555+ Throw " $Method to $Uri failed with Exception $ ( $_.Exception.Message ) `n $responseBody "
5556+ }
5557+
5558+ Write-Output $Response.Json.data
5559+ }
5560+ }
5561+
5562+ <#
5563+ . SYNOPSIS
5564+ Suspend decomission
5565+ . DESCRIPTION
5566+ Suspend decomission
5567+ . PARAMETER Server
5568+ StorageGRID Webscale Management Server object. If not specified, global CurrentSgwServer object will be used.
5569+ . PARAMETER ProfileName
5570+ StorageGRID Profile to use for connection.
5571+ #>
5572+ function Global :Suspend-SgwDecommission {
5573+ [CmdletBinding ()]
5574+
5575+ PARAM (
5576+ [parameter (Mandatory = $False ,
5577+ Position = 0 ,
5578+ HelpMessage = " StorageGRID Webscale Management Server object. If not specified, global CurrentSgwServer object will be used." )][PSCustomObject ]$Server ,
5579+ [parameter (Mandatory = $False ,
5580+ Position = 1 ,
5581+ HelpMessage = " StorageGRID Profile to use for connection." )][Alias (" Profile" )][String ]$ProfileName
5582+ )
5583+
5584+ Begin {
5585+ if (! $ProfileName -and ! $Server -and ! $CurrentSgwServer.Name ) {
5586+ $ProfileName = " default"
5587+ }
5588+ if ($ProfileName ) {
5589+ $Profile = Get-SgwProfile - ProfileName $ProfileName
5590+ if (! $Profile.Name ) {
5591+ Throw " Profile $ProfileName not found. Create a profile using New-SgwProfile or connect to a StorageGRID Server using Connect-SgwServer"
5592+ }
5593+ $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
5594+ }
5595+
5596+ if (! $Server ) {
5597+ $Server = $Global :CurrentSgwServer
5598+ }
5599+ if (! $Server ) {
5600+ Throw " No StorageGRID Webscale Management Server management server found. Please run Connect-SgwServer to continue."
5601+ }
5602+ if ($Server.AccountId ) {
5603+ Throw " Operation not supported when connected as tenant. Use Connect-SgwServer without the AccountId parameter to connect as grid administrator and then rerun this command."
5604+ }
5605+
5606+ Write-Warning " This is currently a private REST API and may change in future versions"
5607+ }
5608+
5609+ Process {
5610+ $Uri = $Server.BaseURI + " /private/decommission/pause"
5611+ $Method = " POST"
5612+
5613+ try {
5614+ $Response = Invoke-SgwRequest - WebSession $Server.Session - Method $Method - Uri $Uri - Headers $Server.Headers - SkipCertificateCheck:$Server.SkipCertificateCheck
5615+ }
5616+ catch {
5617+ $ResponseBody = ParseErrorForResponseBody $_
5618+ Throw " $Method to $Uri failed with Exception $ ( $_.Exception.Message ) `n $responseBody "
5619+ }
5620+
5621+ Write-Output $Response.Json.data
5622+ }
5623+ }
5624+
5625+ <#
5626+ . SYNOPSIS
5627+ Resume decomission
5628+ . DESCRIPTION
5629+ Resume decomission
5630+ . PARAMETER Server
5631+ StorageGRID Webscale Management Server object. If not specified, global CurrentSgwServer object will be used.
5632+ . PARAMETER ProfileName
5633+ StorageGRID Profile to use for connection.
5634+ #>
5635+ function Global :Resume-SgwDecommission {
5636+ [CmdletBinding ()]
5637+
5638+ PARAM (
5639+ [parameter (Mandatory = $False ,
5640+ Position = 0 ,
5641+ HelpMessage = " StorageGRID Webscale Management Server object. If not specified, global CurrentSgwServer object will be used." )][PSCustomObject ]$Server ,
5642+ [parameter (Mandatory = $False ,
5643+ Position = 1 ,
5644+ HelpMessage = " StorageGRID Profile to use for connection." )][Alias (" Profile" )][String ]$ProfileName
5645+ )
5646+
5647+ Begin {
5648+ if (! $ProfileName -and ! $Server -and ! $CurrentSgwServer.Name ) {
5649+ $ProfileName = " default"
5650+ }
5651+ if ($ProfileName ) {
5652+ $Profile = Get-SgwProfile - ProfileName $ProfileName
5653+ if (! $Profile.Name ) {
5654+ Throw " Profile $ProfileName not found. Create a profile using New-SgwProfile or connect to a StorageGRID Server using Connect-SgwServer"
5655+ }
5656+ $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
5657+ }
5658+
5659+ if (! $Server ) {
5660+ $Server = $Global :CurrentSgwServer
5661+ }
5662+ if (! $Server ) {
5663+ Throw " No StorageGRID Webscale Management Server management server found. Please run Connect-SgwServer to continue."
5664+ }
5665+ if ($Server.AccountId ) {
5666+ Throw " Operation not supported when connected as tenant. Use Connect-SgwServer without the AccountId parameter to connect as grid administrator and then rerun this command."
5667+ }
5668+
5669+ Write-Warning " This is currently a private REST API and may change in future versions"
5670+ }
5671+
5672+ Process {
5673+ $Uri = $Server.BaseURI + " /private/decommission/resume"
5674+ $Method = " POST"
5675+
5676+ try {
5677+ $Response = Invoke-SgwRequest - WebSession $Server.Session - Method $Method - Uri $Uri - Headers $Server.Headers - SkipCertificateCheck:$Server.SkipCertificateCheck
5678+ }
5679+ catch {
5680+ $ResponseBody = ParseErrorForResponseBody $_
5681+ Throw " $Method to $Uri failed with Exception $ ( $_.Exception.Message ) `n $responseBody "
5682+ }
5683+
5684+ Write-Output $Response.Json.data
5685+ }
5686+ }
5687+
54065688# # dns-servers ##
54075689
54085690# complete as of API 2.2
0 commit comments