toJson method

Map<String, Object> toJson()

Converts a LoadBalancerIngress instance to JSON data.

Implementation

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

  final tempHostname = hostname;
  final tempIp = ip;
  final tempPorts = ports;

  if (tempHostname != null) {
    jsonData['hostname'] = tempHostname;
  }

  if (tempIp != null) {
    jsonData['ip'] = tempIp;
  }

  if (tempPorts != null) {
    jsonData['ports'] =
        tempPorts.map((e) => e.toJson()).toList(growable: false);
  }

  return jsonData;
}