func ListResponseWithInfo(keys []string, keyInfo map[string]interface{}) *Response {
	resp := ListResponse(keys)
	keyInfoData := make(map[string]interface{})
	for _, key := range keys {
		val, ok := keyInfo[key]
		if ok {
			keyInfoData[key] = val
		}
	}
	if len(keyInfoData) > 0 {
		resp.Data["key_info"] = keyInfoData
	}
	return resp
}
ListResponseWithInfo is used to format a response to a list operation and
return the keys as well as a map with corresponding key info.
package logical
import (
	"encoding/json"
	"errors"
	"github.com/hashicorp/vault/helper/wrapping"
)
const (
	HTTPContentType = "http_content_type"
	HTTPRawBody = "http_raw_body"
	HTTPStatusCode = "http_status_code"
	HTTPRawBodyAlreadyJSONDecoded = "http_raw_body_already_json_decoded"
)
type Response struct {
	Secret *Secret `json:"secret" structs:"secret" mapstructure:"secret"`
	Auth *Auth `json:"auth" structs:"auth" mapstructure:"auth"`
	Data map[string]interface{} `json:"data" structs:"data" mapstructure:"data"`
	Redirect string `json:"redirect" structs:"redirect" mapstructure:"redirect"`
	Warnings []string `json:"warnings" structs:"warnings" mapstructure:"warnings"`
	WrapInfo *wrapping.ResponseWrapInfo `json:"wrap_info" structs:"wrap_info" mapstructure:"wrap_info"`
}
func (r *Response) AddWarning(warning string) {
	if r.Warnings == nil {
		r.Warnings = make([]string, 0, 1)
	}
	r.Warnings = append(r.Warnings, warning)
}
func (r *Response) IsError() bool {
	return r != nil && r.Data != nil && len(r.Data) == 1 && r.Data["error"] != nil
}
func (r *Response) Error() error {
	if !r.IsError() {
		return nil
	}
	switch r.Data["error"].(type) {
	case string:
		return errors.New(r.Data["error"].(string))
	case error:
		return r.Data["error"].(error)
	}
	return nil
}
func HelpResponse(text string, seeAlso []string) *Response {
	return &Response{
		Data: map[string]interface{}{
			"help":     text,
			"see_also": seeAlso,
		},
	}
}
func ErrorResponse(text string) *Response {
	return &Response{
		Data: map[string]interface{}{
			"error": text,
		},
	}
}
func ListResponse(keys []string) *Response {
	resp := &Response{
		Data: map[string]interface{}{},
	}
	if len(keys) != 0 {
		resp.Data["keys"] = keys
	}
	return resp
}