ipamRefs, err := network.GetNetworkIpamRefs()
ipamFQN := ipamRefs[0].To
ipam, err := types.NetworkIpamByName(client, strings.Join(ipamFQN, ":"))
subnets := ipamRefs[0].Attr.(types.VnSubnetsType)
// simple subnet creation, but this new subnet is not the problem anyway
subnet, err := subnetCIDRToSubnet(subnetCIDR)
subnets.AddIpamSubnets(subnet)
network.AddNetworkIpam(ipam, subnets)
err = client.Update(network)
existing properties such as dns nameservers are get cleared.
We should send only diff for update API call
Example
existing properties such as dns nameservers are get cleared.