@Override
    public void probePolicyState(String organizationId, String apiId, String version, int policyIdx, String apiKey, String probeConfigRaw,
                                 @Suspended AsyncResponse response) throws NotAuthorizedException {
        if (apiKey == null) {
            engine.getRegistry().getApi(organizationId, apiId, version, result -> {
                if (result.isSuccess()) {
                    Api api = result.getResult();
                    if (api != null) {
                        getPolicy(api, policyIdx, probeConfigRaw, response);
                    } else {
                        response.resume(Response.status(Status.NOT_FOUND).build());
                    }
                } else {
                    throwError(result.getError());
                }
            });
        } else {
            engine.getRegistry().getContract(organizationId, apiId, version, apiKey, result -> {
                if (result.isSuccess()) {
                    ApiContract contract = result.getResult();
                    if (contract != null) {
                        getPolicy(contract, policyIdx, probeConfigRaw, response);
                    } else {
                        response.resume(Response.status(Status.NOT_FOUND).build());
                    }
                } else {
                    throwError(result.getError());
                }
            });
        }
    }
@author Marc Savy {@literal <marc@rhymewithgravy.com>}
gateway/platforms/vertx3/vertx3/src/main/java/io/apiman/gateway/platforms/vertx3/api/ApiResourceImpl.java