/** * @return The current leader address */ @Get(uri = "/status/leader", single = true) Publisher<String> status();
/** * Reads a Key from Consul. See https://www.consul.io/api/kv.html. * * @param key The key to read * @return A {@link Publisher} that emits a list of {@link KeyValue} */ @Get(uri = "/kv/{+key}?recurse", single = true) Publisher<List<KeyValue>> readValues(String key);
/** * Gets all of the registered services. * * @return The {@link NewServiceEntry} instances */ @Get(uri = "/agent/services", single = true) Publisher<Map<String, ServiceEntry>> getServices();
/** * Gets all of the service names and optional tags. * * @return A Map where the keys are service names and the values are service tags */ @Get(uri = "/catalog/services", single = true) Publisher<Map<String, List<String>>> getServiceNames();
/** * Returns the configuration and member information of the local agent. * * @return the {@link LocalAgentConfiguration} instance */ @Get(uri = "/agent/self", single = true) Publisher<LocalAgentConfiguration> getSelf();
/** * Returns the members the agent sees in the cluster gossip pool. * * @return the {@link MemberEntry} instances */ @Get(uri = "/agent/members", single = true) Publisher<List<MemberEntry>> getMembers();
/** * Gets all of the registered nodes. * * @return All the nodes */ @Get(uri = "/catalog/nodes", single = true) Publisher<List<CatalogEntry>> getNodes();
/** * Gets all the nodes for the given data center. * * @param datacenter The data center * @return A publisher that emits the nodes */ @Get(uri = "/catalog/nodes?dc={datacenter}", single = true) Publisher<List<CatalogEntry>> getNodes(@NotNull String datacenter);
/** * @return A {@link Publisher} with applications info. */ @SuppressWarnings("WeakerAccess") @Get("/apps") @Produces(single = true) public abstract Publisher<ApplicationInfos> getApplicationInfosInternal();
/** * Obtain a {@link ApplicationInfo} for the given app id. * * @param appId The app id * @return The {@link ApplicationInfo} instance */ @Get(uri = "/apps/{appId}", single = true) Publisher<ApplicationInfo> getApplicationInfo(@NotBlank String appId);
@Get public HttpStatus index() { return HttpStatus.CREATED; } //end::respondHttpStatus[]
@Get("/{number}") String issue(Integer number) { return appPrefix + ": issue # " + number + "!"; } }
/** * @param vipAddress The vip address * @return A {@link Publisher} with applications info */ @SuppressWarnings("WeakerAccess") @Get("/vips/{vipAddress}") @Produces(single = true) public abstract Publisher<ApplicationInfos> getApplicationVipsInternal(String vipAddress);
@Get("/nullable") String nullable(@Nullable Integer max) { return "Parameter Value: " + (max != null ? max : "null"); }
@Get("/list") String list(List<Integer> values) { assert values.stream().allMatch(val -> val instanceof Integer); return "Parameter Value: " + values; }
/** * Obtain a {@link InstanceInfo} for the given app id. * * @param appId The app id * @param instanceId The instance id (this is the value of {@link InstanceInfo#getId()}) * @return The {@link InstanceInfo} instance */ @Get(uri = "/apps/{appId}/{instanceId}", single = true) Publisher<InstanceInfo> getInstanceInfo(@NotBlank String appId, @NotBlank String instanceId);
@Get("/optional-list") String optionalList(Optional<List<Integer>> values) { if (values.isPresent()) { assert values.get().stream().allMatch(val -> val instanceof Integer); return "Parameter Value: " + values.get(); } else { return "Parameter Value: none"; } } }
@Get public HttpResponse index(String username) { return HttpResponse.ok("Authenticated: " + username); } }
@Get("/greet/{name}") Message greet(String name) { return new Message("Hello " + name); } // end::json[]
@Get("/maybestock/{isbn}") public Maybe<Map> maybestock(String isbn) { return Maybe.empty(); //<2> } }