1*0ec8b83dSEd Tanous #pragma once 2*0ec8b83dSEd Tanous #include <nlohmann/json.hpp> 3*0ec8b83dSEd Tanous 4*0ec8b83dSEd Tanous namespace resource 5*0ec8b83dSEd Tanous { 6*0ec8b83dSEd Tanous // clang-format off 7*0ec8b83dSEd Tanous 8*0ec8b83dSEd Tanous enum class State{ 9*0ec8b83dSEd Tanous Invalid, 10*0ec8b83dSEd Tanous Enabled, 11*0ec8b83dSEd Tanous Disabled, 12*0ec8b83dSEd Tanous StandbyOffline, 13*0ec8b83dSEd Tanous StandbySpare, 14*0ec8b83dSEd Tanous InTest, 15*0ec8b83dSEd Tanous Starting, 16*0ec8b83dSEd Tanous Absent, 17*0ec8b83dSEd Tanous UnavailableOffline, 18*0ec8b83dSEd Tanous Deferring, 19*0ec8b83dSEd Tanous Quiesced, 20*0ec8b83dSEd Tanous Updating, 21*0ec8b83dSEd Tanous Qualified, 22*0ec8b83dSEd Tanous }; 23*0ec8b83dSEd Tanous 24*0ec8b83dSEd Tanous enum class Health{ 25*0ec8b83dSEd Tanous Invalid, 26*0ec8b83dSEd Tanous OK, 27*0ec8b83dSEd Tanous Warning, 28*0ec8b83dSEd Tanous Critical, 29*0ec8b83dSEd Tanous }; 30*0ec8b83dSEd Tanous 31*0ec8b83dSEd Tanous enum class ResetType{ 32*0ec8b83dSEd Tanous Invalid, 33*0ec8b83dSEd Tanous On, 34*0ec8b83dSEd Tanous ForceOff, 35*0ec8b83dSEd Tanous GracefulShutdown, 36*0ec8b83dSEd Tanous GracefulRestart, 37*0ec8b83dSEd Tanous ForceRestart, 38*0ec8b83dSEd Tanous Nmi, 39*0ec8b83dSEd Tanous ForceOn, 40*0ec8b83dSEd Tanous PushPowerButton, 41*0ec8b83dSEd Tanous PowerCycle, 42*0ec8b83dSEd Tanous Suspend, 43*0ec8b83dSEd Tanous Pause, 44*0ec8b83dSEd Tanous Resume, 45*0ec8b83dSEd Tanous }; 46*0ec8b83dSEd Tanous 47*0ec8b83dSEd Tanous enum class IndicatorLED{ 48*0ec8b83dSEd Tanous Invalid, 49*0ec8b83dSEd Tanous Lit, 50*0ec8b83dSEd Tanous Blinking, 51*0ec8b83dSEd Tanous Off, 52*0ec8b83dSEd Tanous }; 53*0ec8b83dSEd Tanous 54*0ec8b83dSEd Tanous enum class PowerState{ 55*0ec8b83dSEd Tanous Invalid, 56*0ec8b83dSEd Tanous On, 57*0ec8b83dSEd Tanous Off, 58*0ec8b83dSEd Tanous PoweringOn, 59*0ec8b83dSEd Tanous PoweringOff, 60*0ec8b83dSEd Tanous Paused, 61*0ec8b83dSEd Tanous }; 62*0ec8b83dSEd Tanous 63*0ec8b83dSEd Tanous enum class DurableNameFormat{ 64*0ec8b83dSEd Tanous Invalid, 65*0ec8b83dSEd Tanous NAA, 66*0ec8b83dSEd Tanous iQN, 67*0ec8b83dSEd Tanous FC_WWN, 68*0ec8b83dSEd Tanous UUID, 69*0ec8b83dSEd Tanous EUI, 70*0ec8b83dSEd Tanous NQN, 71*0ec8b83dSEd Tanous NSID, 72*0ec8b83dSEd Tanous NGUID, 73*0ec8b83dSEd Tanous MACAddress, 74*0ec8b83dSEd Tanous }; 75*0ec8b83dSEd Tanous 76*0ec8b83dSEd Tanous enum class RackUnits{ 77*0ec8b83dSEd Tanous Invalid, 78*0ec8b83dSEd Tanous OpenU, 79*0ec8b83dSEd Tanous EIA_310, 80*0ec8b83dSEd Tanous }; 81*0ec8b83dSEd Tanous 82*0ec8b83dSEd Tanous enum class LocationType{ 83*0ec8b83dSEd Tanous Invalid, 84*0ec8b83dSEd Tanous Slot, 85*0ec8b83dSEd Tanous Bay, 86*0ec8b83dSEd Tanous Connector, 87*0ec8b83dSEd Tanous Socket, 88*0ec8b83dSEd Tanous Backplane, 89*0ec8b83dSEd Tanous Embedded, 90*0ec8b83dSEd Tanous }; 91*0ec8b83dSEd Tanous 92*0ec8b83dSEd Tanous enum class Reference{ 93*0ec8b83dSEd Tanous Invalid, 94*0ec8b83dSEd Tanous Top, 95*0ec8b83dSEd Tanous Bottom, 96*0ec8b83dSEd Tanous Front, 97*0ec8b83dSEd Tanous Rear, 98*0ec8b83dSEd Tanous Left, 99*0ec8b83dSEd Tanous Right, 100*0ec8b83dSEd Tanous Middle, 101*0ec8b83dSEd Tanous }; 102*0ec8b83dSEd Tanous 103*0ec8b83dSEd Tanous enum class Orientation{ 104*0ec8b83dSEd Tanous Invalid, 105*0ec8b83dSEd Tanous FrontToBack, 106*0ec8b83dSEd Tanous BackToFront, 107*0ec8b83dSEd Tanous TopToBottom, 108*0ec8b83dSEd Tanous BottomToTop, 109*0ec8b83dSEd Tanous LeftToRight, 110*0ec8b83dSEd Tanous RightToLeft, 111*0ec8b83dSEd Tanous }; 112*0ec8b83dSEd Tanous 113*0ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(State, { 114*0ec8b83dSEd Tanous {State::Invalid, "Invalid"}, 115*0ec8b83dSEd Tanous {State::Enabled, "Enabled"}, 116*0ec8b83dSEd Tanous {State::Disabled, "Disabled"}, 117*0ec8b83dSEd Tanous {State::StandbyOffline, "StandbyOffline"}, 118*0ec8b83dSEd Tanous {State::StandbySpare, "StandbySpare"}, 119*0ec8b83dSEd Tanous {State::InTest, "InTest"}, 120*0ec8b83dSEd Tanous {State::Starting, "Starting"}, 121*0ec8b83dSEd Tanous {State::Absent, "Absent"}, 122*0ec8b83dSEd Tanous {State::UnavailableOffline, "UnavailableOffline"}, 123*0ec8b83dSEd Tanous {State::Deferring, "Deferring"}, 124*0ec8b83dSEd Tanous {State::Quiesced, "Quiesced"}, 125*0ec8b83dSEd Tanous {State::Updating, "Updating"}, 126*0ec8b83dSEd Tanous {State::Qualified, "Qualified"}, 127*0ec8b83dSEd Tanous }); 128*0ec8b83dSEd Tanous 129*0ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(Health, { 130*0ec8b83dSEd Tanous {Health::Invalid, "Invalid"}, 131*0ec8b83dSEd Tanous {Health::OK, "OK"}, 132*0ec8b83dSEd Tanous {Health::Warning, "Warning"}, 133*0ec8b83dSEd Tanous {Health::Critical, "Critical"}, 134*0ec8b83dSEd Tanous }); 135*0ec8b83dSEd Tanous 136*0ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(ResetType, { 137*0ec8b83dSEd Tanous {ResetType::Invalid, "Invalid"}, 138*0ec8b83dSEd Tanous {ResetType::On, "On"}, 139*0ec8b83dSEd Tanous {ResetType::ForceOff, "ForceOff"}, 140*0ec8b83dSEd Tanous {ResetType::GracefulShutdown, "GracefulShutdown"}, 141*0ec8b83dSEd Tanous {ResetType::GracefulRestart, "GracefulRestart"}, 142*0ec8b83dSEd Tanous {ResetType::ForceRestart, "ForceRestart"}, 143*0ec8b83dSEd Tanous {ResetType::Nmi, "Nmi"}, 144*0ec8b83dSEd Tanous {ResetType::ForceOn, "ForceOn"}, 145*0ec8b83dSEd Tanous {ResetType::PushPowerButton, "PushPowerButton"}, 146*0ec8b83dSEd Tanous {ResetType::PowerCycle, "PowerCycle"}, 147*0ec8b83dSEd Tanous {ResetType::Suspend, "Suspend"}, 148*0ec8b83dSEd Tanous {ResetType::Pause, "Pause"}, 149*0ec8b83dSEd Tanous {ResetType::Resume, "Resume"}, 150*0ec8b83dSEd Tanous }); 151*0ec8b83dSEd Tanous 152*0ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(IndicatorLED, { 153*0ec8b83dSEd Tanous {IndicatorLED::Invalid, "Invalid"}, 154*0ec8b83dSEd Tanous {IndicatorLED::Lit, "Lit"}, 155*0ec8b83dSEd Tanous {IndicatorLED::Blinking, "Blinking"}, 156*0ec8b83dSEd Tanous {IndicatorLED::Off, "Off"}, 157*0ec8b83dSEd Tanous }); 158*0ec8b83dSEd Tanous 159*0ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(PowerState, { 160*0ec8b83dSEd Tanous {PowerState::Invalid, "Invalid"}, 161*0ec8b83dSEd Tanous {PowerState::On, "On"}, 162*0ec8b83dSEd Tanous {PowerState::Off, "Off"}, 163*0ec8b83dSEd Tanous {PowerState::PoweringOn, "PoweringOn"}, 164*0ec8b83dSEd Tanous {PowerState::PoweringOff, "PoweringOff"}, 165*0ec8b83dSEd Tanous {PowerState::Paused, "Paused"}, 166*0ec8b83dSEd Tanous }); 167*0ec8b83dSEd Tanous 168*0ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(DurableNameFormat, { 169*0ec8b83dSEd Tanous {DurableNameFormat::Invalid, "Invalid"}, 170*0ec8b83dSEd Tanous {DurableNameFormat::NAA, "NAA"}, 171*0ec8b83dSEd Tanous {DurableNameFormat::iQN, "iQN"}, 172*0ec8b83dSEd Tanous {DurableNameFormat::FC_WWN, "FC_WWN"}, 173*0ec8b83dSEd Tanous {DurableNameFormat::UUID, "UUID"}, 174*0ec8b83dSEd Tanous {DurableNameFormat::EUI, "EUI"}, 175*0ec8b83dSEd Tanous {DurableNameFormat::NQN, "NQN"}, 176*0ec8b83dSEd Tanous {DurableNameFormat::NSID, "NSID"}, 177*0ec8b83dSEd Tanous {DurableNameFormat::NGUID, "NGUID"}, 178*0ec8b83dSEd Tanous {DurableNameFormat::MACAddress, "MACAddress"}, 179*0ec8b83dSEd Tanous }); 180*0ec8b83dSEd Tanous 181*0ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(RackUnits, { 182*0ec8b83dSEd Tanous {RackUnits::Invalid, "Invalid"}, 183*0ec8b83dSEd Tanous {RackUnits::OpenU, "OpenU"}, 184*0ec8b83dSEd Tanous {RackUnits::EIA_310, "EIA_310"}, 185*0ec8b83dSEd Tanous }); 186*0ec8b83dSEd Tanous 187*0ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(LocationType, { 188*0ec8b83dSEd Tanous {LocationType::Invalid, "Invalid"}, 189*0ec8b83dSEd Tanous {LocationType::Slot, "Slot"}, 190*0ec8b83dSEd Tanous {LocationType::Bay, "Bay"}, 191*0ec8b83dSEd Tanous {LocationType::Connector, "Connector"}, 192*0ec8b83dSEd Tanous {LocationType::Socket, "Socket"}, 193*0ec8b83dSEd Tanous {LocationType::Backplane, "Backplane"}, 194*0ec8b83dSEd Tanous {LocationType::Embedded, "Embedded"}, 195*0ec8b83dSEd Tanous }); 196*0ec8b83dSEd Tanous 197*0ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(Reference, { 198*0ec8b83dSEd Tanous {Reference::Invalid, "Invalid"}, 199*0ec8b83dSEd Tanous {Reference::Top, "Top"}, 200*0ec8b83dSEd Tanous {Reference::Bottom, "Bottom"}, 201*0ec8b83dSEd Tanous {Reference::Front, "Front"}, 202*0ec8b83dSEd Tanous {Reference::Rear, "Rear"}, 203*0ec8b83dSEd Tanous {Reference::Left, "Left"}, 204*0ec8b83dSEd Tanous {Reference::Right, "Right"}, 205*0ec8b83dSEd Tanous {Reference::Middle, "Middle"}, 206*0ec8b83dSEd Tanous }); 207*0ec8b83dSEd Tanous 208*0ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(Orientation, { 209*0ec8b83dSEd Tanous {Orientation::Invalid, "Invalid"}, 210*0ec8b83dSEd Tanous {Orientation::FrontToBack, "FrontToBack"}, 211*0ec8b83dSEd Tanous {Orientation::BackToFront, "BackToFront"}, 212*0ec8b83dSEd Tanous {Orientation::TopToBottom, "TopToBottom"}, 213*0ec8b83dSEd Tanous {Orientation::BottomToTop, "BottomToTop"}, 214*0ec8b83dSEd Tanous {Orientation::LeftToRight, "LeftToRight"}, 215*0ec8b83dSEd Tanous {Orientation::RightToLeft, "RightToLeft"}, 216*0ec8b83dSEd Tanous }); 217*0ec8b83dSEd Tanous 218*0ec8b83dSEd Tanous } 219*0ec8b83dSEd Tanous // clang-format on 220