code: public static ResourceName create(PathTemplate template, String path) {
      ImmutableMap<String, String> values = template.match(path);
      if (values == null) {
        throw new ValidationException("path '%s' does not match template '%s'", path, template);
      }
      return new ResourceName(template, values, null);
    }
docs: Creates a new resource name based on given template and path. The path must match the template,
  otherwise null is returned.
  
  @throws ValidationException if the path does not match the template.