Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redfish/task: Adds the Oem field as json.RawMessage #289

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions redfish/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ type Task struct {
// Status section of the Redfish specification and shall not be set until
// the task has completed.
TaskStatus common.Health
// Oem property contains OEM specific task information
Oem json.RawMessage `json:"Oem,omitempty"`
}

// UnmarshalJSON unmarshals a Task object from the raw JSON.
Expand Down
22 changes: 22 additions & 0 deletions redfish/task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,24 @@ var taskBody = strings.NewReader(
"JsonBody": "{}",
"TargetUri": "http://example.com/API"
},
"Oem": {
"Dell": {
"@odata.type": "#DellJob.v1_4_0.DellJob",
"CompletionTime": null,
"Description": "Job Instance",
"EndTime": "TIME_NA",
"Id": "JID_005950769310",
"JobState": "Scheduled",
"JobType": "FirmwareUpdate",
"Message": "Task successfully scheduled.",
"MessageArgs": [],
"MessageId": "IDRAC.2.8.JCP001",
"Name": "Firmware Update: BIOS",
"PercentComplete": 0,
"StartTime": "TIME_NOW",
"TargetSettingsURI": null
}
},
"PercentComplete": 60,
"StartTime": "2012-03-07T14:04+06:00",
"TaskMonitor": "http://example.com/API/Tasks/1",
Expand Down Expand Up @@ -75,4 +93,8 @@ func TestTask(t *testing.T) {
if len(result.Messages) != 1 {
t.Errorf("Incorrect number of task messages: %d", len(result.Messages))
}

if len(result.Oem) == 0 {
t.Error("Expected Oem object with properties, got none")
}
}