toJson method
Converts a StatefulSetSpec instance to JSON data.
Implementation
Map<String, Object> toJson() {
final jsonData = <String, Object>{};
final tempMinReadySeconds = minReadySeconds;
final tempOrdinals = ordinals;
final tempPersistentVolumeClaimRetentionPolicy =
persistentVolumeClaimRetentionPolicy;
final tempPodManagementPolicy = podManagementPolicy;
final tempReplicas = replicas;
final tempRevisionHistoryLimit = revisionHistoryLimit;
final tempSelector = selector;
final tempServiceName = serviceName;
final tempTemplate = template;
final tempUpdateStrategy = updateStrategy;
final tempVolumeClaimTemplates = volumeClaimTemplates;
if (tempMinReadySeconds != null) {
jsonData['minReadySeconds'] = tempMinReadySeconds;
}
if (tempOrdinals != null) {
jsonData['ordinals'] = tempOrdinals.toJson();
}
if (tempPersistentVolumeClaimRetentionPolicy != null) {
jsonData['persistentVolumeClaimRetentionPolicy'] =
tempPersistentVolumeClaimRetentionPolicy.toJson();
}
if (tempPodManagementPolicy != null) {
jsonData['podManagementPolicy'] = tempPodManagementPolicy;
}
if (tempReplicas != null) {
jsonData['replicas'] = tempReplicas;
}
if (tempRevisionHistoryLimit != null) {
jsonData['revisionHistoryLimit'] = tempRevisionHistoryLimit;
}
jsonData['selector'] = tempSelector.toJson();
jsonData['serviceName'] = tempServiceName;
jsonData['template'] = tempTemplate.toJson();
if (tempUpdateStrategy != null) {
jsonData['updateStrategy'] = tempUpdateStrategy.toJson();
}
if (tempVolumeClaimTemplates != null) {
jsonData['volumeClaimTemplates'] = tempVolumeClaimTemplates
.map((e) => e.toJson())
.toList(growable: false);
}
return jsonData;
}