toJson method
Converts a APIGroup instance to JSON data.
Implementation
Map<String, Object> toJson() {
final jsonData = <String, Object>{};
final tempApiVersion = apiVersion;
final tempKind = kind;
final tempName = name;
final tempPreferredVersion = preferredVersion;
final tempServerAddressByClientCIDRs = serverAddressByClientCIDRs;
final tempVersions = versions;
if (tempApiVersion != null) {
jsonData['apiVersion'] = tempApiVersion;
}
if (tempKind != null) {
jsonData['kind'] = tempKind;
}
jsonData['name'] = tempName;
if (tempPreferredVersion != null) {
jsonData['preferredVersion'] = tempPreferredVersion.toJson();
}
if (tempServerAddressByClientCIDRs != null) {
jsonData['serverAddressByClientCIDRs'] = tempServerAddressByClientCIDRs
.map((e) => e.toJson())
.toList(growable: false);
}
jsonData['versions'] =
tempVersions.map((e) => e.toJson()).toList(growable: false);
return jsonData;
}