Add PutAutoPilotRaftConfiguration to api (#12428)

This commit is contained in:
Jonas-Taha El Sesiy 2021-11-10 18:10:15 +01:00 committed by GitHub
parent 558672797e
commit 811c7a8133
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 0 deletions

View File

@ -368,3 +368,22 @@ func (c *Sys) RaftAutopilotConfiguration() (*AutopilotConfig, error) {
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
}

3
changelog/12428.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:improvement
api: add api method for modifying raft autopilot configuration
```