Files
ps.ipam/functions/public/Get-Section.ps1
2022-12-14 15:26:43 +03:00

39 lines
1.0 KiB
PowerShell

function Get-Section {
[CmdletBinding(DefaultParameterSetName="NoParams")]
[OutputType([PS.IPAM.Section])]
param (
[parameter(
Mandatory=$false,
ValueFromPipeline=$true,
Position=0,
ParameterSetName="ByID"
)]
[ValidateNotNullOrEmpty()]
[int]
$Id,
[parameter(
Mandatory=$true,
ValueFromPipeline=$true,
Position=0,
ParameterSetName="ByName"
)]
[ValidateNotNullOrEmpty()]
[string]
$Name
)
process {
$_params = @{
Controller = [PS.IPAM.controllers]::sections
Method = "GET"
Type = [PS.IPAM.types]::Section
}
switch ($PSCmdlet.ParameterSetName) {
"ByID" { $_identifiers = @($Id); break }
"ByName" { $_identifiers = @($Name); break }
}
$_params.Add("Identifiers",$_identifiers)
Invoke-Request @_params
}
}
Export-ModuleMember Get-Section