mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-06 01:07:41 +08:00
implement network delete and update node_limit
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package functions
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/gravitl/netmaker/models"
|
||||
@@ -16,6 +17,13 @@ func UpdateNetwork(name string, payload *models.Network) *models.Network {
|
||||
return request[models.Network](http.MethodPut, "/api/networks/"+name, payload)
|
||||
}
|
||||
|
||||
// UpdateNetworkNodeLimit - updates a network
|
||||
func UpdateNetworkNodeLimit(name string, nodeLimit int32) *models.Network {
|
||||
return request[models.Network](http.MethodPut, fmt.Sprintf("/api/networks/%s/nodelimit", name), &models.Network{
|
||||
NodeLimit: nodeLimit,
|
||||
})
|
||||
}
|
||||
|
||||
// GetNetworks - fetch all networks
|
||||
func GetNetworks() *[]models.Network {
|
||||
return request[[]models.Network](http.MethodGet, "/api/networks", nil)
|
||||
@@ -25,3 +33,8 @@ func GetNetworks() *[]models.Network {
|
||||
func GetNetwork(name string) *models.Network {
|
||||
return request[models.Network](http.MethodGet, "/api/networks/"+name, nil)
|
||||
}
|
||||
|
||||
// DeleteNetwork - delete a network
|
||||
func DeleteNetwork(name string) *string {
|
||||
return request[string](http.MethodDelete, "/api/networks/"+name, nil)
|
||||
}
|
||||
|
Reference in New Issue
Block a user