toJson method

Map<String, Object> toJson()

Converts a ReplicaSetStatus instance to JSON data.

Implementation

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

  final tempAvailableReplicas = availableReplicas;
  final tempConditions = conditions;
  final tempFullyLabeledReplicas = fullyLabeledReplicas;
  final tempObservedGeneration = observedGeneration;
  final tempReadyReplicas = readyReplicas;
  final tempReplicas = replicas;

  if (tempAvailableReplicas != null) {
    jsonData['availableReplicas'] = tempAvailableReplicas;
  }

  if (tempConditions != null) {
    jsonData['conditions'] =
        tempConditions.map((e) => e.toJson()).toList(growable: false);
  }

  if (tempFullyLabeledReplicas != null) {
    jsonData['fullyLabeledReplicas'] = tempFullyLabeledReplicas;
  }

  if (tempObservedGeneration != null) {
    jsonData['observedGeneration'] = tempObservedGeneration;
  }

  if (tempReadyReplicas != null) {
    jsonData['readyReplicas'] = tempReadyReplicas;
  }

  jsonData['replicas'] = tempReplicas;

  return jsonData;
}