toJson method
Converts a JobStatus instance to JSON data.
Implementation
Map<String, Object> toJson() {
final jsonData = <String, Object>{};
final tempActive = active;
final tempCompletedIndexes = completedIndexes;
final tempCompletionTime = completionTime;
final tempConditions = conditions;
final tempFailed = failed;
final tempReady = ready;
final tempStartTime = startTime;
final tempSucceeded = succeeded;
final tempUncountedTerminatedPods = uncountedTerminatedPods;
if (tempActive != null) {
jsonData['active'] = tempActive;
}
if (tempCompletedIndexes != null) {
jsonData['completedIndexes'] = tempCompletedIndexes;
}
if (tempCompletionTime != null) {
jsonData['completionTime'] = tempCompletionTime;
}
if (tempConditions != null) {
jsonData['conditions'] =
tempConditions.map((e) => e.toJson()).toList(growable: false);
}
if (tempFailed != null) {
jsonData['failed'] = tempFailed;
}
if (tempReady != null) {
jsonData['ready'] = tempReady;
}
if (tempStartTime != null) {
jsonData['startTime'] = tempStartTime;
}
if (tempSucceeded != null) {
jsonData['succeeded'] = tempSucceeded;
}
if (tempUncountedTerminatedPods != null) {
jsonData['uncountedTerminatedPods'] =
tempUncountedTerminatedPods.toJson();
}
return jsonData;
}