go-redfish/client/model_power_state.go
James Gu c442eb5bcb Upgrade openapi generator to v5.1.0
Upgraded openapi generator version to 5.1.0 for the support of nullable
values for optional fields; Added missing "Disabled" enum value to the
BootSourceOverrideEnabled model in the openapi schema.

Signed-off-by: James Gu <james.gu@att.com>
Change-Id: Ia3e0b018be13079d2085ef61ed2e797bcfd25fd7
2021-05-05 10:18:32 -04:00

87 lines
1.7 KiB
Go

/*
* Redfish OAPI specification
*
* Partial Redfish OAPI specification for a limited client
*
* API version: 0.0.1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package client
import (
"encoding/json"
"fmt"
)
// PowerState the model 'PowerState'
type PowerState string
// List of PowerState
const (
POWERSTATE_ON PowerState = "On"
POWERSTATE_OFF PowerState = "Off"
POWERSTATE_POWERING_ON PowerState = "PoweringOn"
POWERSTATE_POWERING_OFF PowerState = "PoweringOff"
)
func (v *PowerState) UnmarshalJSON(src []byte) error {
var value string
err := json.Unmarshal(src, &value)
if err != nil {
return err
}
enumTypeValue := PowerState(value)
for _, existing := range []PowerState{ "On", "Off", "PoweringOn", "PoweringOff", } {
if existing == enumTypeValue {
*v = enumTypeValue
return nil
}
}
return fmt.Errorf("%+v is not a valid PowerState", value)
}
// Ptr returns reference to PowerState value
func (v PowerState) Ptr() *PowerState {
return &v
}
type NullablePowerState struct {
value *PowerState
isSet bool
}
func (v NullablePowerState) Get() *PowerState {
return v.value
}
func (v *NullablePowerState) Set(val *PowerState) {
v.value = val
v.isSet = true
}
func (v NullablePowerState) IsSet() bool {
return v.isSet
}
func (v *NullablePowerState) Unset() {
v.value = nil
v.isSet = false
}
func NewNullablePowerState(val *PowerState) *NullablePowerState {
return &NullablePowerState{value: val, isSet: true}
}
func (v NullablePowerState) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullablePowerState) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}