JobSpec.fromJson constructor

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

Creates a JobSpec from JSON data.

Implementation

factory JobSpec.fromJson(Map<String, dynamic> json) {
  final tempActiveDeadlineSecondsJson = json['activeDeadlineSeconds'];
  final tempBackoffLimitJson = json['backoffLimit'];
  final tempCompletionModeJson = json['completionMode'];
  final tempCompletionsJson = json['completions'];
  final tempManualSelectorJson = json['manualSelector'];
  final tempParallelismJson = json['parallelism'];
  final tempPodFailurePolicyJson = json['podFailurePolicy'];
  final tempSelectorJson = json['selector'];
  final tempSuspendJson = json['suspend'];
  final tempTemplateJson = json['template'];
  final tempTtlSecondsAfterFinishedJson = json['ttlSecondsAfterFinished'];

  final int? tempActiveDeadlineSeconds = tempActiveDeadlineSecondsJson;
  final int? tempBackoffLimit = tempBackoffLimitJson;
  final String? tempCompletionMode = tempCompletionModeJson;
  final int? tempCompletions = tempCompletionsJson;
  final bool? tempManualSelector = tempManualSelectorJson;
  final int? tempParallelism = tempParallelismJson;
  final PodFailurePolicy? tempPodFailurePolicy =
      tempPodFailurePolicyJson != null
          ? PodFailurePolicy.fromJson(tempPodFailurePolicyJson)
          : null;
  final LabelSelector? tempSelector = tempSelectorJson != null
      ? LabelSelector.fromJson(tempSelectorJson)
      : null;
  final bool? tempSuspend = tempSuspendJson;
  final PodTemplateSpec tempTemplate =
      PodTemplateSpec.fromJson(tempTemplateJson);
  final int? tempTtlSecondsAfterFinished = tempTtlSecondsAfterFinishedJson;

  return JobSpec(
    activeDeadlineSeconds: tempActiveDeadlineSeconds,
    backoffLimit: tempBackoffLimit,
    completionMode: tempCompletionMode,
    completions: tempCompletions,
    manualSelector: tempManualSelector,
    parallelism: tempParallelism,
    podFailurePolicy: tempPodFailurePolicy,
    selector: tempSelector,
    suspend: tempSuspend,
    template: tempTemplate,
    ttlSecondsAfterFinished: tempTtlSecondsAfterFinished,
  );
}