Purge structs from API.
Its use provides no value (in the current code, not generally) and has already caused one bug (#4325).
This commit is contained in:
parent
d089ff613b
commit
acad9fcec3
|
@ -42,16 +42,16 @@ type SSHHelper struct {
|
||||||
type SSHVerifyResponse struct {
|
type SSHVerifyResponse struct {
|
||||||
// Usually empty. If the request OTP is echo request message, this will
|
// Usually empty. If the request OTP is echo request message, this will
|
||||||
// be set to the corresponding echo response message.
|
// be set to the corresponding echo response message.
|
||||||
Message string `json:"message" structs:"message" mapstructure:"message"`
|
Message string `json:"message" mapstructure:"message"`
|
||||||
|
|
||||||
// Username associated with the OTP
|
// Username associated with the OTP
|
||||||
Username string `json:"username" structs:"username" mapstructure:"username"`
|
Username string `json:"username" mapstructure:"username"`
|
||||||
|
|
||||||
// IP associated with the OTP
|
// IP associated with the OTP
|
||||||
IP string `json:"ip" structs:"ip" mapstructure:"ip"`
|
IP string `json:"ip" mapstructure:"ip"`
|
||||||
|
|
||||||
// Name of the role against which the OTP was issued
|
// Name of the role against which the OTP was issued
|
||||||
RoleName string `json:"role_name" structs:"role_name" mapstructure:"role_name"`
|
RoleName string `json:"role_name" mapstructure:"role_name"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// SSHHelperConfig is a structure which represents the entries from the vault-ssh-helper's configuration file.
|
// SSHHelperConfig is a structure which represents the entries from the vault-ssh-helper's configuration file.
|
||||||
|
|
|
@ -3,7 +3,6 @@ package api
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/fatih/structs"
|
|
||||||
"github.com/mitchellh/mapstructure"
|
"github.com/mitchellh/mapstructure"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -83,10 +82,8 @@ func (c *Sys) EnableAudit(
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Sys) EnableAuditWithOptions(path string, options *EnableAuditOptions) error {
|
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))
|
r := c.c.NewRequest("PUT", fmt.Sprintf("/v1/sys/audit/%s", path))
|
||||||
if err := r.SetJSONBody(body); err != nil {
|
if err := r.SetJSONBody(options); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,10 +110,10 @@ func (c *Sys) DisableAudit(path string) error {
|
||||||
// documentation. Please refer to that documentation for more details.
|
// documentation. Please refer to that documentation for more details.
|
||||||
|
|
||||||
type EnableAuditOptions struct {
|
type EnableAuditOptions struct {
|
||||||
Type string `json:"type" structs:"type"`
|
Type string `json:"type"`
|
||||||
Description string `json:"description" structs:"description"`
|
Description string `json:"description"`
|
||||||
Options map[string]string `json:"options" structs:"options"`
|
Options map[string]string `json:"options"`
|
||||||
Local bool `json:"local" structs:"local"`
|
Local bool `json:"local"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Audit struct {
|
type Audit struct {
|
||||||
|
|
|
@ -3,7 +3,6 @@ package api
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/fatih/structs"
|
|
||||||
"github.com/mitchellh/mapstructure"
|
"github.com/mitchellh/mapstructure"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -52,10 +51,8 @@ func (c *Sys) EnableAuth(path, authType, desc string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Sys) EnableAuthWithOptions(path string, options *EnableAuthOptions) error {
|
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))
|
r := c.c.NewRequest("POST", fmt.Sprintf("/v1/sys/auth/%s", path))
|
||||||
if err := r.SetJSONBody(body); err != nil {
|
if err := r.SetJSONBody(options); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,41 +79,41 @@ func (c *Sys) DisableAuth(path string) error {
|
||||||
// documentation. Please refer to that documentation for more details.
|
// documentation. Please refer to that documentation for more details.
|
||||||
|
|
||||||
type EnableAuthOptions struct {
|
type EnableAuthOptions struct {
|
||||||
Type string `json:"type" structs:"type"`
|
Type string `json:"type"`
|
||||||
Description string `json:"description" structs:"description"`
|
Description string `json:"description"`
|
||||||
Config AuthConfigInput `json:"config" structs:"config"`
|
Config AuthConfigInput `json:"config"`
|
||||||
Local bool `json:"local" structs:"local"`
|
Local bool `json:"local"`
|
||||||
PluginName string `json:"plugin_name,omitempty" structs:"plugin_name,omitempty"`
|
PluginName string `json:"plugin_name,omitempty"`
|
||||||
SealWrap bool `json:"seal_wrap" structs:"seal_wrap" mapstructure:"seal_wrap"`
|
SealWrap bool `json:"seal_wrap" mapstructure:"seal_wrap"`
|
||||||
Options map[string]string `json:"options" structs:"options" mapstructure:"options"`
|
Options map[string]string `json:"options" mapstructure:"options"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type AuthConfigInput struct {
|
type AuthConfigInput struct {
|
||||||
DefaultLeaseTTL string `json:"default_lease_ttl" structs:"default_lease_ttl" mapstructure:"default_lease_ttl"`
|
DefaultLeaseTTL string `json:"default_lease_ttl" mapstructure:"default_lease_ttl"`
|
||||||
MaxLeaseTTL string `json:"max_lease_ttl" structs:"max_lease_ttl" mapstructure:"max_lease_ttl"`
|
MaxLeaseTTL string `json:"max_lease_ttl" mapstructure:"max_lease_ttl"`
|
||||||
PluginName string `json:"plugin_name,omitempty" structs:"plugin_name,omitempty" mapstructure:"plugin_name"`
|
PluginName string `json:"plugin_name,omitempty" mapstructure:"plugin_name"`
|
||||||
AuditNonHMACRequestKeys []string `json:"audit_non_hmac_request_keys,omitempty" structs:"audit_non_hmac_request_keys" mapstructure:"audit_non_hmac_request_keys"`
|
AuditNonHMACRequestKeys []string `json:"audit_non_hmac_request_keys,omitempty" mapstructure:"audit_non_hmac_request_keys"`
|
||||||
AuditNonHMACResponseKeys []string `json:"audit_non_hmac_response_keys,omitempty" structs:"audit_non_hmac_response_keys" mapstructure:"audit_non_hmac_response_keys"`
|
AuditNonHMACResponseKeys []string `json:"audit_non_hmac_response_keys,omitempty" mapstructure:"audit_non_hmac_response_keys"`
|
||||||
ListingVisibility string `json:"listing_visibility,omitempty" structs:"listing_visibility" mapstructure:"listing_visibility"`
|
ListingVisibility string `json:"listing_visibility,omitempty" mapstructure:"listing_visibility"`
|
||||||
PassthroughRequestHeaders []string `json:"passthrough_request_headers,omitempty" structs:"passthrough_request_headers" mapstructure:"passthrough_request_headers"`
|
PassthroughRequestHeaders []string `json:"passthrough_request_headers,omitempty" mapstructure:"passthrough_request_headers"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type AuthMount struct {
|
type AuthMount struct {
|
||||||
Type string `json:"type" structs:"type" mapstructure:"type"`
|
Type string `json:"type" mapstructure:"type"`
|
||||||
Description string `json:"description" structs:"description" mapstructure:"description"`
|
Description string `json:"description" mapstructure:"description"`
|
||||||
Accessor string `json:"accessor" structs:"accessor" mapstructure:"accessor"`
|
Accessor string `json:"accessor" mapstructure:"accessor"`
|
||||||
Config AuthConfigOutput `json:"config" structs:"config" mapstructure:"config"`
|
Config AuthConfigOutput `json:"config" mapstructure:"config"`
|
||||||
Local bool `json:"local" structs:"local" mapstructure:"local"`
|
Local bool `json:"local" mapstructure:"local"`
|
||||||
SealWrap bool `json:"seal_wrap" structs:"seal_wrap" mapstructure:"seal_wrap"`
|
SealWrap bool `json:"seal_wrap" mapstructure:"seal_wrap"`
|
||||||
Options map[string]string `json:"options" structs:"options" mapstructure:"options"`
|
Options map[string]string `json:"options" mapstructure:"options"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type AuthConfigOutput struct {
|
type AuthConfigOutput struct {
|
||||||
DefaultLeaseTTL int `json:"default_lease_ttl" structs:"default_lease_ttl" mapstructure:"default_lease_ttl"`
|
DefaultLeaseTTL int `json:"default_lease_ttl" mapstructure:"default_lease_ttl"`
|
||||||
MaxLeaseTTL int `json:"max_lease_ttl" structs:"max_lease_ttl" mapstructure:"max_lease_ttl"`
|
MaxLeaseTTL int `json:"max_lease_ttl" mapstructure:"max_lease_ttl"`
|
||||||
PluginName string `json:"plugin_name,omitempty" structs:"plugin_name,omitempty" mapstructure:"plugin_name"`
|
PluginName string `json:"plugin_name,omitempty" mapstructure:"plugin_name"`
|
||||||
AuditNonHMACRequestKeys []string `json:"audit_non_hmac_request_keys,omitempty" structs:"audit_non_hmac_request_keys" mapstructure:"audit_non_hmac_request_keys"`
|
AuditNonHMACRequestKeys []string `json:"audit_non_hmac_request_keys,omitempty" mapstructure:"audit_non_hmac_request_keys"`
|
||||||
AuditNonHMACResponseKeys []string `json:"audit_non_hmac_response_keys,omitempty" structs:"audit_non_hmac_response_keys" mapstructure:"audit_non_hmac_response_keys"`
|
AuditNonHMACResponseKeys []string `json:"audit_non_hmac_response_keys,omitempty" mapstructure:"audit_non_hmac_response_keys"`
|
||||||
ListingVisibility string `json:"listing_visibility,omitempty" structs:"listing_visibility" mapstructure:"listing_visibility"`
|
ListingVisibility string `json:"listing_visibility,omitempty" mapstructure:"listing_visibility"`
|
||||||
PassthroughRequestHeaders []string `json:"passthrough_request_headers,omitempty" structs:"passthrough_request_headers" mapstructure:"passthrough_request_headers"`
|
PassthroughRequestHeaders []string `json:"passthrough_request_headers,omitempty" mapstructure:"passthrough_request_headers"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package api
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/fatih/structs"
|
|
||||||
"github.com/mitchellh/mapstructure"
|
"github.com/mitchellh/mapstructure"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -44,10 +43,8 @@ func (c *Sys) ListMounts() (map[string]*MountOutput, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Sys) Mount(path string, mountInfo *MountInput) error {
|
func (c *Sys) Mount(path string, mountInfo *MountInput) error {
|
||||||
body := structs.Map(mountInfo)
|
|
||||||
|
|
||||||
r := c.c.NewRequest("POST", fmt.Sprintf("/v1/sys/mounts/%s", path))
|
r := c.c.NewRequest("POST", fmt.Sprintf("/v1/sys/mounts/%s", path))
|
||||||
if err := r.SetJSONBody(body); err != nil {
|
if err := r.SetJSONBody(mountInfo); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,44 +116,44 @@ func (c *Sys) MountConfig(path string) (*MountConfigOutput, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
type MountInput struct {
|
type MountInput struct {
|
||||||
Type string `json:"type" structs:"type"`
|
Type string `json:"type"`
|
||||||
Description string `json:"description" structs:"description"`
|
Description string `json:"description"`
|
||||||
Config MountConfigInput `json:"config" structs:"config"`
|
Config MountConfigInput `json:"config"`
|
||||||
Options map[string]string `json:"options" structs:"options"`
|
Options map[string]string `json:"options"`
|
||||||
Local bool `json:"local" structs:"local"`
|
Local bool `json:"local"`
|
||||||
PluginName string `json:"plugin_name,omitempty" structs:"plugin_name"`
|
PluginName string `json:"plugin_name,omitempty"`
|
||||||
SealWrap bool `json:"seal_wrap" structs:"seal_wrap" mapstructure:"seal_wrap"`
|
SealWrap bool `json:"seal_wrap" mapstructure:"seal_wrap"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type MountConfigInput struct {
|
type MountConfigInput struct {
|
||||||
Options map[string]string `json:"options" structs:"options" mapstructure:"options"`
|
Options map[string]string `json:"options" mapstructure:"options"`
|
||||||
DefaultLeaseTTL string `json:"default_lease_ttl" structs:"default_lease_ttl" mapstructure:"default_lease_ttl"`
|
DefaultLeaseTTL string `json:"default_lease_ttl" mapstructure:"default_lease_ttl"`
|
||||||
MaxLeaseTTL string `json:"max_lease_ttl" structs:"max_lease_ttl" mapstructure:"max_lease_ttl"`
|
MaxLeaseTTL string `json:"max_lease_ttl" mapstructure:"max_lease_ttl"`
|
||||||
ForceNoCache bool `json:"force_no_cache" structs:"force_no_cache" mapstructure:"force_no_cache"`
|
ForceNoCache bool `json:"force_no_cache" mapstructure:"force_no_cache"`
|
||||||
PluginName string `json:"plugin_name,omitempty" structs:"plugin_name,omitempty" mapstructure:"plugin_name"`
|
PluginName string `json:"plugin_name,omitempty" mapstructure:"plugin_name"`
|
||||||
AuditNonHMACRequestKeys []string `json:"audit_non_hmac_request_keys,omitempty" structs:"audit_non_hmac_request_keys" mapstructure:"audit_non_hmac_request_keys"`
|
AuditNonHMACRequestKeys []string `json:"audit_non_hmac_request_keys,omitempty" mapstructure:"audit_non_hmac_request_keys"`
|
||||||
AuditNonHMACResponseKeys []string `json:"audit_non_hmac_response_keys,omitempty" structs:"audit_non_hmac_response_keys" mapstructure:"audit_non_hmac_response_keys"`
|
AuditNonHMACResponseKeys []string `json:"audit_non_hmac_response_keys,omitempty" mapstructure:"audit_non_hmac_response_keys"`
|
||||||
ListingVisibility string `json:"listing_visibility,omitempty" structs:"listing_visibility" mapstructure:"listing_visibility"`
|
ListingVisibility string `json:"listing_visibility,omitempty" mapstructure:"listing_visibility"`
|
||||||
PassthroughRequestHeaders []string `json:"passthrough_request_headers,omitempty" structs:"passthrough_request_headers" mapstructure:"passthrough_request_headers"`
|
PassthroughRequestHeaders []string `json:"passthrough_request_headers,omitempty" mapstructure:"passthrough_request_headers"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type MountOutput struct {
|
type MountOutput struct {
|
||||||
Type string `json:"type" structs:"type"`
|
Type string `json:"type"`
|
||||||
Description string `json:"description" structs:"description"`
|
Description string `json:"description"`
|
||||||
Accessor string `json:"accessor" structs:"accessor"`
|
Accessor string `json:"accessor"`
|
||||||
Config MountConfigOutput `json:"config" structs:"config"`
|
Config MountConfigOutput `json:"config"`
|
||||||
Options map[string]string `json:"options" structs:"options"`
|
Options map[string]string `json:"options"`
|
||||||
Local bool `json:"local" structs:"local"`
|
Local bool `json:"local"`
|
||||||
SealWrap bool `json:"seal_wrap" structs:"seal_wrap" mapstructure:"seal_wrap"`
|
SealWrap bool `json:"seal_wrap" mapstructure:"seal_wrap"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type MountConfigOutput struct {
|
type MountConfigOutput struct {
|
||||||
DefaultLeaseTTL int `json:"default_lease_ttl" structs:"default_lease_ttl" mapstructure:"default_lease_ttl"`
|
DefaultLeaseTTL int `json:"default_lease_ttl" mapstructure:"default_lease_ttl"`
|
||||||
MaxLeaseTTL int `json:"max_lease_ttl" structs:"max_lease_ttl" mapstructure:"max_lease_ttl"`
|
MaxLeaseTTL int `json:"max_lease_ttl" mapstructure:"max_lease_ttl"`
|
||||||
ForceNoCache bool `json:"force_no_cache" structs:"force_no_cache" mapstructure:"force_no_cache"`
|
ForceNoCache bool `json:"force_no_cache" mapstructure:"force_no_cache"`
|
||||||
PluginName string `json:"plugin_name,omitempty" structs:"plugin_name,omitempty" mapstructure:"plugin_name"`
|
PluginName string `json:"plugin_name,omitempty" mapstructure:"plugin_name"`
|
||||||
AuditNonHMACRequestKeys []string `json:"audit_non_hmac_request_keys,omitempty" structs:"audit_non_hmac_request_keys" mapstructure:"audit_non_hmac_request_keys"`
|
AuditNonHMACRequestKeys []string `json:"audit_non_hmac_request_keys,omitempty" mapstructure:"audit_non_hmac_request_keys"`
|
||||||
AuditNonHMACResponseKeys []string `json:"audit_non_hmac_response_keys,omitempty" structs:"audit_non_hmac_response_keys" mapstructure:"audit_non_hmac_response_keys"`
|
AuditNonHMACResponseKeys []string `json:"audit_non_hmac_response_keys,omitempty" mapstructure:"audit_non_hmac_response_keys"`
|
||||||
ListingVisibility string `json:"listing_visibility,omitempty" structs:"listing_visibility" mapstructure:"listing_visibility"`
|
ListingVisibility string `json:"listing_visibility,omitempty" mapstructure:"listing_visibility"`
|
||||||
PassthroughRequestHeaders []string `json:"passthrough_request_headers,omitempty" structs:"passthrough_request_headers" mapstructure:"passthrough_request_headers"`
|
PassthroughRequestHeaders []string `json:"passthrough_request_headers,omitempty" mapstructure:"passthrough_request_headers"`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue