Files
ps.ipam/functions/public/Get-Section.ps1
2022-12-12 18:58:13 +03:00

29 lines
936 B
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