toJson method
Converts a ContainerPort instance to JSON data.
Implementation
Map<String, Object> toJson() {
final jsonData = <String, Object>{};
final tempContainerPort = containerPort;
final tempHostIP = hostIP;
final tempHostPort = hostPort;
final tempName = name;
final tempProtocol = protocol;
jsonData['containerPort'] = tempContainerPort;
if (tempHostIP != null) {
jsonData['hostIP'] = tempHostIP;
}
if (tempHostPort != null) {
jsonData['hostPort'] = tempHostPort;
}
if (tempName != null) {
jsonData['name'] = tempName;
}
if (tempProtocol != null) {
jsonData['protocol'] = tempProtocol;
}
return jsonData;
}