@@ -1139,6 +1139,164 @@ function Global:Get-SGWVersions {
11391139 }
11401140}
11411141
1142+ # # deactivated-features ##
1143+
1144+ <#
1145+ . SYNOPSIS
1146+ Retrieves the deactivated features configuration
1147+ . DESCRIPTION
1148+ Retrieves the deactivated features configuration
1149+ #>
1150+ function Global :Get-SGWDeactivatedFeatures {
1151+ [CmdletBinding ()]
1152+
1153+ PARAM (
1154+ [parameter (Mandatory = $False ,
1155+ Position = 0 ,
1156+ HelpMessage = " StorageGRID Webscale Management Server object. If not specified, global CurrentSGWServer object will be used." )][PSCustomObject ]$Server
1157+ )
1158+
1159+ Begin {
1160+ if (! $Server ) {
1161+ $Server = $Global :CurrentSGWServer
1162+ }
1163+ if (! $Server ) {
1164+ Throw " No StorageGRID Webscale Management Server management server found. Please run Connect-SGWServer to continue."
1165+ }
1166+ if ($Server.APIVersion -lt 2 ) {
1167+ Throw " This Cmdlet is only supported for API Version 2.0 and above"
1168+ }
1169+ }
1170+
1171+ Process {
1172+ $Uri = $Server.BaseURI + " /grid/deactivated-features"
1173+ $Method = " GET"
1174+
1175+ try {
1176+ $Result = Invoke-RestMethod - WebSession $Server.Session - Method $Method - Uri $Uri - Headers $Server.Headers
1177+ }
1178+ catch {
1179+ $ResponseBody = ParseExceptionBody $_.Exception.Response
1180+ Write-Error " $Method to $Uri failed with Exception $ ( $_.Exception.Message ) `n $responseBody "
1181+ }
1182+
1183+ Write-Output $Result.data
1184+ }
1185+ }
1186+
1187+ <#
1188+ . SYNOPSIS
1189+ Deactivates specific features. If no feature is selected, all features will be enabled again.
1190+ . DESCRIPTION
1191+ Deactivates specific features. If no feature is selected, all features will be enabled again.
1192+ #>
1193+ function Global :Update-SGWDeactivatedFeatures {
1194+ [CmdletBinding ()]
1195+
1196+ PARAM (
1197+ [parameter (Mandatory = $False ,
1198+ Position = 0 ,
1199+ HelpMessage = " Deactivate Alarm Acknowledgements." )][Boolean ]$AlarmAcknowledgment ,
1200+ [parameter (Mandatory = $False ,
1201+ Position = 1 ,
1202+ HelpMessage = " Deactivate Other Grid Configuration." )][Boolean ]$OtherGridConfiguration ,
1203+ [parameter (Mandatory = $False ,
1204+ Position = 2 ,
1205+ HelpMessage = " Deactivate Grid Topology Page Configuration." )][Boolean ]$GridTopologyPageConfiguration ,
1206+ [parameter (Mandatory = $False ,
1207+ Position = 3 ,
1208+ HelpMessage = " Deactivate Management of Tenant Accounts." )][Boolean ]$TenantAccounts ,
1209+ [parameter (Mandatory = $False ,
1210+ Position = 4 ,
1211+ HelpMessage = " Deactivate changing of tenant root passwords." )][Boolean ]$ChangeTenantRootPassword ,
1212+ [parameter (Mandatory = $False ,
1213+ Position = 4 ,
1214+ HelpMessage = " Deactivate maintenance." )][Boolean ]$Maintenance ,
1215+ [parameter (Mandatory = $False ,
1216+ Position = 5 ,
1217+ HelpMessage = " Deactivates activating features. This cannot be undone!" )][Boolean ]$ActivateFeatures ,
1218+ [parameter (Mandatory = $False ,
1219+ Position = 6 ,
1220+ HelpMessage = " Deactivates managing of own S3 Credentials." )][Boolean ]$ManageOwnS3Credentials ,
1221+ [parameter (Mandatory = $False ,
1222+ Position = 7 ,
1223+ HelpMessage = " StorageGRID Webscale Management Server object. If not specified, global CurrentSGWServer object will be used." )][PSCustomObject ]$Server
1224+ )
1225+
1226+ Begin {
1227+ if (! $Server ) {
1228+ $Server = $Global :CurrentSGWServer
1229+ }
1230+ if (! $Server ) {
1231+ Throw " No StorageGRID Webscale Management Server management server found. Please run Connect-SGWServer to continue."
1232+ }
1233+ if ($Server.APIVersion -lt 2 ) {
1234+ Throw " This Cmdlet is only supported for API Version 2.0 and above"
1235+ }
1236+ }
1237+
1238+ Process {
1239+ $Uri = $Server.BaseURI + " /grid/deactivated-features"
1240+ $Method = " PUT"
1241+
1242+ $Body = @ {}
1243+ if ($AlarmAcknowledgment -or $OtherGridConfiguration -or $GridTopologyPageConfiguration -or $TenantAccounts -or $ChangeTenantRootPassword -or $Maintenance -or $ActivateFeatures ) {
1244+ $Body.grid = @ {}
1245+ }
1246+ if ($AlarmAcknowledgment ) {
1247+ $Body.grid.alarmAcknowledgment = $AlarmAcknowledgment
1248+ }
1249+ if ($OtherGridConfiguration ) {
1250+ $Body.grid.otherGridConfiguration = $OtherGridConfiguration
1251+ }
1252+ if ($GridTopologyPageConfiguration ) {
1253+ $Body.grid.gridTopologyPageConfiguration = $GridTopologyPageConfiguration
1254+ }
1255+ if ($TenantAccounts ) {
1256+ $Body.grid.tenantAccounts = $TenantAccounts
1257+ }
1258+ if ($ChangeTenantRootPassword ) {
1259+ $Body.grid.changeTenantRootPassword = $ChangeTenantRootPassword
1260+ }
1261+ if ($Maintenance ) {
1262+ $Body.grid.maintenance = $Maintenance
1263+ }
1264+ if ($ActivateFeatures ) {
1265+ $caption = " Please Confirm"
1266+ $message = " Are you sure you want to proceed with permanently deactivating the activation of features (this can't be undone!):"
1267+ [int ]$defaultChoice = 0
1268+ $yes = New-Object System.Management.Automation.Host.ChoiceDescription " &Yes" , " Do the job."
1269+ $no = New-Object System.Management.Automation.Host.ChoiceDescription " &No" , " Do not do the job."
1270+ $options = [System.Management.Automation.Host.ChoiceDescription []]($no , $yes )
1271+ $choiceRTN = $host.ui.PromptForChoice ($caption , $message , $options , $defaultChoice )
1272+ if ($choiceRTN -eq 1 ) {
1273+ $Body.grid.activateFeatures = $ActivateFeatures
1274+ }
1275+ else {
1276+ Write-Host " Deactivating of permanent feature activation aborted."
1277+ return
1278+ }
1279+ }
1280+ if ($ManageOwnS3Credentials ) {
1281+ $Body.tenant = @ {manageOwnS3Credentials = $ManageOwnS3Credentials }
1282+ }
1283+ $Body = $Body | ConvertTo-Json
1284+
1285+ Write-Verbose " Body: $Body "
1286+
1287+ try {
1288+ $Result = Invoke-RestMethod - WebSession $Server.Session - Method $Method - Uri $Uri - Headers $Server.Headers - Body $Body - ContentType application/ json
1289+ }
1290+ catch {
1291+ $ResponseBody = ParseExceptionBody $_.Exception.Response
1292+ Write-Error " $Method to $Uri failed with Exception $ ( $_.Exception.Message ) `n $responseBody "
1293+ }
1294+
1295+ Write-Output $Result.data
1296+ }
1297+ }
1298+
1299+
11421300# # dns-servers ##
11431301
11441302<#
0 commit comments