98 lines
2.8 KiB
PowerShell
98 lines
2.8 KiB
PowerShell
function Get-GpfsFileset {
|
|
[CmdletBinding(DefaultParameterSetName = 'All')]
|
|
param(
|
|
[Parameter(Mandatory, Position = 0)]
|
|
[string]$FilesystemName,
|
|
|
|
[Parameter(Mandatory, ParameterSetName = 'ByName', Position = 1)]
|
|
[string]$FilesetName
|
|
)
|
|
|
|
if ($PSCmdlet.ParameterSetName -eq 'ByName') {
|
|
Invoke-GpfsApiRequest -Method GET -Endpoint "filesystems/$FilesystemName/filesets/$FilesetName"
|
|
}
|
|
else {
|
|
Invoke-GpfsApiRequest -Method GET -Endpoint "filesystems/$FilesystemName/filesets"
|
|
}
|
|
}
|
|
|
|
function New-GpfsFileset {
|
|
[CmdletBinding(SupportsShouldProcess)]
|
|
param(
|
|
[Parameter(Mandatory, Position = 0)]
|
|
[string]$FilesystemName,
|
|
|
|
[Parameter(Mandatory)]
|
|
[hashtable]$Settings
|
|
)
|
|
|
|
if ($PSCmdlet.ShouldProcess($FilesystemName, 'Create fileset')) {
|
|
Invoke-GpfsApiRequest -Method POST -Endpoint "filesystems/$FilesystemName/filesets" -Body $Settings
|
|
}
|
|
}
|
|
|
|
function Set-GpfsFileset {
|
|
[CmdletBinding(SupportsShouldProcess)]
|
|
param(
|
|
[Parameter(Mandatory, Position = 0)]
|
|
[string]$FilesystemName,
|
|
|
|
[Parameter(Mandatory, Position = 1)]
|
|
[string]$FilesetName,
|
|
|
|
[Parameter(Mandatory)]
|
|
[hashtable]$Settings
|
|
)
|
|
|
|
if ($PSCmdlet.ShouldProcess($FilesetName, 'Update fileset')) {
|
|
Invoke-GpfsApiRequest -Method PUT -Endpoint "filesystems/$FilesystemName/filesets/$FilesetName" -Body $Settings
|
|
}
|
|
}
|
|
|
|
function Remove-GpfsFileset {
|
|
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')]
|
|
param(
|
|
[Parameter(Mandatory, Position = 0)]
|
|
[string]$FilesystemName,
|
|
|
|
[Parameter(Mandatory, Position = 1)]
|
|
[string]$FilesetName
|
|
)
|
|
|
|
if ($PSCmdlet.ShouldProcess($FilesetName, 'Remove fileset')) {
|
|
Invoke-GpfsApiRequest -Method DELETE -Endpoint "filesystems/$FilesystemName/filesets/$FilesetName"
|
|
}
|
|
}
|
|
|
|
function Register-GpfsFileset {
|
|
[CmdletBinding(SupportsShouldProcess)]
|
|
param(
|
|
[Parameter(Mandatory, Position = 0)]
|
|
[string]$FilesystemName,
|
|
|
|
[Parameter(Mandatory, Position = 1)]
|
|
[string]$FilesetName,
|
|
|
|
[Parameter(Mandatory)]
|
|
[hashtable]$LinkSettings
|
|
)
|
|
|
|
if ($PSCmdlet.ShouldProcess($FilesetName, 'Link fileset')) {
|
|
Invoke-GpfsApiRequest -Method PUT -Endpoint "filesystems/$FilesystemName/filesets/$FilesetName/link" -Body $LinkSettings
|
|
}
|
|
}
|
|
|
|
function Unregister-GpfsFileset {
|
|
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')]
|
|
param(
|
|
[Parameter(Mandatory, Position = 0)]
|
|
[string]$FilesystemName,
|
|
|
|
[Parameter(Mandatory, Position = 1)]
|
|
[string]$FilesetName
|
|
)
|
|
|
|
if ($PSCmdlet.ShouldProcess($FilesetName, 'Unlink fileset')) {
|
|
Invoke-GpfsApiRequest -Method DELETE -Endpoint "filesystems/$FilesystemName/filesets/$FilesetName/link"
|
|
}
|
|
}
|