feat(omni): support for omni [R8S-75] (#105)

Co-authored-by: stevensbkang <skan070@gmail.com>
Co-authored-by: testA113 <aliharriss1995@gmail.com>
Co-authored-by: Malcolm Lockyer <segfault88@users.noreply.github.com>
Co-authored-by: Ali <83188384+testA113@users.noreply.github.com>
release/2.26
Yajith Dayarathna 2025-01-13 17:06:10 +13:00 committed by GitHub
parent 45bd7984b0
commit 55c98912ed
1 changed files with 13 additions and 0 deletions

View File

@ -30,6 +30,19 @@ func GetPortainerURLFromEdgeKey(edgeKey string) (string, error) {
return keyInfo[0], nil
}
// GetEndpointIDFromEdgeKey returns the endpoint ID from an edge key
// format: <portainer_instance_url>|<tunnel_server_addr>|<tunnel_server_fingerprint>|<endpoint_id>
func GetEndpointIDFromEdgeKey(edgeKey string) (int, error) {
decodedKey, err := base64.RawStdEncoding.DecodeString(edgeKey)
if err != nil {
return 0, err
}
keyInfo := strings.Split(string(decodedKey), "|")
return strconv.Atoi(keyInfo[3])
}
// IsValidEdgeStackName validates an edge stack name
// Edge stack name must be between 1 and 255 characters long
// and can only contain lowercase letters, digits, hyphens and underscores