Interface VaultClient.RequestHeadersSpec<S extends VaultClient.RequestHeadersSpec<S>>

Type Parameters:
S - a self reference to the spec type
All Known Subinterfaces:
VaultClient.RequestBodySpec, VaultClient.RequestHeadersBodyPathSpec, VaultClient.RequestHeadersPathSpec<S>
Enclosing interface:
VaultClient

public static interface VaultClient.RequestHeadersSpec<S extends VaultClient.RequestHeadersSpec<S>>
Contract for specifying request headers leading up to the exchange.
  • Method Summary

    Modifier and Type
    Method
    Description
    header(String headerName, String... headerValues)
    Add the given, single header value under the given name.
    headers(Consumer<HttpHeaders> headersConsumer)
    Provides access to every header declared so far with the possibility to add, replace, or remove values.
    headers(HttpHeaders httpHeaders)
    Add or replace the given headers.
    default S
    namespace(String namespace)
    Set the namespace for this request.
    Enter the retrieve workflow and use the returned VaultClient.ResponseSpec to select from a number of built-in options to extract the response.
    default S
    Set the authentication token for this request.
  • Method Details

    • namespace

      default S namespace(String namespace)
      Set the namespace for this request.
      Parameters:
      namespace - the namespace value.
      Returns:
      this builder.
    • token

      default S token(VaultToken token)
      Set the authentication token for this request.
      Parameters:
      token - the Vault token.
      Returns:
      this builder.
    • header

      S header(String headerName, String... headerValues)
      Add the given, single header value under the given name.
      Parameters:
      headerName - the header name.
      headerValues - the header value(s).
      Returns:
      this builder
    • headers

      S headers(HttpHeaders httpHeaders)
      Add or replace the given headers.
      Parameters:
      httpHeaders - the headers to be applied.
      Returns:
      this builder.
    • headers

      S headers(Consumer<HttpHeaders> headersConsumer)
      Provides access to every header declared so far with the possibility to add, replace, or remove values.
      Parameters:
      headersConsumer - the consumer to provide access to.
      Returns:
      this builder.
    • retrieve

      Enter the retrieve workflow and use the returned VaultClient.ResponseSpec to select from a number of built-in options to extract the response. For example:
       ResponseEntity<Person> entity = client.get()
           .path("/persons/1")
           .retrieve()
           .toEntity(Person.class);
       

      Or if interested only in the body:

       Person person = client.get()
           .path("/persons/1")
           .retrieve()
           .body(Person.class);
       
      Note that this method does not actually execute the request until you call one of the returned VaultClient.ResponseSpec.

      By default, 4xx and 5xx response codes result in a VaultClientResponseException with a HttpClientErrorException cause respective HttpServerErrorException cause. To customize error handling, use onStatus handlers.

      Returns:
      ResponseSpec to specify how to decode the body.