Closed Grant-Rc closed 1 year ago
see the function here
获取Outlook for Androidhttps://aka.ms/AAb9ysg
From: Grant Crowe @.> Sent: Wednesday, June 14, 2023 9:03:17 AM To: yoke88/PSPHPIPAM @.> Cc: Subscribed @.***> Subject: [yoke88/PSPHPIPAM] Question - (Issue #29)
Hello guys,
We used to be able to get the next free subnet and then use that to create a new one by using the command
Get-PhpIpamSubnetfirst_subnetByID
I got my laptop rebuild and after reinstalling everything including this module again I noticed this is no longer a function
I have recreated the function but is there a reason it was removed?
`$cred = Get-Credential
$PhpIpamApiUrl = "https://
$headers = @{ Authorization = "Basic {0}" -f $base64Token } $uri = "{0}/{1}/user/" -f $PhpIpamApiUrl, $AppID
$token = Invoke-RestMethod -Method post -Uri $uri -SkipCertificateCheck -Credential $cred -SkipHeaderValidation -Authentication Basic
$headers = @{ token = $token.data.token }
Invoke-RestMethod -Method get -Uri "https://davpipam001/api/Powershell/subnets/628/first_subnet/24/" -Headers $headers -SkipCertificateCheck `
― Reply to this email directly, view it on GitHubhttps://github.com/yoke88/PSPHPIPAM/issues/29, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAYAD4W5CO3HYSPZGC5YAF3XLEEVLANCNFSM6AAAAAAZFT2UU4. You are receiving this because you are subscribed to this thread.Message ID: @.***>
Thank you for the reply @Yoke88 but unless this is a bug this only returns the first IPaddress not the first subnet
Get-PhpIpamSubnetFirstFreeByID -ID 625 -debug DEBUG: Using TokenAuth,Test Token Status DEBUG: IsStaticToken=False DEBUG: get uri=https://{server}/api/{App}/subnets/625/first_free/ DEBUG: headers={ "token": "" } DEBUG: contentType=null DEBUG: body={} DEBUG: Func Return: { "code": 409, "success": false, "message": "Subnet contains subnets", "time": 0.007 }
This is because its using the API call
/api/my_app/subnets/{id}/first_free/ | Returns first available IP address in subnet
whereas the old one I assume was
/api/my_app/subnets/{id}/first_subnet/{mask}/ | Returns first available subnet within selected for mask
you can create your own funtion or just using Invoke-PhpIpamExecute
$r=Invoke-PhpIpamExecute -method get -controller subnets -identifiers @($ID,"first_free") Resolve-PhpIpamExecuteResult -result $r
获取Outlook for Androidhttps://aka.ms/AAb9ysg
From: Grant Crowe @.> Sent: Thursday, June 15, 2023 4:47:32 AM To: yoke88/PSPHPIPAM @.> Cc: yoke88 @.>; Mention @.> Subject: Re: [yoke88/PSPHPIPAM] Question - First available subnet within selected for mask (Issue #29)
Thank you for the reply @yoke88https://github.com/yoke88 but unless this is a bug this only returns the first IPaddress not the first subnet
Get-PhpIpamSubnetFirstFreeByID -ID 625 -debug DEBUG: Using TokenAuth,Test Token Status DEBUG: IsStaticToken=False DEBUG: get uri=https://{server}/api/{App}/subnets/625/first_free/ DEBUG: headers={ "token": "" } DEBUG: contentType=null DEBUG: body={} DEBUG: Func Return: { "code": 409, "success": false, "message": "Subnet contains subnets", "time": 0.007 }
This is because its using the API call
/api/my_app/subnets/{id}/first_free/ | Returns first available IP address in subnet
whereas the old one I assume was
/api/my_app/subnets/{id}/first_subnet/{mask}/ | Returns first available subnet within selected for mask
― Reply to this email directly, view it on GitHubhttps://github.com/yoke88/PSPHPIPAM/issues/29#issuecomment-1591957790, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAYAD4UDHVYMQ44DRJ5KODDXLIPOJANCNFSM6AAAAAAZFT2UU4. You are receiving this because you were mentioned.Message ID: @.***>
$r=Invoke-PhpIpamExecute -method get -controller subnets -identifiers @($ID,"first_subnet",$mask)
Resolve-PhpIpamExecuteResult -result $r
/api/my_app/subnets/{id}/first_subnet/{mask}/ Returns first available subnet within selected for mask
获取Outlook for Androidhttps://aka.ms/AAb9ysg
From: 党 永立 @.> Sent: Saturday, June 17, 2023 7:18:56 PM To: yoke88/PSPHPIPAM @.>; yoke88/PSPHPIPAM @.> Cc: Mention @.> Subject: Re: [yoke88/PSPHPIPAM] Question - First available subnet within selected for mask (Issue #29)
you can create your own funtion or just using Invoke-PhpIpamExecute
$r=Invoke-PhpIpamExecute -method get -controller subnets -identifiers @($ID,"first_free") Resolve-PhpIpamExecuteResult -result $r
获取Outlook for Androidhttps://aka.ms/AAb9ysg
From: Grant Crowe @.> Sent: Thursday, June 15, 2023 4:47:32 AM To: yoke88/PSPHPIPAM @.> Cc: yoke88 @.>; Mention @.> Subject: Re: [yoke88/PSPHPIPAM] Question - First available subnet within selected for mask (Issue #29)
Thank you for the reply @yoke88https://github.com/yoke88 but unless this is a bug this only returns the first IPaddress not the first subnet
Get-PhpIpamSubnetFirstFreeByID -ID 625 -debug DEBUG: Using TokenAuth,Test Token Status DEBUG: IsStaticToken=False DEBUG: get uri=https://{server}/api/{App}/subnets/625/first_free/ DEBUG: headers={ "token": "" } DEBUG: contentType=null DEBUG: body={} DEBUG: Func Return: { "code": 409, "success": false, "message": "Subnet contains subnets", "time": 0.007 }
This is because its using the API call
/api/my_app/subnets/{id}/first_free/ | Returns first available IP address in subnet
whereas the old one I assume was
/api/my_app/subnets/{id}/first_subnet/{mask}/ | Returns first available subnet within selected for mask
― Reply to this email directly, view it on GitHubhttps://github.com/yoke88/PSPHPIPAM/issues/29#issuecomment-1591957790, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAYAD4UDHVYMQ44DRJ5KODDXLIPOJANCNFSM6AAAAAAZFT2UU4. You are receiving this because you were mentioned.Message ID: @.***>
Hello guys,
We used to be able to get the next free subnet and then use that to create a new one by using the command
Get-PhpIpamSubnetfirst_subnetByID
I got my laptop rebuild and after reinstalling everything including this module again I noticed this is no longer a function
I have recreated the function but is there a reason it was removed?
` $cred = Get-Credential
$PhpIpamApiUrl = "https:///api"
$AppID = ""
$token = Invoke-RestMethod -Method post -Uri $uri -SkipCertificateCheck -Credential $cred -SkipHeaderValidation -Authentication Basic
$headers = @{ token = $token.data.token
}
Invoke-RestMethod -Method get -Uri "https://{IPAM_Server}/api/{AppID}/subnets/{ID}/first_subnet/{mask}/" -Headers $headers -SkipCertificateCheck `