RouterNatRuleAction.fromJson constructor

RouterNatRuleAction.fromJson(
  1. Object? j
)

Implementation

factory RouterNatRuleAction.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return RouterNatRuleAction(
    sourceNatActiveIps: switch (json['sourceNatActiveIps']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"sourceNatActiveIps" is not a list'),
    },
    sourceNatActiveRanges: switch (json['sourceNatActiveRanges']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException(
        '"sourceNatActiveRanges" is not a list',
      ),
    },
    sourceNatDrainIps: switch (json['sourceNatDrainIps']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"sourceNatDrainIps" is not a list'),
    },
    sourceNatDrainRanges: switch (json['sourceNatDrainRanges']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException(
        '"sourceNatDrainRanges" is not a list',
      ),
    },
  );
}