toJson method
Converts a NodeStatus instance to JSON data.
Implementation
Map<String, Object> toJson() {
final jsonData = <String, Object>{};
final tempAddresses = addresses;
final tempAllocatable = allocatable;
final tempCapacity = capacity;
final tempConditions = conditions;
final tempConfig = config;
final tempDaemonEndpoints = daemonEndpoints;
final tempImages = images;
final tempNodeInfo = nodeInfo;
final tempPhase = phase;
final tempVolumesAttached = volumesAttached;
final tempVolumesInUse = volumesInUse;
if (tempAddresses != null) {
jsonData['addresses'] =
tempAddresses.map((e) => e.toJson()).toList(growable: false);
}
if (tempAllocatable != null) {
jsonData['allocatable'] = tempAllocatable;
}
if (tempCapacity != null) {
jsonData['capacity'] = tempCapacity;
}
if (tempConditions != null) {
jsonData['conditions'] =
tempConditions.map((e) => e.toJson()).toList(growable: false);
}
if (tempConfig != null) {
jsonData['config'] = tempConfig.toJson();
}
if (tempDaemonEndpoints != null) {
jsonData['daemonEndpoints'] = tempDaemonEndpoints.toJson();
}
if (tempImages != null) {
jsonData['images'] =
tempImages.map((e) => e.toJson()).toList(growable: false);
}
if (tempNodeInfo != null) {
jsonData['nodeInfo'] = tempNodeInfo.toJson();
}
if (tempPhase != null) {
jsonData['phase'] = tempPhase;
}
if (tempVolumesAttached != null) {
jsonData['volumesAttached'] =
tempVolumesAttached.map((e) => e.toJson()).toList(growable: false);
}
if (tempVolumesInUse != null) {
jsonData['volumesInUse'] = tempVolumesInUse;
}
return jsonData;
}