func IsPathKeyMatchWithResourceId()

in coverage/from_local_spec.go [117:136]


func IsPathKeyMatchWithResourceId(pathKey, resourceId string) bool {
	pathParts := strings.Split(strings.Trim(pathKey, "/"), "/")
	resourceIdParts := strings.Split(strings.Trim(resourceId, "/"), "/")
	i := len(pathParts) - 1
	j := len(resourceIdParts) - 1
	for i >= 0 && j >= 0 {
		if i == 0 && (strings.EqualFold(pathParts[i], "{resourceid}") || strings.EqualFold(pathParts[i], "{scope}") || strings.EqualFold(pathParts[i], "{resourceUri}")) {
			return true
		}
		if strings.EqualFold(pathParts[i], resourceIdParts[j]) ||
			strings.HasPrefix(pathParts[i], "{") && strings.HasSuffix(pathParts[i], "}") {
			i--
			j--
		} else {
			break
		}
	}

	return i < 0 && j < 0
}