Initial commit
This commit is contained in:
commit
6bf433c9a9
20 changed files with 1162 additions and 0 deletions
72
Public/GpfsQuota.ps1
Normal file
72
Public/GpfsQuota.ps1
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
function Get-GpfsQuota {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory, Position = 0)]
|
||||
[string]$FilesystemName,
|
||||
|
||||
[Parameter()]
|
||||
[ValidateSet('USR', 'GRP', 'FILESET')]
|
||||
[string]$QuotaType,
|
||||
|
||||
[Parameter()]
|
||||
[string]$ObjectName,
|
||||
|
||||
[Parameter()]
|
||||
[string]$FilesetName
|
||||
)
|
||||
|
||||
$query = @{}
|
||||
if ($QuotaType) { $query['quotaType'] = $QuotaType }
|
||||
if ($ObjectName) { $query['objectName'] = $ObjectName }
|
||||
if ($FilesetName){ $query['filesetName']= $FilesetName }
|
||||
|
||||
$params = @{ Method = 'GET'; Endpoint = "filesystems/$FilesystemName/quotas" }
|
||||
if ($query.Count -gt 0) { $params['QueryParameters'] = $query }
|
||||
|
||||
Invoke-GpfsApiRequest @params
|
||||
}
|
||||
|
||||
function New-GpfsQuota {
|
||||
[CmdletBinding(SupportsShouldProcess)]
|
||||
param(
|
||||
[Parameter(Mandatory, Position = 0)]
|
||||
[string]$FilesystemName,
|
||||
|
||||
[Parameter(Mandatory)]
|
||||
[hashtable]$Settings
|
||||
)
|
||||
|
||||
if ($PSCmdlet.ShouldProcess($FilesystemName, 'Create quota')) {
|
||||
Invoke-GpfsApiRequest -Method POST -Endpoint "filesystems/$FilesystemName/quotas" -Body $Settings
|
||||
}
|
||||
}
|
||||
|
||||
function Set-GpfsQuota {
|
||||
[CmdletBinding(SupportsShouldProcess)]
|
||||
param(
|
||||
[Parameter(Mandatory, Position = 0)]
|
||||
[string]$FilesystemName,
|
||||
|
||||
[Parameter(Mandatory)]
|
||||
[hashtable]$Settings
|
||||
)
|
||||
|
||||
if ($PSCmdlet.ShouldProcess($FilesystemName, 'Update quota')) {
|
||||
Invoke-GpfsApiRequest -Method PUT -Endpoint "filesystems/$FilesystemName/quotas" -Body $Settings
|
||||
}
|
||||
}
|
||||
|
||||
function Remove-GpfsQuota {
|
||||
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')]
|
||||
param(
|
||||
[Parameter(Mandatory, Position = 0)]
|
||||
[string]$FilesystemName,
|
||||
|
||||
[Parameter(Mandatory)]
|
||||
[hashtable]$Filter
|
||||
)
|
||||
|
||||
if ($PSCmdlet.ShouldProcess($FilesystemName, 'Remove quota')) {
|
||||
Invoke-GpfsApiRequest -Method DELETE -Endpoint "filesystems/$FilesystemName/quotas" -Body $Filter
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue