mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-22 07:01:09 +02:00
updating utilization api client (#31385)
This commit is contained in:
parent
d762062d78
commit
aa73cbf04f
@ -12,15 +12,23 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (c *Sys) UtilizationReport() (*UtilizationReportOutput, error) {
|
func (c *Sys) UtilizationReport() (*UtilizationReportOutput, error) {
|
||||||
return c.UtilizationReportWithContext(context.Background())
|
return c.UtilizationReportWithContext(context.Background(), "")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Sys) UtilizationReportWithContext(ctx context.Context) (*UtilizationReportOutput, error) {
|
func (c *Sys) UtilizationReportWithNamespace(nsPath string) (*UtilizationReportOutput, error) {
|
||||||
|
return c.UtilizationReportWithContext(context.Background(), nsPath)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Sys) UtilizationReportWithContext(ctx context.Context, nsPath string) (*UtilizationReportOutput, error) {
|
||||||
ctx, cancelFunc := c.c.withConfiguredTimeout(ctx)
|
ctx, cancelFunc := c.c.withConfiguredTimeout(ctx)
|
||||||
defer cancelFunc()
|
defer cancelFunc()
|
||||||
|
|
||||||
r := c.c.NewRequest(http.MethodGet, "/v1/sys/utilization-report")
|
r := c.c.NewRequest(http.MethodGet, "/v1/sys/utilization-report")
|
||||||
|
|
||||||
|
if nsPath != "" {
|
||||||
|
r.Params.Add("namespace", nsPath)
|
||||||
|
}
|
||||||
|
|
||||||
resp, err := c.c.rawRequestWithContext(ctx, r)
|
resp, err := c.c.rawRequestWithContext(ctx, r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
x
Reference in New Issue
Block a user