mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 02:57:59 +00:00
Add context-aware functions to vault/api (#14388)
This commit is contained in:
committed by
GitHub
parent
fea828993c
commit
8234a663e7
14
api/help.go
14
api/help.go
@@ -5,14 +5,20 @@ import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// Help reads the help information for the given path.
|
||||
// Help wraps HelpWithContext using context.Background.
|
||||
func (c *Client) Help(path string) (*Help, error) {
|
||||
return c.HelpWithContext(context.Background(), path)
|
||||
}
|
||||
|
||||
// HelpWithContext reads the help information for the given path.
|
||||
func (c *Client) HelpWithContext(ctx context.Context, path string) (*Help, error) {
|
||||
ctx, cancelFunc := c.withConfiguredTimeout(ctx)
|
||||
defer cancelFunc()
|
||||
|
||||
r := c.NewRequest("GET", fmt.Sprintf("/v1/%s", path))
|
||||
r.Params.Add("help", "1")
|
||||
|
||||
ctx, cancelFunc := context.WithCancel(context.Background())
|
||||
defer cancelFunc()
|
||||
resp, err := c.RawRequestWithContext(ctx, r)
|
||||
resp, err := c.rawRequestWithContext(ctx, r)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user