toJson method
Converts a Container instance to JSON data.
Implementation
Map<String, Object> toJson() {
final jsonData = <String, Object>{};
final tempArgs = args;
final tempCommand = command;
final tempEnv = env;
final tempEnvFrom = envFrom;
final tempImage = image;
final tempImagePullPolicy = imagePullPolicy;
final tempLifecycle = lifecycle;
final tempLivenessProbe = livenessProbe;
final tempName = name;
final tempPorts = ports;
final tempReadinessProbe = readinessProbe;
final tempResizePolicy = resizePolicy;
final tempResources = resources;
final tempSecurityContext = securityContext;
final tempStartupProbe = startupProbe;
final tempStdin = stdin;
final tempStdinOnce = stdinOnce;
final tempTerminationMessagePath = terminationMessagePath;
final tempTerminationMessagePolicy = terminationMessagePolicy;
final tempTty = tty;
final tempVolumeDevices = volumeDevices;
final tempVolumeMounts = volumeMounts;
final tempWorkingDir = workingDir;
if (tempArgs != null) {
jsonData['args'] = tempArgs;
}
if (tempCommand != null) {
jsonData['command'] = tempCommand;
}
if (tempEnv != null) {
jsonData['env'] = tempEnv.map((e) => e.toJson()).toList(growable: false);
}
if (tempEnvFrom != null) {
jsonData['envFrom'] =
tempEnvFrom.map((e) => e.toJson()).toList(growable: false);
}
if (tempImage != null) {
jsonData['image'] = tempImage;
}
if (tempImagePullPolicy != null) {
jsonData['imagePullPolicy'] = tempImagePullPolicy;
}
if (tempLifecycle != null) {
jsonData['lifecycle'] = tempLifecycle.toJson();
}
if (tempLivenessProbe != null) {
jsonData['livenessProbe'] = tempLivenessProbe.toJson();
}
jsonData['name'] = tempName;
if (tempPorts != null) {
jsonData['ports'] =
tempPorts.map((e) => e.toJson()).toList(growable: false);
}
if (tempReadinessProbe != null) {
jsonData['readinessProbe'] = tempReadinessProbe.toJson();
}
if (tempResizePolicy != null) {
jsonData['resizePolicy'] =
tempResizePolicy.map((e) => e.toJson()).toList(growable: false);
}
if (tempResources != null) {
jsonData['resources'] = tempResources.toJson();
}
if (tempSecurityContext != null) {
jsonData['securityContext'] = tempSecurityContext.toJson();
}
if (tempStartupProbe != null) {
jsonData['startupProbe'] = tempStartupProbe.toJson();
}
if (tempStdin != null) {
jsonData['stdin'] = tempStdin;
}
if (tempStdinOnce != null) {
jsonData['stdinOnce'] = tempStdinOnce;
}
if (tempTerminationMessagePath != null) {
jsonData['terminationMessagePath'] = tempTerminationMessagePath;
}
if (tempTerminationMessagePolicy != null) {
jsonData['terminationMessagePolicy'] = tempTerminationMessagePolicy;
}
if (tempTty != null) {
jsonData['tty'] = tempTty;
}
if (tempVolumeDevices != null) {
jsonData['volumeDevices'] =
tempVolumeDevices.map((e) => e.toJson()).toList(growable: false);
}
if (tempVolumeMounts != null) {
jsonData['volumeMounts'] =
tempVolumeMounts.map((e) => e.toJson()).toList(growable: false);
}
if (tempWorkingDir != null) {
jsonData['workingDir'] = tempWorkingDir;
}
return jsonData;
}