-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some DMTF 2024.4 release bits (#393)
* Add Pump controls * Add Enabled to LeakDetector * Add SetMode to CoolingUnit * Add CoolantConnector controls * Add LeakDetectors to Chassis
- Loading branch information
Showing
5 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,8 @@ type CoolingUnit struct { | |
ODataEtag string `json:"@odata.etag"` | ||
// ODataType is the odata type. | ||
ODataType string `json:"@odata.type"` | ||
// AllowedCoolingUnitModes shall contain the allowed values for setting the mode of this cooling unit. | ||
AllowedCoolingUnitModes []CoolingUnitMode | ||
// Assembly shall contain a link to a resource of type Assembly. | ||
assembly string | ||
// AssetTag shall contain the user-assigned asset tag, which is an identifying string that tracks the equipment for | ||
|
@@ -88,6 +90,8 @@ type CoolingUnit struct { | |
secondaryCoolantConnectors string | ||
// SerialNumber shall contain a manufacturer-allocated number that identifies the equipment. | ||
SerialNumber string | ||
// setMode shall contain the action target for setting the mode of this cooling unit. | ||
setMode string | ||
// Status shall contain any status or health properties of the resource. | ||
Status common.Status | ||
// UserLabel shall contain a user-assigned label used to identify this resource. If a value has not been assigned | ||
|
@@ -106,6 +110,13 @@ type CoolingUnit struct { | |
ManagedByCount int | ||
} | ||
|
||
type CoolingUnitMode string | ||
|
||
const ( | ||
EnabledCoolingUnitMode CoolingUnitMode = "Enabled" | ||
DisabledCoolingUnitMode CoolingUnitMode = "Disabled" | ||
) | ||
|
||
// UnmarshalJSON unmarshals a CoolingUnit object from the raw JSON. | ||
func (coolingunit *CoolingUnit) UnmarshalJSON(b []byte) error { | ||
type temp CoolingUnit | ||
|
@@ -124,8 +135,16 @@ func (coolingunit *CoolingUnit) UnmarshalJSON(b []byte) error { | |
// [email protected] | ||
ManagedByCount int `json:"[email protected]"` | ||
} | ||
type CoolingUnitActions struct { | ||
SetMode struct { | ||
AllowedCoolingUnitModes []CoolingUnitMode `json:"[email protected]"` | ||
Target string | ||
} `json:"#CoolingUnit.SetMode"` | ||
} | ||
|
||
var t struct { | ||
temp | ||
Actions CoolingUnitActions | ||
Assembly common.Link | ||
CoolantConnectorRedundancy common.Links | ||
EnvironmentMetrics common.Link | ||
|
@@ -160,13 +179,24 @@ func (coolingunit *CoolingUnit) UnmarshalJSON(b []byte) error { | |
coolingunit.facility = t.Links.Facility.String() | ||
coolingunit.managedBy = t.Links.ManagedBy.ToStrings() | ||
coolingunit.ManagedByCount = t.Links.ManagedByCount | ||
coolingunit.AllowedCoolingUnitModes = t.Actions.SetMode.AllowedCoolingUnitModes | ||
coolingunit.setMode = t.Actions.SetMode.Target | ||
|
||
// This is a read/write object, so we need to save the raw object data for later | ||
coolingunit.rawData = b | ||
|
||
return nil | ||
} | ||
|
||
func (coolingunit *CoolingUnit) SetMode(mode CoolingUnitMode) error { | ||
// TODO: check if mode is in Allowable values | ||
properties := map[string]interface{}{ | ||
"Mode": mode, | ||
} | ||
|
||
return coolingunit.Post(coolingunit.setMode, properties) | ||
} | ||
|
||
// Update commits updates to this object's properties to the running system. | ||
func (coolingunit *CoolingUnit) Update() error { | ||
// Get a representation of the object's original state so we can find what | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters