func splitResource()

in funcframework/events.go [231:247]


func splitResource(service, resource string) (string, string, error) {
	re, ok := ceServiceToResourceRe[service]
	if !ok {
		return resource, "", nil
	}

	match := re.FindStringSubmatch(resource)
	if match == nil {
		return resource, "", fmt.Errorf("resource regexp did not match")
	}

	if len(match) != 3 {
		return resource, "", fmt.Errorf("expected 2 match groups, got %v", len(match)-1)
	}

	return match[1], match[2], nil
}