Package com.hazelcast.spi.utils
Class RestClient
- java.lang.Object
-
- com.hazelcast.spi.utils.RestClient
-
public final class RestClient extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RestClient.Response
static class
RestClient.WatchResponse
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_CONNECT_TIMEOUT_SECONDS
Default value of -1 results in connection timeout not being explicitly definedstatic int
HTTP_NOT_FOUND
HTTP status code 404 NOT FOUNDstatic int
HTTP_OK
HTTP status code 200 OK
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RestClient
create(java.lang.String url)
static RestClient
create(java.lang.String url, int connectTimeoutSeconds)
static RestClient
createWithSSL(java.lang.String url, java.lang.String caCertificate)
static RestClient
createWithSSL(java.lang.String url, java.lang.String caCertificate, int connectTimeoutSeconds)
RestClient
expectResponseCodes(java.lang.Integer... codes)
RestClient.Response
get()
RestClient.Response
post()
RestClient.Response
put()
RestClient.WatchResponse
watch(java.lang.String resourceVersion)
Issues a watch request to a Kubernetes resource, starting with the givenresourceVersion
.RestClient
withBody(java.lang.String body)
RestClient
withHeader(java.lang.String name, java.lang.String value)
RestClient
withHeaders(java.util.Map<java.lang.String,java.lang.String> headers)
RestClient
withRequestTimeoutSeconds(int timeoutSeconds)
RestClient
withRetries(int retries)
-
-
-
Field Detail
-
HTTP_OK
public static final int HTTP_OK
HTTP status code 200 OK- See Also:
- Constant Field Values
-
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)
-
get
public RestClient.Response get()
-
post
public RestClient.Response post()
-
put
public RestClient.Response put()
-
watch
public RestClient.WatchResponse watch(java.lang.String resourceVersion) throws RestClientException
Issues a watch request to a Kubernetes resource, starting with the givenresourceVersion
. 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 invokingRestClient.WatchResponse.disconnect()
) once the watch is no longer required.- Throws:
RestClientException
-
-