SecurityPolicyRuleNetworkMatcher.fromJson constructor

SecurityPolicyRuleNetworkMatcher.fromJson(
  1. Object? j
)

Implementation

factory SecurityPolicyRuleNetworkMatcher.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return SecurityPolicyRuleNetworkMatcher(
    destIpRanges: switch (json['destIpRanges']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"destIpRanges" is not a list'),
    },
    destPorts: switch (json['destPorts']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"destPorts" is not a list'),
    },
    ipProtocols: switch (json['ipProtocols']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"ipProtocols" is not a list'),
    },
    srcAsns: switch (json['srcAsns']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeInt(i)],
      _ => throw const FormatException('"srcAsns" is not a list'),
    },
    srcIpRanges: switch (json['srcIpRanges']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"srcIpRanges" is not a list'),
    },
    srcPorts: switch (json['srcPorts']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"srcPorts" is not a list'),
    },
    srcRegionCodes: switch (json['srcRegionCodes']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"srcRegionCodes" is not a list'),
    },
    userDefinedFields: switch (json['userDefinedFields']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1)
          SecurityPolicyRuleNetworkMatcherUserDefinedFieldMatch.fromJson(i),
      ],
      _ => throw const FormatException('"userDefinedFields" is not a list'),
    },
  );
}