TopologySpreadConstraint.fromJson constructor
Creates a TopologySpreadConstraint from JSON data.
Implementation
factory TopologySpreadConstraint.fromJson(Map<String, dynamic> json) {
final tempLabelSelectorJson = json['labelSelector'];
final tempMatchLabelKeysJson = json['matchLabelKeys'];
final tempMaxSkewJson = json['maxSkew'];
final tempMinDomainsJson = json['minDomains'];
final tempNodeAffinityPolicyJson = json['nodeAffinityPolicy'];
final tempNodeTaintsPolicyJson = json['nodeTaintsPolicy'];
final tempTopologyKeyJson = json['topologyKey'];
final tempWhenUnsatisfiableJson = json['whenUnsatisfiable'];
final LabelSelector? tempLabelSelector = tempLabelSelectorJson != null
? LabelSelector.fromJson(tempLabelSelectorJson)
: null;
final List<String>? tempMatchLabelKeys = tempMatchLabelKeysJson != null
? List<String>.from(tempMatchLabelKeysJson)
: null;
final int tempMaxSkew = tempMaxSkewJson;
final int? tempMinDomains = tempMinDomainsJson;
final String? tempNodeAffinityPolicy = tempNodeAffinityPolicyJson;
final String? tempNodeTaintsPolicy = tempNodeTaintsPolicyJson;
final String tempTopologyKey = tempTopologyKeyJson;
final String tempWhenUnsatisfiable = tempWhenUnsatisfiableJson;
return TopologySpreadConstraint(
labelSelector: tempLabelSelector,
matchLabelKeys: tempMatchLabelKeys,
maxSkew: tempMaxSkew,
minDomains: tempMinDomains,
nodeAffinityPolicy: tempNodeAffinityPolicy,
nodeTaintsPolicy: tempNodeTaintsPolicy,
topologyKey: tempTopologyKey,
whenUnsatisfiable: tempWhenUnsatisfiable,
);
}