IngressSpec.fromJson constructor

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

Creates a IngressSpec from JSON data.

Implementation

factory IngressSpec.fromJson(Map<String, dynamic> json) {
  final tempDefaultBackendJson = json['defaultBackend'];
  final tempIngressClassNameJson = json['ingressClassName'];
  final tempRulesJson = json['rules'];
  final tempTlsJson = json['tls'];

  final IngressBackend? tempDefaultBackend = tempDefaultBackendJson != null
      ? IngressBackend.fromJson(tempDefaultBackendJson)
      : null;
  final String? tempIngressClassName = tempIngressClassNameJson;

  final List<IngressRule>? tempRules = tempRulesJson != null
      ? List<dynamic>.from(tempRulesJson)
          .map(
            (e) => IngressRule.fromJson(
              Map<String, dynamic>.from(e),
            ),
          )
          .toList()
      : null;

  final List<IngressTLS>? tempTls = tempTlsJson != null
      ? List<dynamic>.from(tempTlsJson)
          .map(
            (e) => IngressTLS.fromJson(
              Map<String, dynamic>.from(e),
            ),
          )
          .toList()
      : null;

  return IngressSpec(
    defaultBackend: tempDefaultBackend,
    ingressClassName: tempIngressClassName,
    rules: tempRules,
    tls: tempTls,
  );
}