New-Address documentation
This commit is contained in:
@@ -6,7 +6,8 @@ function Get-Subnet {
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,ParameterSetName="ByCIDR"
|
||||
Position=0,
|
||||
ParameterSetName="ByCIDR"
|
||||
)]
|
||||
[ValidateScript({[ipaddress] $_.Split("/")[0] -and $_.Split("/")[1] -match "\d{1,2}"})]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
@@ -16,7 +17,8 @@ function Get-Subnet {
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,ParameterSetName="ByID"
|
||||
Position=0,
|
||||
ParameterSetName="ByID"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
@@ -25,7 +27,8 @@ function Get-Subnet {
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,ParameterSetName="BySectionId"
|
||||
Position=0,
|
||||
ParameterSetName="BySectionId"
|
||||
)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
@@ -110,12 +113,18 @@ function Get-Subnet {
|
||||
$VlanDomainId,
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=1,
|
||||
ParameterSetName="ByID"
|
||||
)]
|
||||
[switch]
|
||||
$Slaves,
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=2,
|
||||
ParameterSetName="ByID"
|
||||
)]
|
||||
[switch]
|
||||
|
||||
@@ -1,4 +1,51 @@
|
||||
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 (
|
||||
@@ -6,7 +53,6 @@ function New-Address {
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
HelpMessage="Id of subnet address belongs to",
|
||||
Position=0)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
@@ -15,7 +61,6 @@ function New-Address {
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
HelpMessage="IP address",
|
||||
Position=1)]
|
||||
[ValidateScript({[ipaddress] $_ })]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
@@ -25,7 +70,6 @@ function New-Address {
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
HelpMessage="Defines if address is presented as gateway",
|
||||
Position=2)]
|
||||
[switch]
|
||||
$Gateway,
|
||||
@@ -33,7 +77,6 @@ function New-Address {
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
HelpMessage="Address description",
|
||||
Position=3)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
@@ -42,7 +85,6 @@ function New-Address {
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
HelpMessage="Address hostname",
|
||||
Position=4)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
@@ -51,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()]
|
||||
@@ -61,7 +102,6 @@ function New-Address {
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
HelpMessage="Address owner",
|
||||
Position=6)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
@@ -70,7 +110,6 @@ function New-Address {
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
HelpMessage="Id of subnet address belongs to",
|
||||
Position=7)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
@@ -79,7 +118,6 @@ function New-Address {
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
HelpMessage="Controls if PTR should not be created",
|
||||
Position=8)]
|
||||
[switch]
|
||||
$PTRIgnore,
|
||||
@@ -87,7 +125,6 @@ function New-Address {
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
HelpMessage="Id of PowerDNS PTR record",
|
||||
Position=7)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
@@ -96,7 +133,6 @@ function New-Address {
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
HelpMessage="Note",
|
||||
Position=10)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
@@ -105,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,
|
||||
@@ -113,7 +148,6 @@ function New-Address {
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
HelpMessage="Id of device address belongs to",
|
||||
Position=12)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
@@ -122,7 +156,6 @@ function New-Address {
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
HelpMessage="Port",
|
||||
Position=13)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
@@ -130,7 +163,8 @@ function New-Address {
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=14
|
||||
)]
|
||||
[ValidateScript({ $_ -is [Hashtable] -or $_ -is [PSCustomObject] })]
|
||||
$CustomFields
|
||||
@@ -168,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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user