NetworkPolicyPeer.fromJson constructor

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

Creates a NetworkPolicyPeer from JSON data.

Implementation

factory NetworkPolicyPeer.fromJson(Map<String, dynamic> json) {
  final tempIpBlockJson = json['ipBlock'];
  final tempNamespaceSelectorJson = json['namespaceSelector'];
  final tempPodSelectorJson = json['podSelector'];

  final IPBlock? tempIpBlock =
      tempIpBlockJson != null ? IPBlock.fromJson(tempIpBlockJson) : null;
  final LabelSelector? tempNamespaceSelector =
      tempNamespaceSelectorJson != null
          ? LabelSelector.fromJson(tempNamespaceSelectorJson)
          : null;
  final LabelSelector? tempPodSelector = tempPodSelectorJson != null
      ? LabelSelector.fromJson(tempPodSelectorJson)
      : null;

  return NetworkPolicyPeer(
    ipBlock: tempIpBlock,
    namespaceSelector: tempNamespaceSelector,
    podSelector: tempPodSelector,
  );
}