From cea5d31f5964599aabd02c435cb8a2c80bb3a71d Mon Sep 17 00:00:00 2001 From: Joel Rebello Date: Mon, 25 Sep 2023 12:29:35 +0200 Subject: [PATCH] client: expose redfish etag match header disable parameter --- option.go | 6 ++++++ providers/redfish/redfish.go | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/option.go b/option.go index f79cab5f..79447e40 100644 --- a/option.go +++ b/option.go @@ -111,6 +111,12 @@ func WithRedfishUseBasicAuth(useBasicAuth bool) Option { } } +func WithRedfishEtagMatchDisabled(d bool) Option { + return func(args *Client) { + args.providerConfig.gofish.DisableEtagMatch = d + } +} + func WithIntelAMTHostScheme(hostScheme string) Option { return func(args *Client) { args.providerConfig.intelamt.HostScheme = hostScheme diff --git a/providers/redfish/redfish.go b/providers/redfish/redfish.go index 22fc4e19..1a982af0 100644 --- a/providers/redfish/redfish.go +++ b/providers/redfish/redfish.go @@ -58,8 +58,8 @@ type Config struct { VersionsNotCompatible []string RootCAs *x509.CertPool UseBasicAuth bool - // WithEtagMatchDisabled disables the If-Match Etag header from being included by the Gofish driver. - disableEtagMatch bool + // DisableEtagMatch disables the If-Match Etag header from being included by the Gofish driver. + DisableEtagMatch bool } // Option for setting optional Client values @@ -100,7 +100,7 @@ func WithUseBasicAuth(useBasicAuth bool) Option { // As of the current implementation this disables the header for POST/PATCH requests to the System entity endpoints. func WithEtagMatchDisabled(d bool) Option { return func(c *Config) { - c.disableEtagMatch = d + c.DisableEtagMatch = d } } @@ -118,7 +118,7 @@ func New(host, user, pass string, log logr.Logger, opts ...Option) *Conn { rfOpts := []redfishwrapper.Option{ redfishwrapper.WithHTTPClient(defaultConfig.HttpClient), redfishwrapper.WithVersionsNotCompatible(defaultConfig.VersionsNotCompatible), - redfishwrapper.WithEtagMatchDisabled(defaultConfig.disableEtagMatch), + redfishwrapper.WithEtagMatchDisabled(defaultConfig.DisableEtagMatch), } if defaultConfig.RootCAs != nil {