mirror of
https://github.com/netbirdio/netbird.git
synced 2024-12-13 18:31:18 +01:00
Add missing network resource in account copy
Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
This commit is contained in:
parent
382dba4a85
commit
a52ef1a066
@ -894,6 +894,11 @@ func (a *Account) Copy() *Account {
|
||||
networkRouters = append(networkRouters, router.Copy())
|
||||
}
|
||||
|
||||
networkResources := []*networks.NetworkResource{}
|
||||
for _, resource := range a.NetworkResources {
|
||||
networkResources = append(networkResources, resource.Copy())
|
||||
}
|
||||
|
||||
return &Account{
|
||||
Id: a.Id,
|
||||
CreatedBy: a.CreatedBy,
|
||||
@ -914,6 +919,7 @@ func (a *Account) Copy() *Account {
|
||||
Settings: settings,
|
||||
Networks: nets,
|
||||
NetworkRouters: networkRouters,
|
||||
NetworkResources: networkResources,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,6 +49,18 @@ func NewNetworkResource(accountID, networkID, name, description, address string)
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (n *NetworkResource) Copy() *NetworkResource {
|
||||
return &NetworkResource{
|
||||
ID: n.ID,
|
||||
AccountID: n.AccountID,
|
||||
NetworkID: n.NetworkID,
|
||||
Name: n.Name,
|
||||
Description: n.Description,
|
||||
Type: n.Type,
|
||||
Address: n.Address,
|
||||
}
|
||||
}
|
||||
|
||||
// getResourceType returns the type of the resource based on the address
|
||||
func getResourceType(address string) (NetworkResourceType, error) {
|
||||
if ip, cidr, err := net.ParseCIDR(address); err == nil {
|
||||
|
Loading…
Reference in New Issue
Block a user