PodFailurePolicyRule.fromJson constructor

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

Creates a PodFailurePolicyRule from JSON data.

Implementation

factory PodFailurePolicyRule.fromJson(Map<String, dynamic> json) {
  final tempActionJson = json['action'];
  final tempOnExitCodesJson = json['onExitCodes'];
  final tempOnPodConditionsJson = json['onPodConditions'];

  final String tempAction = tempActionJson;
  final PodFailurePolicyOnExitCodesRequirement? tempOnExitCodes =
      tempOnExitCodesJson != null
          ? PodFailurePolicyOnExitCodesRequirement.fromJson(
              tempOnExitCodesJson)
          : null;

  final List<PodFailurePolicyOnPodConditionsPattern> tempOnPodConditions =
      List<dynamic>.from(tempOnPodConditionsJson)
          .map(
            (e) => PodFailurePolicyOnPodConditionsPattern.fromJson(
              Map<String, dynamic>.from(e),
            ),
          )
          .toList();

  return PodFailurePolicyRule(
    action: tempAction,
    onExitCodes: tempOnExitCodes,
    onPodConditions: tempOnPodConditions,
  );
}