code: func (impl *repoImpl) handleLegacyResolve(ctx *router.Context) error {
  	c, r, w := ctx.Context, ctx.Request, ctx.Writer
  
  	resp, err := impl.ResolveVersion(c, &api.ResolveVersionRequest{
  		Package: r.FormValue("package_name"),
  		Version: r.FormValue("version"),
  	})
  
  	switch grpc.Code(err) {
  	case codes.OK:
  		return replyWithJSON(w, map[string]string{
  			"status":      "SUCCESS",
  			"instance_id": common.ObjectRefToInstanceID(resp.Instance),
  		})
  	case codes.NotFound:
  		return replyWithError(w, "INSTANCE_NOT_FOUND", "%s", grpc.ErrorDesc(err))
  	case codes.FailedPrecondition:
  		return replyWithError(w, "AMBIGUOUS_VERSION", "%s", grpc.ErrorDesc(err))
  	default:
  		return err // the legacy client recognizes other codes just fine
  	}
  }
docs: // handleLegacyResolve is a legacy handler for ResolveVersion RPC.
  //
  // GET /_ah/api/repo/v1/instance/resolve?package_name=...&version=...
  //
  // Where:
  //    package_name: full name of a package.
  //    version: a package version identifier (instance ID, a ref or a tag).
  //
  // Returns:
  //    {
  //      "status": "...",
  //      "error_message": "...",
  //      "instance_id": "..."
  //    }