2015-03-21 10:18:46 +00:00
|
|
|
package aws
|
|
|
|
|
|
|
|
import (
|
2018-01-19 06:44:44 +00:00
|
|
|
"context"
|
2015-03-21 10:18:46 +00:00
|
|
|
"fmt"
|
|
|
|
|
2019-04-13 07:44:06 +00:00
|
|
|
"github.com/hashicorp/vault/sdk/framework"
|
2019-04-12 21:54:35 +00:00
|
|
|
"github.com/hashicorp/vault/sdk/helper/consts"
|
|
|
|
"github.com/hashicorp/vault/sdk/logical"
|
2015-03-21 10:18:46 +00:00
|
|
|
)
|
|
|
|
|
2018-02-03 01:28:25 +00:00
|
|
|
func (b *backend) walRollback(ctx context.Context, req *logical.Request, kind string, data interface{}) error {
|
2018-09-26 14:10:00 +00:00
|
|
|
walRollbackMap := map[string]framework.WALRollbackFunc{
|
|
|
|
"user": b.pathUserRollback,
|
|
|
|
}
|
|
|
|
|
2019-02-01 21:56:57 +00:00
|
|
|
if !b.System().LocalMount() && b.System().ReplicationState().HasState(consts.ReplicationPerformanceSecondary|consts.ReplicationPerformanceStandby) {
|
2018-02-03 01:28:25 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2016-04-19 01:06:26 +00:00
|
|
|
f, ok := walRollbackMap[kind]
|
2015-03-21 10:18:46 +00:00
|
|
|
if !ok {
|
|
|
|
return fmt.Errorf("unknown type to rollback")
|
|
|
|
}
|
|
|
|
|
2018-01-19 06:44:44 +00:00
|
|
|
return f(ctx, req, kind, data)
|
2015-03-21 10:18:46 +00:00
|
|
|
}
|