Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions identifiers/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading