private String fixHref(String href, Object id, Object stackVersion) {
      href = href.replaceAll("/versions/[^/]+/", "/versions/" + stackVersion + "/");
      if (!href.endsWith("/" + id)) {
        href += "/" + id;
      }
      return href;
    }
ResourceDefinition with a custom href post processor which overrides the URL
ambari-server/src/main/java/org/apache/ambari/server/api/resources/CompatibleRepositoryVersionDefinition.java