forked from stmcginnis/gofish
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbatterymetrics.go
80 lines (75 loc) · 4.26 KB
/
batterymetrics.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//
// SPDX-License-Identifier: BSD-3-Clause
//
package redfish
import (
"github.com/stmcginnis/gofish/common"
)
// BatteryMetrics shall be used to represent the metrics of a battery unit for a Redfish implementation.
type BatteryMetrics struct {
common.Entity
// ODataContext is the odata context.
ODataContext string `json:"@odata.context"`
// ODataEtag is the odata etag.
ODataEtag string `json:"@odata.etag"`
// ODataType is the odata type.
ODataType string `json:"@odata.type"`
// CellVoltages shall contain the cell voltages, in volt units, for this battery. The value of the DataSourceUri
// property, if present, shall reference a resource of type Sensor with the ReadingType property containing the
// value 'Voltage'.
CellVoltages []SensorVoltageExcerpt
CellVoltagesCount int `json:"[email protected]"`
// ChargePercent shall contain the amount of charge available, in percent units, typically '0' to '100', in this
// battery. The value of the DataSourceUri property, if present, shall reference a resource of type Sensor with the
// ReadingType property containing the value 'Percent'.
ChargePercent SensorExcerpt
// Description provides a description of this resource.
Description string
// DischargeCycles shall contain the number of discharges this battery has sustained.
DischargeCycles float64
// InputCurrentAmps shall contain the input current, in ampere units, for this battery. The value of the
// DataSourceUri property, if present, shall reference a resource of type Sensor with the ReadingType property
// containing the value 'Current'.
InputCurrentAmps SensorCurrentExcerpt
// InputVoltage shall contain the input voltage, in volt units, for this battery. The value of the DataSourceUri
// property, if present, shall reference a resource of type Sensor with the ReadingType property containing the
// value 'Voltage'.
InputVoltage SensorVoltageExcerpt
// OutputCurrentAmps shall contain the output currents, in ampere units, for this battery. The value of the
// DataSourceUri property, if present, shall reference a resource of type Sensor with the ReadingType property
// containing the value 'Current'. The sensors shall appear in the same array order as the OutputVoltages property.
OutputCurrentAmps []SensorCurrentExcerpt
OutputCurrentAmpsCount int `json:"[email protected]"`
// OutputVoltages shall contain the output voltages, in volt units, for this battery. The value of the
// DataSourceUri property, if present, shall reference a resource of type Sensor with the ReadingType property
// containing the value 'Voltage'. The sensors shall appear in the same array order as the OutputCurrentAmps
// property.
OutputVoltages []SensorVoltageExcerpt
OutputVoltagesCount int `json:"[email protected]"`
// Status shall contain any status or health properties of the resource.
Status common.Status
// StoredChargeAmpHours shall contain the stored charge, in ampere-hour units, for this battery. The value of the
// DataSourceUri property, if present, shall reference a resource of type Sensor with the ReadingType property
// containing the value 'ChargeAh'.
StoredChargeAmpHours SensorExcerpt
// StoredEnergyWattHours shall contain the stored energy, in watt-hour units, for this battery. The value of the
// DataSourceUri property, if present, shall reference a resource of type Sensor with the ReadingType property
// containing the value 'EnergyWh'.
StoredEnergyWattHours SensorExcerpt
// TemperatureCelsius shall contain the temperature, in degree Celsius units, for this battery. The value of the
// DataSourceUri property, if present, shall reference a resource of type Sensor with the ReadingType property
// containing the value 'Temperature'.
TemperatureCelsius SensorExcerpt
}
// GetBatteryMetrics will get a BatteryMetrics instance from the service.
func GetBatteryMetrics(c common.Client, uri string) (*BatteryMetrics, error) {
return common.GetObject[BatteryMetrics](c, uri)
}
// ListReferencedBatteryMetricss gets the collection of BatteryMetrics from
// a provided reference.
func ListReferencedBatteryMetricss(c common.Client, link string) ([]*BatteryMetrics, error) {
return common.GetCollectionObjects[BatteryMetrics](c, link)
}