PodSecurityContext.fromJson constructor

PodSecurityContext.fromJson(
  1. Map<String, dynamic> json
)

Creates a PodSecurityContext from JSON data.

Implementation

factory PodSecurityContext.fromJson(Map<String, dynamic> json) {
  final tempFsGroupJson = json['fsGroup'];
  final tempFsGroupChangePolicyJson = json['fsGroupChangePolicy'];
  final tempRunAsGroupJson = json['runAsGroup'];
  final tempRunAsNonRootJson = json['runAsNonRoot'];
  final tempRunAsUserJson = json['runAsUser'];
  final tempSeLinuxOptionsJson = json['seLinuxOptions'];
  final tempSeccompProfileJson = json['seccompProfile'];
  final tempSupplementalGroupsJson = json['supplementalGroups'];
  final tempSysctlsJson = json['sysctls'];
  final tempWindowsOptionsJson = json['windowsOptions'];

  final int? tempFsGroup = tempFsGroupJson;
  final String? tempFsGroupChangePolicy = tempFsGroupChangePolicyJson;
  final int? tempRunAsGroup = tempRunAsGroupJson;
  final bool? tempRunAsNonRoot = tempRunAsNonRootJson;
  final int? tempRunAsUser = tempRunAsUserJson;
  final SELinuxOptions? tempSeLinuxOptions = tempSeLinuxOptionsJson != null
      ? SELinuxOptions.fromJson(tempSeLinuxOptionsJson)
      : null;
  final SeccompProfile? tempSeccompProfile = tempSeccompProfileJson != null
      ? SeccompProfile.fromJson(tempSeccompProfileJson)
      : null;
  final List<int>? tempSupplementalGroups = tempSupplementalGroupsJson != null
      ? List<int>.from(tempSupplementalGroupsJson)
      : null;

  final List<Sysctl>? tempSysctls = tempSysctlsJson != null
      ? List<dynamic>.from(tempSysctlsJson)
          .map(
            (e) => Sysctl.fromJson(
              Map<String, dynamic>.from(e),
            ),
          )
          .toList()
      : null;

  final WindowsSecurityContextOptions? tempWindowsOptions =
      tempWindowsOptionsJson != null
          ? WindowsSecurityContextOptions.fromJson(tempWindowsOptionsJson)
          : null;

  return PodSecurityContext(
    fsGroup: tempFsGroup,
    fsGroupChangePolicy: tempFsGroupChangePolicy,
    runAsGroup: tempRunAsGroup,
    runAsNonRoot: tempRunAsNonRoot,
    runAsUser: tempRunAsUser,
    seLinuxOptions: tempSeLinuxOptions,
    seccompProfile: tempSeccompProfile,
    supplementalGroups: tempSupplementalGroups,
    sysctls: tempSysctls,
    windowsOptions: tempWindowsOptions,
  );
}