aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/hashicorp/vault/api
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/hashicorp/vault/api')
-rw-r--r--vendor/github.com/hashicorp/vault/api/sys_audit.go24
-rw-r--r--vendor/github.com/hashicorp/vault/api/sys_auth.go21
-rw-r--r--vendor/github.com/hashicorp/vault/api/sys_mounts.go2
3 files changed, 38 insertions, 9 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
}
diff --git a/vendor/github.com/hashicorp/vault/api/sys_auth.go b/vendor/github.com/hashicorp/vault/api/sys_auth.go
index 1940e84..f9f3c8c 100644
--- a/vendor/github.com/hashicorp/vault/api/sys_auth.go
+++ b/vendor/github.com/hashicorp/vault/api/sys_auth.go
@@ -3,6 +3,7 @@ package api
import (
"fmt"
+ "github.com/fatih/structs"
"github.com/mitchellh/mapstructure"
)
@@ -42,11 +43,16 @@ func (c *Sys) ListAuth() (map[string]*AuthMount, error) {
return mounts, nil
}
+// DEPRECATED: Use EnableAuthWithOptions instead
func (c *Sys) EnableAuth(path, authType, desc string) error {
- body := map[string]string{
- "type": authType,
- "description": desc,
- }
+ return c.EnableAuthWithOptions(path, &EnableAuthOptions{
+ Type: authType,
+ Description: desc,
+ })
+}
+
+func (c *Sys) EnableAuthWithOptions(path string, options *EnableAuthOptions) error {
+ body := structs.Map(options)
r := c.c.NewRequest("POST", fmt.Sprintf("/v1/sys/auth/%s", path))
if err := r.SetJSONBody(body); err != nil {
@@ -75,10 +81,17 @@ func (c *Sys) DisableAuth(path string) error {
// individually documentd because the map almost directly to the raw HTTP API
// documentation. Please refer to that documentation for more details.
+type EnableAuthOptions struct {
+ Type string `json:"type" structs:"type"`
+ Description string `json:"description" structs:"description"`
+ Local bool `json:"local" structs:"local"`
+}
+
type AuthMount struct {
Type string `json:"type" structs:"type" mapstructure:"type"`
Description string `json:"description" structs:"description" mapstructure:"description"`
Config AuthConfigOutput `json:"config" structs:"config" mapstructure:"config"`
+ Local bool `json:"local" structs:"local" mapstructure:"local"`
}
type AuthConfigOutput struct {
diff --git a/vendor/github.com/hashicorp/vault/api/sys_mounts.go b/vendor/github.com/hashicorp/vault/api/sys_mounts.go
index ca5e427..768e09f 100644
--- a/vendor/github.com/hashicorp/vault/api/sys_mounts.go
+++ b/vendor/github.com/hashicorp/vault/api/sys_mounts.go
@@ -123,6 +123,7 @@ type MountInput struct {
Type string `json:"type" structs:"type"`
Description string `json:"description" structs:"description"`
Config MountConfigInput `json:"config" structs:"config"`
+ Local bool `json:"local" structs:"local"`
}
type MountConfigInput struct {
@@ -134,6 +135,7 @@ type MountOutput struct {
Type string `json:"type" structs:"type"`
Description string `json:"description" structs:"description"`
Config MountConfigOutput `json:"config" structs:"config"`
+ Local bool `json:"local" structs:"local"`
}
type MountConfigOutput struct {