toJson method
Converts a ServiceSpec instance to JSON data.
Implementation
Map<String, Object> toJson() {
final jsonData = <String, Object>{};
final tempAllocateLoadBalancerNodePorts = allocateLoadBalancerNodePorts;
final tempClusterIP = clusterIP;
final tempClusterIPs = clusterIPs;
final tempExternalIPs = externalIPs;
final tempExternalName = externalName;
final tempExternalTrafficPolicy = externalTrafficPolicy;
final tempHealthCheckNodePort = healthCheckNodePort;
final tempInternalTrafficPolicy = internalTrafficPolicy;
final tempIpFamilies = ipFamilies;
final tempIpFamilyPolicy = ipFamilyPolicy;
final tempLoadBalancerClass = loadBalancerClass;
final tempLoadBalancerIP = loadBalancerIP;
final tempLoadBalancerSourceRanges = loadBalancerSourceRanges;
final tempPorts = ports;
final tempPublishNotReadyAddresses = publishNotReadyAddresses;
final tempSelector = selector;
final tempSessionAffinity = sessionAffinity;
final tempSessionAffinityConfig = sessionAffinityConfig;
final tempType = type;
if (tempAllocateLoadBalancerNodePorts != null) {
jsonData['allocateLoadBalancerNodePorts'] =
tempAllocateLoadBalancerNodePorts;
}
if (tempClusterIP != null) {
jsonData['clusterIP'] = tempClusterIP;
}
if (tempClusterIPs != null) {
jsonData['clusterIPs'] = tempClusterIPs;
}
if (tempExternalIPs != null) {
jsonData['externalIPs'] = tempExternalIPs;
}
if (tempExternalName != null) {
jsonData['externalName'] = tempExternalName;
}
if (tempExternalTrafficPolicy != null) {
jsonData['externalTrafficPolicy'] = tempExternalTrafficPolicy;
}
if (tempHealthCheckNodePort != null) {
jsonData['healthCheckNodePort'] = tempHealthCheckNodePort;
}
if (tempInternalTrafficPolicy != null) {
jsonData['internalTrafficPolicy'] = tempInternalTrafficPolicy;
}
if (tempIpFamilies != null) {
jsonData['ipFamilies'] = tempIpFamilies;
}
if (tempIpFamilyPolicy != null) {
jsonData['ipFamilyPolicy'] = tempIpFamilyPolicy;
}
if (tempLoadBalancerClass != null) {
jsonData['loadBalancerClass'] = tempLoadBalancerClass;
}
if (tempLoadBalancerIP != null) {
jsonData['loadBalancerIP'] = tempLoadBalancerIP;
}
if (tempLoadBalancerSourceRanges != null) {
jsonData['loadBalancerSourceRanges'] = tempLoadBalancerSourceRanges;
}
if (tempPorts != null) {
jsonData['ports'] =
tempPorts.map((e) => e.toJson()).toList(growable: false);
}
if (tempPublishNotReadyAddresses != null) {
jsonData['publishNotReadyAddresses'] = tempPublishNotReadyAddresses;
}
if (tempSelector != null) {
jsonData['selector'] = tempSelector;
}
if (tempSessionAffinity != null) {
jsonData['sessionAffinity'] = tempSessionAffinity;
}
if (tempSessionAffinityConfig != null) {
jsonData['sessionAffinityConfig'] = tempSessionAffinityConfig.toJson();
}
if (tempType != null) {
jsonData['type'] = tempType;
}
return jsonData;
}