mirror of
https://github.com/hashicorp/vault.git
synced 2026-02-03 20:40:45 -05:00
* VAULT-40965 async option for scan API * whoopsie * whoopsie * add test, return accepted (for real), fix docs * Add extra time * make test more resilient Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>
This commit is contained in:
parent
1f92de7454
commit
e7133e83f2
1 changed files with 12 additions and 3 deletions
|
|
@ -11,16 +11,20 @@ import (
|
|||
"github.com/mitchellh/mapstructure"
|
||||
)
|
||||
|
||||
func (c *Sys) ReportingScan() (*ReportingScanOutput, error) {
|
||||
return c.ReportingScanWithContext(context.Background())
|
||||
func (c *Sys) ReportingScan(opts *ReportingScanRequest) (*ReportingScanOutput, error) {
|
||||
return c.ReportingScanWithContext(context.Background(), opts)
|
||||
}
|
||||
|
||||
func (c *Sys) ReportingScanWithContext(ctx context.Context) (*ReportingScanOutput, error) {
|
||||
func (c *Sys) ReportingScanWithContext(ctx context.Context, opts *ReportingScanRequest) (*ReportingScanOutput, error) {
|
||||
ctx, cancelFunc := c.c.withConfiguredTimeout(ctx)
|
||||
defer cancelFunc()
|
||||
|
||||
r := c.c.NewRequest(http.MethodPost, "/v1/sys/reporting/scan")
|
||||
|
||||
if err := r.SetJSONBody(opts); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp, err := c.c.rawRequestWithContext(ctx, r)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
@ -44,6 +48,11 @@ func (c *Sys) ReportingScanWithContext(ctx context.Context) (*ReportingScanOutpu
|
|||
return &result, err
|
||||
}
|
||||
|
||||
// ReportingScanRequest represents the parameters consumed by the reporting scan API
|
||||
type ReportingScanRequest struct {
|
||||
Async bool `json:"async"`
|
||||
}
|
||||
|
||||
type ReportingScanOutput struct {
|
||||
Timestamp string `json:"timestamp" structs:"timestamp" mapstructure:"timestamp"`
|
||||
FullDirectoryPath string `json:"full_directory_path" structs:"full_directory_path" mapstructure:"full_directory_path"`
|
||||
|
|
|
|||
Loading…
Reference in a new issue