toJson method
Converts a HorizontalPodAutoscalerStatus instance to JSON data.
Implementation
Map<String, Object> toJson() {
final jsonData = <String, Object>{};
final tempConditions = conditions;
final tempCurrentMetrics = currentMetrics;
final tempCurrentReplicas = currentReplicas;
final tempDesiredReplicas = desiredReplicas;
final tempLastScaleTime = lastScaleTime;
final tempObservedGeneration = observedGeneration;
if (tempConditions != null) {
jsonData['conditions'] =
tempConditions.map((e) => e.toJson()).toList(growable: false);
}
if (tempCurrentMetrics != null) {
jsonData['currentMetrics'] =
tempCurrentMetrics.map((e) => e.toJson()).toList(growable: false);
}
if (tempCurrentReplicas != null) {
jsonData['currentReplicas'] = tempCurrentReplicas;
}
jsonData['desiredReplicas'] = tempDesiredReplicas;
if (tempLastScaleTime != null) {
jsonData['lastScaleTime'] = tempLastScaleTime;
}
if (tempObservedGeneration != null) {
jsonData['observedGeneration'] = tempObservedGeneration;
}
return jsonData;
}