func ListResponse(keys []string) *Response {
	resp := &Response{
		Data: map[string]interface{}{},
	}
	if len(keys) != 0 {
		resp.Data["keys"] = keys
	}
	return resp
}
ListResponse is used to format a response to a list operation.
package logical
import (
	"errors"
	"fmt"
	"reflect"
	"time"
	"github.com/mitchellh/copystructure"
)
const (
	HTTPContentType = "http_content_type"
	HTTPRawBody = "http_raw_body"
	HTTPStatusCode = "http_status_code"
)
type WrapInfo struct {
	TTL time.Duration `json:"ttl" structs:"ttl" mapstructure:"ttl"`
	Token string `json:"token" structs:"token" mapstructure:"token"`
	CreationTime time.Time `json:"creation_time" structs:"creation_time" mapstructure:"cration_time"`
	WrappedAccessor string `json:"wrapped_accessor" structs:"wrapped_accessor" mapstructure:"wrapped_accessor"`
}
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 *WrapInfo `json:"wrap_info" structs:"wrap_info" mapstructure:"wrap_info"`
}
func init() {
	copystructure.Copiers[reflect.TypeOf(Response{})] = func(v interface{}) (interface{}, error) {
		input := v.(Response)
		ret := Response{
			Redirect: input.Redirect,
		}
		if input.Secret != nil {
			retSec, err := copystructure.Copy(input.Secret)
			if err != nil {
				return nil, fmt.Errorf("error copying Secret: %v", err)
			}
			ret.Secret = retSec.(*Secret)
		}
		if input.Auth != nil {
			retAuth, err := copystructure.Copy(input.Auth)
			if err != nil {
				return nil, fmt.Errorf("error copying Auth: %v", err)
			}
			ret.Auth = retAuth.(*Auth)
		}
		if input.Data != nil {
			retData, err := copystructure.Copy(&input.Data)
			if err != nil {
				return nil, fmt.Errorf("error copying Data: %v", err)
			}
			ret.Data = retData.(map[string]interface{})
		}
		if input.Warnings() != nil {
			for _, warning := range input.Warnings() {
				ret.AddWarning(warning)
			}
		}
		if input.WrapInfo != nil {
			retWrapInfo, err := copystructure.Copy(input.WrapInfo)
			if err != nil {
				return nil, fmt.Errorf("error copying WrapInfo: %v", err)
			}
			ret.WrapInfo = retWrapInfo.(*WrapInfo)
		}
		return &ret, nil
	}
}
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) Warnings() []string {
	return r.warnings
}
func (r *Response) ClearWarnings() {
	r.warnings = make([]string, 0, 1)
}
func (r *Response) CloneWarnings(other *Response) {
	r.warnings = other.warnings
}
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,
		},
	}
}