baramundisoftware / PS-bConnect

Powershell module for baramundi Connect (bConnect), the REST-API of the baramundi Management Suite
https://www.baramundi.com/en/management-suite/interfaces/
MIT License
26 stars 14 forks source link

add IpNetworks Controller #43

Closed T0biii closed 2 years ago

T0biii commented 3 years ago

you are welcome to get involved here

(At the end this Pull Requeste should be squashed and merged)

T0biii commented 3 years ago

i tried to add New-bConnectIpNetwork(https://github.com/baramundisoftware/PS-bConnect/pull/43/commits/3c8b335b1ca8bf9c00e5364fcf18c9c49615eaf7) but i get an error: Client:

Invoke-bConnectPost : Failed to create ip network object. Check baramundi Server Log for more details
Hashtable: {
    "DuplicateWolToThisNetwork":  {
                                      "IsPresent":  false
                                  },
    "Scopes":  [
                   {
                       "NetworkAddress":  "10.10.10.0",
                       "SubnetMask":  "255.255.255.0"
                   },
                   {
                       "NetworkAddress":  "10.10.12.0",
                       "SubnetMask":  "255.255.255.0"
                   }
               ],
    "Name":  "test1",
    "MaxBandwidthKbits":  0
}

Server:

ERROR  Failed to create ip network object.(...)                                                                                       [Process=bServer, Thread=138, Module=baramundi.bMS.Server.Connector.Rest.BConnect.Controller.IpNetworks.IpNetworksController]
    NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
    --------------------------------------------------------------------------------
    *** Stacktrace ***
       bei Baramundi.Bms.Server.Connector.Rest.BConnect.Controller.IpNetworks.IpNetworksController.ValidateIpNetwork(ThirdPartyIpNetwork ipNetwork, String idString, Boolean isPostRequest)
       bei Baramundi.Bms.Server.Connector.Rest.BConnect.Controller.IpNetworks.IpNetworksController.DoCreateIpNetwork(HttpRequestMessage request, ThirdPartyIpNetwork ipNetwork)

this is the code snipped i used

$scopes = @{NetworkAddress = "10.10.10.0";SubnetMask = "255.255.255.0"}
$scopes2 = @{NetworkAddress = "10.10.12.0";SubnetMask = "255.255.255.0"}
$myObject = [pscustomobject]$scopes
$myObject2 = [pscustomobject]$scopes2
$myarray =  New-Object System.Collections.ArrayList
$myarray.Add($myObject)
$myarray.Add($myObject2)

New-bConnectIpNetwork -Name "test1" -Scopes $myarray

maybe @baramundi-ahaugk knows a solution?

T0biii commented 3 years ago

ping @baramundi-ahaugk any suggestions?

baramundi-ahaugk commented 3 years ago

Had no time for investigation. Perhaps in the next weeks.

@baramundi-lkersten could you try to reproduce this issue?

baramundi-lkersten commented 2 years ago

@T0biii found the problem -> should work fine now

T0biii commented 2 years ago

Thx you for the investigation. I am going to test it soon

EDIT: Works now, but now it is always true EDIT2: ah it should be "$DuplicateWolToThisNetwork.IsPresent"

T0biii commented 2 years ago

xD oh

T0biii commented 2 years ago

do you want to use this? effd66a (#43)

baramundi-lkersten commented 2 years ago

do you want to use this? effd66a (#43)

yes

T0biii commented 2 years ago

there you go