PSGpfsApi/Public/GpfsPool.ps1

65 lines
1.8 KiB
PowerShell

function Get-GpfsPool {
[CmdletBinding(DefaultParameterSetName = 'All')]
param(
[Parameter(Mandatory, Position = 0)]
[string]$FilesystemName,
[Parameter(Mandatory, ParameterSetName = 'ByName', Position = 1)]
[string]$PoolName
)
if ($PSCmdlet.ParameterSetName -eq 'ByName') {
Invoke-GpfsApiRequest -Method GET -Endpoint "filesystems/$FilesystemName/pools/$PoolName"
}
else {
Invoke-GpfsApiRequest -Method GET -Endpoint "filesystems/$FilesystemName/pools"
}
}
function New-GpfsPool {
[CmdletBinding(SupportsShouldProcess)]
param(
[Parameter(Mandatory, Position = 0)]
[string]$FilesystemName,
[Parameter(Mandatory)]
[hashtable]$Settings
)
if ($PSCmdlet.ShouldProcess($FilesystemName, 'Create pool')) {
Invoke-GpfsApiRequest -Method POST -Endpoint "filesystems/$FilesystemName/pools" -Body $Settings
}
}
function Set-GpfsPool {
[CmdletBinding(SupportsShouldProcess)]
param(
[Parameter(Mandatory, Position = 0)]
[string]$FilesystemName,
[Parameter(Mandatory, Position = 1)]
[string]$PoolName,
[Parameter(Mandatory)]
[hashtable]$Settings
)
if ($PSCmdlet.ShouldProcess($PoolName, 'Update pool')) {
Invoke-GpfsApiRequest -Method PUT -Endpoint "filesystems/$FilesystemName/pools/$PoolName" -Body $Settings
}
}
function Remove-GpfsPool {
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')]
param(
[Parameter(Mandatory, Position = 0)]
[string]$FilesystemName,
[Parameter(Mandatory, Position = 1)]
[string]$PoolName
)
if ($PSCmdlet.ShouldProcess($PoolName, 'Remove pool')) {
Invoke-GpfsApiRequest -Method DELETE -Endpoint "filesystems/$FilesystemName/pools/$PoolName"
}
}