@@ -14,29 +14,28 @@ import (
1414 "slices"
1515 "strings"
1616
17- "github.com/stmcginnis/gofish/common"
18- "github.com/stmcginnis/gofish/redfish"
17+ "github.com/stmcginnis/gofish/schemas"
1918 ctrl "sigs.k8s.io/controller-runtime"
2019)
2120
2221// SimpleUpdateRequestBody extends SimpleUpdateParameters with an OEM apply-time field.
2322type SimpleUpdateRequestBody struct {
24- redfish. SimpleUpdateParameters
25- RedfishOperationApplyTime redfish .OperationApplyTime `json:"@Redfish.OperationApplyTime,omitempty"`
23+ schemas. UpdateServiceSimpleUpdateParameters
24+ RedfishOperationApplyTime schemas .OperationApplyTime `json:"@Redfish.OperationApplyTime,omitempty"`
2625}
2726
2827// upgradeRequestBodyFn builds a vendor-specific request body from update parameters.
29- type upgradeRequestBodyFn func (parameters * redfish. SimpleUpdateParameters ) * SimpleUpdateRequestBody
28+ type upgradeRequestBodyFn func (parameters * schemas. UpdateServiceSimpleUpdateParameters ) * SimpleUpdateRequestBody
3029
3130// upgradeTaskMonitorURIFn extracts the task monitor URI from the update response.
3231type upgradeTaskMonitorURIFn func (response * http.Response ) (string , error )
3332
3433// taskMonitorDetailsFn parses vendor-specific task monitor details.
35- type taskMonitorDetailsFn func (ctx context.Context , response * http.Response ) (* redfish .Task , error )
34+ type taskMonitorDetailsFn func (ctx context.Context , response * http.Response ) (* schemas .Task , error )
3635
3736// upgradeVersion is the common firmware upgrade flow shared by all vendors.
3837// Vendor-specific parts are injected via callbacks.
39- func upgradeVersion (ctx context.Context , base * RedfishBaseBMC , params * redfish. SimpleUpdateParameters , requestBodyFn upgradeRequestBodyFn , taskMonitorURIFn upgradeTaskMonitorURIFn ) (string , bool , error ) {
38+ func upgradeVersion (ctx context.Context , base * RedfishBaseBMC , params * schemas. UpdateServiceSimpleUpdateParameters , requestBodyFn upgradeRequestBodyFn , taskMonitorURIFn upgradeTaskMonitorURIFn ) (string , bool , error ) {
4039 log := ctrl .LoggerFrom (ctx )
4140 service := base .client .GetService ()
4241
@@ -50,7 +49,7 @@ func upgradeVersion(ctx context.Context, base *RedfishBaseBMC, params *redfish.S
5049 AllowableValues []string `json:"TransferProtocol@Redfish.AllowableValues"`
5150 Target string
5251 } `json:"#UpdateService.SimpleUpdate"`
53- StartUpdate common .ActionTarget `json:"#UpdateService.StartUpdate"`
52+ StartUpdate schemas .ActionTarget `json:"#UpdateService.StartUpdate"`
5453 }
5554
5655 var tUS struct {
@@ -98,7 +97,7 @@ func upgradeVersion(ctx context.Context, base *RedfishBaseBMC, params *redfish.S
9897}
9998
10099// getUpgradeTask is the common task polling flow shared by all vendors.
101- func getUpgradeTask (ctx context.Context , base * RedfishBaseBMC , taskURI string , parseTaskDetails taskMonitorDetailsFn ) (* redfish .Task , error ) {
100+ func getUpgradeTask (ctx context.Context , base * RedfishBaseBMC , taskURI string , parseTaskDetails taskMonitorDetailsFn ) (* schemas .Task , error ) {
102101 log := ctrl .LoggerFrom (ctx )
103102
104103 respTask , err := base .client .GetService ().GetClient ().Get (taskURI )
@@ -128,11 +127,11 @@ func getUpgradeTask(ctx context.Context, base *RedfishBaseBMC, taskURI string, p
128127
129128// httpBasedGetBMCSettingAttribute retrieves BMC settings via HTTP GET.
130129// Shared by HPE and Lenovo which use "GET <URI>" format attributes.
131- func httpBasedGetBMCSettingAttribute (c common .Client , attributes map [string ]string ) (redfish .SettingsAttributes , error ) {
130+ func httpBasedGetBMCSettingAttribute (c schemas .Client , attributes map [string ]string ) (schemas .SettingsAttributes , error ) {
132131 if c == nil {
133132 return nil , fmt .Errorf ("failed to get client from gofish service" )
134133 }
135- result := redfish .SettingsAttributes {}
134+ result := schemas .SettingsAttributes {}
136135 var errs []error
137136 for key , data := range attributes {
138137 parts := strings .Fields (key )
@@ -179,8 +178,8 @@ func httpBasedGetBMCSettingAttribute(c common.Client, attributes map[string]stri
179178
180179// httpBasedUpdateBMCAttributes applies BMC attributes via HTTP POST/PATCH.
181180// Shared by HPE and Lenovo which use "POST <URI>" or "PATCH <URI>" format attributes.
182- func httpBasedUpdateBMCAttributes (c common .Client , attrs redfish .SettingsAttributes , applyTime common. ApplyTime ) error {
183- if applyTime != common . ImmediateApplyTime {
181+ func httpBasedUpdateBMCAttributes (c schemas .Client , attrs schemas .SettingsAttributes , applyTime schemas. SettingsApplyTime ) error {
182+ if applyTime != schemas . ImmediateSettingsApplyTime {
184183 return fmt .Errorf ("does not support scheduled apply time for BMC attributes" )
185184 }
186185 if c == nil {
@@ -264,7 +263,7 @@ func isSubMap(main, sub map[string]any) bool {
264263
265264// checkAttributes validates attributes against a filtered registry, returning
266265// whether a reset is required and any validation errors.
267- func checkAttributes (attrs redfish .SettingsAttributes , filtered map [string ]redfish. Attribute ) (reset bool , err error ) {
266+ func checkAttributes (attrs schemas .SettingsAttributes , filtered map [string ]schemas. Attributes ) (reset bool , err error ) {
268267 reset = false
269268 var errs []error
270269 for name , value := range attrs {
@@ -277,19 +276,19 @@ func checkAttributes(attrs redfish.SettingsAttributes, filtered map[string]redfi
277276 reset = true
278277 }
279278 switch entryAttribute .Type {
280- case redfish .IntegerAttributeType :
279+ case schemas .IntegerAttributeType :
281280 if _ , ok := value .(int ); ! ok {
282281 errs = append (errs ,
283282 fmt .Errorf ("attribute '%s's' value '%v' has wrong type. needed '%s' for '%v'" ,
284283 name , value , entryAttribute .Type , entryAttribute ))
285284 }
286- case redfish .StringAttributeType :
285+ case schemas .StringAttributeType :
287286 if _ , ok := value .(string ); ! ok {
288287 errs = append (errs ,
289288 fmt .Errorf ("attribute '%s's' value '%v' has wrong type. needed '%s' for '%v'" ,
290289 name , value , entryAttribute .Type , entryAttribute ))
291290 }
292- case redfish .EnumerationAttributeType :
291+ case schemas .EnumerationAttributeType :
293292 if _ , ok := value .(string ); ! ok {
294293 errs = append (errs ,
295294 fmt .Errorf ("attribute '%s's' value '%v' has wrong type. needed '%s' for '%v'" ,
0 commit comments