toJson method

Map<String, Object> toJson()

Converts a Endpoint instance to JSON data.

Implementation

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

  final tempAddresses = addresses;
  final tempConditions = conditions;
  final tempDeprecatedTopology = deprecatedTopology;
  final tempHints = hints;
  final tempHostname = hostname;
  final tempNodeName = nodeName;
  final tempTargetRef = targetRef;
  final tempZone = zone;

  jsonData['addresses'] = tempAddresses;

  if (tempConditions != null) {
    jsonData['conditions'] = tempConditions.toJson();
  }

  if (tempDeprecatedTopology != null) {
    jsonData['deprecatedTopology'] = tempDeprecatedTopology;
  }

  if (tempHints != null) {
    jsonData['hints'] = tempHints.toJson();
  }

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

  if (tempNodeName != null) {
    jsonData['nodeName'] = tempNodeName;
  }

  if (tempTargetRef != null) {
    jsonData['targetRef'] = tempTargetRef.toJson();
  }

  if (tempZone != null) {
    jsonData['zone'] = tempZone;
  }

  return jsonData;
}