toJson method
Converts a PodSecurityContext instance to JSON data.
Implementation
Map<String, Object> toJson() {
final jsonData = <String, Object>{};
final tempFsGroup = fsGroup;
final tempFsGroupChangePolicy = fsGroupChangePolicy;
final tempRunAsGroup = runAsGroup;
final tempRunAsNonRoot = runAsNonRoot;
final tempRunAsUser = runAsUser;
final tempSeLinuxOptions = seLinuxOptions;
final tempSeccompProfile = seccompProfile;
final tempSupplementalGroups = supplementalGroups;
final tempSysctls = sysctls;
final tempWindowsOptions = windowsOptions;
if (tempFsGroup != null) {
jsonData['fsGroup'] = tempFsGroup;
}
if (tempFsGroupChangePolicy != null) {
jsonData['fsGroupChangePolicy'] = tempFsGroupChangePolicy;
}
if (tempRunAsGroup != null) {
jsonData['runAsGroup'] = tempRunAsGroup;
}
if (tempRunAsNonRoot != null) {
jsonData['runAsNonRoot'] = tempRunAsNonRoot;
}
if (tempRunAsUser != null) {
jsonData['runAsUser'] = tempRunAsUser;
}
if (tempSeLinuxOptions != null) {
jsonData['seLinuxOptions'] = tempSeLinuxOptions.toJson();
}
if (tempSeccompProfile != null) {
jsonData['seccompProfile'] = tempSeccompProfile.toJson();
}
if (tempSupplementalGroups != null) {
jsonData['supplementalGroups'] = tempSupplementalGroups;
}
if (tempSysctls != null) {
jsonData['sysctls'] =
tempSysctls.map((e) => e.toJson()).toList(growable: false);
}
if (tempWindowsOptions != null) {
jsonData['windowsOptions'] = tempWindowsOptions.toJson();
}
return jsonData;
}