func (r *ProtocolLXD) UpdateNetwork(name string, network api.NetworkPut, ETag string) error {
	if !r.HasExtension("network") {
		return fmt.Errorf("The server is missing the required \"network\" API extension")
	}
	_, _, err := r.query("PUT", fmt.Sprintf("/networks/%s", url.QueryEscape(name)), network, ETag)
	if err != nil {
		return err
	}
	return nil
}
UpdateNetwork updates the network to match the provided Network struct
package lxd
import (
	"fmt"
	"net/url"
	"strings"
	"github.com/lxc/lxd/shared/api"
)
func (r *ProtocolLXD) GetNetworkNames() ([]string, error) {
	if !r.HasExtension("network") {
		return nil, fmt.Errorf("The server is missing the required \"network\" API extension")
	}
	urls := []string{}
	_, err := r.queryStruct("GET", "/networks", nil, "", &urls)
	if err != nil {
		return nil, err
	}
	names := []string{}
	for _, url := range urls {
		fields := strings.Split(url, "/networks/")
		names = append(names, fields[len(fields)-1])
	}
	return names, nil
}
func (r *ProtocolLXD) GetNetworks() ([]api.Network, error) {
	if !r.HasExtension("network") {
		return nil, fmt.Errorf("The server is missing the required \"network\" API extension")
	}
	networks := []api.Network{}
	_, err := r.queryStruct("GET", "/networks?recursion=1", nil, "", &networks)
	if err != nil {
		return nil, err
	}
	return networks, nil
}
func (r *ProtocolLXD) GetNetwork(name string) (*api.Network, string, error) {
	if !r.HasExtension("network") {
		return nil, "", fmt.Errorf("The server is missing the required \"network\" API extension")
	}
	network := api.Network{}
	path := fmt.Sprintf("/networks/%s", url.QueryEscape(name))
	if r.clusterTarget != "" {
		path += fmt.Sprintf("?target=%s", r.clusterTarget)
	}
	etag, err := r.queryStruct("GET", path, nil, "", &network)
	if err != nil {
		return nil, "", err
	}
	return &network, etag, nil
}
func (r *ProtocolLXD) GetNetworkLeases(name string) ([]api.NetworkLease, error) {
	if !r.HasExtension("network_leases") {
		return nil, fmt.Errorf("The server is missing the required \"network_leases\" API extension")
	}
	leases := []api.NetworkLease{}
	_, err := r.queryStruct("GET", fmt.Sprintf("/networks/%s/leases", url.QueryEscape(name)), nil, "", &leases)
	if err != nil {
		return nil, err
	}
	return leases, nil
}
func (r *ProtocolLXD) GetNetworkState(name string) (*api.NetworkState, error) {
	if !r.HasExtension("network_state") {
		return nil, fmt.Errorf("The server is missing the required \"network_state\" API extension")
	}
	state := api.NetworkState{}
	_, err := r.queryStruct("GET", fmt.Sprintf("/networks/%s/state", url.QueryEscape(name)), nil, "", &state)
	if err != nil {
		return nil, err
	}
	return &state, nil
}
func (r *ProtocolLXD) CreateNetwork(network api.NetworksPost) error {
	if !r.HasExtension("network") {
		return fmt.Errorf("The server is missing the required \"network\" API extension")
	}
	path := "/networks"
	if r.clusterTarget != "" {
		path += fmt.Sprintf("?target=%s", r.clusterTarget)
	}
	_, _, err := r.query("POST", path, network, "")
	if err != nil {
		return err
	}
	return nil
}