toJson method

Map<String, Object> toJson()

Converts a DeploymentSpec instance to JSON data.

Implementation

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

  final tempMinReadySeconds = minReadySeconds;
  final tempPaused = paused;
  final tempProgressDeadlineSeconds = progressDeadlineSeconds;
  final tempReplicas = replicas;
  final tempRevisionHistoryLimit = revisionHistoryLimit;
  final tempSelector = selector;
  final tempStrategy = strategy;
  final tempTemplate = template;

  if (tempMinReadySeconds != null) {
    jsonData['minReadySeconds'] = tempMinReadySeconds;
  }

  if (tempPaused != null) {
    jsonData['paused'] = tempPaused;
  }

  if (tempProgressDeadlineSeconds != null) {
    jsonData['progressDeadlineSeconds'] = tempProgressDeadlineSeconds;
  }

  if (tempReplicas != null) {
    jsonData['replicas'] = tempReplicas;
  }

  if (tempRevisionHistoryLimit != null) {
    jsonData['revisionHistoryLimit'] = tempRevisionHistoryLimit;
  }

  jsonData['selector'] = tempSelector.toJson();

  if (tempStrategy != null) {
    jsonData['strategy'] = tempStrategy.toJson();
  }

  jsonData['template'] = tempTemplate.toJson();

  return jsonData;
}