Scheduling.fromJson constructor

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

Creates a Scheduling from JSON data.

Implementation

factory Scheduling.fromJson(Map<String, dynamic> json) {
  final tempNodeSelectorJson = json['nodeSelector'];
  final tempTolerationsJson = json['tolerations'];

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

  final List<Toleration>? tempTolerations = tempTolerationsJson != null
      ? List<dynamic>.from(tempTolerationsJson)
          .map(
            (e) => Toleration.fromJson(
              Map<String, dynamic>.from(e),
            ),
          )
          .toList()
      : null;

  return Scheduling(
    nodeSelector: tempNodeSelector,
    tolerations: tempTolerations,
  );
}