forked from palantir/witchcraft-go-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
structs.conjure.go
98 lines (86 loc) · 3.3 KB
/
structs.conjure.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// This file was generated by Conjure and should not be manually edited.
package health
import (
"github.com/palantir/pkg/safejson"
"github.com/palantir/pkg/safeyaml"
)
// Metadata describing the status of a service.
type HealthCheckResult struct {
// A constant representing the type of health check. Values should be uppercase, underscore delimited, ascii letters with no spaces, ([A-Z_]).
Type CheckType `json:"type" conjure-docs:"A constant representing the type of health check. Values should be uppercase, underscore delimited, ascii letters with no spaces, ([A-Z_]).\n"`
// Health state of the check.
State HealthState `json:"state" conjure-docs:"Health state of the check.\n"`
// Text describing the state of the check which should provide enough information for the check to be actionable when included in an alert.
Message *string `json:"message" conjure-docs:"Text describing the state of the check which should provide enough information for the check to be actionable when included in an alert.\n"`
// Additional redacted information on the nature of the health check.
Params map[string]interface{} `json:"params" conjure-docs:"Additional redacted information on the nature of the health check.\n"`
}
func (o HealthCheckResult) MarshalJSON() ([]byte, error) {
if o.Params == nil {
o.Params = make(map[string]interface{}, 0)
}
type HealthCheckResultAlias HealthCheckResult
return safejson.Marshal(HealthCheckResultAlias(o))
}
func (o *HealthCheckResult) UnmarshalJSON(data []byte) error {
type HealthCheckResultAlias HealthCheckResult
var rawHealthCheckResult HealthCheckResultAlias
if err := safejson.Unmarshal(data, &rawHealthCheckResult); err != nil {
return err
}
if rawHealthCheckResult.Params == nil {
rawHealthCheckResult.Params = make(map[string]interface{}, 0)
}
*o = HealthCheckResult(rawHealthCheckResult)
return nil
}
func (o HealthCheckResult) MarshalYAML() (interface{}, error) {
jsonBytes, err := safejson.Marshal(o)
if err != nil {
return nil, err
}
return safeyaml.JSONtoYAMLMapSlice(jsonBytes)
}
func (o *HealthCheckResult) UnmarshalYAML(unmarshal func(interface{}) error) error {
jsonBytes, err := safeyaml.UnmarshalerToJSONBytes(unmarshal)
if err != nil {
return err
}
return safejson.Unmarshal(jsonBytes, *&o)
}
type HealthStatus struct {
Checks map[CheckType]HealthCheckResult `json:"checks"`
}
func (o HealthStatus) MarshalJSON() ([]byte, error) {
if o.Checks == nil {
o.Checks = make(map[CheckType]HealthCheckResult, 0)
}
type HealthStatusAlias HealthStatus
return safejson.Marshal(HealthStatusAlias(o))
}
func (o *HealthStatus) UnmarshalJSON(data []byte) error {
type HealthStatusAlias HealthStatus
var rawHealthStatus HealthStatusAlias
if err := safejson.Unmarshal(data, &rawHealthStatus); err != nil {
return err
}
if rawHealthStatus.Checks == nil {
rawHealthStatus.Checks = make(map[CheckType]HealthCheckResult, 0)
}
*o = HealthStatus(rawHealthStatus)
return nil
}
func (o HealthStatus) MarshalYAML() (interface{}, error) {
jsonBytes, err := safejson.Marshal(o)
if err != nil {
return nil, err
}
return safeyaml.JSONtoYAMLMapSlice(jsonBytes)
}
func (o *HealthStatus) UnmarshalYAML(unmarshal func(interface{}) error) error {
jsonBytes, err := safeyaml.UnmarshalerToJSONBytes(unmarshal)
if err != nil {
return err
}
return safejson.Unmarshal(jsonBytes, *&o)
}