Initial commit

This commit is contained in:
Laurence Horrocks-Barlow 2026-05-19 00:35:27 +01:00
commit 6bf433c9a9
20 changed files with 1162 additions and 0 deletions

54
Public/GpfsSnapshot.ps1 Normal file
View file

@ -0,0 +1,54 @@
function Get-GpfsSnapshot {
[CmdletBinding(DefaultParameterSetName = 'All')]
param(
[Parameter(Mandatory, Position = 0)]
[string]$FilesystemName,
[Parameter(Mandatory, ParameterSetName = 'ByName', Position = 1)]
[string]$SnapshotName,
[Parameter(ParameterSetName = 'All')]
[string]$FilesetName
)
if ($PSCmdlet.ParameterSetName -eq 'ByName') {
Invoke-GpfsApiRequest -Method GET -Endpoint "filesystems/$FilesystemName/snapshots/$SnapshotName"
}
else {
$params = @{ Method = 'GET'; Endpoint = "filesystems/$FilesystemName/snapshots" }
if ($FilesetName) {
$params['QueryParameters'] = @{ filesetName = $FilesetName }
}
Invoke-GpfsApiRequest @params
}
}
function New-GpfsSnapshot {
[CmdletBinding(SupportsShouldProcess)]
param(
[Parameter(Mandatory, Position = 0)]
[string]$FilesystemName,
[Parameter(Mandatory)]
[hashtable]$Settings
)
if ($PSCmdlet.ShouldProcess($FilesystemName, 'Create snapshot')) {
Invoke-GpfsApiRequest -Method POST -Endpoint "filesystems/$FilesystemName/snapshots" -Body $Settings
}
}
function Remove-GpfsSnapshot {
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')]
param(
[Parameter(Mandatory, Position = 0)]
[string]$FilesystemName,
[Parameter(Mandatory, Position = 1)]
[string]$SnapshotName
)
if ($PSCmdlet.ShouldProcess($SnapshotName, 'Remove snapshot')) {
Invoke-GpfsApiRequest -Method DELETE -Endpoint "filesystems/$FilesystemName/snapshots/$SnapshotName"
}
}