53 lines
1.4 KiB
PowerShell
53 lines
1.4 KiB
PowerShell
function Get-GpfsNfsExport {
|
|
[CmdletBinding(DefaultParameterSetName = 'All')]
|
|
param(
|
|
[Parameter(Mandatory, ParameterSetName = 'ById', Position = 0)]
|
|
[string]$ExportId
|
|
)
|
|
|
|
if ($PSCmdlet.ParameterSetName -eq 'ById') {
|
|
Invoke-GpfsApiRequest -Method GET -Endpoint "nfs/exports/$ExportId"
|
|
}
|
|
else {
|
|
Invoke-GpfsApiRequest -Method GET -Endpoint 'nfs/exports'
|
|
}
|
|
}
|
|
|
|
function New-GpfsNfsExport {
|
|
[CmdletBinding(SupportsShouldProcess)]
|
|
param(
|
|
[Parameter(Mandatory)]
|
|
[hashtable]$Settings
|
|
)
|
|
|
|
if ($PSCmdlet.ShouldProcess('NFS export', 'Create')) {
|
|
Invoke-GpfsApiRequest -Method POST -Endpoint 'nfs/exports' -Body $Settings
|
|
}
|
|
}
|
|
|
|
function Set-GpfsNfsExport {
|
|
[CmdletBinding(SupportsShouldProcess)]
|
|
param(
|
|
[Parameter(Mandatory, Position = 0)]
|
|
[string]$ExportId,
|
|
|
|
[Parameter(Mandatory)]
|
|
[hashtable]$Settings
|
|
)
|
|
|
|
if ($PSCmdlet.ShouldProcess($ExportId, 'Update NFS export')) {
|
|
Invoke-GpfsApiRequest -Method PUT -Endpoint "nfs/exports/$ExportId" -Body $Settings
|
|
}
|
|
}
|
|
|
|
function Remove-GpfsNfsExport {
|
|
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')]
|
|
param(
|
|
[Parameter(Mandatory, Position = 0)]
|
|
[string]$ExportId
|
|
)
|
|
|
|
if ($PSCmdlet.ShouldProcess($ExportId, 'Remove NFS export')) {
|
|
Invoke-GpfsApiRequest -Method DELETE -Endpoint "nfs/exports/$ExportId"
|
|
}
|
|
}
|