The Snapshot Get Repository API allows to retrieve information about a registered repository.
The following arguments can optionally be provided:
String [] repositories = new String[] {repositoryName};
request.repositories(repositories);
| Sets the repositories to retrieve |
| The local flag (defaults to false ) controls whether the repositories need
to be looked up in the local cluster state or in the cluster state held by
the elected master node |
request.masterNodeTimeout(TimeValue.timeValueMinutes(1));
request.masterNodeTimeout("1m");
| Timeout to connect to the master node as a TimeValue |
| Timeout to connect to the master node as a String |
The asynchronous execution of a snapshot get repository requires both the
GetRepositoriesRequest
instance and an ActionListener
instance to be
passed to the asynchronous method:
client.snapshot().getRepositoryAsync(request, RequestOptions.DEFAULT, listener);
| The GetRepositoriesRequest to execute and the ActionListener
to use when the execution completes |
The asynchronous method does not block and returns immediately. Once it is
completed the ActionListener
is called back using the onResponse
method
if the execution successfully completed or using the onFailure
method if
it failed.
A typical listener for GetRepositoriesResponse
looks like:
ActionListener<GetRepositoriesResponse> listener =
new ActionListener<GetRepositoriesResponse>() {
@Override
public void onResponse(GetRepositoriesResponse getRepositoriesResponse) {
}
@Override
public void onFailure(Exception e) {
}
};
| Called when the execution is successfully completed. The response is
provided as an argument |
| Called in case of a failure. The raised exception is provided as an argument |