HorizontalPodAutoscalerStatus.fromJson constructor

HorizontalPodAutoscalerStatus.fromJson(
  1. Map<String, dynamic> json
)

Creates a HorizontalPodAutoscalerStatus from JSON data.

Implementation

factory HorizontalPodAutoscalerStatus.fromJson(Map<String, dynamic> json) {
  final tempCurrentCPUUtilizationPercentageJson =
      json['currentCPUUtilizationPercentage'];
  final tempCurrentReplicasJson = json['currentReplicas'];
  final tempDesiredReplicasJson = json['desiredReplicas'];
  final tempLastScaleTimeJson = json['lastScaleTime'];
  final tempObservedGenerationJson = json['observedGeneration'];

  final int? tempCurrentCPUUtilizationPercentage =
      tempCurrentCPUUtilizationPercentageJson;
  final int tempCurrentReplicas = tempCurrentReplicasJson;
  final int tempDesiredReplicas = tempDesiredReplicasJson;
  final DateTime? tempLastScaleTime = tempLastScaleTimeJson != null
      ? DateTime.tryParse(tempLastScaleTimeJson)
      : null;
  final int? tempObservedGeneration = tempObservedGenerationJson;

  return HorizontalPodAutoscalerStatus(
    currentCPUUtilizationPercentage: tempCurrentCPUUtilizationPercentage,
    currentReplicas: tempCurrentReplicas,
    desiredReplicas: tempDesiredReplicas,
    lastScaleTime: tempLastScaleTime,
    observedGeneration: tempObservedGeneration,
  );
}