toJson method

Map<String, Object> toJson()

Converts a PodDisruptionBudgetSpec instance to JSON data.

Implementation

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

  final tempMaxUnavailable = maxUnavailable;
  final tempMinAvailable = minAvailable;
  final tempSelector = selector;
  final tempUnhealthyPodEvictionPolicy = unhealthyPodEvictionPolicy;

  if (tempMaxUnavailable != null) {
    jsonData['maxUnavailable'] = tempMaxUnavailable;
  }

  if (tempMinAvailable != null) {
    jsonData['minAvailable'] = tempMinAvailable;
  }

  if (tempSelector != null) {
    jsonData['selector'] = tempSelector.toJson();
  }

  if (tempUnhealthyPodEvictionPolicy != null) {
    jsonData['unhealthyPodEvictionPolicy'] = tempUnhealthyPodEvictionPolicy;
  }

  return jsonData;
}