Set-Address documented
This commit is contained in:
@@ -1,57 +1,140 @@
|
|||||||
function Set-Address {
|
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")]
|
[CmdletBinding(DefaultParameterSetName="ById")]
|
||||||
param (
|
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()]
|
[ValidateNotNullOrEmpty()]
|
||||||
[int]
|
[int]
|
||||||
$Id,
|
$Id,
|
||||||
[parameter(Mandatory=$false,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="ByAddressObject")]
|
[parameter(
|
||||||
|
Mandatory=$true,
|
||||||
|
ValueFromPipeline=$true,
|
||||||
|
ValueFromPipelineByPropertyName=$true,
|
||||||
|
Position=0,
|
||||||
|
ParameterSetName="ByAddressObject"
|
||||||
|
)]
|
||||||
[ValidateNotNullOrEmpty()]
|
[ValidateNotNullOrEmpty()]
|
||||||
[PS.IPAM.Address]
|
[PS.IPAM.Address]
|
||||||
$AddressObject,
|
$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]
|
[bool]
|
||||||
$Gateway,
|
$Gateway,
|
||||||
[parameter(Mandatory=$false,HelpMessage="Address description",Position=2)]
|
[parameter(
|
||||||
|
Position=2
|
||||||
|
)]
|
||||||
|
[parameter(
|
||||||
|
ValueFromPipeline=$true,
|
||||||
|
ValueFromPipelineByPropertyName=$true,
|
||||||
|
ParameterSetName="ById"
|
||||||
|
)]
|
||||||
[ValidateNotNullOrEmpty()]
|
[ValidateNotNullOrEmpty()]
|
||||||
[string]
|
[string]
|
||||||
$Description,
|
$Description,
|
||||||
[parameter(Mandatory=$false,HelpMessage="Address hostname",Position=3)]
|
[parameter(
|
||||||
|
Mandatory=$false,
|
||||||
|
HelpMessage="Address hostname",
|
||||||
|
Position=3
|
||||||
|
)]
|
||||||
[ValidateNotNullOrEmpty()]
|
[ValidateNotNullOrEmpty()]
|
||||||
[string]
|
[string]
|
||||||
$Hostname,
|
$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)$" })]
|
[ValidateScript({ $_.Replace(":","") -match "^$('([A-F0-9]{2})' * 6)$" })]
|
||||||
[ValidateNotNullOrEmpty()]
|
[ValidateNotNullOrEmpty()]
|
||||||
[string]
|
[string]
|
||||||
$MAC,
|
$MAC,
|
||||||
[parameter(Mandatory=$false,HelpMessage="Address owner",Position=5)]
|
[parameter(
|
||||||
|
Mandatory=$false,
|
||||||
|
HelpMessage="Address owner",
|
||||||
|
Position=5
|
||||||
|
)]
|
||||||
[ValidateNotNullOrEmpty()]
|
[ValidateNotNullOrEmpty()]
|
||||||
[string]
|
[string]
|
||||||
$Owner,
|
$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()]
|
[ValidateNotNullOrEmpty()]
|
||||||
[int]
|
[int]
|
||||||
$TagId,
|
$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]
|
[bool]
|
||||||
$PTRIgnore,
|
$PTRIgnore,
|
||||||
[parameter(Mandatory=$false,HelpMessage="Id of PowerDNS PTR record",Position=8)]
|
[parameter(
|
||||||
|
Mandatory=$false,
|
||||||
|
HelpMessage="Id of PowerDNS PTR record",
|
||||||
|
Position=8
|
||||||
|
)]
|
||||||
[ValidateNotNullOrEmpty()]
|
[ValidateNotNullOrEmpty()]
|
||||||
[int]
|
[int]
|
||||||
$PTRId,
|
$PTRId,
|
||||||
[parameter(Mandatory=$false,HelpMessage="Note",Position=9)]
|
[parameter(
|
||||||
|
Mandatory=$false,
|
||||||
|
HelpMessage="Note",
|
||||||
|
Position=9
|
||||||
|
)]
|
||||||
[ValidateNotNullOrEmpty()]
|
[ValidateNotNullOrEmpty()]
|
||||||
[string]
|
[string]
|
||||||
$Note,
|
$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]
|
[bool]
|
||||||
$ExcludePing,
|
$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()]
|
[ValidateNotNullOrEmpty()]
|
||||||
[int]
|
[int]
|
||||||
$DeviceId,
|
$DeviceId,
|
||||||
[parameter(Mandatory=$false,HelpMessage="Port",Position=12)]
|
[parameter(
|
||||||
|
Mandatory=$false,
|
||||||
|
HelpMessage="Port",
|
||||||
|
Position=12
|
||||||
|
)]
|
||||||
[ValidateNotNullOrEmpty()]
|
[ValidateNotNullOrEmpty()]
|
||||||
[string]
|
[string]
|
||||||
$Port,
|
$Port,
|
||||||
@@ -103,7 +186,7 @@ function Set-Address {
|
|||||||
Invoke-Request @_params
|
Invoke-Request @_params
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
Get-Address -Id $_id
|
Get-Address -id $_id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user