Snapshot Verify Repository APIedit

The Snapshot Verify Repository API allows to verify a registered repository.

Snapshot Verify Repository Requestedit

A VerifyRepositoryRequest:

VerifyRepositoryRequest request = new VerifyRepositoryRequest(repositoryName);

Optional Argumentsedit

The following arguments can optionally be provided:

request.timeout(TimeValue.timeValueMinutes(1)); 
request.timeout("1m"); 

Timeout to wait for the all the nodes to acknowledge the settings were applied as a TimeValue

Timeout to wait for the all the nodes to acknowledge the settings were applied as a String

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

Synchronous Executionedit

VerifyRepositoryResponse response = client.snapshot().verifyRepository(request, RequestOptions.DEFAULT);

Asynchronous Executionedit

The asynchronous execution of a snapshot verify repository requires both the VerifyRepositoryRequest instance and an ActionListener instance to be passed to the asynchronous method:

client.snapshot().verifyRepositoryAsync(request, RequestOptions.DEFAULT, listener); 

The VerifyRepositoryRequest 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 VerifyRepositoryResponse looks like:

ActionListener<VerifyRepositoryResponse> listener =
    new ActionListener<VerifyRepositoryResponse>() {
        @Override
        public void onResponse(VerifyRepositoryResponse verifyRepositoryRestResponse) {
            
        }

        @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

Snapshot Verify Repository Responseedit

The returned VerifyRepositoryResponse allows to retrieve information about the executed operation as follows:

List<VerifyRepositoryResponse.NodeView> repositoryMetaDataResponse = response.getNodes();