Package org.apache.flink.runtime.rest
Class RestClient
- java.lang.Object
-
- org.apache.flink.runtime.rest.RestClient
-
- All Implemented Interfaces:
AutoCloseable
,org.apache.flink.util.AutoCloseableAsync
public class RestClient extends Object implements org.apache.flink.util.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(org.apache.flink.configuration.Configuration configuration, Executor executor)
RestClient(org.apache.flink.configuration.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()
static RestClient
forUrl(org.apache.flink.configuration.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)
-
-
-
Field Detail
-
VERSION_PLACEHOLDER
public static final String VERSION_PLACEHOLDER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RestClient
public RestClient(org.apache.flink.configuration.Configuration configuration, Executor executor) throws org.apache.flink.util.ConfigurationException
- Throws:
org.apache.flink.util.ConfigurationException
-
-
Method Detail
-
forUrl
public static RestClient forUrl(org.apache.flink.configuration.Configuration configuration, Executor executor, URL rootUrl) throws org.apache.flink.util.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:
org.apache.flink.util.ConfigurationException
-
closeAsync
public CompletableFuture<Void> closeAsync()
- Specified by:
closeAsync
in interfaceorg.apache.flink.util.AutoCloseableAsync
-
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
-
-