HorizontalPodAutoscalerSpec.fromJson constructor

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

Creates a HorizontalPodAutoscalerSpec from JSON data.

Implementation

factory HorizontalPodAutoscalerSpec.fromJson(Map<String, dynamic> json) {
  final tempMaxReplicasJson = json['maxReplicas'];
  final tempMinReplicasJson = json['minReplicas'];
  final tempScaleTargetRefJson = json['scaleTargetRef'];
  final tempTargetCPUUtilizationPercentageJson =
      json['targetCPUUtilizationPercentage'];

  final int tempMaxReplicas = tempMaxReplicasJson;
  final int? tempMinReplicas = tempMinReplicasJson;
  final CrossVersionObjectReference tempScaleTargetRef =
      CrossVersionObjectReference.fromJson(tempScaleTargetRefJson);
  final int? tempTargetCPUUtilizationPercentage =
      tempTargetCPUUtilizationPercentageJson;

  return HorizontalPodAutoscalerSpec(
    maxReplicas: tempMaxReplicas,
    minReplicas: tempMinReplicas,
    scaleTargetRef: tempScaleTargetRef,
    targetCPUUtilizationPercentage: tempTargetCPUUtilizationPercentage,
  );
}