diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 00000000..ef82ecf2 Binary files /dev/null and b/.DS_Store differ diff --git a/client/cluster_edge_native.go b/client/cluster_edge_native.go index 0ff7bb10..1cad9989 100644 --- a/client/cluster_edge_native.go +++ b/client/cluster_edge_native.go @@ -33,15 +33,28 @@ func (h *V1Client) GetRegistrationToken(tokenName string) (string, error) { } // CreateRegistrationToken creates a new registration token. -func (h *V1Client) CreateRegistrationToken(tokenName string, body *models.V1EdgeTokenEntity) (string, error) { +func (h *V1Client) CreateRegistrationToken(tokenName string, body *models.V1EdgeTokenEntity) (string, string, error) { // ACL scoped to tenant only params := clientv1.NewV1EdgeTokensCreateParams(). WithBody(body) - _, err := h.Client.V1EdgeTokensCreate(params) + res, err := h.Client.V1EdgeTokensCreate(params) if err != nil { - return "", err + return "", "", err + } + token, err := h.GetRegistrationToken(tokenName) + + return *res.Payload.UID, token, err +} + +// DeleteRegistrationToken deletes a registration token by name. +func (h *V1Client) DeleteRegistrationToken(tokenUID string) error { + // ACL scoped to tenant only + params := clientv1.NewV1EdgeTokensUIDDeleteParams().WithUID(tokenUID) + _, err := h.Client.V1EdgeTokensUIDDelete(params) + if err != nil { + return fmt.Errorf("failed to delete registration token: %w", err) } - return h.GetRegistrationToken(tokenName) + return nil } // GetEdgeHost retrieves an existing edge host by UID.