add network create,get and list

This commit is contained in:
Anish Mukherjee
2022-11-18 17:42:40 +05:30
parent fa9b7643cb
commit 6a493b951a
10 changed files with 177 additions and 36 deletions

View File

@@ -8,10 +8,20 @@ import (
// CreateNetwork - creates a network
func CreateNetwork(payload *models.Network) *models.Network {
return Request[models.Network](http.MethodPost, "/api/networks", payload)
return request[models.Network](http.MethodPost, "/api/networks", payload)
}
// UpdateNetwork - updates a network
func UpdateNetwork(name string, payload *models.Network) *models.Network {
return request[models.Network](http.MethodPut, "/api/networks/"+name, payload)
}
// GetNetworks - fetch all networks
func GetNetworks() *models.Network {
return Request[models.Network](http.MethodGet, "/api/networks", nil)
func GetNetworks() *[]models.Network {
return request[[]models.Network](http.MethodGet, "/api/networks", nil)
}
// GetNetwork - fetch a single network
func GetNetwork(name string) *models.Network {
return request[models.Network](http.MethodGet, "/api/networks/"+name, nil)
}