aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/hashicorp/vault/api/sys_audit.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/hashicorp/vault/api/sys_audit.go')
-rw-r--r--vendor/github.com/hashicorp/vault/api/sys_audit.go24
1 files changed, 19 insertions, 5 deletions
diff --git a/vendor/github.com/hashicorp/vault/api/sys_audit.go b/vendor/github.com/hashicorp/vault/api/sys_audit.go
index 1ffdef8..89f2141 100644
--- a/vendor/github.com/hashicorp/vault/api/sys_audit.go
+++ b/vendor/github.com/hashicorp/vault/api/sys_audit.go
@@ -3,6 +3,7 @@ package api
import (
"fmt"
+ "github.com/fatih/structs"
"github.com/mitchellh/mapstructure"
)
@@ -71,13 +72,18 @@ func (c *Sys) ListAudit() (map[string]*Audit, error) {
return mounts, nil
}
+// DEPRECATED: Use EnableAuditWithOptions instead
func (c *Sys) EnableAudit(
path string, auditType string, desc string, opts map[string]string) error {
- body := map[string]interface{}{
- "type": auditType,
- "description": desc,
- "options": opts,
- }
+ return c.EnableAuditWithOptions(path, &EnableAuditOptions{
+ Type: auditType,
+ Description: desc,
+ Options: opts,
+ })
+}
+
+func (c *Sys) EnableAuditWithOptions(path string, options *EnableAuditOptions) error {
+ body := structs.Map(options)
r := c.c.NewRequest("PUT", fmt.Sprintf("/v1/sys/audit/%s", path))
if err := r.SetJSONBody(body); err != nil {
@@ -106,9 +112,17 @@ func (c *Sys) DisableAudit(path string) error {
// individually documented because the map almost directly to the raw HTTP API
// documentation. Please refer to that documentation for more details.
+type EnableAuditOptions struct {
+ Type string `json:"type" structs:"type"`
+ Description string `json:"description" structs:"description"`
+ Options map[string]string `json:"options" structs:"options"`
+ Local bool `json:"local" structs:"local"`
+}
+
type Audit struct {
Path string
Type string
Description string
Options map[string]string
+ Local bool
}