HPAScalingRules.fromJson constructor

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

Creates a HPAScalingRules from JSON data.

Implementation

factory HPAScalingRules.fromJson(Map<String, dynamic> json) {
  final tempPoliciesJson = json['policies'];
  final tempSelectPolicyJson = json['selectPolicy'];
  final tempStabilizationWindowSecondsJson =
      json['stabilizationWindowSeconds'];

  final List<HPAScalingPolicy>? tempPolicies = tempPoliciesJson != null
      ? List<dynamic>.from(tempPoliciesJson)
          .map(
            (e) => HPAScalingPolicy.fromJson(
              Map<String, dynamic>.from(e),
            ),
          )
          .toList()
      : null;

  final String? tempSelectPolicy = tempSelectPolicyJson;
  final int? tempStabilizationWindowSeconds =
      tempStabilizationWindowSecondsJson;

  return HPAScalingRules(
    policies: tempPolicies,
    selectPolicy: tempSelectPolicy,
    stabilizationWindowSeconds: tempStabilizationWindowSeconds,
  );
}