PodDisruptionBudgetSpec.fromJson constructor

PodDisruptionBudgetSpec.fromJson(
  1. Map<String, dynamic> json
)

Creates a PodDisruptionBudgetSpec from JSON data.

Implementation

factory PodDisruptionBudgetSpec.fromJson(Map<String, dynamic> json) {
  final tempMaxUnavailableJson = json['maxUnavailable'];
  final tempMinAvailableJson = json['minAvailable'];
  final tempSelectorJson = json['selector'];
  final tempUnhealthyPodEvictionPolicyJson =
      json['unhealthyPodEvictionPolicy'];

  final IntOrString? tempMaxUnavailable = tempMaxUnavailableJson != null
      ? IntOrString(tempMaxUnavailableJson)
      : null;
  final IntOrString? tempMinAvailable =
      tempMinAvailableJson != null ? IntOrString(tempMinAvailableJson) : null;
  final LabelSelector? tempSelector = tempSelectorJson != null
      ? LabelSelector.fromJson(tempSelectorJson)
      : null;
  final String? tempUnhealthyPodEvictionPolicy =
      tempUnhealthyPodEvictionPolicyJson;

  return PodDisruptionBudgetSpec(
    maxUnavailable: tempMaxUnavailable,
    minAvailable: tempMinAvailable,
    selector: tempSelector,
    unhealthyPodEvictionPolicy: tempUnhealthyPodEvictionPolicy,
  );
}