Class SnapshotClient


  • public class SnapshotClient
    extends java.lang.Object
    HTTP Client for /v1/snapshot/ endpoints.
    See Also:
    The Consul API Docs for Snapshots
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Http http  
    • Method Summary

      Modifier and Type Method Description
      ClientConfig getConfig()  
      ClientEventHandler getEventHandler()  
      void restore​(java.io.File sourceFile, QueryOptions queryOptions, Callback<java.lang.Void> callback)
      Restores a snapshot stored in a file.
      void save​(java.io.File destinationFile, QueryOptions queryOptions, Callback<java.math.BigInteger> callback)
      Requests a new snapshot and save it in a file.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • http

        protected final Http http
    • Method Detail

      • save

        public void save​(java.io.File destinationFile,
                         QueryOptions queryOptions,
                         Callback<java.math.BigInteger> callback)
        Requests a new snapshot and save it in a file. Only a subset of the QueryOptions is supported: datacenter, consistencymode, and token.
        Parameters:
        destinationFile - file in which the snapshot is to be saved.
        queryOptions - query options. Only a subset of the QueryOptions is supported: datacenter, consistencymode, and token.
        callback - callback called once the operation is over. It the save operation is successful, the X-Consul-Index is send.
      • restore

        public void restore​(java.io.File sourceFile,
                            QueryOptions queryOptions,
                            Callback<java.lang.Void> callback)
        Restores a snapshot stored in a file.
        Parameters:
        sourceFile - source file where the snapshot is stored.
        queryOptions - query options. Only a subset of the QueryOptions is supported: datacenter, token.
        callback - callback called once the operation is over.