4
4
package redfishreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/redfishreceiver"
5
5
6
6
import (
7
- "fmt "
7
+ "errors "
8
8
"time"
9
9
10
10
"go.opentelemetry.io/collector/config/configopaque"
@@ -24,7 +24,7 @@ type Server struct {
24
24
Insecure bool `mapstructure:"insecure"`
25
25
Timeout string `mapstructure:"timeout"`
26
26
Redfish redfishConfig `mapstructure:"redfish"`
27
- ComputerSystemId string `mapstructure:"computer_system_id"`
27
+ ComputerSystemID string `mapstructure:"computer_system_id"`
28
28
Resources []Resource `mapstructure:"resources"`
29
29
}
30
30
@@ -39,18 +39,18 @@ type Config struct {
39
39
40
40
func (cfg * Config ) Validate () error {
41
41
if len (cfg .Servers ) == 0 {
42
- return fmt . Errorf ("servers must not be empty" )
42
+ return errors . New ("servers must not be empty" )
43
43
}
44
44
45
- for _ , server := range cfg .Servers {
46
- if server .Redfish .Version != "v1" {
47
- return fmt . Errorf ("redfish version must be once of the following values: 'v1'" )
45
+ for i := range cfg .Servers {
46
+ if cfg . Servers [ i ] .Redfish .Version != "v1" {
47
+ return errors . New ("redfish version must be once of the following values: 'v1'" )
48
48
}
49
- if len (server .Resources ) == 0 {
50
- return fmt . Errorf ("resources must not be empty" )
49
+ if len (cfg . Servers [ i ] .Resources ) == 0 {
50
+ return errors . New ("resources must not be empty" )
51
51
}
52
- if _ , err := time .ParseDuration (server . Timeout ); err != nil && server .Timeout != "" {
53
- return fmt . Errorf ("invalid server timeout" )
52
+ if _ , err := time .ParseDuration (cfg . Servers [ i ]. Timeout ); err != nil && cfg . Servers [ i ] .Timeout != "" {
53
+ return errors . New ("invalid server timeout" )
54
54
}
55
55
}
56
56
return nil
0 commit comments