PodStatus.fromJson constructor
Creates a PodStatus from JSON data.
Implementation
factory PodStatus.fromJson(Map<String, dynamic> json) {
final tempConditionsJson = json['conditions'];
final tempContainerStatusesJson = json['containerStatuses'];
final tempEphemeralContainerStatusesJson =
json['ephemeralContainerStatuses'];
final tempHostIPJson = json['hostIP'];
final tempInitContainerStatusesJson = json['initContainerStatuses'];
final tempMessageJson = json['message'];
final tempNominatedNodeNameJson = json['nominatedNodeName'];
final tempPhaseJson = json['phase'];
final tempPodIPJson = json['podIP'];
final tempPodIPsJson = json['podIPs'];
final tempQosClassJson = json['qosClass'];
final tempReasonJson = json['reason'];
final tempResizeJson = json['resize'];
final tempStartTimeJson = json['startTime'];
final List<PodCondition>? tempConditions = tempConditionsJson != null
? List<dynamic>.from(tempConditionsJson)
.map(
(e) => PodCondition.fromJson(
Map<String, dynamic>.from(e),
),
)
.toList()
: null;
final List<ContainerStatus>? tempContainerStatuses =
tempContainerStatusesJson != null
? List<dynamic>.from(tempContainerStatusesJson)
.map(
(e) => ContainerStatus.fromJson(
Map<String, dynamic>.from(e),
),
)
.toList()
: null;
final List<ContainerStatus>? tempEphemeralContainerStatuses =
tempEphemeralContainerStatusesJson != null
? List<dynamic>.from(tempEphemeralContainerStatusesJson)
.map(
(e) => ContainerStatus.fromJson(
Map<String, dynamic>.from(e),
),
)
.toList()
: null;
final String? tempHostIP = tempHostIPJson;
final List<ContainerStatus>? tempInitContainerStatuses =
tempInitContainerStatusesJson != null
? List<dynamic>.from(tempInitContainerStatusesJson)
.map(
(e) => ContainerStatus.fromJson(
Map<String, dynamic>.from(e),
),
)
.toList()
: null;
final String? tempMessage = tempMessageJson;
final String? tempNominatedNodeName = tempNominatedNodeNameJson;
final String? tempPhase = tempPhaseJson;
final String? tempPodIP = tempPodIPJson;
final List<PodIP>? tempPodIPs = tempPodIPsJson != null
? List<dynamic>.from(tempPodIPsJson)
.map(
(e) => PodIP.fromJson(
Map<String, dynamic>.from(e),
),
)
.toList()
: null;
final String? tempQosClass = tempQosClassJson;
final String? tempReason = tempReasonJson;
final String? tempResize = tempResizeJson;
final DateTime? tempStartTime =
tempStartTimeJson != null ? DateTime.tryParse(tempStartTimeJson) : null;
return PodStatus(
conditions: tempConditions,
containerStatuses: tempContainerStatuses,
ephemeralContainerStatuses: tempEphemeralContainerStatuses,
hostIP: tempHostIP,
initContainerStatuses: tempInitContainerStatuses,
message: tempMessage,
nominatedNodeName: tempNominatedNodeName,
phase: tempPhase,
podIP: tempPodIP,
podIPs: tempPodIPs,
qosClass: tempQosClass,
reason: tempReason,
resize: tempResize,
startTime: tempStartTime,
);
}