toJson method

Map<String, Object> toJson()

Converts a StatefulSetStatus instance to JSON data.

Implementation

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

  final tempAvailableReplicas = availableReplicas;
  final tempCollisionCount = collisionCount;
  final tempConditions = conditions;
  final tempCurrentReplicas = currentReplicas;
  final tempCurrentRevision = currentRevision;
  final tempObservedGeneration = observedGeneration;
  final tempReadyReplicas = readyReplicas;
  final tempReplicas = replicas;
  final tempUpdateRevision = updateRevision;
  final tempUpdatedReplicas = updatedReplicas;

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

  if (tempCollisionCount != null) {
    jsonData['collisionCount'] = tempCollisionCount;
  }

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

  if (tempCurrentReplicas != null) {
    jsonData['currentReplicas'] = tempCurrentReplicas;
  }

  if (tempCurrentRevision != null) {
    jsonData['currentRevision'] = tempCurrentRevision;
  }

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

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

  jsonData['replicas'] = tempReplicas;

  if (tempUpdateRevision != null) {
    jsonData['updateRevision'] = tempUpdateRevision;
  }

  if (tempUpdatedReplicas != null) {
    jsonData['updatedReplicas'] = tempUpdatedReplicas;
  }

  return jsonData;
}