From 877308f4c7f044e250267461715ce2a335620cdb Mon Sep 17 00:00:00 2001 From: Amir Malka Date: Wed, 28 Jan 2026 16:06:00 +0200 Subject: [PATCH] AWS resource hash calculation Signed-off-by: Amir Malka --- identifiers/utils.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/identifiers/utils.go b/identifiers/utils.go index 0e25b42..499e6b0 100644 --- a/identifiers/utils.go +++ b/identifiers/utils.go @@ -15,6 +15,15 @@ func CalcHashFNV(id string) string { return fmt.Sprintf("%v", hasher.Sum64()) } +// CalcAwsResourceHashFNV calculates the hash (FNV) of the AWS resource ARN +// customerGUID is the customer GUID +// resourceArn is the AWS resource ARN +// returns the hash (FNV) of the AWS resource ARN +func CalcAwsResourceHashFNV(customerGUID, resourceArn string) string { + strLower := strings.ToLower(fmt.Sprintf("%s/%s", customerGUID, resourceArn)) + return CalcHashFNV(strLower) +} + func CalcResourceHashFNV(customerGUID, cluster, kind, name, namespace, apiVersion string) string { strLower := strings.ToLower(fmt.Sprintf("%s/%s/%s/%s/%s/%s", customerGUID, cluster, kind, name, namespace, apiVersion)) return CalcHashFNV(strLower)