Files
threshold/api/error_details.gen.go
T

37 lines
846 B
Go
Raw Normal View History

// Code generated by "make api"; DO NOT EDIT.
2020-05-04 10:58:20 -04:00
package api
import (
"encoding/json"
"github.com/fatih/structs"
2020-05-04 10:58:20 -04:00
"github.com/hashicorp/watchtower/api/internal/strutil"
)
type ErrorDetails struct {
defaultFields []string
TraceId *string `json:"TraceId,omitempty"`
RequestId *string `json:"request_id,omitempty"`
RequestFields []*FieldError `json:"request_fields,omitempty"`
2020-05-04 10:58:20 -04:00
}
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)
}