Rename generated files to make them obvious
This commit is contained in:
1 parent
050b914447
commit
828fee20a1
10 files changed
+8
-8
No files matched your search
@@ -0,0 +1,43 @@
|
||||
// Code generated by "make api"; DO NOT EDIT.
|
||||
package api
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/fatih/structs"
|
||||
|
||||
"github.com/hashicorp/watchtower/api/internal/strutil"
|
||||
)
|
||||
|
||||
type Error struct {
|
||||
defaultFields []string
|
||||
|
||||
// The HTTP Status code applicable to this error
|
||||
Status *int64 `json:"status,omitempty"`
|
||||
// An application-specific error string
|
||||
Code *string `json:"code,omitempty"`
|
||||
// A human readable explanation specific to this occurrence of the error
|
||||
Message *string `json:"message,omitempty"`
|
||||
// Additional metadata regarding the error. Depending on the error
|
||||
// different fields will be populated.
|
||||
Details *ErrorDetails `json:"details,omitempty"`
|
||||
}
|
||||
|
||||
func (s *Error) SetDefault(key string) {
|
||||
s.defaultFields = strutil.AppendIfMissing(s.defaultFields, key)
|
||||
}
|
||||
|
||||
func (s *Error) UnsetDefault(key string) {
|
||||
s.defaultFields = strutil.StrListDelete(s.defaultFields, key)
|
||||
}
|
||||
|
||||
func (s Error) 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)
|
||||
}
|
||||
Reference in new issue
Block a user