in lambda/rapidcore/standalone/restoreHandler.go [24:58]
func RestoreHandler(w http.ResponseWriter, r *http.Request, s InteropServer) {
restoreRequest := RestoreBody{}
if lerr := readBodyAndUnmarshalJSON(r, &restoreRequest); lerr != nil {
lerr.Send(w, r)
return
}
restore := &interop.Restore{
AwsKey: restoreRequest.AwsKey,
AwsSecret: restoreRequest.AwsSecret,
AwsSession: restoreRequest.AwsSession,
CredentialsExpiry: restoreRequest.CredentialsExpiry,
RestoreHookTimeoutMs: restoreRequest.RestoreHookTimeoutMs,
}
restoreResult, err := s.Restore(restore)
responseMap := make(map[string]string)
responseMap["restoreMs"] = strconv.FormatInt(restoreResult.RestoreMs, 10)
if err != nil {
log.Errorf("Failed to restore: %s", err)
responseMap["restoreError"] = err.Error()
w.WriteHeader(http.StatusBadGateway)
}
responseJSON, err := json.Marshal(responseMap)
if err != nil {
log.Panicf("Cannot marshal the response map for RESTORE, %v", responseMap)
}
w.Write(responseJSON)
}