qos.psm1
$QosDefaultProperties = ('name', 'index', 'limit-type', 'max-iops', 'max-bw', 'burst-percentage') .(commonLib) Function Get-XtremQoSs { <# .DESCRIPTION displays the list of all QoS policies .PARAMETER Properties Array of properties requested from this call. .PARAMETER Filters Array of filters for this call. .PARAMETER ShowRest Return an object represents the REST operation including URI , Method and JSON .EXAMPLE Get-XtremQoSs #> [cmdletbinding()] [Alias('xmsQoSList')] Param ( [parameter()] $XtremClusterName = (Get-XtremDefaultSession)._XtremClusterName, [parameter()] [Alias("Properties")] [Argumentcompleter( { doComplete $args 'qos-policies' prop })] [string[]]$Property = $QosDefaultProperties, [parameter()] [Alias("Filters")] [Argumentcompleter( { doComplete $args 'qos-policies' filter })] [string[]]$Filter, [Parameter()] [object]$Session = (Get-XtremDefaultSession), [Parameter()] [switch]$ShowRest, [Parameter()] [switch]$Full = $false ) initCommand $Route = '/types/qos-policies' if ($Full) { $Property = '' } $result = NewXtremRequest -Method GET -Endpoint $Route -Session $Session -XtremClusterName $XtremClusterName -Properties $Property -Filters $Filter -ObjectSelection $ObjectSelection -ShowRest:$ShowRest.IsPresent -Multi -Full:$Full.IsPresent $result = formatOutPut $Property $result finalizeCommand return $result } Function Get-XtremQoS { <# .DESCRIPTION Retrieves information about an XtremIO QoS policy .PARAMETER QosPolicyName Index or name of the QoS policy .PARAMETER Properties Array of properties requested from this call. .PARAMETER ShowRest Return an object represents the REST operation including URI , Method and JSON .EXAMPLE Get-XtremQoS name #> [cmdletbinding()] [Alias('xmsQoSGet')] Param ( [parameter()] $XtremClusterName = (Get-XtremDefaultSession)._XtremClusterName, [Alias("Name", "Index")] [parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true, Position = 0)] [Argumentcompleter( { doComplete $args 'qos-policies' name })] $QosPolicyName, [Parameter()] [Alias("Properties")] [Argumentcompleter( { doComplete $args 'qos-policies' prop })] [string[]]$Property, [Parameter()] [object]$Session = (Get-XtremDefaultSession), [Parameter()] [switch]$ShowRest ) initCommand $Route = '/types/qos-policies' $Route, $GetProperty = SetParametersForRequest $Route $QosPolicyName $result = NewXtremRequest -Method GET -Endpoint $Route -Session $Session -XtremClusterName $XtremClusterName -ObjectSelection $ObjectSelection -GetProperty $GetProperty -Properties $Property -ShowRest:$ShowRest.IsPresent $result = formatOutPut $Property $result finalizeCommand return $result } Function New-XtremQoS { <# .DESCRIPTION Enables you to create a new QoS policy. .PARAMETER QosPolicyName QoS policy name .PARAMETER LimtType Limit Type .PARAMETER MaxBW Max BW .PARAMETER MaxIOPS Max IOPS .PARAMETER BurstPercentage Burst Percentage block size 4096 must not be defined with an offset. .PARAMETER IoSize IoSize .PARAMETER ShowRest Return an object represents the REST operation including URI , Method and JSON .EXAMPLE New-XtremQoS -QosPolicYName testQoS -limit_type fixed #> [CmdletBinding()] [Alias('xmsQoSCreate')] Param( [Parameter()] $XtremClusterName = (Get-XtremDefaultSession)._XtremClusterName, [Alias("Name","Index")] [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true,Position=0)] [Argumentcompleter( { doComplete $args 'qos-policies' name })] [ValidatePattern("^[^\[\]&\(\)`";,<>'/]+$")] [String]$QosPolicyName, [Parameter(Mandatory=$true,Position=1)] [ValidateSet('fixed','adaptive')] [String]$LimitType, [Parameter()] [String]$MaxBW, [Parameter()] [System.Nullable[Int]]$MaxIOPS, [Parameter()] [String]$BurstPercentage, [Parameter()] [String]$IoSize, [Parameter()] [object]$Session = (Get-XtremDefaultSession), [Parameter()] [switch]$ShowRest ) initCommand $Route = '/types/qos-policies' $BodyList = @{} $IsClusterX2 = $false; $ClusterType = $Session.GetXtremInternalClusterType($XtremClusterName) if ($ClusterType -eq 'X2') { $IsClusterX2 = $true; } AddIfExists -name "cluster-id" -value $XtremClusterName -list $BodyList AddIfExists -name "qos-policy-name" -value $QosPolicyName -list $BodyList AddIfExists -name "limit-type" -value $LimitType -list $BodyList AddIfExists -name "max-bw" -value $MaxBW -list $BodyList AddIfExists -name "max-iops" -value $MaxIOPS -list $BodyList AddIfExists -name "burst-percentage" -value $BurstPercentage -list $BodyList AddIfExists -name "io-size" -value $IoSize -list $BodyList $Body = BuildXtremJson -list $BodyList $result = NewXtremRequest -Method POST -Endpoint $Route -Session $Session -XtremClusterName $XtremClusterName -Body $Body -ObjectSelection $ObjectSelection -ShowRest:$ShowRest.IsPresent finalizeCommand return $result } Function Set-XtremQoS{ <# .DESCRIPTION Enables you to modify properties of the selected QoS. .PARAMETER QosPolicyName QoS policy name .PARAMETER NewQosPolicyName New QoS policy name .PARAMETER LimtType Limit Type .PARAMETER MaxBW Max BW .PARAMETER MaxIOPS Max IOPS .PARAMETER BurstPercentage Burst Percentage block size 4096 must not be defined with an offset. .PARAMETER IoSize IoSize .PARAMETER ShowRest Return an object represents the REST operation including URI , Method and JSON .EXAMPLE Set-XtremQoS -QosPolicYName testQoS -limit_type fixed #> [CmdletBinding()] [Alias('xmsQoSModify')] Param( [Parameter()] $XtremClusterName = (Get-XtremDefaultSession)._XtremClusterName, [Alias("Name","Index")] [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true,Position=0)] [Argumentcompleter( { doComplete $args 'qos-policies' name })] [String]$QosPolicyName, [ValidateSet('fixed','adaptive')] [String]$LimitType, [Parameter()] [String]$MaxBW, [Parameter()] [System.Nullable[Int]]$MaxIOPS, [Parameter()] [String]$BurstPercentage, [Parameter()] [String]$IoSize, [Parameter()] [ValidatePattern("^[^\[\]&\(\)`";,<>'/]+$")] [String]$NewQoSPolicyName, [Parameter()] [object]$Session = (Get-XtremDefaultSession), [Parameter()] [switch]$ShowRest ) initCommand $Route = '/types/qos-policies' $Route, $GetProperty = SetParametersForRequest $Route $QosPolicyName $BodyList = @{} $IsClusterX2 = $false; $ClusterType = $Session.GetXtremInternalClusterType($XtremClusterName) if ($ClusterType -eq 'X2') { $IsClusterX2 = $true; } AddIfExists -name "cluster-id" -value $XtremClusterName -list $BodyList AddIfExists -name "qos-policy-name" -value $NewQosPolicyName -list $BodyList AddIfExists -name "limit-type" -value $LimitType -list $BodyList AddIfExists -name "max-bw" -value $MaxBW -list $BodyList AddIfExists -name "max-iops" -value $MaxIOPS -list $BodyList AddIfExists -name "burst-percentage" -value $BurstPercentage -list $BodyList AddIfExists -name "io-size" -value $IoSize -list $BodyList if ($ManagmentLocked -ne $null -and $IsClusterX2) { if ($ManagmentLocked -eq $True) { AddIfExists -name "management-locked" -value "enabled" -list $BodyList } else { AddIfExists -name "management-locked" -value "disabled" -list $BodyList } } $Body = BuildXtremJson -list $BodyList $result = NewXtremRequest -Method PUT -Endpoint $Route -Session $Session -XtremClusterName $XtremClusterName -Body $Body -ObjectSelection $ObjectSelection -GetProperty $GetProperty -ShowRest:$ShowRest.IsPresent finalizeCommand return $result } Function Remove-XtremQoS{ <# .DESCRIPTION Enables you to delete a QosPolicy. .PARAMETER QosPolicyName policy name or index number. .PARAMETER ShowRest Return an object represents the REST operation including URI , Method and JSON .EXAMPLE Remove-XtremQoS qosName #> [CmdletBinding()] [Alias('xmsQoSRemove')] Param( [Parameter()] $XtremClusterName = (Get-XtremDefaultSession)._XtremClusterName, [Alias("Name","Index")] [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true,Position=0)] [Argumentcompleter( { doComplete $args 'qos-policies' name })] $QosPolicyName, [Parameter()] [bool]$Confirm = (Get-XtremDefaultSession)._XtremCLIMode, [Parameter()] [object]$Session = (Get-XtremDefaultSession), [Parameter()] [switch]$ShowRest ) initCommand $confirmed = IsConfirmed $Confirm if (!$confirmed) { return } $Route = '/types/qos-policies' $Route, $GetProperty = SetParametersForRequest $Route $QosPolicyName $result = NewXtremRequest -Method DELETE -Endpoint $Route -Session $Session -XtremClusterName $XtremClusterName -GetProperty $GetProperty -ShowRest:$ShowRest.IsPresent finalizeCommand return $result } Export-ModuleMember *-* -Alias * |