Add PutAutoPilotRaftConfiguration to api (#12428)
This commit is contained in:
parent
558672797e
commit
811c7a8133
|
@ -368,3 +368,22 @@ func (c *Sys) RaftAutopilotConfiguration() (*AutopilotConfig, error) {
|
||||||
|
|
||||||
return &result, err
|
return &result, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PutRaftAutopilotConfiguration allows modifying the raft autopilot configuration
|
||||||
|
func (c *Sys) PutRaftAutopilotConfiguration(opts *AutopilotConfig) error {
|
||||||
|
r := c.c.NewRequest("POST", "/v1/sys/storage/raft/autopilot/configuration")
|
||||||
|
|
||||||
|
if err := r.SetJSONBody(opts); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx, cancelFunc := context.WithCancel(context.Background())
|
||||||
|
defer cancelFunc()
|
||||||
|
resp, err := c.c.RawRequestWithContext(ctx, r)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:improvement
|
||||||
|
api: add api method for modifying raft autopilot configuration
|
||||||
|
```
|
Loading…
Reference in New Issue