2023-03-15 19:00:52 +03:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2016-02-27 03:43:55 +03:00
|
|
|
package api
|
|
|
|
|
2022-03-24 20:58:03 +03:00
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"net/http"
|
|
|
|
)
|
2018-07-25 01:49:55 +03:00
|
|
|
|
2016-02-27 03:43:55 +03:00
|
|
|
func (c *Sys) StepDown() error {
|
2022-03-24 00:47:43 +03:00
|
|
|
return c.StepDownWithContext(context.Background())
|
|
|
|
}
|
2018-07-25 01:49:55 +03:00
|
|
|
|
2022-03-24 00:47:43 +03:00
|
|
|
func (c *Sys) StepDownWithContext(ctx context.Context) error {
|
|
|
|
ctx, cancelFunc := c.c.withConfiguredTimeout(ctx)
|
2018-07-25 01:49:55 +03:00
|
|
|
defer cancelFunc()
|
2022-03-24 00:47:43 +03:00
|
|
|
|
2022-03-24 20:58:03 +03:00
|
|
|
r := c.c.NewRequest(http.MethodPut, "/v1/sys/step-down")
|
2022-03-24 00:47:43 +03:00
|
|
|
|
|
|
|
resp, err := c.c.rawRequestWithContext(ctx, r)
|
2018-08-04 18:50:29 +03:00
|
|
|
if resp != nil && resp.Body != nil {
|
|
|
|
resp.Body.Close()
|
2016-02-27 03:43:55 +03:00
|
|
|
}
|
|
|
|
return err
|
|
|
|
}
|