toJson method
Converts a NodeSpec instance to JSON data.
Implementation
Map<String, Object> toJson() {
final jsonData = <String, Object>{};
final tempConfigSource = configSource;
final tempExternalID = externalID;
final tempPodCIDR = podCIDR;
final tempPodCIDRs = podCIDRs;
final tempProviderID = providerID;
final tempTaints = taints;
final tempUnschedulable = unschedulable;
if (tempConfigSource != null) {
jsonData['configSource'] = tempConfigSource.toJson();
}
if (tempExternalID != null) {
jsonData['externalID'] = tempExternalID;
}
if (tempPodCIDR != null) {
jsonData['podCIDR'] = tempPodCIDR;
}
if (tempPodCIDRs != null) {
jsonData['podCIDRs'] = tempPodCIDRs;
}
if (tempProviderID != null) {
jsonData['providerID'] = tempProviderID;
}
if (tempTaints != null) {
jsonData['taints'] =
tempTaints.map((e) => e.toJson()).toList(growable: false);
}
if (tempUnschedulable != null) {
jsonData['unschedulable'] = tempUnschedulable;
}
return jsonData;
}