Compare commits
20 Commits
078beb8d3c
...
documentat
| Author | SHA1 | Date | |
|---|---|---|---|
| fb39efd493 | |||
| e45d2665fa | |||
| 2af591dbbf | |||
| 85e13dc150 | |||
| d1128997cc | |||
| bc645fc0d8 | |||
| ced1dde708 | |||
| bad183aff4 | |||
| e456d7affe | |||
|
|
4c128f5864 | ||
|
|
0913fc2069 | ||
| ea9b760933 | |||
| 833bb183eb | |||
| ed9d648074 | |||
| ad9744bf56 | |||
| 1291bc0b69 | |||
| b1c5feb73b | |||
| 6fb2e81142 | |||
| 9912656752 | |||
| 538d84305f |
@@ -14,10 +14,10 @@ public class Domain {
|
||||
string description,
|
||||
string sections
|
||||
) {
|
||||
this.Id = id;
|
||||
this.Name = name;
|
||||
this.Id = id;
|
||||
this.Name = name;
|
||||
this.Description = description;
|
||||
this.Sections = sections;
|
||||
this.Sections = sections;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
||||
28
classlib/class/nameserver.cs
Normal file
28
classlib/class/nameserver.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
namespace PS.IPAM;
|
||||
using System;
|
||||
|
||||
[Serializable]
|
||||
public class Nameserver {
|
||||
public int Id { get; }
|
||||
public string Name { get; }
|
||||
public string[] NameServers { get; }
|
||||
public string Description { get; }
|
||||
public string Permissions { get; }
|
||||
public DateTime? EditDate { get; }
|
||||
|
||||
public Nameserver(
|
||||
int id,
|
||||
string name,
|
||||
string nameServers,
|
||||
string description,
|
||||
string permissions,
|
||||
DateTime? editDate
|
||||
) {
|
||||
this.Id = id;
|
||||
this.Name = name;
|
||||
this.NameServers = nameServers.Split(new char[] {';'});
|
||||
this.Description = description;
|
||||
this.Permissions = permissions;
|
||||
this.EditDate = editDate;
|
||||
}
|
||||
}
|
||||
@@ -34,20 +34,20 @@ public class Section {
|
||||
bool showSupernetOnly,
|
||||
int dnsId
|
||||
) {
|
||||
this.Id = id;
|
||||
this.Name = name;
|
||||
this.Description = description;
|
||||
this.MasterSectionId = masterSectionId;
|
||||
this.Permissions = permissions;
|
||||
this.StrictMode = strictMode;
|
||||
this.SubnetOrdering = subnetOrdering;
|
||||
this.Order = order;
|
||||
this.EditDate = editDate;
|
||||
this.ShowSubnet = showSubnet;
|
||||
this.ShowVlan = showVlan;
|
||||
this.ShowVRF = showVRF;
|
||||
this.Id = id;
|
||||
this.Name = name;
|
||||
this.Description = description;
|
||||
this.MasterSectionId = masterSectionId;
|
||||
this.Permissions = permissions;
|
||||
this.StrictMode = strictMode;
|
||||
this.SubnetOrdering = subnetOrdering;
|
||||
this.Order = order;
|
||||
this.EditDate = editDate;
|
||||
this.ShowSubnet = showSubnet;
|
||||
this.ShowVlan = showVlan;
|
||||
this.ShowVRF = showVRF;
|
||||
this.ShowSupernetOnly = showSupernetOnly;
|
||||
this.DNSId = dnsId;
|
||||
this.DNSId = dnsId;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
||||
@@ -17,11 +17,11 @@ public class Session {
|
||||
DateTime? expires,
|
||||
Object? credentials
|
||||
) {
|
||||
AuthType = authType;
|
||||
Token = token;
|
||||
AppID = appId;
|
||||
URL = url;
|
||||
Expires = expires;
|
||||
AuthType = authType;
|
||||
Token = token;
|
||||
AppID = appId;
|
||||
URL = url;
|
||||
Expires = expires;
|
||||
Credentials = credentials;
|
||||
}
|
||||
|
||||
|
||||
@@ -69,38 +69,38 @@ public class Subnetwork {
|
||||
Object calculation,
|
||||
Object? custom_fields
|
||||
) {
|
||||
this.Id = id;
|
||||
this.Subnet = subnet;
|
||||
this.Mask = mask;
|
||||
this.SectionId = sectionId;
|
||||
this.Description = description;
|
||||
this.LinkedSubnet = linkedSubnet;
|
||||
this.Id = id;
|
||||
this.Subnet = subnet;
|
||||
this.Mask = mask;
|
||||
this.SectionId = sectionId;
|
||||
this.Description = description;
|
||||
this.LinkedSubnet = linkedSubnet;
|
||||
this.FirewallAddressObject = firewallAddressObject;
|
||||
this.VrfId = vrfId;
|
||||
this.MasterSubnetId = masterSubnetId;
|
||||
this.AllowRequests = allowRequests;
|
||||
this.VlanId = vlanId;
|
||||
this.ShowName = showName;
|
||||
this.DeviceId = deviceId;
|
||||
this.Permissions = permissions;
|
||||
this.PingSubnet = pingSubnet;
|
||||
this.DiscoverSubnet = discoverSubnet;
|
||||
this.ResolveDNS = resolveDNS;
|
||||
this.DNSRecursive = dnsRecursive;
|
||||
this.DNSRecords = dnsRecords;
|
||||
this.NameserverId = nameserverId;
|
||||
this.ScanAgent = scanAgent;
|
||||
this.IsFolder = isFolder;
|
||||
this.IsFull = isFull;
|
||||
this.IsPool = isPool;
|
||||
this.TagId = tagId;
|
||||
this.Threshold = threshold;
|
||||
this.LocationId = locationId;
|
||||
this.EditDate = editDate;
|
||||
this.LastScan = lastScan;
|
||||
this.LastDiscovery = lastDiscovery;
|
||||
this.Calculation = calculation;
|
||||
this.ExtendedData = custom_fields;
|
||||
this.VrfId = vrfId;
|
||||
this.MasterSubnetId = masterSubnetId;
|
||||
this.AllowRequests = allowRequests;
|
||||
this.VlanId = vlanId;
|
||||
this.ShowName = showName;
|
||||
this.DeviceId = deviceId;
|
||||
this.Permissions = permissions;
|
||||
this.PingSubnet = pingSubnet;
|
||||
this.DiscoverSubnet = discoverSubnet;
|
||||
this.ResolveDNS = resolveDNS;
|
||||
this.DNSRecursive = dnsRecursive;
|
||||
this.DNSRecords = dnsRecords;
|
||||
this.NameserverId = nameserverId;
|
||||
this.ScanAgent = scanAgent;
|
||||
this.IsFolder = isFolder;
|
||||
this.IsFull = isFull;
|
||||
this.IsPool = isPool;
|
||||
this.TagId = tagId;
|
||||
this.Threshold = threshold;
|
||||
this.LocationId = locationId;
|
||||
this.EditDate = editDate;
|
||||
this.LastScan = lastScan;
|
||||
this.LastDiscovery = lastDiscovery;
|
||||
this.Calculation = calculation;
|
||||
this.ExtendedData = custom_fields;
|
||||
}
|
||||
|
||||
public string GetCIDR() {
|
||||
|
||||
@@ -22,13 +22,13 @@ public class Vlan : DynamicObject {
|
||||
int customer_id,
|
||||
Object? custom_fields
|
||||
) {
|
||||
this.Id = vlanId;
|
||||
this.DomainId = domainId;
|
||||
this.Name = name;
|
||||
this.Number = number;
|
||||
this.Description = description;
|
||||
this.EditDate = editDate;
|
||||
this.CustomerId = customer_id;
|
||||
this.Id = vlanId;
|
||||
this.DomainId = domainId;
|
||||
this.Name = name;
|
||||
this.Number = number;
|
||||
this.Description = description;
|
||||
this.EditDate = editDate;
|
||||
this.CustomerId = customer_id;
|
||||
this.ExtendedData = custom_fields;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,13 +20,13 @@ public class Vrf {
|
||||
DateTime? editDate,
|
||||
Object? custom_fields
|
||||
) {
|
||||
this.Id = id;
|
||||
this.Name = name;
|
||||
this.Id = id;
|
||||
this.Name = name;
|
||||
this.RouteDistinguisher = rd;
|
||||
this.Description = description;
|
||||
this.Sections = sections;
|
||||
this.EditDate = editDate;
|
||||
this.ExtendedData = custom_fields;
|
||||
this.Description = description;
|
||||
this.Sections = sections;
|
||||
this.EditDate = editDate;
|
||||
this.ExtendedData = custom_fields;
|
||||
}
|
||||
public override string ToString()
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@ public enum types {
|
||||
Domain,
|
||||
Section,
|
||||
Subnetwork,
|
||||
Nameserver,
|
||||
Tag,
|
||||
Vlan,
|
||||
Vrf
|
||||
|
||||
21
functions/private/ConvertTo-Hashtable.ps1
Normal file
21
functions/private/ConvertTo-Hashtable.ps1
Normal file
@@ -0,0 +1,21 @@
|
||||
function ConvertTo-Hashtable {
|
||||
[CmdletBinding()]
|
||||
param (
|
||||
[Parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[PSCustomObject]$InputObject
|
||||
)
|
||||
process {
|
||||
$_hashtable = @{}
|
||||
$InputObject | Get-Member -MemberType *Property | Where-Object {
|
||||
$_hashtable.($_.name) = $CustomFields.($_.name)
|
||||
}
|
||||
|
||||
Write-Output $_hashtable
|
||||
}
|
||||
}
|
||||
@@ -26,25 +26,21 @@ function Invoke-Request {
|
||||
if ($_tokenStatus -eq "NoToken") { throw "No session available!" }
|
||||
if ($_tokenStatus -eq "Expired") { Update-Session }
|
||||
|
||||
$Controller = $Controller
|
||||
|
||||
$_uri = "$($script:psipamSession.URL)/api/$($script:psipamSession.AppID)/$Controller"
|
||||
if ($SubController) { $_uri += "/$SubController" }
|
||||
if ($Identifiers) { $_uri += "/$($Identifiers -join '/')/" }
|
||||
if ($null -ne $SubController) { $_uri += "/$SubController" }
|
||||
if ($null -ne $Identifiers) { $_uri += "/$($Identifiers -join '/')/" }
|
||||
|
||||
$_headers = @{
|
||||
"Accept" = "application/json"
|
||||
"Content-Type" = "application/json"
|
||||
}
|
||||
$_headers = @{ }
|
||||
switch ($script:psipamSession.AuthType) {
|
||||
"Credentials" { $_headers.Add("token", $script:psipamSession.Token) }
|
||||
"Token" { $_headers.Add("phpipam-token", $script:psipamSession.Token) }
|
||||
}
|
||||
|
||||
$_arguments = @{
|
||||
Method = $Method
|
||||
Uri = $_uri
|
||||
Headers = $_headers
|
||||
Method = $Method
|
||||
Uri = $_uri
|
||||
Headers = $_headers
|
||||
ContentType = "application/json"
|
||||
}
|
||||
|
||||
if ($Method -eq "POST" -or $Method -eq "PATCH") {
|
||||
@@ -60,42 +56,48 @@ function Invoke-Request {
|
||||
|
||||
Write-Verbose -Message "Invoking web request to $($_uri), with method $($_arguments.Method), headers: $($_arguments.Headers)"
|
||||
|
||||
$_response = Invoke-RestMethod @_arguments
|
||||
|
||||
if ($_response.code -match "20\d") {
|
||||
if ($Type -is [PS.IPAM.types]) {
|
||||
switch ($Type) {
|
||||
"address" {
|
||||
$_paramList = @("id","subnetId","ip","is_gateway","description","hostname","mac","owner","tag","deviceId","location","port","note","lastSeen","excludePing","PTRignore","PTR","firewallAddressObject","editDate","customer_id")
|
||||
|
||||
$_response.data | ForEach-Object {
|
||||
New-Object -TypeName ([PS.IPAM.Address]) -ArgumentList (@(($_ | Select-Object $_paramList).psobject.properties.value) + ($_ | Select-Object -Property custom_* -ExcludeProperty 'custom_\*'))
|
||||
}; break
|
||||
}
|
||||
"vlan" {
|
||||
$_paramList = @("vlanId","domainId","name","number","description","editDate","customer_id","custom_fields")
|
||||
|
||||
$_response.data | ForEach-Object {
|
||||
New-Object -TypeName ([PS.IPAM.Vlan]) -ArgumentList (@(($_ | Select-Object $_paramList).psobject.properties.value) + ($_ | Select-Object -Property custom_* -ExcludeProperty 'custom_\*'))
|
||||
}; break
|
||||
}
|
||||
"subnetwork" {
|
||||
$_response.data | ForEach-Object {
|
||||
New-Object -TypeName ([PS.IPAM.Subnetwork]) -ArgumentList (@($_.psobject.properties.value[0..30]) + ($_ | Select-Object -Property custom_* -ExcludeProperty 'custom_\*'))
|
||||
}; break
|
||||
}
|
||||
"vrf" {
|
||||
$_response.data | ForEach-Object {
|
||||
New-Object -TypeName ([PS.IPAM.Vrf]) -ArgumentList (@($_.psobject.properties.value[0..5]) + ($_ | Select-Object -Property custom_* -ExcludeProperty 'custom_\*'))
|
||||
}; break
|
||||
}
|
||||
Default { $_response.data | ForEach-Object { New-Object -TypeName ("PS.IPAM.$Type") -ArgumentList $_.psobject.properties.value } }
|
||||
}
|
||||
|
||||
} else {
|
||||
return $_response.data
|
||||
try {
|
||||
$_response = Invoke-RestMethod @_arguments
|
||||
}
|
||||
catch [System.Net.WebException] {
|
||||
switch ($_.Exception.Message) {
|
||||
"The remote server returned an error: (404) Not Found." { Write-Verbose -Message "Not found." }
|
||||
"The remote server returned an error: (400) Bad Request." { Write-Warning -Message "Bad Request." }
|
||||
Default { Write-Verbose -Message "Error occured while requesting api" }
|
||||
}
|
||||
}
|
||||
if (!$_response) { return $null }
|
||||
|
||||
if ($Type -is [PS.IPAM.types]) {
|
||||
switch ($Type) {
|
||||
"address" {
|
||||
$_paramList = @("id","subnetId","ip","is_gateway","description","hostname","mac","owner","tag","deviceId","location","port","note","lastSeen","excludePing","PTRignore","PTR","firewallAddressObject","editDate","customer_id")
|
||||
|
||||
$_response.data | ForEach-Object {
|
||||
New-Object -TypeName ([PS.IPAM.Address]) -ArgumentList (@(($_ | Select-Object $_paramList).psobject.properties.value) + ($_ | Select-Object -Property custom_* -ExcludeProperty 'custom_\*'))
|
||||
}
|
||||
}
|
||||
"vlan" {
|
||||
$_paramList = @("vlanId","domainId","name","number","description","editDate","customer_id","custom_fields")
|
||||
|
||||
$_response.data | ForEach-Object {
|
||||
New-Object -TypeName ([PS.IPAM.Vlan]) -ArgumentList (@(($_ | Select-Object $_paramList).psobject.properties.value) + ($_ | Select-Object -Property custom_* -ExcludeProperty 'custom_\*'))
|
||||
}
|
||||
}
|
||||
"subnetwork" {
|
||||
$_response.data | ForEach-Object {
|
||||
New-Object -TypeName ([PS.IPAM.Subnetwork]) -ArgumentList (@($_.psobject.properties.value[0..30]) + ($_ | Select-Object -Property custom_* -ExcludeProperty 'custom_\*'))
|
||||
}
|
||||
}
|
||||
"vrf" {
|
||||
$_response.data | ForEach-Object {
|
||||
New-Object -TypeName ([PS.IPAM.Vrf]) -ArgumentList (@($_.psobject.properties.value[0..5]) + ($_ | Select-Object -Property custom_* -ExcludeProperty 'custom_\*'))
|
||||
}
|
||||
}
|
||||
Default { $_response.data | ForEach-Object { New-Object -TypeName ("PS.IPAM.$Type") -ArgumentList $_.psobject.properties.value } }
|
||||
}
|
||||
|
||||
} else {
|
||||
throw ("Error - $($_response.code)")
|
||||
$_response.data
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,27 @@
|
||||
function Assign-Tag {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
||||
Assign tag to address.
|
||||
|
||||
.PARAMETER Tag
|
||||
Tag object to assign.
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param (
|
||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0)]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[PS.IPAM.Address]
|
||||
$AddressObject,
|
||||
[parameter(Mandatory=$true,Position=1)]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
Position=1
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[PS.IPAM.Tag]
|
||||
$Tag
|
||||
|
||||
20
functions/public/Close-Session.ps1
Normal file
20
functions/public/Close-Session.ps1
Normal file
@@ -0,0 +1,20 @@
|
||||
function Close-Session {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
||||
Removes (revokes) token.
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param()
|
||||
process {
|
||||
$_params = @{
|
||||
Controller = [PS.IPAM.controllers]::user
|
||||
Method = "DELETE"
|
||||
}
|
||||
|
||||
Invoke-Request @_params
|
||||
|
||||
$script:psipamSession = $null
|
||||
}
|
||||
}
|
||||
Export-ModuleMember Close-Session
|
||||
@@ -1,29 +1,86 @@
|
||||
function Get-Address {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
||||
Returns address object.
|
||||
#>
|
||||
[CmdletBinding(DefaultParameterSetName="ByID")]
|
||||
[OutputType([PS.IPAM.address])]
|
||||
param (
|
||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="ByID")]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="ByID"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
$Id,
|
||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="ByIP")]
|
||||
[parameter(Mandatory=$false,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=1,ParameterSetName="BySubnetId")]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="ByIP"
|
||||
)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=1,
|
||||
ParameterSetName="BySubnetId"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[ipaddress]
|
||||
$IP,
|
||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="ByHostName")]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="ByHostName"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
$HostName,
|
||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="ByTag")]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="ByHostBase"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
$HostBase,
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="ByTag"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
$TagId,
|
||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="BySubnetId")]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="BySubnetId"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
$SubnetId,
|
||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="BySubnetCIDR")]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="BySubnetCIDR"
|
||||
)]
|
||||
[ValidateScript({[ipaddress] $_.Split("/")[0] -and $_.Split("/")[1] -match "\d{1,2}"})]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
@@ -39,6 +96,7 @@ function Get-Address {
|
||||
"ByID" { $_identifiers = @($id); break }
|
||||
"ByIP" { $_identifiers = ("search",$IP); break }
|
||||
"ByHostName" { $_identifiers = ("search_hostname",$HostName); break }
|
||||
"ByHostBase" { $_identifiers = ("search_hostbase",$HostBase); break }
|
||||
"ByTag" { $_identifiers = ("tags",$TagId,[PS.IPAM.controllers]::addresses); break }
|
||||
"BySubnetId" {
|
||||
if ($IP) {
|
||||
|
||||
@@ -1,16 +1,34 @@
|
||||
function Get-FirstFreeIP {
|
||||
[CmdletBinding(DefaultParameterSetName="ByID")]
|
||||
param (
|
||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="ByCIDR")]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="ByCIDR"
|
||||
)]
|
||||
[ValidateScript({[ipaddress] $_.Split("/")[0] -and $_.Split("/")[1] -match "\d{1,2}"})]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
$CIDR,
|
||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="ByID")]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="ByID"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
$Id,
|
||||
[parameter(Mandatory=$false,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="BySubnetObject")]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="BySubnetObject"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[PS.IPAM.Subnetwork]
|
||||
$SubnetObject
|
||||
|
||||
@@ -2,7 +2,13 @@ function Get-L2Domain {
|
||||
[CmdletBinding(DefaultParameterSetName="ByID")]
|
||||
[OutputType([PS.IPAM.Domain])]
|
||||
param (
|
||||
[parameter(Mandatory=$false,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="ByID")]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="ByID"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
$Id
|
||||
|
||||
@@ -1,19 +1,23 @@
|
||||
function Get-Nameserver {
|
||||
[CmdletBinding(DefaultParameterSetName="ByID")]
|
||||
[CmdletBinding(DefaultParameterSetName="NoParams")]
|
||||
param (
|
||||
[parameter(Mandatory=$false,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="ByID")]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="ByID"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
$Id
|
||||
)
|
||||
process {
|
||||
[string[]]$visiblePropertiesList = @('Id','Name','Address','Description')
|
||||
$visibleProperties = [System.Management.Automation.PSPropertySet]::new('DefaultDisplayPropertySet',$visiblePropertiesList)
|
||||
|
||||
$_params = @{
|
||||
Controller = [PS.IPAM.controllers]::tools
|
||||
SubController = [PS.IPAM.subcontrollers]::nameservers
|
||||
Method = "GET"
|
||||
Type = [PS.IPAM.types]::nameserver
|
||||
}
|
||||
switch ($PSCmdlet.ParameterSetName) {
|
||||
"ByID" { $_nameserverId = $Id; break }
|
||||
@@ -21,8 +25,7 @@ function Get-Nameserver {
|
||||
$_identifiers = @($_nameserverId)
|
||||
$_params.Add("Identifiers",$_identifiers)
|
||||
|
||||
Invoke-Request @_params | Select-Object @{n="address";e={$_.namesrv1}},* | Select-Object -ExcludeProperty namesrv1 | `
|
||||
Add-Member -MemberType MemberSet -Name PSStandardMembers -Value $visibleProperties -PassThru
|
||||
Invoke-Request @_params
|
||||
}
|
||||
}
|
||||
Export-ModuleMember -Function Get-Nameserver
|
||||
@@ -2,11 +2,21 @@ function Get-Section {
|
||||
[CmdletBinding(DefaultParameterSetName="NoParams")]
|
||||
[OutputType([PS.IPAM.Section])]
|
||||
param (
|
||||
[parameter(Mandatory=$false,ValueFromPipeline=$true,Position=0,ParameterSetName="ByID")]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
Position=0,
|
||||
ParameterSetName="ByID"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
$Id,
|
||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,Position=0,ParameterSetName="ByName")]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
Position=0,
|
||||
ParameterSetName="ByName"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
$Name
|
||||
|
||||
@@ -2,47 +2,131 @@ function Get-Subnet {
|
||||
[CmdletBinding(DefaultParameterSetName="NoParams")]
|
||||
[OutputType([PS.IPAM.Subnetwork])]
|
||||
param (
|
||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="ByCIDR")]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="ByCIDR"
|
||||
)]
|
||||
[ValidateScript({[ipaddress] $_.Split("/")[0] -and $_.Split("/")[1] -match "\d{1,2}"})]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
$CIDR,
|
||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="ByID")]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="ByID"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
$Id,
|
||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="BySectionId")]
|
||||
[parameter(Mandatory=$false,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=2,ParameterSetName="ByVlanNumber")]
|
||||
[parameter(Mandatory=$false,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=1,ParameterSetName="ByVlanId")]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="BySectionId"
|
||||
)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=2,
|
||||
ParameterSetName="ByVlanNumber"
|
||||
)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=1,
|
||||
ParameterSetName="ByVlanId"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
$SectionId,
|
||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="BySectionName")]
|
||||
[parameter(Mandatory=$false,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=3,ParameterSetName="ByVlanNumber")]
|
||||
[parameter(Mandatory=$false,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=2,ParameterSetName="ByVlanId")]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="BySectionName"
|
||||
)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=3,
|
||||
ParameterSetName="ByVlanNumber"
|
||||
)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=2,
|
||||
ParameterSetName="ByVlanId"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
$SectionName,
|
||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="ByVrfId")]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="ByVrfId"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
$VrfId,
|
||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="ByVlanId")]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="ByVlanId"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
$VlanId,
|
||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="ByVlanNumber")]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="ByVlanNumber"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
$VlanNumber,
|
||||
[parameter(Mandatory=$false,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=1,ParameterSetName="ByVlanNumber")]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=1,
|
||||
ParameterSetName="ByVlanNumber"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
$VlanDomainId,
|
||||
[parameter(Mandatory=$false,ParameterSetName="ByID")]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=1,
|
||||
ParameterSetName="ByID"
|
||||
)]
|
||||
[switch]
|
||||
$Slaves,
|
||||
[parameter(Mandatory=$false,ParameterSetName="ByID")]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=2,
|
||||
ParameterSetName="ByID"
|
||||
)]
|
||||
[switch]
|
||||
$Recurse
|
||||
)
|
||||
|
||||
@@ -1,20 +1,31 @@
|
||||
function Get-SubnetUsage {
|
||||
[CmdletBinding(DefaultParameterSetName="ByID")]
|
||||
param (
|
||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="ByCIDR")]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="ByCIDR"
|
||||
)]
|
||||
[ValidateScript({[ipaddress] $_.Split("/")[0] -and $_.Split("/")[1] -match "\d{1,2}"})]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
$CIDR,
|
||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="ByID")]
|
||||
[ValidateScript({ $_ -match "^\d+$" })]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="ByID"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
[int]
|
||||
$Id
|
||||
)
|
||||
process {
|
||||
$_params = @{
|
||||
Controller = "subnets"
|
||||
Controller = [ps.ipam.controllers]::subnets
|
||||
Method = "GET"
|
||||
}
|
||||
switch ($PSCmdlet.ParameterSetName) {
|
||||
|
||||
@@ -1,16 +1,43 @@
|
||||
function Get-Tag {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
||||
Return address tag.
|
||||
|
||||
.DESCRIPTION
|
||||
|
||||
Return address tag by id, address object or subnetwork object. Or leave it empty at take all tags at once.
|
||||
#>
|
||||
[CmdletBinding(DefaultParameterSetName="NoParams")]
|
||||
[OutputType([PS.IPAM.Tag])]
|
||||
param (
|
||||
[parameter(Mandatory=$false,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="ByID")]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="ByID"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
$Id,
|
||||
[parameter(Mandatory=$false,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="ByAddressObject")]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="ByAddressObject"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[PS.IPAM.Address]
|
||||
$AddressObject,
|
||||
[parameter(Mandatory=$false,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="BySubnetObject")]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="BySubnetObject"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[PS.IPAM.Subnetwork]
|
||||
$SubnetObject
|
||||
|
||||
@@ -1,24 +1,66 @@
|
||||
function Get-Vlan {
|
||||
[CmdletBinding(DefaultParameterSetName="ByID")]
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
||||
Return vlan object.
|
||||
|
||||
.DESCRIPTION
|
||||
|
||||
Return vlan object by vlanId, vlan number, l2domainId (return all vlans in domain), subnet object or l2domain object
|
||||
|
||||
.PARAMETER Number
|
||||
Vlan tag
|
||||
#>
|
||||
[CmdletBinding(DefaultParameterSetName="NoParams")]
|
||||
[OutputType([PS.IPAM.Vlan])]
|
||||
param (
|
||||
[parameter(Mandatory=$false,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="ByID")]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="ByID"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
$Id,
|
||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="ByNumber")]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="ByNumber"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
$Number,
|
||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="ByL2Domain")]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="ByL2Domain"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
$L2DomainId,
|
||||
[parameter(Mandatory=$false,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="BySubnetObject")]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="BySubnetObject"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[PS.IPAM.Subnetwork]
|
||||
$SubnetObject,
|
||||
[parameter(Mandatory=$false,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="ByDomainObject")]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="ByDomainObject"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[PS.IPAM.Domain]
|
||||
$DomainObject
|
||||
|
||||
@@ -1,8 +1,23 @@
|
||||
function Get-Vrf {
|
||||
[CmdletBinding(DefaultParameterSetName="ByID")]
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
||||
Returns VRF object.
|
||||
|
||||
.DESCRIPTION
|
||||
|
||||
Returns VRF by id. Or leave it empty to get all VRFs.
|
||||
#>
|
||||
[CmdletBinding(DefaultParameterSetName="NoParams")]
|
||||
[OutputType([PS.IPAM.Vrf])]
|
||||
param (
|
||||
[parameter(Mandatory=$false,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="ByID")]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="ByID"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
$Id
|
||||
|
||||
@@ -1,11 +1,58 @@
|
||||
function New-Address {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
||||
Creates address object.
|
||||
|
||||
.PARAMETER SubnetId
|
||||
Id of subnet address belongs to.
|
||||
|
||||
.PARAMETER Ip
|
||||
IP address.
|
||||
|
||||
.PARAMETER Gateway
|
||||
Defines if address is presented as gateway.
|
||||
|
||||
.PARAMETER Description
|
||||
Address description.
|
||||
|
||||
.PARAMETER Hostname
|
||||
Address hostname.
|
||||
|
||||
.PARAMETER MAC
|
||||
Mac address.
|
||||
|
||||
.PARAMETER Owner
|
||||
Address owner.
|
||||
|
||||
.PARAMETER TagId
|
||||
Id of subnet address belongs to.
|
||||
|
||||
.PARAMETER PTRIgnore
|
||||
Controls if PTR should not be created.
|
||||
|
||||
.PARAMETER PTRId
|
||||
Id of PowerDNS PTR record.
|
||||
|
||||
.PARAMETER Note
|
||||
Note.
|
||||
|
||||
.PARAMETER ExcludePing
|
||||
Exclude this address from status update scans (ping).
|
||||
|
||||
.PARAMETER DeviceId
|
||||
Id of device address belongs to.
|
||||
|
||||
.PARAMETER Port
|
||||
Port.
|
||||
#>
|
||||
[OutputType([PS.IPAM.address])]
|
||||
[CmdletBinding()]
|
||||
param (
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
HelpMessage="Id of subnet address belongs to",
|
||||
Position=0)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
@@ -14,7 +61,6 @@ function New-Address {
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
HelpMessage="IP address",
|
||||
Position=1)]
|
||||
[ValidateScript({[ipaddress] $_ })]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
@@ -24,7 +70,6 @@ function New-Address {
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
HelpMessage="Defines if address is presented as gateway",
|
||||
Position=2)]
|
||||
[switch]
|
||||
$Gateway,
|
||||
@@ -32,7 +77,6 @@ function New-Address {
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
HelpMessage="Address description",
|
||||
Position=3)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
@@ -41,7 +85,6 @@ function New-Address {
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
HelpMessage="Address hostname",
|
||||
Position=4)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
@@ -50,7 +93,6 @@ function New-Address {
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
HelpMessage="Mac address",
|
||||
Position=5)]
|
||||
[ValidateScript({ $_.Replace(":","") -match "^$('([A-F0-9]{2})' * 6)$" })]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
@@ -60,7 +102,6 @@ function New-Address {
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
HelpMessage="Address owner",
|
||||
Position=6)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
@@ -69,7 +110,6 @@ function New-Address {
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
HelpMessage="Id of subnet address belongs to",
|
||||
Position=7)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
@@ -78,7 +118,6 @@ function New-Address {
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
HelpMessage="Controls if PTR should not be created",
|
||||
Position=8)]
|
||||
[switch]
|
||||
$PTRIgnore,
|
||||
@@ -86,7 +125,6 @@ function New-Address {
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
HelpMessage="Id of PowerDNS PTR record",
|
||||
Position=7)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
@@ -95,7 +133,6 @@ function New-Address {
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
HelpMessage="Note",
|
||||
Position=10)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
@@ -104,7 +141,6 @@ function New-Address {
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
HelpMessage="Exclude this address from status update scans (ping)",
|
||||
Position=11)]
|
||||
[switch]
|
||||
$ExcludePing,
|
||||
@@ -112,7 +148,6 @@ function New-Address {
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
HelpMessage="Id of device address belongs to",
|
||||
Position=12)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
@@ -121,13 +156,16 @@ function New-Address {
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
HelpMessage="Port",
|
||||
Position=13)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
$Port,
|
||||
|
||||
[parameter(Mandatory=$false,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=14
|
||||
)]
|
||||
[ValidateScript({ $_ -is [Hashtable] -or $_ -is [PSCustomObject] })]
|
||||
$CustomFields
|
||||
)
|
||||
@@ -156,10 +194,7 @@ function New-Address {
|
||||
|
||||
if ($CustomFields) {
|
||||
if ($CustomFields -is [PSCustomObject]) {
|
||||
$_customFields = @{};
|
||||
$CustomFields | Get-Member -MemberType *Property | Where-Object {
|
||||
$_customFields.($_.name) = $CustomFields.($_.name)
|
||||
}
|
||||
$_customFields = ConvertTo-Hashtable -InputObject $CustomFields
|
||||
} else { $_customFields = $CustomFields }
|
||||
|
||||
$_body = $_body + $_customFields
|
||||
@@ -167,10 +202,9 @@ function New-Address {
|
||||
|
||||
$_params.Add("Params",$_body)
|
||||
|
||||
try {
|
||||
Invoke-Request @_params
|
||||
}
|
||||
finally {
|
||||
$_result = Invoke-Request @_params
|
||||
|
||||
if ($_result) {
|
||||
Get-Address -SubnetId $SubnetId -Ip $Ip
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,72 @@
|
||||
function New-Session {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
||||
Creates new session to phpIPAM instance.
|
||||
|
||||
.DESCRIPTION
|
||||
|
||||
Creates new session to phpIPAM instance by provided credentials or token.
|
||||
|
||||
.PARAMETER URL
|
||||
Base URL of phpIPAM instance.
|
||||
Example - http://ipam.example.com
|
||||
|
||||
.PARAMETER AppID
|
||||
API id (specified in phpIPAM api settings)
|
||||
|
||||
.PARAMETER Token
|
||||
User token foor authorization
|
||||
|
||||
.PARAMETER IgnoreSSL
|
||||
Ignore SSL errors
|
||||
|
||||
.OUTPUTS
|
||||
None. New-Session does not generate any output.
|
||||
#>
|
||||
[CmdletBinding(DefaultParameterSetName="Credentials")]
|
||||
param (
|
||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0)]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[validatescript({$_.startswith("http")})]
|
||||
[string]$URL,
|
||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=1)]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=1
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]$AppID,
|
||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=2,ParameterSetName="Credentials")]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=2,
|
||||
ParameterSetName="Credentials"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[pscredential]$Credentials,
|
||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=2,ParameterSetName="Token")]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=2,
|
||||
ParameterSetName="Token"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]$Token,
|
||||
[parameter(Mandatory=$false,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=3)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=3
|
||||
)]
|
||||
[switch]$IgnoreSSL = $false
|
||||
)
|
||||
switch ($PSCmdlet.ParameterSetName) {
|
||||
|
||||
@@ -1,83 +1,225 @@
|
||||
function New-Subnet {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
||||
Creates new subnetwork object.
|
||||
|
||||
.PARAMETER CIDR
|
||||
CIDR of subnet in dotted format (e.g 10.10.10.0/24).
|
||||
|
||||
.PARAMETER SectionId
|
||||
Section identifier.
|
||||
|
||||
.PARAMETER Description
|
||||
Subnet description.
|
||||
|
||||
.PARAMETER VlanId
|
||||
Assigns subnet to VLAN.
|
||||
|
||||
.PARAMETER VrfId
|
||||
Assigns subnet to VRF.
|
||||
|
||||
.PARAMETER MasterSubnetId
|
||||
Master subnet id for nested subnet.
|
||||
|
||||
.PARAMETER NameserverId
|
||||
Id of nameserver to attach to subnet.
|
||||
|
||||
.PARAMETER ShowName
|
||||
Controls weather subnet is displayed as IP address or Name in subnets menu.
|
||||
|
||||
.PARAMETER DNSRecursive
|
||||
Controls if PTR records should be created for subnet.
|
||||
|
||||
.PARAMETER DNSRecords
|
||||
Controls weather hostname DNS records are displayed.
|
||||
|
||||
.PARAMETER AllowRequests
|
||||
Controls if IP requests are allowed for subnet.
|
||||
|
||||
.PARAMETER ScanAgentId
|
||||
Controls which scanagent to use for subnet (default id 1).
|
||||
|
||||
.PARAMETER DiscoverSubnet
|
||||
Controls if new hosts should be discovered for new host scans.
|
||||
|
||||
.PARAMETER IsFull
|
||||
Marks subnet as used.
|
||||
|
||||
.PARAMETER TagId
|
||||
Assignes state (tag) to subnet (default: 1 Used).
|
||||
|
||||
.PARAMETER Threshold
|
||||
Subnet threshold.
|
||||
|
||||
.PARAMETER LocationId
|
||||
Location index.
|
||||
#>
|
||||
[OutputType([PS.IPAM.Subnetwork])]
|
||||
[CmdletBinding()]
|
||||
param (
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
HelpMessage="CIDR of subnet in dotted format (e.g 10.10.10.0/24)",
|
||||
Position=0)]
|
||||
Position=0
|
||||
)]
|
||||
[ValidateScript({[ipaddress] $_.Split("/")[0] -and $_.Split("/")[1] -match "\d{1,2}"})]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
$CIDR,
|
||||
[parameter(Mandatory=$true,HelpMessage="Section identifier",Position=1)]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=1
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
$SectionId,
|
||||
[parameter(Mandatory=$false,HelpMessage="Subnet description",Position=2)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=2
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
$Description,
|
||||
[parameter(Mandatory=$false,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,HelpMessage="Assigns subnet to VLAN",Position=3)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=3
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
$VlanId,
|
||||
[parameter(Mandatory=$false,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,HelpMessage="Assigns subnet to VRF",Position=4)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=4
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
$VrfId,
|
||||
[parameter(Mandatory=$false,HelpMessage="Master subnet id for nested subnet",Position=5)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=5
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
$MasterSubnetId,
|
||||
[parameter(Mandatory=$false,HelpMessage="Id of nameserver to attach to subnet",Position=6)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=6
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
$NameserverId,
|
||||
[parameter(Mandatory=$false,HelpMessage="Controls weather subnet is displayed as IP address or Name in subnets menu",Position=7)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=7
|
||||
)]
|
||||
[switch]
|
||||
$ShowName,
|
||||
[parameter(Mandatory=$false,HelpMessage="Controls if PTR records should be created for subnet",Position=8)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=8
|
||||
)]
|
||||
[switch]
|
||||
$DNSRecursive,
|
||||
[parameter(Mandatory=$false,HelpMessage="Controls weather hostname DNS records are displayed",Position=9)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=9
|
||||
)]
|
||||
[switch]
|
||||
$DNSRecords,
|
||||
[parameter(Mandatory=$false,HelpMessage="Controls if IP requests are allowed for subnet",Position=10)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=10
|
||||
)]
|
||||
[switch]
|
||||
$AllowRequests,
|
||||
[parameter(Mandatory=$false,HelpMessage="Controls which scanagent to use for subnet (default id 1)",Position=11)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=11
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
$ScanAgentId,
|
||||
[parameter(Mandatory=$false,HelpMessage="Controls if new hosts should be discovered for new host scans",Position=12)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=12
|
||||
)]
|
||||
[switch]
|
||||
$DiscoverSubnet,
|
||||
[parameter(Mandatory=$false,HelpMessage="Marks subnet as used",Position=12)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=12
|
||||
)]
|
||||
[switch]
|
||||
$IsFull,
|
||||
[parameter(Mandatory=$false,HelpMessage="Assignes state (tag) to subnet (default: 1 Used)",Position=12)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=12
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
$TagId,
|
||||
[parameter(Mandatory=$false,HelpMessage="Subnet threshold",Position=13)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=13
|
||||
)]
|
||||
[ValidateScript({ $_ -le 100 -and $_ -ge 1 })]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
$Threshold,
|
||||
[parameter(Mandatory=$false,HelpMessage="Location index",Position=14)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=14
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
$LocationId,
|
||||
[parameter(Mandatory=$false,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=15
|
||||
)]
|
||||
[ValidateScript({ $_ -is [Hashtable] -or $_ -is [PSCustomObject] })]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
$CustomFields
|
||||
)
|
||||
process {
|
||||
$_params = @{
|
||||
Controller = "subnets"
|
||||
Controller = [PS.IPAM.controllers]::subnets
|
||||
Method = "POST"
|
||||
}
|
||||
|
||||
@@ -104,10 +246,7 @@ function New-Subnet {
|
||||
|
||||
if ($CustomFields) {
|
||||
if ($CustomFields -is [PSCustomObject]) {
|
||||
$_customFields = @{};
|
||||
$CustomFields | Get-Member -MemberType *Property | Where-Object {
|
||||
$_customFields.($_.name) = $CustomFields.($_.name)
|
||||
}
|
||||
$_customFields = ConvertTo-Hashtable -InputObject $CustomFields
|
||||
} else { $_customFields = $CustomFields }
|
||||
|
||||
$_body = $_body + $_customFields
|
||||
@@ -116,6 +255,7 @@ function New-Subnet {
|
||||
$_params.Add("Params",$_body)
|
||||
|
||||
$_result = Invoke-Request @_params
|
||||
|
||||
if ($_result) {
|
||||
return Get-Subnet -CIDR $_result
|
||||
}
|
||||
|
||||
@@ -1,11 +1,22 @@
|
||||
function Remove-Address {
|
||||
[CmdletBinding(DefaultParameterSetName="ByID")]
|
||||
param (
|
||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,Position=0,ParameterSetName="ByID")]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
Position=0,
|
||||
ParameterSetName="ByID"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
$Id,
|
||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="ByAddressObject")]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="ByAddressObject"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[PS.IPAM.Address]
|
||||
$AddressObject
|
||||
|
||||
@@ -1,57 +1,140 @@
|
||||
function Set-Address {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Edit address object.
|
||||
|
||||
.PARAMETER Id
|
||||
Id of subnet address belongs to.
|
||||
|
||||
.PARAMETER AddressObject
|
||||
Address object to edit.
|
||||
|
||||
.PARAMETER Gateway
|
||||
Defines if address is presented as gateway
|
||||
|
||||
.PARAMETER Description
|
||||
Address description.
|
||||
#>
|
||||
[OutputType([PS.IPAM.address])]
|
||||
[CmdletBinding(DefaultParameterSetName="ById")]
|
||||
param (
|
||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,HelpMessage="Id of subnet address belongs to",Position=0,ParameterSetName="ById")]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="ById"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
$Id,
|
||||
[parameter(Mandatory=$false,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="ByAddressObject")]
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="ByAddressObject"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[PS.IPAM.Address]
|
||||
$AddressObject,
|
||||
[parameter(Mandatory=$false,HelpMessage="Defines if address is presented as gateway",Position=1)]
|
||||
[parameter(
|
||||
Position=1
|
||||
)]
|
||||
[parameter(
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
ParameterSetName="ById"
|
||||
)]
|
||||
[bool]
|
||||
$Gateway,
|
||||
[parameter(Mandatory=$false,HelpMessage="Address description",Position=2)]
|
||||
[parameter(
|
||||
Position=2
|
||||
)]
|
||||
[parameter(
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
ParameterSetName="ById"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
$Description,
|
||||
[parameter(Mandatory=$false,HelpMessage="Address hostname",Position=3)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
HelpMessage="Address hostname",
|
||||
Position=3
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
$Hostname,
|
||||
[parameter(Mandatory=$false,HelpMessage="Mac address",Position=4)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
HelpMessage="Mac address",
|
||||
Position=4
|
||||
)]
|
||||
[ValidateScript({ $_.Replace(":","") -match "^$('([A-F0-9]{2})' * 6)$" })]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
$MAC,
|
||||
[parameter(Mandatory=$false,HelpMessage="Address owner",Position=5)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
HelpMessage="Address owner",
|
||||
Position=5
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
$Owner,
|
||||
[parameter(Mandatory=$false,HelpMessage="Id of subnet address belongs to",Position=6)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
HelpMessage="Id of subnet address belongs to",
|
||||
Position=6
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
$TagId,
|
||||
[parameter(Mandatory=$false,HelpMessage="Controls if PTR should not be created",Position=7)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
HelpMessage="Controls if PTR should not be created",
|
||||
Position=7
|
||||
)]
|
||||
[bool]
|
||||
$PTRIgnore,
|
||||
[parameter(Mandatory=$false,HelpMessage="Id of PowerDNS PTR record",Position=8)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
HelpMessage="Id of PowerDNS PTR record",
|
||||
Position=8
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
$PTRId,
|
||||
[parameter(Mandatory=$false,HelpMessage="Note",Position=9)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
HelpMessage="Note",
|
||||
Position=9
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
$Note,
|
||||
[parameter(Mandatory=$false,HelpMessage="Exclude this address from status update scans (ping)",Position=10)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
HelpMessage="Exclude this address from status update scans (ping)",
|
||||
Position=10
|
||||
)]
|
||||
[bool]
|
||||
$ExcludePing,
|
||||
[parameter(Mandatory=$false,HelpMessage="Id of device address belongs to",Position=11)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
HelpMessage="Id of device address belongs to",
|
||||
Position=11
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
$DeviceId,
|
||||
[parameter(Mandatory=$false,HelpMessage="Port",Position=12)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
HelpMessage="Port",
|
||||
Position=12
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
$Port,
|
||||
@@ -103,7 +186,7 @@ function Set-Address {
|
||||
Invoke-Request @_params
|
||||
}
|
||||
finally {
|
||||
Get-Address -Id $_id
|
||||
Get-Address -id $_id
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BIN
ps.ipam.psd1
BIN
ps.ipam.psd1
Binary file not shown.
@@ -145,7 +145,33 @@
|
||||
</Members>
|
||||
</Type>
|
||||
<Type>
|
||||
<Name>ps.ipam.subnet</Name>
|
||||
<Name>ps.ipam.subnetwork</Name>
|
||||
<Members>
|
||||
<MemberSet>
|
||||
<Name>PSStandardMembers</Name>
|
||||
<Members>
|
||||
<PropertySet>
|
||||
<Name>DefaultDisplayPropertySet</Name>
|
||||
<ReferencedProperties>
|
||||
<Name>Id</Name>
|
||||
<Name>Subnet</Name>
|
||||
<Name>Mask</Name>
|
||||
<Name>SectionId</Name>
|
||||
<Name>Description</Name>
|
||||
</ReferencedProperties>
|
||||
</PropertySet>
|
||||
<PropertySet>
|
||||
<Name>DefaultKeyPropertySet</Name>
|
||||
<ReferencedProperties>
|
||||
<Name>Id</Name>
|
||||
</ReferencedProperties>
|
||||
</PropertySet>
|
||||
</Members>
|
||||
</MemberSet>
|
||||
</Members>
|
||||
</Type>
|
||||
<Type>
|
||||
<Name>ps.ipam.nameserver</Name>
|
||||
<Members>
|
||||
<MemberSet>
|
||||
<Name>PSStandardMembers</Name>
|
||||
@@ -155,8 +181,8 @@
|
||||
<ReferencedProperties>
|
||||
<Name>Id</Name>
|
||||
<Name>Name</Name>
|
||||
<Name>DomainId</Name>
|
||||
<Name>Number</Name>
|
||||
<Name>NameServers</Name>
|
||||
<Name>Description</Name>
|
||||
</ReferencedProperties>
|
||||
</PropertySet>
|
||||
<PropertySet>
|
||||
|
||||
Reference in New Issue
Block a user