toJson method

Map<String, Object> toJson()

Converts a PodAffinityTerm instance to JSON data.

Implementation

Map<String, Object> toJson() {
  final jsonData = <String, Object>{};

  final tempLabelSelector = labelSelector;
  final tempNamespaceSelector = namespaceSelector;
  final tempNamespaces = namespaces;
  final tempTopologyKey = topologyKey;

  if (tempLabelSelector != null) {
    jsonData['labelSelector'] = tempLabelSelector.toJson();
  }

  if (tempNamespaceSelector != null) {
    jsonData['namespaceSelector'] = tempNamespaceSelector.toJson();
  }

  if (tempNamespaces != null) {
    jsonData['namespaces'] = tempNamespaces;
  }

  jsonData['topologyKey'] = tempTopologyKey;

  return jsonData;
}