1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
package incus
import (
"github.com/lxc/incus/v6/shared/api"
)
// GetNetworkAllocations returns a list of Network allocations for a specific project.
func (r *ProtocolIncus) GetNetworkAllocations() ([]api.NetworkAllocations, error) {
err := r.CheckExtension("network_allocations")
if err != nil {
return nil, err
}
// Fetch the raw value.
netAllocations := []api.NetworkAllocations{}
_, err = r.queryStruct("GET", "/network-allocations", nil, "", &netAllocations)
if err != nil {
return nil, err
}
return netAllocations, nil
}
// GetNetworkAllocationsAllProjects returns a list of Network allocations across all projects.
func (r *ProtocolIncus) GetNetworkAllocationsAllProjects() ([]api.NetworkAllocations, error) {
err := r.CheckExtension("network_allocations")
if err != nil {
return nil, err
}
// Fetch the raw value.
netAllocations := []api.NetworkAllocations{}
_, err = r.queryStruct("GET", "/network-allocations?all-projects=true", nil, "", &netAllocations)
if err != nil {
return nil, err
}
return netAllocations, nil
}
|