toJson method
Converts a Affinity instance to JSON data.
Implementation
Map<String, Object> toJson() {
final jsonData = <String, Object>{};
final tempNodeAffinity = nodeAffinity;
final tempPodAffinity = podAffinity;
final tempPodAntiAffinity = podAntiAffinity;
if (tempNodeAffinity != null) {
jsonData['nodeAffinity'] = tempNodeAffinity.toJson();
}
if (tempPodAffinity != null) {
jsonData['podAffinity'] = tempPodAffinity.toJson();
}
if (tempPodAntiAffinity != null) {
jsonData['podAntiAffinity'] = tempPodAntiAffinity.toJson();
}
return jsonData;
}