ServiceSpec.fromJson constructor
Creates a ServiceSpec from JSON data.
Implementation
factory ServiceSpec.fromJson(Map<String, dynamic> json) {
final tempAllocateLoadBalancerNodePortsJson =
json['allocateLoadBalancerNodePorts'];
final tempClusterIPJson = json['clusterIP'];
final tempClusterIPsJson = json['clusterIPs'];
final tempExternalIPsJson = json['externalIPs'];
final tempExternalNameJson = json['externalName'];
final tempExternalTrafficPolicyJson = json['externalTrafficPolicy'];
final tempHealthCheckNodePortJson = json['healthCheckNodePort'];
final tempInternalTrafficPolicyJson = json['internalTrafficPolicy'];
final tempIpFamiliesJson = json['ipFamilies'];
final tempIpFamilyPolicyJson = json['ipFamilyPolicy'];
final tempLoadBalancerClassJson = json['loadBalancerClass'];
final tempLoadBalancerIPJson = json['loadBalancerIP'];
final tempLoadBalancerSourceRangesJson = json['loadBalancerSourceRanges'];
final tempPortsJson = json['ports'];
final tempPublishNotReadyAddressesJson = json['publishNotReadyAddresses'];
final tempSelectorJson = json['selector'];
final tempSessionAffinityJson = json['sessionAffinity'];
final tempSessionAffinityConfigJson = json['sessionAffinityConfig'];
final tempTypeJson = json['type'];
final bool? tempAllocateLoadBalancerNodePorts =
tempAllocateLoadBalancerNodePortsJson;
final String? tempClusterIP = tempClusterIPJson;
final List<String>? tempClusterIPs = tempClusterIPsJson != null
? List<String>.from(tempClusterIPsJson)
: null;
final List<String>? tempExternalIPs = tempExternalIPsJson != null
? List<String>.from(tempExternalIPsJson)
: null;
final String? tempExternalName = tempExternalNameJson;
final String? tempExternalTrafficPolicy = tempExternalTrafficPolicyJson;
final int? tempHealthCheckNodePort = tempHealthCheckNodePortJson;
final String? tempInternalTrafficPolicy = tempInternalTrafficPolicyJson;
final List<String>? tempIpFamilies = tempIpFamiliesJson != null
? List<String>.from(tempIpFamiliesJson)
: null;
final String? tempIpFamilyPolicy = tempIpFamilyPolicyJson;
final String? tempLoadBalancerClass = tempLoadBalancerClassJson;
final String? tempLoadBalancerIP = tempLoadBalancerIPJson;
final List<String>? tempLoadBalancerSourceRanges =
tempLoadBalancerSourceRangesJson != null
? List<String>.from(tempLoadBalancerSourceRangesJson)
: null;
final List<ServicePort>? tempPorts = tempPortsJson != null
? List<dynamic>.from(tempPortsJson)
.map(
(e) => ServicePort.fromJson(
Map<String, dynamic>.from(e),
),
)
.toList()
: null;
final bool? tempPublishNotReadyAddresses = tempPublishNotReadyAddressesJson;
final Map<String, String>? tempSelector = tempSelectorJson != null
? Map<String, String>.from(tempSelectorJson)
: null;
final String? tempSessionAffinity = tempSessionAffinityJson;
final SessionAffinityConfig? tempSessionAffinityConfig =
tempSessionAffinityConfigJson != null
? SessionAffinityConfig.fromJson(tempSessionAffinityConfigJson)
: null;
final String? tempType = tempTypeJson;
return ServiceSpec(
allocateLoadBalancerNodePorts: tempAllocateLoadBalancerNodePorts,
clusterIP: tempClusterIP,
clusterIPs: tempClusterIPs,
externalIPs: tempExternalIPs,
externalName: tempExternalName,
externalTrafficPolicy: tempExternalTrafficPolicy,
healthCheckNodePort: tempHealthCheckNodePort,
internalTrafficPolicy: tempInternalTrafficPolicy,
ipFamilies: tempIpFamilies,
ipFamilyPolicy: tempIpFamilyPolicy,
loadBalancerClass: tempLoadBalancerClass,
loadBalancerIP: tempLoadBalancerIP,
loadBalancerSourceRanges: tempLoadBalancerSourceRanges,
ports: tempPorts,
publishNotReadyAddresses: tempPublishNotReadyAddresses,
selector: tempSelector,
sessionAffinity: tempSessionAffinity,
sessionAffinityConfig: tempSessionAffinityConfig,
type: tempType,
);
}