Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gets instances of resources where relevant in cooling unit #381

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}