@@ -3079,7 +3079,147 @@ function Global:Sync-SGWIdentitySources {
30793079
30803080# # ilm ##
30813081
3082- # TODO: Implement ILM Cmdlets
3082+ <#
3083+ . SYNOPSIS
3084+ Evaluates proposed ILM policy
3085+ . DESCRIPTION
3086+ Evaluates proposed ILM policy
3087+ #>
3088+ function Global :Invoke-SGWIlmEvaluate {
3089+ [CmdletBinding ()]
3090+
3091+ PARAM (
3092+ [parameter (Mandatory = $False ,
3093+ Position = 0 ,
3094+ HelpMessage = " The object API that the provided object was evaluated against." )][String ][ValidateSet (' cdmi' , ' s3' , ' swift' )]$API ,
3095+ [parameter (Mandatory = $True ,
3096+ Position = 1 ,
3097+ HelpMessage = " Protocol-specific object identifier (e.g. bucket/key/1)." )][String ]$ObjectID ,
3098+ [parameter (Mandatory = $False ,
3099+ Position = 2 ,
3100+ HelpMessage = " Switch indicating that ILM evaluation should occur immediately." )][Switch ]$Now ,
3101+ [parameter (Mandatory = $False ,
3102+ Position = 3 ,
3103+ HelpMessage = " StorageGRID Webscale Management Server object. If not specified, global CurrentSGWServer object will be used." )][PSCustomObject ]$Server
3104+ )
3105+
3106+ Begin {
3107+ if (! $Server ) {
3108+ $Server = $Global :CurrentSGWServer
3109+ }
3110+ if (! $Server ) {
3111+ Throw " No StorageGRID Webscale Management Server management server found. Please run Connect-SGWServer to continue."
3112+ }
3113+ }
3114+
3115+ Process {
3116+ $Uri = $Server.BaseURI + " /grid/ilm-evaluate"
3117+ $Method = " POST"
3118+
3119+ $Body = @ {}
3120+ $Body.objectID = $ObjectID
3121+ if ($API ) {
3122+ $Body.api = $API
3123+ }
3124+ if ($Now ) {
3125+ $Body.now = Get-Date - Format u
3126+ }
3127+
3128+ try {
3129+ $Result = Invoke-RestMethod - WebSession $Server.Session - Method $Method - Uri $Uri - Headers $Server.Headers - Body $Body - ContentType application/ json
3130+ }
3131+ catch {
3132+ $ResponseBody = ParseExceptionBody $_.Exception.Response
3133+ Write-Error " $Method to $Uri failed with Exception $ ( $_.Exception.Message ) `n $responseBody "
3134+ }
3135+
3136+ Write-Output $Result.data
3137+ }
3138+ }
3139+
3140+ <#
3141+ . SYNOPSIS
3142+ Lists metadata available for creating an ILM rule
3143+ . DESCRIPTION
3144+ Lists metadata available for creating an ILM rule
3145+ #>
3146+ function Global :Get-SGWIlmMetadata {
3147+ [CmdletBinding ()]
3148+
3149+ PARAM (
3150+ [parameter (Mandatory = $False ,
3151+ Position = 0 ,
3152+ HelpMessage = " The object API that the provided object was evaluated against." )][String ][ValidateSet (' cdmi' , ' s3' , ' swift' )]$API ,
3153+ [parameter (Mandatory = $False ,
3154+ Position = 1 ,
3155+ HelpMessage = " StorageGRID Webscale Management Server object. If not specified, global CurrentSGWServer object will be used." )][PSCustomObject ]$Server
3156+ )
3157+
3158+ Begin {
3159+ if (! $Server ) {
3160+ $Server = $Global :CurrentSGWServer
3161+ }
3162+ if (! $Server ) {
3163+ Throw " No StorageGRID Webscale Management Server management server found. Please run Connect-SGWServer to continue."
3164+ }
3165+ }
3166+
3167+ Process {
3168+ $Uri = $Server.BaseURI + " /grid/ilm-metadata?api=$api "
3169+ $Method = " GET"
3170+
3171+ try {
3172+ $Result = Invoke-RestMethod - WebSession $Server.Session - Method $Method - Uri $Uri - Headers $Server.Headers
3173+ }
3174+ catch {
3175+ $ResponseBody = ParseExceptionBody $_.Exception.Response
3176+ Write-Error " $Method to $Uri failed with Exception $ ( $_.Exception.Message ) `n $responseBody "
3177+ }
3178+
3179+ Write-Output $Result.data
3180+ }
3181+ }
3182+
3183+ <#
3184+ . SYNOPSIS
3185+ Lists ILM rules
3186+ . DESCRIPTION
3187+ Lists ILM rules
3188+ #>
3189+ function Global :Get-SGWIlmRules {
3190+ [CmdletBinding ()]
3191+
3192+ PARAM (
3193+ [parameter (Mandatory = $False ,
3194+ Position = 0 ,
3195+ HelpMessage = " StorageGRID Webscale Management Server object. If not specified, global CurrentSGWServer object will be used." )][PSCustomObject ]$Server
3196+ )
3197+
3198+ Begin {
3199+ if (! $Server ) {
3200+ $Server = $Global :CurrentSGWServer
3201+ }
3202+ if (! $Server ) {
3203+ Throw " No StorageGRID Webscale Management Server management server found. Please run Connect-SGWServer to continue."
3204+ }
3205+ }
3206+
3207+ Process {
3208+ $Uri = $Server.BaseURI + " /grid/ilm-rules"
3209+ $Method = " GET"
3210+
3211+ try {
3212+ $Result = Invoke-RestMethod - WebSession $Server.Session - Method $Method - Uri $Uri - Headers $Server.Headers
3213+ }
3214+ catch {
3215+ $ResponseBody = ParseExceptionBody $_.Exception.Response
3216+ Write-Error " $Method to $Uri failed with Exception $ ( $_.Exception.Message ) `n $responseBody "
3217+ }
3218+
3219+ Write-Output $Result.data
3220+ }
3221+ }
3222+
30833223
30843224# # license ##
30853225
0 commit comments