PodAffinityTerm.fromJson constructor

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

Creates a PodAffinityTerm from JSON data.

Implementation

factory PodAffinityTerm.fromJson(Map<String, dynamic> json) {
  final tempLabelSelectorJson = json['labelSelector'];
  final tempNamespaceSelectorJson = json['namespaceSelector'];
  final tempNamespacesJson = json['namespaces'];
  final tempTopologyKeyJson = json['topologyKey'];

  final LabelSelector? tempLabelSelector = tempLabelSelectorJson != null
      ? LabelSelector.fromJson(tempLabelSelectorJson)
      : null;
  final LabelSelector? tempNamespaceSelector =
      tempNamespaceSelectorJson != null
          ? LabelSelector.fromJson(tempNamespaceSelectorJson)
          : null;
  final List<String>? tempNamespaces = tempNamespacesJson != null
      ? List<String>.from(tempNamespacesJson)
      : null;
  final String tempTopologyKey = tempTopologyKeyJson;

  return PodAffinityTerm(
    labelSelector: tempLabelSelector,
    namespaceSelector: tempNamespaceSelector,
    namespaces: tempNamespaces,
    topologyKey: tempTopologyKey,
  );
}