Add "Unknown" value to health state enum

Dell iDrac returns "Unknown" health state when the server is powered off.

Change-Id: I6b1b35fa0a97afff110d11fb4d995210182ad6fd
This commit is contained in:
James Gu 2021-10-04 14:28:45 -04:00
parent 313b61f87b
commit 3c3d7c6ba0
5 changed files with 7 additions and 2 deletions

View File

@ -1,4 +1,4 @@
// Code generated by mockery v0.0.0-dev. DO NOT EDIT. // Code generated by mockery v2.7.4. DO NOT EDIT.
package mocks package mocks

View File

@ -577,6 +577,7 @@ components:
- OK - OK
- Warning - Warning
- Critical - Critical
- Unknown
type: string type: string
PowerState: PowerState:
enum: enum:

View File

@ -9,6 +9,8 @@
* `CRITICAL` (value: `"Critical"`) * `CRITICAL` (value: `"Critical"`)
* `UNKNOWN` (value: `"Unknown"`)
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -23,6 +23,7 @@ const (
HEALTH_OK Health = "OK" HEALTH_OK Health = "OK"
HEALTH_WARNING Health = "Warning" HEALTH_WARNING Health = "Warning"
HEALTH_CRITICAL Health = "Critical" HEALTH_CRITICAL Health = "Critical"
HEALTH_UNKNOWN Health = "Unknown"
) )
func (v *Health) UnmarshalJSON(src []byte) error { func (v *Health) UnmarshalJSON(src []byte) error {
@ -32,7 +33,7 @@ func (v *Health) UnmarshalJSON(src []byte) error {
return err return err
} }
enumTypeValue := Health(value) enumTypeValue := Health(value)
for _, existing := range []Health{ "OK", "Warning", "Critical", } { for _, existing := range []Health{ "OK", "Warning", "Critical", "Unknown", } {
if existing == enumTypeValue { if existing == enumTypeValue {
*v = enumTypeValue *v = enumTypeValue
return nil return nil

View File

@ -569,6 +569,7 @@ components:
- OK - OK
- Warning - Warning
- Critical - Critical
- Unknown
type: string type: string
PowerState: PowerState:
enum: enum: