Skip to content

Commit

Permalink
Gets instances of resources where relevant in cooling unit
Browse files Browse the repository at this point in the history
  • Loading branch information
iamsli committed Oct 23, 2024
1 parent 9bc001c commit 5cf2122
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
22 changes: 14 additions & 8 deletions redfish/coolingunit.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func (coolingunit *CoolingUnit) UnmarshalJSON(b []byte) error {
LeakDetection common.Link
PrimaryCoolantConnectors common.Link
Pumps common.Link
Resevoirs common.Link
Reservoirs common.Link
SecondaryCoolantConnectors common.Link
Links Links
}
Expand All @@ -153,7 +153,7 @@ func (coolingunit *CoolingUnit) UnmarshalJSON(b []byte) error {
coolingunit.leakDetection = t.LeakDetection.String()
coolingunit.primaryCoolantConnectors = t.PrimaryCoolantConnectors.String()
coolingunit.pumps = t.Pumps.String()
coolingunit.reservoirs = t.Resevoirs.String()
coolingunit.reservoirs = t.Reservoirs.String()
coolingunit.secondaryCoolantConnectors = t.SecondaryCoolantConnectors.String()
coolingunit.chassis = t.Links.Chassis.ToStrings()
coolingunit.ChassisCount = t.Links.ChassisCount
Expand Down Expand Up @@ -201,19 +201,25 @@ func (coolingunit *CoolingUnit) Assembly() ([]*Assembly, error) {
return ListReferencedAssemblys(coolingunit.GetClient(), coolingunit.assembly)
}

// EnvironmentMetrics gets a collection of environment metrics.
func (coolingunit *CoolingUnit) EnvironmentMetrics() ([]*EnvironmentMetrics, error) {
return ListReferencedEnvironmentMetricss(coolingunit.GetClient(), coolingunit.environmentMetrics)
// EnvironmentMetrics gets the environment metrics for this cooling unit.
func (coolingunit *CoolingUnit) EnvironmentMetrics() (*EnvironmentMetrics, error) {
if coolingunit.environmentMetrics == "" {
return nil, nil
}
return GetEnvironmentMetrics(coolingunit.GetClient(), coolingunit.environmentMetrics)
}

// Filters gets a collection of filters.
func (coolingunit *CoolingUnit) Filters() ([]*Filter, error) {
return ListReferencedFilters(coolingunit.GetClient(), coolingunit.filters)
}

// LeakDetection gets a collection of leak detections.
func (coolingunit *CoolingUnit) LeakDetection() ([]*LeakDetection, error) {
return ListReferencedLeakDetections(coolingunit.GetClient(), coolingunit.leakDetection)
// LeakDetection gets the of leak detection of this cooling unit.
func (coolingunit *CoolingUnit) LeakDetection() (*LeakDetection, error) {
if coolingunit.leakDetection == "" {
return nil, nil
}
return GetLeakDetection(coolingunit.GetClient(), coolingunit.leakDetection)
}

// PrimaryCoolantConnectors gets a collection of primary coolant connectors.
Expand Down
4 changes: 2 additions & 2 deletions redfish/environmentmetrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ func GetEnvironmentMetrics(c common.Client, uri string) (*EnvironmentMetrics, er
return common.GetObject[EnvironmentMetrics](c, uri)
}

// ListReferencedEnvironmentMetricss gets the collection of EnvironmentMetrics from
// ListReferencedEnvironmentMetrics gets the collection of EnvironmentMetrics from
// a provided reference.
func ListReferencedEnvironmentMetricss(c common.Client, link string) ([]*EnvironmentMetrics, error) {
func ListReferencedEnvironmentMetrics(c common.Client, link string) ([]*EnvironmentMetrics, error) {
return common.GetCollectionObjects[EnvironmentMetrics](c, link)
}

0 comments on commit 5cf2122

Please sign in to comment.