toJson method
Converts a Probe instance to JSON data.
Implementation
Map<String, Object> toJson() {
final jsonData = <String, Object>{};
final tempExec = exec;
final tempFailureThreshold = failureThreshold;
final tempGrpc = grpc;
final tempHttpGet = httpGet;
final tempInitialDelaySeconds = initialDelaySeconds;
final tempPeriodSeconds = periodSeconds;
final tempSuccessThreshold = successThreshold;
final tempTcpSocket = tcpSocket;
final tempTerminationGracePeriodSeconds = terminationGracePeriodSeconds;
final tempTimeoutSeconds = timeoutSeconds;
if (tempExec != null) {
jsonData['exec'] = tempExec.toJson();
}
if (tempFailureThreshold != null) {
jsonData['failureThreshold'] = tempFailureThreshold;
}
if (tempGrpc != null) {
jsonData['grpc'] = tempGrpc.toJson();
}
if (tempHttpGet != null) {
jsonData['httpGet'] = tempHttpGet.toJson();
}
if (tempInitialDelaySeconds != null) {
jsonData['initialDelaySeconds'] = tempInitialDelaySeconds;
}
if (tempPeriodSeconds != null) {
jsonData['periodSeconds'] = tempPeriodSeconds;
}
if (tempSuccessThreshold != null) {
jsonData['successThreshold'] = tempSuccessThreshold;
}
if (tempTcpSocket != null) {
jsonData['tcpSocket'] = tempTcpSocket.toJson();
}
if (tempTerminationGracePeriodSeconds != null) {
jsonData['terminationGracePeriodSeconds'] =
tempTerminationGracePeriodSeconds;
}
if (tempTimeoutSeconds != null) {
jsonData['timeoutSeconds'] = tempTimeoutSeconds;
}
return jsonData;
}