Add CLI support for restore endpoint.

+ Add the relevant parts to the command line tool and the client
  package.
+ Small improvements to cryptor's restore function:
  + Don't try to restore if the store is already active.
  + Flush the persistence key cache once the restoration occurs.
+ The redoctober program now explicitly mentions that a config file is
  invalid when that's the case.
This commit is contained in:
Kyle Isom
2016-08-16 15:00:40 -07:00
parent 4d7d8257e7
commit 4da501264a
4 changed files with 50 additions and 0 deletions

View File

@@ -387,3 +387,20 @@ func (c *RemoteServer) Status(req core.StatusRequest) (*core.ResponseData, error
return unmarshalResponseData(respBytes)
}
// Restore issues a restore request to the server. Note that a restore
// request is the same as a delegation request, except that the user
// and label lists are ignored.
func (c *RemoteServer) Restore(req core.DelegateRequest) (*core.ResponseData, error) {
reqBytes, err := json.Marshal(req)
if err != nil {
return nil, err
}
respBytes, err := c.doAction("restore", reqBytes)
if err != nil {
return nil, err
}
return unmarshalResponseData(respBytes)
}