Class RestClient


  • public final class RestClient
    extends java.lang.Object
    • Field Detail

      • HTTP_NOT_FOUND

        public static final int HTTP_NOT_FOUND
        HTTP status code 404 NOT FOUND
        See Also:
        Constant Field Values
      • DEFAULT_CONNECT_TIMEOUT_SECONDS

        public static final int DEFAULT_CONNECT_TIMEOUT_SECONDS
        Default value of -1 results in connection timeout not being explicitly defined
        See Also:
        Constant Field Values
    • Method Detail

      • create

        public static RestClient create​(java.lang.String url)
      • create

        public static RestClient create​(java.lang.String url,
                                        int connectTimeoutSeconds)
      • createWithSSL

        public static RestClient createWithSSL​(java.lang.String url,
                                               java.lang.String caCertificate)
      • createWithSSL

        public static RestClient createWithSSL​(java.lang.String url,
                                               java.lang.String caCertificate,
                                               int connectTimeoutSeconds)
      • withHeaders

        public RestClient withHeaders​(java.util.Map<java.lang.String,​java.lang.String> headers)
      • withHeader

        public RestClient withHeader​(java.lang.String name,
                                     java.lang.String value)
      • withBody

        public RestClient withBody​(java.lang.String body)
      • withRequestTimeoutSeconds

        public RestClient withRequestTimeoutSeconds​(int timeoutSeconds)
      • withRetries

        public RestClient withRetries​(int retries)
      • expectResponseCodes

        public RestClient expectResponseCodes​(java.lang.Integer... codes)
      • watch

        public RestClient.WatchResponse watch​(java.lang.String resourceVersion)
                                       throws RestClientException
        Issues a watch request to a Kubernetes resource, starting with the given resourceVersion. Since a watch implies a stream of updates from the server will be consumed, unlike other methods in this class, it is the responsibility of the consumer to disconnect the connection (by invoking RestClient.WatchResponse.disconnect()) once the watch is no longer required.
        Throws:
        RestClientException