mirror of
https://github.com/hashicorp/vault.git
synced 2025-11-28 14:11:10 +01:00
Add JSON marshaler to CLI output of autopilot config (#11166)
This commit is contained in:
parent
28fc771465
commit
aa30d531b1
@ -44,6 +44,18 @@ type AutopilotConfig struct {
|
|||||||
ServerStabilizationTime time.Duration `json:"server_stabilization_time" mapstructure:"-"`
|
ServerStabilizationTime time.Duration `json:"server_stabilization_time" mapstructure:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MarshalJSON makes the autopilot config fields JSON compatible
|
||||||
|
func (ac *AutopilotConfig) MarshalJSON() ([]byte, error) {
|
||||||
|
return json.Marshal(map[string]interface{}{
|
||||||
|
"cleanup_dead_servers": ac.CleanupDeadServers,
|
||||||
|
"last_contact_threshold": ac.LastContactThreshold.String(),
|
||||||
|
"dead_server_last_contact_threshold": ac.DeadServerLastContactThreshold.String(),
|
||||||
|
"max_trailing_logs": ac.MaxTrailingLogs,
|
||||||
|
"min_quorum": ac.MinQuorum,
|
||||||
|
"server_stabilization_time": ac.ServerStabilizationTime.String(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// UnmarshalJSON parses the autopilot config JSON blob
|
// UnmarshalJSON parses the autopilot config JSON blob
|
||||||
func (ac *AutopilotConfig) UnmarshalJSON(b []byte) error {
|
func (ac *AutopilotConfig) UnmarshalJSON(b []byte) error {
|
||||||
var data interface{}
|
var data interface{}
|
||||||
|
|||||||
12
vendor/github.com/hashicorp/vault/api/sys_raft.go
generated
vendored
12
vendor/github.com/hashicorp/vault/api/sys_raft.go
generated
vendored
@ -44,6 +44,18 @@ type AutopilotConfig struct {
|
|||||||
ServerStabilizationTime time.Duration `json:"server_stabilization_time" mapstructure:"-"`
|
ServerStabilizationTime time.Duration `json:"server_stabilization_time" mapstructure:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MarshalJSON makes the autopilot config fields JSON compatible
|
||||||
|
func (ac *AutopilotConfig) MarshalJSON() ([]byte, error) {
|
||||||
|
return json.Marshal(map[string]interface{}{
|
||||||
|
"cleanup_dead_servers": ac.CleanupDeadServers,
|
||||||
|
"last_contact_threshold": ac.LastContactThreshold.String(),
|
||||||
|
"dead_server_last_contact_threshold": ac.DeadServerLastContactThreshold.String(),
|
||||||
|
"max_trailing_logs": ac.MaxTrailingLogs,
|
||||||
|
"min_quorum": ac.MinQuorum,
|
||||||
|
"server_stabilization_time": ac.ServerStabilizationTime.String(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// UnmarshalJSON parses the autopilot config JSON blob
|
// UnmarshalJSON parses the autopilot config JSON blob
|
||||||
func (ac *AutopilotConfig) UnmarshalJSON(b []byte) error {
|
func (ac *AutopilotConfig) UnmarshalJSON(b []byte) error {
|
||||||
var data interface{}
|
var data interface{}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user