toJson method

Map<String, Object> toJson()

Converts a CronJobSpec instance to JSON data.

Implementation

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

  final tempConcurrencyPolicy = concurrencyPolicy;
  final tempFailedJobsHistoryLimit = failedJobsHistoryLimit;
  final tempJobTemplate = jobTemplate;
  final tempSchedule = schedule;
  final tempStartingDeadlineSeconds = startingDeadlineSeconds;
  final tempSuccessfulJobsHistoryLimit = successfulJobsHistoryLimit;
  final tempSuspend = suspend;
  final tempTimeZone = timeZone;

  if (tempConcurrencyPolicy != null) {
    jsonData['concurrencyPolicy'] = tempConcurrencyPolicy;
  }

  if (tempFailedJobsHistoryLimit != null) {
    jsonData['failedJobsHistoryLimit'] = tempFailedJobsHistoryLimit;
  }

  jsonData['jobTemplate'] = tempJobTemplate.toJson();

  jsonData['schedule'] = tempSchedule;

  if (tempStartingDeadlineSeconds != null) {
    jsonData['startingDeadlineSeconds'] = tempStartingDeadlineSeconds;
  }

  if (tempSuccessfulJobsHistoryLimit != null) {
    jsonData['successfulJobsHistoryLimit'] = tempSuccessfulJobsHistoryLimit;
  }

  if (tempSuspend != null) {
    jsonData['suspend'] = tempSuspend;
  }

  if (tempTimeZone != null) {
    jsonData['timeZone'] = tempTimeZone;
  }

  return jsonData;
}