39 lines
927 B
Go
39 lines
927 B
Go
// Code generated by go generate; DO NOT EDIT.
|
|
// This file was generated by robots at
|
|
// 2020-05-03 14:33:51.462308 -0400 EDT m=+0.042480801
|
|
package api
|
|
|
|
import (
|
|
"encoding/json"
|
|
|
|
"github.com/fatih/structs"
|
|
"github.com/hashicorp/watchtower/api/internal/strutil"
|
|
)
|
|
|
|
type ErrorDetails struct {
|
|
defaultFields []string
|
|
|
|
TraceId *string `json:"trace_id,omitempty"`
|
|
RequestId *string `json:"request_id,omitempty"`
|
|
RequestFields []string `json:"request_fields,omitempty"`
|
|
}
|
|
|
|
func (s *ErrorDetails) SetDefault(key string) {
|
|
s.defaultFields = strutil.AppendIfMissing(s.defaultFields, key)
|
|
}
|
|
|
|
func (s *ErrorDetails) UnsetDefault(key string) {
|
|
s.defaultFields = strutil.StrListDelete(s.defaultFields, key)
|
|
}
|
|
|
|
func (s ErrorDetails) MarshalJSON() ([]byte, error) {
|
|
m := structs.Map(s)
|
|
if m == nil {
|
|
m = make(map[string]interface{})
|
|
}
|
|
for _, k := range s.defaultFields {
|
|
m[k] = nil
|
|
}
|
|
return json.Marshal(m)
|
|
}
|