toJson method

Map<String, Object> toJson()

Converts a PodAntiAffinity instance to JSON data.

Implementation

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

  final tempPreferredDuringSchedulingIgnoredDuringExecution =
      preferredDuringSchedulingIgnoredDuringExecution;
  final tempRequiredDuringSchedulingIgnoredDuringExecution =
      requiredDuringSchedulingIgnoredDuringExecution;

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

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

  return jsonData;
}