Interface ConsulOperations

All Known Subinterfaces:
ConsulClient
All Known Implementing Classes:
AbstractConsulClient

public interface ConsulOperations
API operations for Consul.
Since:
1.0
Author:
graemerocher
  • Method Details

    • putValue

      @Put(value="/kv/{+key}", processes="text/plain", single=true) org.reactivestreams.Publisher<Boolean> putValue(String key, @Body String value)
      Writes a value for the given key to Consul.
      Parameters:
      key - The key
      value - The value as a String
      Returns:
      A Publisher that emits a boolean if the operation succeeded
    • readValues

      @Get(uri="/kv/{+key}?recurse", single=true) org.reactivestreams.Publisher<List<KeyValue>> readValues(String key)
      Reads a Key from Consul. See https://www.consul.io/api/kv.html.
      Parameters:
      key - The key to read
      Returns:
      A Publisher that emits a list of KeyValue
    • readValues

      @Get(uri="/kv/{+key}?recurse=true{&dc}{&raw}{&seperator}", single=true) @Retryable(attempts="${consul.client.config.retry-count:3}", delay="${consul.client.config.retry-delay:1s}") org.reactivestreams.Publisher<List<KeyValue>> readValues(String key, @Nullable @QueryValue("dc") @Nullable String datacenter, @Nullable @Nullable Boolean raw, @Nullable @Nullable String seperator)
      Reads a Key from Consul. See https://www.consul.io/api/kv.html.
      Parameters:
      key - The key
      datacenter - The data center
      raw - Whether the value should be raw without encoding or metadata
      seperator - The separator to use
      Returns:
      A Publisher that emits a list of KeyValue
    • pass

      @Put("/agent/check/pass/{checkId}{?note}") @Retryable(attempts="${consul.client.registration.retry-count:3}", delay="${consul.client.registration.retry-delay:3s}") org.reactivestreams.Publisher<io.micronaut.http.HttpStatus> pass(String checkId, @Nullable @Nullable String note)
      Pass the TTL check. See https://www.consul.io/api/agent/check.html.
      Parameters:
      checkId - The check ID
      note - An optional note
      Returns:
      An HttpStatus of HttpStatus.OK if all is well
    • warn

      @Put("/agent/check/warn/{checkId}{?note}") org.reactivestreams.Publisher<io.micronaut.http.HttpStatus> warn(String checkId, @Nullable @Nullable String note)
      Warn the TTL check. See https://www.consul.io/api/agent/check.html.
      Parameters:
      checkId - The check ID
      note - An optional note
      Returns:
      An HttpStatus of HttpStatus.OK if all is well
    • fail

      @Put("/agent/check/fail/{checkId}{?note}") @Retryable(attempts="${consul.client.registration.retry-count:3}", delay="${consul.client.registration.retry-delay:3s}") org.reactivestreams.Publisher<io.micronaut.http.HttpStatus> fail(String checkId, @Nullable @Nullable String note)
      Fail the TTL check. See https://www.consul.io/api/agent/check.html.
      Parameters:
      checkId - The check ID
      note - An optional note
      Returns:
      An HttpStatus of HttpStatus.OK if all is well
    • status

      @Get(uri="/status/leader", single=true) @Retryable org.reactivestreams.Publisher<String> status()
      Returns:
      The current leader address
    • register

      @Put(uri="/catalog/register", single=true) @Deprecated(since="4.1.0", forRemoval=true) org.reactivestreams.Publisher<Boolean> register(@NotNull @Body @NotNull CatalogEntry entry)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Register a new CatalogEntry. See https://www.consul.io/api/catalog.html.
      Parameters:
      entry - The entry to register
      Returns:
      A Publisher that emits a boolean true if the operation was successful
    • deregister

      @Deprecated(since="4.1.0", forRemoval=true) org.reactivestreams.Publisher<Boolean> deregister(@NotNull @Body @NotNull CatalogEntry entry)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Register a new CatalogEntry. See https://www.consul.io/api/catalog.html.
      Parameters:
      entry - The entry to register
      Returns:
      A Publisher that emits a boolean true if the operation was successful
    • register

      @Put(uri="/catalog/register", single=true) org.reactivestreams.Publisher<Boolean> register(@NotNull @Body @NotNull ConsulCatalogEntry entry)
      Register a new CatalogEntry. See https://www.consul.io/api/catalog.html.
      Parameters:
      entry - The entry to register
      Returns:
      A Publisher that emits a boolean true if the operation was successful
    • deregister

      @Put(uri="/catalog/deregister", single=true) org.reactivestreams.Publisher<Boolean> deregister(@NotNull @Body @NotNull ConsulCatalogEntry entry)
      Register a new ConsulCatalogEntry. See https://www.consul.io/api/catalog.html.
      Parameters:
      entry - The entry to register
      Returns:
      A Publisher that emits a boolean true if the operation was successful
    • register

      @Put("/agent/service/register") @Retryable(attempts="${consul.client.registration.retry-count:3}", delay="${consul.client.registration.retry-delay:3s}") org.reactivestreams.Publisher<io.micronaut.http.HttpStatus> register(@NotNull @Body @NotNull ConsulNewServiceEntry entry)
      Register a new CatalogEntry. See https://www.consul.io/api/catalog.html.
      Parameters:
      entry - The entry to register
      Returns:
      A Publisher that emits a boolean true if the operation was successful
    • register

      @Retryable(attempts="${consul.client.registration.retry-count:3}", delay="${consul.client.registration.retry-delay:3s}") @Deprecated(forRemoval=true, since="4.1.0") org.reactivestreams.Publisher<io.micronaut.http.HttpStatus> register(@NotNull @Body @NotNull NewServiceEntry entry)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Register a new NewServiceEntry. See https://www.consul.io/api/catalog.html.
      Parameters:
      entry - The entry to register
      Returns:
      A Publisher that emits a boolean true if the operation was successful
    • deregister

      @Put("/agent/service/deregister/{service}") @Retryable(attempts="${consul.client.registration.retry-count:3}", delay="${consul.client.registration.retry-delay:3s}") org.reactivestreams.Publisher<io.micronaut.http.HttpStatus> deregister(@NotNull @NotNull String service)
      Deregister a service.
      Parameters:
      service - The service to register
      Returns:
      A Publisher that emits a boolean true if the operation was successful
    • getServices

      @Deprecated(forRemoval=true, since="4.1.0") org.reactivestreams.Publisher<Map<String,ServiceEntry>> getServices()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use findServices() instead.
      Gets all of the registered services.
      Returns:
      The ServiceEntry instances
    • findServices

      @Get(uri="/agent/services", single=true) org.reactivestreams.Publisher<Map<String,ConsulServiceEntry>> findServices()
      Find every registered services.
      Returns:
      The ConsulServiceEntry instances
    • getMembers

      @Get(uri="/agent/members", single=true) org.reactivestreams.Publisher<List<MemberEntry>> getMembers()
      Returns the members the agent sees in the cluster gossip pool.
      Returns:
      the MemberEntry instances
    • getSelf

      @Get(uri="/agent/self", single=true) org.reactivestreams.Publisher<LocalAgentConfiguration> getSelf()
      Returns the configuration and member information of the local agent.
      Returns:
      the LocalAgentConfiguration instance
    • getHealthyServices

      @Deprecated(forRemoval=true, since="4.1.0") org.reactivestreams.Publisher<List<HealthEntry>> getHealthyServices(@NotNull @NotNull String service, @Nullable @Nullable Boolean passing, @Nullable @Nullable String tag, @Nullable @Nullable String dc)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets the healthy services that are passing health checks.
      Parameters:
      service - The service
      passing - The passing parameter
      tag - The tag
      dc - The dc
      Returns:
      The HealthEntry instances
    • findHealthyServices

      @Get(uri="/health/service/{service}{?passing,tag,dc}", single=true) org.reactivestreams.Publisher<List<ConsulHealthEntry>> findHealthyServices(@NotNull @NotNull String service, @Nullable @Nullable Boolean passing, @Nullable @Nullable String tag, @Nullable @Nullable String dc)
      find healthy services that are passing health checks.
      Parameters:
      service - The service
      passing - The passing parameter
      tag - The tag
      dc - The dc
      Returns:
      The ConsulHealthEntry instances
    • getNodes

      @Get(uri="/catalog/nodes", single=true) org.reactivestreams.Publisher<List<CatalogEntry>> getNodes()
      Gets all of the registered nodes.
      Returns:
      All the nodes
    • getNodes

      @Get(uri="/catalog/nodes?dc={datacenter}", single=true) org.reactivestreams.Publisher<List<CatalogEntry>> getNodes(@NotNull @NotNull String datacenter)
      Gets all the nodes for the given data center.
      Parameters:
      datacenter - The data center
      Returns:
      A publisher that emits the nodes
    • getServiceNames

      @Get(uri="/catalog/services", single=true) org.reactivestreams.Publisher<Map<String,List<String>>> getServiceNames()
      Gets all of the service names and optional tags.
      Returns:
      A Map where the keys are service names and the values are service tags
    • pass

      default org.reactivestreams.Publisher<io.micronaut.http.HttpStatus> pass(String checkId)
      Pass the TTL check. See https://www.consul.io/api/agent/check.html.
      Parameters:
      checkId - The check ID
      Returns:
      An HttpStatus of HttpStatus.OK if all is well
    • warn

      default org.reactivestreams.Publisher<io.micronaut.http.HttpStatus> warn(String checkId)
      Warn the TTL check. See https://www.consul.io/api/agent/check.html.
      Parameters:
      checkId - The check ID
      Returns:
      An HttpStatus of HttpStatus.OK if all is well
    • fail

      default org.reactivestreams.Publisher<io.micronaut.http.HttpStatus> fail(String checkId)
      Fail the TTL check. See https://www.consul.io/api/agent/check.html.
      Parameters:
      checkId - The check ID
      Returns:
      An HttpStatus of HttpStatus.OK if all is well
    • getHealthyServices

      @Deprecated(forRemoval=true, since="4.1.0") default org.reactivestreams.Publisher<List<HealthEntry>> getHealthyServices(@NotNull @NotNull String service)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets service health information. Defaults to return both non-healthy and healthy services.
      Parameters:
      service - The service
      Returns:
      The ConsulHealthEntry instances
    • findHealthyServices

      default org.reactivestreams.Publisher<List<ConsulHealthEntry>> findHealthyServices(@NotNull @NotNull String service)
      Gets service health information. Defaults to return both non-healthy and healthy services.
      Parameters:
      service - The service
      Returns:
      The ConsulHealthEntry instances