PodDisruptionBudgetStatus.fromJson constructor

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

Creates a PodDisruptionBudgetStatus from JSON data.

Implementation

factory PodDisruptionBudgetStatus.fromJson(Map<String, dynamic> json) {
  final tempConditionsJson = json['conditions'];
  final tempCurrentHealthyJson = json['currentHealthy'];
  final tempDesiredHealthyJson = json['desiredHealthy'];
  final tempDisruptedPodsJson = json['disruptedPods'];
  final tempDisruptionsAllowedJson = json['disruptionsAllowed'];
  final tempExpectedPodsJson = json['expectedPods'];
  final tempObservedGenerationJson = json['observedGeneration'];

  final List<Condition>? tempConditions = tempConditionsJson != null
      ? List<dynamic>.from(tempConditionsJson)
          .map(
            (e) => Condition.fromJson(
              Map<String, dynamic>.from(e),
            ),
          )
          .toList()
      : null;

  final int tempCurrentHealthy = tempCurrentHealthyJson;
  final int tempDesiredHealthy = tempDesiredHealthyJson;

  final Map<String, String>? tempDisruptedPods = tempDisruptedPodsJson != null
      ? Map<String, String>.from(tempDisruptedPodsJson)
      : null;

  final int tempDisruptionsAllowed = tempDisruptionsAllowedJson;
  final int tempExpectedPods = tempExpectedPodsJson;
  final int? tempObservedGeneration = tempObservedGenerationJson;

  return PodDisruptionBudgetStatus(
    conditions: tempConditions,
    currentHealthy: tempCurrentHealthy,
    desiredHealthy: tempDesiredHealthy,
    disruptedPods: tempDisruptedPods,
    disruptionsAllowed: tempDisruptionsAllowed,
    expectedPods: tempExpectedPods,
    observedGeneration: tempObservedGeneration,
  );
}