toJson method

Map<String, Object> toJson()

Converts a PodFailurePolicyRule instance to JSON data.

Implementation

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

  final tempAction = action;
  final tempOnExitCodes = onExitCodes;
  final tempOnPodConditions = onPodConditions;

  jsonData['action'] = tempAction;

  if (tempOnExitCodes != null) {
    jsonData['onExitCodes'] = tempOnExitCodes.toJson();
  }

  jsonData['onPodConditions'] =
      tempOnPodConditions.map((e) => e.toJson()).toList(growable: false);

  return jsonData;
}