Snapshot Delete Repository APIedit

The Snapshot Delete Repository API allows to delete a registered repository.

Snapshot Delete Repository Requestedit

A DeleteRepositoryRequest:

DeleteRepositoryRequest request = new DeleteRepositoryRequest(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

AcknowledgedResponse response = client.snapshot().deleteRepository(request, RequestOptions.DEFAULT);

Asynchronous Executionedit

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

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

The DeleteRepositoryRequest 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 DeleteRepositoryResponse looks like:

ActionListener<AcknowledgedResponse> listener =
    new ActionListener<AcknowledgedResponse>() {
        @Override
        public void onResponse(AcknowledgedResponse deleteRepositoryResponse) {
            
        }

        @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 Delete Repository Responseedit

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

boolean acknowledged = response.isAcknowledged(); 

Indicates the node has acknowledged the request