Package org.apache.flink.runtime.rest
Class RestClient
- java.lang.Object
-
- org.apache.flink.runtime.rest.RestClient
-
- All Implemented Interfaces:
AutoCloseable
,AutoCloseableAsync
public class RestClient extends Object implements AutoCloseableAsync
This client is the counter-part to theRestServerEndpoint
.
-
-
Field Summary
Fields Modifier and Type Field Description static String
VERSION_PLACEHOLDER
-
Constructor Summary
Constructors Constructor Description RestClient(Configuration configuration, Executor executor)
RestClient(Configuration configuration, Executor executor, String host, int port)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletableFuture<Void>
closeAsync()
Trigger the closing of the resource and return the corresponding close future.static RestClient
forUrl(Configuration configuration, Executor executor, URL rootUrl)
Creates a new RestClient for the provided root URL.<M extends MessageHeaders<EmptyRequestBody,P,EmptyMessageParameters>,P extends ResponseBody>
CompletableFuture<P>sendRequest(String targetAddress, int targetPort, M messageHeaders)
<M extends MessageHeaders<R,P,U>,U extends MessageParameters,R extends RequestBody,P extends ResponseBody>
CompletableFuture<P>sendRequest(String targetAddress, int targetPort, M messageHeaders, U messageParameters, R request)
<M extends MessageHeaders<R,P,U>,U extends MessageParameters,R extends RequestBody,P extends ResponseBody>
CompletableFuture<P>sendRequest(String targetAddress, int targetPort, M messageHeaders, U messageParameters, R request, Collection<FileUpload> fileUploads)
<M extends MessageHeaders<R,P,U>,U extends MessageParameters,R extends RequestBody,P extends ResponseBody>
CompletableFuture<P>sendRequest(String targetAddress, int targetPort, M messageHeaders, U messageParameters, R request, Collection<FileUpload> fileUploads, RestAPIVersion<? extends RestAPIVersion<?>> apiVersion)
void
shutdown(Duration timeout)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.util.AutoCloseableAsync
close
-
-
-
-
Field Detail
-
VERSION_PLACEHOLDER
public static final String VERSION_PLACEHOLDER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RestClient
public RestClient(Configuration configuration, Executor executor) throws ConfigurationException
- Throws:
ConfigurationException
-
RestClient
public RestClient(Configuration configuration, Executor executor, String host, int port) throws ConfigurationException
- Throws:
ConfigurationException
-
-
Method Detail
-
forUrl
public static RestClient forUrl(Configuration configuration, Executor executor, URL rootUrl) throws ConfigurationException
Creates a new RestClient for the provided root URL. If the protocol of the URL is "https", then SSL is automatically enabled for the REST client.- Throws:
ConfigurationException
-
closeAsync
public CompletableFuture<Void> closeAsync()
Description copied from interface:AutoCloseableAsync
Trigger the closing of the resource and return the corresponding close future.- Specified by:
closeAsync
in interfaceAutoCloseableAsync
- Returns:
- Future which is completed once the resource has been closed
-
shutdown
public void shutdown(Duration timeout)
-
sendRequest
public <M extends MessageHeaders<EmptyRequestBody,P,EmptyMessageParameters>,P extends ResponseBody> CompletableFuture<P> sendRequest(String targetAddress, int targetPort, M messageHeaders) throws IOException
- Throws:
IOException
-
sendRequest
public <M extends MessageHeaders<R,P,U>,U extends MessageParameters,R extends RequestBody,P extends ResponseBody> CompletableFuture<P> sendRequest(String targetAddress, int targetPort, M messageHeaders, U messageParameters, R request) throws IOException
- Throws:
IOException
-
sendRequest
public <M extends MessageHeaders<R,P,U>,U extends MessageParameters,R extends RequestBody,P extends ResponseBody> CompletableFuture<P> sendRequest(String targetAddress, int targetPort, M messageHeaders, U messageParameters, R request, Collection<FileUpload> fileUploads) throws IOException
- Throws:
IOException
-
sendRequest
public <M extends MessageHeaders<R,P,U>,U extends MessageParameters,R extends RequestBody,P extends ResponseBody> CompletableFuture<P> sendRequest(String targetAddress, int targetPort, M messageHeaders, U messageParameters, R request, Collection<FileUpload> fileUploads, RestAPIVersion<? extends RestAPIVersion<?>> apiVersion) throws IOException
- Throws:
IOException
-
-