Initial commit
This commit is contained in:
commit
6bf433c9a9
20 changed files with 1162 additions and 0 deletions
53
Public/GpfsSmbShare.ps1
Normal file
53
Public/GpfsSmbShare.ps1
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
function Get-GpfsSmbShare {
|
||||
[CmdletBinding(DefaultParameterSetName = 'All')]
|
||||
param(
|
||||
[Parameter(Mandatory, ParameterSetName = 'ByName', Position = 0)]
|
||||
[string]$ShareName
|
||||
)
|
||||
|
||||
if ($PSCmdlet.ParameterSetName -eq 'ByName') {
|
||||
Invoke-GpfsApiRequest -Method GET -Endpoint "smb/shares/$ShareName"
|
||||
}
|
||||
else {
|
||||
Invoke-GpfsApiRequest -Method GET -Endpoint 'smb/shares'
|
||||
}
|
||||
}
|
||||
|
||||
function New-GpfsSmbShare {
|
||||
[CmdletBinding(SupportsShouldProcess)]
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
[hashtable]$Settings
|
||||
)
|
||||
|
||||
if ($PSCmdlet.ShouldProcess('SMB share', 'Create')) {
|
||||
Invoke-GpfsApiRequest -Method POST -Endpoint 'smb/shares' -Body $Settings
|
||||
}
|
||||
}
|
||||
|
||||
function Set-GpfsSmbShare {
|
||||
[CmdletBinding(SupportsShouldProcess)]
|
||||
param(
|
||||
[Parameter(Mandatory, Position = 0)]
|
||||
[string]$ShareName,
|
||||
|
||||
[Parameter(Mandatory)]
|
||||
[hashtable]$Settings
|
||||
)
|
||||
|
||||
if ($PSCmdlet.ShouldProcess($ShareName, 'Update SMB share')) {
|
||||
Invoke-GpfsApiRequest -Method PUT -Endpoint "smb/shares/$ShareName" -Body $Settings
|
||||
}
|
||||
}
|
||||
|
||||
function Remove-GpfsSmbShare {
|
||||
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')]
|
||||
param(
|
||||
[Parameter(Mandatory, Position = 0)]
|
||||
[string]$ShareName
|
||||
)
|
||||
|
||||
if ($PSCmdlet.ShouldProcess($ShareName, 'Remove SMB share')) {
|
||||
Invoke-GpfsApiRequest -Method DELETE -Endpoint "smb/shares/$ShareName"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue