2016-02-27 00:43:55 +00:00
|
|
|
package api
|
|
|
|
|
2022-03-24 17:58:03 +00:00
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"net/http"
|
|
|
|
)
|
2018-07-24 22:49:55 +00:00
|
|
|
|
2016-02-27 00:43:55 +00:00
|
|
|
func (c *Sys) StepDown() error {
|
2022-03-23 21:47:43 +00:00
|
|
|
return c.StepDownWithContext(context.Background())
|
|
|
|
}
|
2018-07-24 22:49:55 +00:00
|
|
|
|
2022-03-23 21:47:43 +00:00
|
|
|
func (c *Sys) StepDownWithContext(ctx context.Context) error {
|
|
|
|
ctx, cancelFunc := c.c.withConfiguredTimeout(ctx)
|
2018-07-24 22:49:55 +00:00
|
|
|
defer cancelFunc()
|
2022-03-23 21:47:43 +00:00
|
|
|
|
2022-03-24 17:58:03 +00:00
|
|
|
r := c.c.NewRequest(http.MethodPut, "/v1/sys/step-down")
|
2022-03-23 21:47:43 +00:00
|
|
|
|
|
|
|
resp, err := c.c.rawRequestWithContext(ctx, r)
|
2018-08-04 15:50:29 +00:00
|
|
|
if resp != nil && resp.Body != nil {
|
|
|
|
resp.Body.Close()
|
2016-02-27 00:43:55 +00:00
|
|
|
}
|
|
|
|
return err
|
|
|
|
}
|