RouterNat.fromJson constructor

RouterNat.fromJson(
  1. Object? j
)

Implementation

factory RouterNat.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return RouterNat(
    autoNetworkTier: switch (json['autoNetworkTier']) {
      null => null,
      Object $1 => decodeString($1),
    },
    drainNatIps: switch (json['drainNatIps']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"drainNatIps" is not a list'),
    },
    effectiveTcpTimeWaitTimeoutSec:
        switch (json['effectiveTcpTimeWaitTimeoutSec']) {
          null => null,
          Object $1 => decodeInt($1),
        },
    enableDynamicPortAllocation:
        switch (json['enableDynamicPortAllocation']) {
          null => null,
          Object $1 => decodeBool($1),
        },
    enableEndpointIndependentMapping:
        switch (json['enableEndpointIndependentMapping']) {
          null => null,
          Object $1 => decodeBool($1),
        },
    endpointTypes: switch (json['endpointTypes']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"endpointTypes" is not a list'),
    },
    icmpIdleTimeoutSec: switch (json['icmpIdleTimeoutSec']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    logConfig: switch (json['logConfig']) {
      null => null,
      Object $1 => RouterNatLogConfig.fromJson($1),
    },
    maxPortsPerVm: switch (json['maxPortsPerVm']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    minPortsPerVm: switch (json['minPortsPerVm']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    name: switch (json['name']) {
      null => null,
      Object $1 => decodeString($1),
    },
    nat64Subnetworks: switch (json['nat64Subnetworks']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) RouterNatSubnetworkToNat64.fromJson(i),
      ],
      _ => throw const FormatException('"nat64Subnetworks" is not a list'),
    },
    natIpAllocateOption: switch (json['natIpAllocateOption']) {
      null => null,
      Object $1 => decodeString($1),
    },
    natIps: switch (json['natIps']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"natIps" is not a list'),
    },
    rules: switch (json['rules']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) RouterNatRule.fromJson(i)],
      _ => throw const FormatException('"rules" is not a list'),
    },
    sourceSubnetworkIpRangesToNat:
        switch (json['sourceSubnetworkIpRangesToNat']) {
          null => null,
          Object $1 => decodeString($1),
        },
    sourceSubnetworkIpRangesToNat64:
        switch (json['sourceSubnetworkIpRangesToNat64']) {
          null => null,
          Object $1 => decodeString($1),
        },
    subnetworks: switch (json['subnetworks']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) RouterNatSubnetworkToNat.fromJson(i),
      ],
      _ => throw const FormatException('"subnetworks" is not a list'),
    },
    tcpEstablishedIdleTimeoutSec:
        switch (json['tcpEstablishedIdleTimeoutSec']) {
          null => null,
          Object $1 => decodeInt($1),
        },
    tcpTimeWaitTimeoutSec: switch (json['tcpTimeWaitTimeoutSec']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    tcpTransitoryIdleTimeoutSec:
        switch (json['tcpTransitoryIdleTimeoutSec']) {
          null => null,
          Object $1 => decodeInt($1),
        },
    type: switch (json['type']) {
      null => null,
      Object $1 => decodeString($1),
    },
    udpIdleTimeoutSec: switch (json['udpIdleTimeoutSec']) {
      null => null,
      Object $1 => decodeInt($1),
    },
  );
}