PodSpec.fromJson constructor

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

Creates a PodSpec from JSON data.

Implementation

factory PodSpec.fromJson(Map<String, dynamic> json) {
  final tempActiveDeadlineSecondsJson = json['activeDeadlineSeconds'];
  final tempAffinityJson = json['affinity'];
  final tempAutomountServiceAccountTokenJson =
      json['automountServiceAccountToken'];
  final tempContainersJson = json['containers'];
  final tempDnsConfigJson = json['dnsConfig'];
  final tempDnsPolicyJson = json['dnsPolicy'];
  final tempEnableServiceLinksJson = json['enableServiceLinks'];
  final tempEphemeralContainersJson = json['ephemeralContainers'];
  final tempHostAliasesJson = json['hostAliases'];
  final tempHostIPCJson = json['hostIPC'];
  final tempHostNetworkJson = json['hostNetwork'];
  final tempHostPIDJson = json['hostPID'];
  final tempHostUsersJson = json['hostUsers'];
  final tempHostnameJson = json['hostname'];
  final tempImagePullSecretsJson = json['imagePullSecrets'];
  final tempInitContainersJson = json['initContainers'];
  final tempNodeNameJson = json['nodeName'];
  final tempNodeSelectorJson = json['nodeSelector'];
  final tempOsJson = json['os'];
  final tempOverheadJson = json['overhead'];
  final tempPreemptionPolicyJson = json['preemptionPolicy'];
  final tempPriorityJson = json['priority'];
  final tempPriorityClassNameJson = json['priorityClassName'];
  final tempReadinessGatesJson = json['readinessGates'];
  final tempResourceClaimsJson = json['resourceClaims'];
  final tempRestartPolicyJson = json['restartPolicy'];
  final tempRuntimeClassNameJson = json['runtimeClassName'];
  final tempSchedulerNameJson = json['schedulerName'];
  final tempSchedulingGatesJson = json['schedulingGates'];
  final tempSecurityContextJson = json['securityContext'];
  final tempServiceAccountJson = json['serviceAccount'];
  final tempServiceAccountNameJson = json['serviceAccountName'];
  final tempSetHostnameAsFQDNJson = json['setHostnameAsFQDN'];
  final tempShareProcessNamespaceJson = json['shareProcessNamespace'];
  final tempSubdomainJson = json['subdomain'];
  final tempTerminationGracePeriodSecondsJson =
      json['terminationGracePeriodSeconds'];
  final tempTolerationsJson = json['tolerations'];
  final tempTopologySpreadConstraintsJson = json['topologySpreadConstraints'];
  final tempVolumesJson = json['volumes'];

  final int? tempActiveDeadlineSeconds = tempActiveDeadlineSecondsJson;
  final Affinity? tempAffinity =
      tempAffinityJson != null ? Affinity.fromJson(tempAffinityJson) : null;
  final bool? tempAutomountServiceAccountToken =
      tempAutomountServiceAccountTokenJson;

  final List<Container> tempContainers =
      List<dynamic>.from(tempContainersJson)
          .map(
            (e) => Container.fromJson(
              Map<String, dynamic>.from(e),
            ),
          )
          .toList();

  final PodDNSConfig? tempDnsConfig = tempDnsConfigJson != null
      ? PodDNSConfig.fromJson(tempDnsConfigJson)
      : null;
  final String? tempDnsPolicy = tempDnsPolicyJson;
  final bool? tempEnableServiceLinks = tempEnableServiceLinksJson;

  final List<EphemeralContainer>? tempEphemeralContainers =
      tempEphemeralContainersJson != null
          ? List<dynamic>.from(tempEphemeralContainersJson)
              .map(
                (e) => EphemeralContainer.fromJson(
                  Map<String, dynamic>.from(e),
                ),
              )
              .toList()
          : null;

  final List<HostAlias>? tempHostAliases = tempHostAliasesJson != null
      ? List<dynamic>.from(tempHostAliasesJson)
          .map(
            (e) => HostAlias.fromJson(
              Map<String, dynamic>.from(e),
            ),
          )
          .toList()
      : null;

  final bool? tempHostIPC = tempHostIPCJson;
  final bool? tempHostNetwork = tempHostNetworkJson;
  final bool? tempHostPID = tempHostPIDJson;
  final bool? tempHostUsers = tempHostUsersJson;
  final String? tempHostname = tempHostnameJson;

  final List<LocalObjectReference>? tempImagePullSecrets =
      tempImagePullSecretsJson != null
          ? List<dynamic>.from(tempImagePullSecretsJson)
              .map(
                (e) => LocalObjectReference.fromJson(
                  Map<String, dynamic>.from(e),
                ),
              )
              .toList()
          : null;

  final List<Container>? tempInitContainers = tempInitContainersJson != null
      ? List<dynamic>.from(tempInitContainersJson)
          .map(
            (e) => Container.fromJson(
              Map<String, dynamic>.from(e),
            ),
          )
          .toList()
      : null;

  final String? tempNodeName = tempNodeNameJson;

  final Map<String, String>? tempNodeSelector = tempNodeSelectorJson != null
      ? Map<String, String>.from(tempNodeSelectorJson)
      : null;

  final PodOS? tempOs =
      tempOsJson != null ? PodOS.fromJson(tempOsJson) : null;

  final Map<String, String>? tempOverhead = tempOverheadJson != null
      ? Map<String, String>.from(tempOverheadJson)
      : null;

  final String? tempPreemptionPolicy = tempPreemptionPolicyJson;
  final int? tempPriority = tempPriorityJson;
  final String? tempPriorityClassName = tempPriorityClassNameJson;

  final List<PodReadinessGate>? tempReadinessGates =
      tempReadinessGatesJson != null
          ? List<dynamic>.from(tempReadinessGatesJson)
              .map(
                (e) => PodReadinessGate.fromJson(
                  Map<String, dynamic>.from(e),
                ),
              )
              .toList()
          : null;

  final List<PodResourceClaim>? tempResourceClaims =
      tempResourceClaimsJson != null
          ? List<dynamic>.from(tempResourceClaimsJson)
              .map(
                (e) => PodResourceClaim.fromJson(
                  Map<String, dynamic>.from(e),
                ),
              )
              .toList()
          : null;

  final String? tempRestartPolicy = tempRestartPolicyJson;
  final String? tempRuntimeClassName = tempRuntimeClassNameJson;
  final String? tempSchedulerName = tempSchedulerNameJson;

  final List<PodSchedulingGate>? tempSchedulingGates =
      tempSchedulingGatesJson != null
          ? List<dynamic>.from(tempSchedulingGatesJson)
              .map(
                (e) => PodSchedulingGate.fromJson(
                  Map<String, dynamic>.from(e),
                ),
              )
              .toList()
          : null;

  final PodSecurityContext? tempSecurityContext =
      tempSecurityContextJson != null
          ? PodSecurityContext.fromJson(tempSecurityContextJson)
          : null;
  final String? tempServiceAccount = tempServiceAccountJson;
  final String? tempServiceAccountName = tempServiceAccountNameJson;
  final bool? tempSetHostnameAsFQDN = tempSetHostnameAsFQDNJson;
  final bool? tempShareProcessNamespace = tempShareProcessNamespaceJson;
  final String? tempSubdomain = tempSubdomainJson;
  final int? tempTerminationGracePeriodSeconds =
      tempTerminationGracePeriodSecondsJson;

  final List<Toleration>? tempTolerations = tempTolerationsJson != null
      ? List<dynamic>.from(tempTolerationsJson)
          .map(
            (e) => Toleration.fromJson(
              Map<String, dynamic>.from(e),
            ),
          )
          .toList()
      : null;

  final List<TopologySpreadConstraint>? tempTopologySpreadConstraints =
      tempTopologySpreadConstraintsJson != null
          ? List<dynamic>.from(tempTopologySpreadConstraintsJson)
              .map(
                (e) => TopologySpreadConstraint.fromJson(
                  Map<String, dynamic>.from(e),
                ),
              )
              .toList()
          : null;

  final List<Volume>? tempVolumes = tempVolumesJson != null
      ? List<dynamic>.from(tempVolumesJson)
          .map(
            (e) => Volume.fromJson(
              Map<String, dynamic>.from(e),
            ),
          )
          .toList()
      : null;

  return PodSpec(
    activeDeadlineSeconds: tempActiveDeadlineSeconds,
    affinity: tempAffinity,
    automountServiceAccountToken: tempAutomountServiceAccountToken,
    containers: tempContainers,
    dnsConfig: tempDnsConfig,
    dnsPolicy: tempDnsPolicy,
    enableServiceLinks: tempEnableServiceLinks,
    ephemeralContainers: tempEphemeralContainers,
    hostAliases: tempHostAliases,
    hostIPC: tempHostIPC,
    hostNetwork: tempHostNetwork,
    hostPID: tempHostPID,
    hostUsers: tempHostUsers,
    hostname: tempHostname,
    imagePullSecrets: tempImagePullSecrets,
    initContainers: tempInitContainers,
    nodeName: tempNodeName,
    nodeSelector: tempNodeSelector,
    os: tempOs,
    overhead: tempOverhead,
    preemptionPolicy: tempPreemptionPolicy,
    priority: tempPriority,
    priorityClassName: tempPriorityClassName,
    readinessGates: tempReadinessGates,
    resourceClaims: tempResourceClaims,
    restartPolicy: tempRestartPolicy,
    runtimeClassName: tempRuntimeClassName,
    schedulerName: tempSchedulerName,
    schedulingGates: tempSchedulingGates,
    securityContext: tempSecurityContext,
    serviceAccount: tempServiceAccount,
    serviceAccountName: tempServiceAccountName,
    setHostnameAsFQDN: tempSetHostnameAsFQDN,
    shareProcessNamespace: tempShareProcessNamespace,
    subdomain: tempSubdomain,
    terminationGracePeriodSeconds: tempTerminationGracePeriodSeconds,
    tolerations: tempTolerations,
    topologySpreadConstraints: tempTopologySpreadConstraints,
    volumes: tempVolumes,
  );
}