toJson method
Converts a PodSpec instance to JSON data.
Implementation
Map<String, Object> toJson() {
final jsonData = <String, Object>{};
final tempActiveDeadlineSeconds = activeDeadlineSeconds;
final tempAffinity = affinity;
final tempAutomountServiceAccountToken = automountServiceAccountToken;
final tempContainers = containers;
final tempDnsConfig = dnsConfig;
final tempDnsPolicy = dnsPolicy;
final tempEnableServiceLinks = enableServiceLinks;
final tempEphemeralContainers = ephemeralContainers;
final tempHostAliases = hostAliases;
final tempHostIPC = hostIPC;
final tempHostNetwork = hostNetwork;
final tempHostPID = hostPID;
final tempHostUsers = hostUsers;
final tempHostname = hostname;
final tempImagePullSecrets = imagePullSecrets;
final tempInitContainers = initContainers;
final tempNodeName = nodeName;
final tempNodeSelector = nodeSelector;
final tempOs = os;
final tempOverhead = overhead;
final tempPreemptionPolicy = preemptionPolicy;
final tempPriority = priority;
final tempPriorityClassName = priorityClassName;
final tempReadinessGates = readinessGates;
final tempResourceClaims = resourceClaims;
final tempRestartPolicy = restartPolicy;
final tempRuntimeClassName = runtimeClassName;
final tempSchedulerName = schedulerName;
final tempSchedulingGates = schedulingGates;
final tempSecurityContext = securityContext;
final tempServiceAccount = serviceAccount;
final tempServiceAccountName = serviceAccountName;
final tempSetHostnameAsFQDN = setHostnameAsFQDN;
final tempShareProcessNamespace = shareProcessNamespace;
final tempSubdomain = subdomain;
final tempTerminationGracePeriodSeconds = terminationGracePeriodSeconds;
final tempTolerations = tolerations;
final tempTopologySpreadConstraints = topologySpreadConstraints;
final tempVolumes = volumes;
if (tempActiveDeadlineSeconds != null) {
jsonData['activeDeadlineSeconds'] = tempActiveDeadlineSeconds;
}
if (tempAffinity != null) {
jsonData['affinity'] = tempAffinity.toJson();
}
if (tempAutomountServiceAccountToken != null) {
jsonData['automountServiceAccountToken'] =
tempAutomountServiceAccountToken;
}
jsonData['containers'] =
tempContainers.map((e) => e.toJson()).toList(growable: false);
if (tempDnsConfig != null) {
jsonData['dnsConfig'] = tempDnsConfig.toJson();
}
if (tempDnsPolicy != null) {
jsonData['dnsPolicy'] = tempDnsPolicy;
}
if (tempEnableServiceLinks != null) {
jsonData['enableServiceLinks'] = tempEnableServiceLinks;
}
if (tempEphemeralContainers != null) {
jsonData['ephemeralContainers'] = tempEphemeralContainers
.map((e) => e.toJson())
.toList(growable: false);
}
if (tempHostAliases != null) {
jsonData['hostAliases'] =
tempHostAliases.map((e) => e.toJson()).toList(growable: false);
}
if (tempHostIPC != null) {
jsonData['hostIPC'] = tempHostIPC;
}
if (tempHostNetwork != null) {
jsonData['hostNetwork'] = tempHostNetwork;
}
if (tempHostPID != null) {
jsonData['hostPID'] = tempHostPID;
}
if (tempHostUsers != null) {
jsonData['hostUsers'] = tempHostUsers;
}
if (tempHostname != null) {
jsonData['hostname'] = tempHostname;
}
if (tempImagePullSecrets != null) {
jsonData['imagePullSecrets'] =
tempImagePullSecrets.map((e) => e.toJson()).toList(growable: false);
}
if (tempInitContainers != null) {
jsonData['initContainers'] =
tempInitContainers.map((e) => e.toJson()).toList(growable: false);
}
if (tempNodeName != null) {
jsonData['nodeName'] = tempNodeName;
}
if (tempNodeSelector != null) {
jsonData['nodeSelector'] = tempNodeSelector;
}
if (tempOs != null) {
jsonData['os'] = tempOs.toJson();
}
if (tempOverhead != null) {
jsonData['overhead'] = tempOverhead;
}
if (tempPreemptionPolicy != null) {
jsonData['preemptionPolicy'] = tempPreemptionPolicy;
}
if (tempPriority != null) {
jsonData['priority'] = tempPriority;
}
if (tempPriorityClassName != null) {
jsonData['priorityClassName'] = tempPriorityClassName;
}
if (tempReadinessGates != null) {
jsonData['readinessGates'] =
tempReadinessGates.map((e) => e.toJson()).toList(growable: false);
}
if (tempResourceClaims != null) {
jsonData['resourceClaims'] =
tempResourceClaims.map((e) => e.toJson()).toList(growable: false);
}
if (tempRestartPolicy != null) {
jsonData['restartPolicy'] = tempRestartPolicy;
}
if (tempRuntimeClassName != null) {
jsonData['runtimeClassName'] = tempRuntimeClassName;
}
if (tempSchedulerName != null) {
jsonData['schedulerName'] = tempSchedulerName;
}
if (tempSchedulingGates != null) {
jsonData['schedulingGates'] =
tempSchedulingGates.map((e) => e.toJson()).toList(growable: false);
}
if (tempSecurityContext != null) {
jsonData['securityContext'] = tempSecurityContext.toJson();
}
if (tempServiceAccount != null) {
jsonData['serviceAccount'] = tempServiceAccount;
}
if (tempServiceAccountName != null) {
jsonData['serviceAccountName'] = tempServiceAccountName;
}
if (tempSetHostnameAsFQDN != null) {
jsonData['setHostnameAsFQDN'] = tempSetHostnameAsFQDN;
}
if (tempShareProcessNamespace != null) {
jsonData['shareProcessNamespace'] = tempShareProcessNamespace;
}
if (tempSubdomain != null) {
jsonData['subdomain'] = tempSubdomain;
}
if (tempTerminationGracePeriodSeconds != null) {
jsonData['terminationGracePeriodSeconds'] =
tempTerminationGracePeriodSeconds;
}
if (tempTolerations != null) {
jsonData['tolerations'] =
tempTolerations.map((e) => e.toJson()).toList(growable: false);
}
if (tempTopologySpreadConstraints != null) {
jsonData['topologySpreadConstraints'] = tempTopologySpreadConstraints
.map((e) => e.toJson())
.toList(growable: false);
}
if (tempVolumes != null) {
jsonData['volumes'] =
tempVolumes.map((e) => e.toJson()).toList(growable: false);
}
return jsonData;
}