4 Commits

Author SHA1 Message Date
7f856b1d09 New address in subnet by subnet object 2022-12-30 14:43:46 +03:00
31b56c75e1 jenkinsfile content replace 2022-12-27 09:39:15 +03:00
7f0d14fc25 jenkinsfile 2022-12-27 09:31:54 +03:00
00975bb1c5 jenkinsfile 2022-12-27 09:31:33 +03:00
2 changed files with 47 additions and 3 deletions

21
Jenkinsfile vendored Normal file
View File

@@ -0,0 +1,21 @@
pipeline {
agent {
label '.net7.0'
}
stages {
stage('Build classlib') {
steps {
sh '''cd classlib
dotnet build --no-incremental --force --configuration Release
dotnet publish -c Release'''
contentReplace(configs: [fileContentReplaceConfig(configs: [fileContentReplaceItemConfig(replace: 'ModuleVersion = \'2.0.$BUILD_NUMBER\'', search: 'ModuleVersion = \'2.0\'')], fileEncoding: 'UTF-8', filePath: 'ps.ipam.psd1')])
}
}
}
post {
success {
archiveArtifacts artifacts: 'classlib/bin/Release/netstandard2.1/publish/*.dll, *.psd1, *.psm1, LICENSE, **/*.ps1xml, **/*.ps1', followSymlinks: false, onlyIfSuccessful: true
}
}
}

View File

@@ -47,16 +47,28 @@ function New-Address {
Port.
#>
[OutputType([PS.IPAM.address])]
[CmdletBinding()]
[CmdletBinding(DefaultParameterSetName="BySubnetId")]
param (
[parameter(
Mandatory=$true,
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true,
Position=0)]
Position=0,
ParameterSetName="BySubnetId"
)]
[ValidateNotNullOrEmpty()]
[int]
$SubnetId,
[Parameter(
Mandatory=$true,
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true,
Position=0,
ParameterSetName="BySubnetObject"
)]
[ValidateNotNullOrEmpty()]
[ps.ipam.subnetwork]
$SubnetObject,
[parameter(
Mandatory=$true,
ValueFromPipeline=$true,
@@ -175,8 +187,19 @@ function New-Address {
Method = "POST"
}
switch ($PSCmdlet.ParameterSetName) {
"BySubnetId" {
$_subnetId = $SubnetId
break
}
"BySubnetObject" {
$_subnetId = $SubnetObject.id
break
}
}
$_body = @{
subnetId = $SubnetId
subnetId = $_subnetId
ip = $Ip
}
if ($Gateway) { $_body.Add("is_gateway", "1") }