mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-03 02:14:24 +08:00
23 lines
730 B
Go
23 lines
730 B
Go
package functions
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
|
|
"github.com/gravitl/netmaker/models"
|
|
)
|
|
|
|
// GetKeys - fetch all access keys of a network
|
|
func GetKeys(networkName string) *[]models.AccessKey {
|
|
return request[[]models.AccessKey](http.MethodGet, fmt.Sprintf("/api/networks/%s/keys", networkName), nil)
|
|
}
|
|
|
|
// CreateKey - create an access key
|
|
func CreateKey(networkName string, key *models.AccessKey) *models.AccessKey {
|
|
return request[models.AccessKey](http.MethodPost, fmt.Sprintf("/api/networks/%s/keys", networkName), key)
|
|
}
|
|
|
|
// DeleteKey - delete an access key
|
|
func DeleteKey(networkName, keyName string) *string {
|
|
return request[string](http.MethodDelete, fmt.Sprintf("/api/networks/%s/keys/%s", networkName, keyName), nil)
|
|
}
|