RouterStatusNatStatus.fromJson constructor

RouterStatusNatStatus.fromJson(
  1. Object? j
)

Implementation

factory RouterStatusNatStatus.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return RouterStatusNatStatus(
    autoAllocatedNatIps: switch (json['autoAllocatedNatIps']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"autoAllocatedNatIps" is not a list'),
    },
    drainAutoAllocatedNatIps: switch (json['drainAutoAllocatedNatIps']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException(
        '"drainAutoAllocatedNatIps" is not a list',
      ),
    },
    drainUserAllocatedNatIps: switch (json['drainUserAllocatedNatIps']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException(
        '"drainUserAllocatedNatIps" is not a list',
      ),
    },
    minExtraNatIpsNeeded: switch (json['minExtraNatIpsNeeded']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    name: switch (json['name']) {
      null => null,
      Object $1 => decodeString($1),
    },
    numVmEndpointsWithNatMappings:
        switch (json['numVmEndpointsWithNatMappings']) {
          null => null,
          Object $1 => decodeInt($1),
        },
    ruleStatus: switch (json['ruleStatus']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) RouterStatusNatStatusNatRuleStatus.fromJson(i),
      ],
      _ => throw const FormatException('"ruleStatus" is not a list'),
    },
    userAllocatedNatIpResources:
        switch (json['userAllocatedNatIpResources']) {
          null => [],
          List<Object?> $1 => [for (final i in $1) decodeString(i)],
          _ => throw const FormatException(
            '"userAllocatedNatIpResources" is not a list',
          ),
        },
    userAllocatedNatIps: switch (json['userAllocatedNatIps']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"userAllocatedNatIps" is not a list'),
    },
  );
}