toJson method

Map<String, Object> toJson()

Converts a HPAScalingRules instance to JSON data.

Implementation

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

  final tempPolicies = policies;
  final tempSelectPolicy = selectPolicy;
  final tempStabilizationWindowSeconds = stabilizationWindowSeconds;

  if (tempPolicies != null) {
    jsonData['policies'] =
        tempPolicies.map((e) => e.toJson()).toList(growable: false);
  }

  if (tempSelectPolicy != null) {
    jsonData['selectPolicy'] = tempSelectPolicy;
  }

  if (tempStabilizationWindowSeconds != null) {
    jsonData['stabilizationWindowSeconds'] = tempStabilizationWindowSeconds;
  }

  return jsonData;
}