Class VaultRpcChannel.Reply

java.lang.Object
lol.trq.alts.spi.VaultRpcChannel.Reply
Enclosing interface:
VaultRpcChannel

public static final class VaultRpcChannel.Reply extends Object
The outcome of one call: the response message on OK, else the status code, its message and the trailers. A value: equal replies have equal parts, and toString() leaves the message bytes out.
Since:
1.1.0
  • Method Details

    • ok

      public static VaultRpcChannel.Reply ok(byte[] message)
      A successful call.
      Parameters:
      message - the response message, copied
      Returns:
      the reply
      Since:
      1.1.0
    • status

      public static VaultRpcChannel.Reply status(int code, String message, Map<String,String> trailers)
      A call that ended with a status other than OK.
      Parameters:
      code - the gRPC status code, 1 to 16
      message - the status message, or null for none; under the AVP profile a refusal's message is its SPEC 10.4 code
      trailers - the response headers and trailers, or null for none; keys are lower-cased, and a -bin key, a key that is not ASCII and a value that is not printable ASCII are dropped
      Returns:
      the reply
      Throws:
      IllegalArgumentException - if code is 0 (use ok(byte[])) or outside 1 to 16
      Since:
      1.1.0
    • isOk

      public boolean isOk()
      Whether the call succeeded.
      Returns:
      whether the status is OK
      Since:
      1.1.0
    • message

      public byte[] message()
      The response message of a successful call.
      Returns:
      a copy of the message; empty for a failed call
      Since:
      1.1.0
    • code

      public int code()
      The gRPC status code.
      Returns:
      0 for OK, else 1 to 16
      Since:
      1.1.0
    • statusMessage

      public String statusMessage()
      The status message.
      Returns:
      the message; empty for a successful call or a status without one
      Since:
      1.1.0
    • trailers

      public Map<String,String> trailers()
      The response headers and trailers, merged and normalized.
      Returns:
      an unmodifiable map; empty for a successful call
      Since:
      1.1.0
    • equals

      public boolean equals(Object o)
      Compares every part, the message bytes included.
      Overrides:
      equals in class Object
      Parameters:
      o - the other object
      Returns:
      whether it is an equal reply
      Since:
      1.1.0
    • hashCode

      public int hashCode()
      Hashes every part.
      Overrides:
      hashCode in class Object
      Returns:
      the hash
      Since:
      1.1.0
    • toString

      public String toString()
      Names the outcome and the message size, never the message bytes or the trailer values.
      Overrides:
      toString in class Object
      Returns:
      a description
      Since:
      1.1.0