toJson method

Map<String, Object> toJson()

Converts a APIVersions instance to JSON data.

Implementation

Map<String, Object> toJson() {
  final jsonData = <String, Object>{};

  final tempApiVersion = apiVersion;
  final tempKind = kind;
  final tempServerAddressByClientCIDRs = serverAddressByClientCIDRs;
  final tempVersions = versions;

  if (tempApiVersion != null) {
    jsonData['apiVersion'] = tempApiVersion;
  }

  if (tempKind != null) {
    jsonData['kind'] = tempKind;
  }

  jsonData['serverAddressByClientCIDRs'] = tempServerAddressByClientCIDRs
      .map((e) => e.toJson())
      .toList(growable: false);

  jsonData['versions'] = tempVersions;

  return jsonData;
}