Skip to content

Commit

Permalink
api: Refactor UnmarshalHCPOpenShiftCluster parameters
Browse files Browse the repository at this point in the history
Reorder and add parameter for HTTP method.
  • Loading branch information
Matthew Barnes committed Apr 9, 2024
1 parent b74b807 commit 309c606
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion frontend/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ func (f *Frontend) ArmResourceCreateOrUpdate(writer http.ResponseWriter, request
cluster = api.NewDefaultHCPOpenShiftCluster()
}
body := ctx.Value(ContextKeyBody).([]byte)
err := versionedInterface.UnmarshalHCPOpenShiftCluster(body, updating, cluster)
err := versionedInterface.UnmarshalHCPOpenShiftCluster(body, cluster, request.Method, updating)
if err != nil {
f.logger.Error(err.Error())
arm.WriteUnmarshalError(err, writer)
Expand Down
2 changes: 1 addition & 1 deletion internal/api/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type Version interface {
// FIXME Disable until we have generated structs for node pools.
//NewHCPOpenShiftClusterNodePool(*HCPOpenShiftClusterNodePool) VersionedHCPOpenShiftClusterNodePool

UnmarshalHCPOpenShiftCluster([]byte, bool, *HCPOpenShiftCluster) error
UnmarshalHCPOpenShiftCluster([]byte, *HCPOpenShiftCluster, string, bool) error
}

// apiRegistry is the map of registered API versions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func (v version) NewHCPOpenShiftCluster(from *api.HCPOpenShiftCluster) api.Versi
return out
}

func (v version) UnmarshalHCPOpenShiftCluster(data []byte, updating bool, out *api.HCPOpenShiftCluster) error {
func (v version) UnmarshalHCPOpenShiftCluster(data []byte, out *api.HCPOpenShiftCluster, method string, updating bool) error {
var resource HcpOpenShiftClusterResource

err := json.Unmarshal(data, &resource)
Expand Down

0 comments on commit 309c606

Please sign in to comment.