toJson method

Map<String, Object> toJson()

Converts a HorizontalPodAutoscalerStatus instance to JSON data.

Implementation

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

  final tempCurrentCPUUtilizationPercentage = currentCPUUtilizationPercentage;
  final tempCurrentReplicas = currentReplicas;
  final tempDesiredReplicas = desiredReplicas;
  final tempLastScaleTime = lastScaleTime;
  final tempObservedGeneration = observedGeneration;

  if (tempCurrentCPUUtilizationPercentage != null) {
    jsonData['currentCPUUtilizationPercentage'] =
        tempCurrentCPUUtilizationPercentage;
  }

  jsonData['currentReplicas'] = tempCurrentReplicas;

  jsonData['desiredReplicas'] = tempDesiredReplicas;

  if (tempLastScaleTime != null) {
    jsonData['lastScaleTime'] = tempLastScaleTime;
  }

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

  return jsonData;
}