subnet type
This commit is contained in:
@@ -2,8 +2,7 @@ function Invoke-Request {
|
||||
[CmdletBinding()]
|
||||
param (
|
||||
[parameter(Mandatory=$true)]
|
||||
[ValidateSet("POST","GET","PATCH","DELETE")]
|
||||
[string]
|
||||
[methods]
|
||||
$Method,
|
||||
[parameter(Mandatory=$true)]
|
||||
[ValidateSet("user","vlan","subnets","addresses","sections","vrf","l2domains","tools")]
|
||||
@@ -50,7 +49,7 @@ function Invoke-Request {
|
||||
Headers = $_headers
|
||||
}
|
||||
|
||||
if ($Method -match "POST|PATCH") {
|
||||
if ($Method -eq [methods]::POST -or $Method -eq [methods]) {
|
||||
if ($Params -is [PSCustomObject]) {
|
||||
$_params = @{};
|
||||
$Params | Get-Member -MemberType *Property | Where-Object {
|
||||
@@ -65,9 +64,9 @@ function Invoke-Request {
|
||||
|
||||
if ($_response.code -match "20\d") {
|
||||
switch ($Type) {
|
||||
"address" { $_response.data | ForEach-Object { New-Object -TypeName "PS.IPAM.Address" -ArgumentList $_.psobject.properties.value } }
|
||||
"subnet" { $_response.data | ForEach-Object { New-Object -TypeName "PS.IPAM.Subnetwork" -ArgumentList $_.psobject.properties.value } }
|
||||
"tag" { $_response.data | ForEach-Object { New-Object -TypeName "PS.IPAM.Tag" -ArgumentList $_.psobject.properties.value } }
|
||||
"address" { $_response.data | ForEach-Object { New-Object -TypeName "Address" -ArgumentList $_.psobject.properties.value } }
|
||||
"subnet" { $_response.data | ForEach-Object { New-Object -TypeName "Subnetwork" -ArgumentList $_.psobject.properties.value } }
|
||||
"tag" { $_response.data | ForEach-Object { New-Object -TypeName "Tag" -ArgumentList $_.psobject.properties.value } }
|
||||
Default { $_response.data }
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user