RouterBgpPeer.fromJson constructor

RouterBgpPeer.fromJson(
  1. Object? j
)

Implementation

factory RouterBgpPeer.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return RouterBgpPeer(
    advertiseMode: switch (json['advertiseMode']) {
      null => null,
      Object $1 => decodeString($1),
    },
    advertisedGroups: switch (json['advertisedGroups']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"advertisedGroups" is not a list'),
    },
    advertisedIpRanges: switch (json['advertisedIpRanges']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) RouterAdvertisedIpRange.fromJson(i),
      ],
      _ => throw const FormatException('"advertisedIpRanges" is not a list'),
    },
    advertisedRoutePriority: switch (json['advertisedRoutePriority']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    bfd: switch (json['bfd']) {
      null => null,
      Object $1 => RouterBgpPeerBfd.fromJson($1),
    },
    customLearnedIpRanges: switch (json['customLearnedIpRanges']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) RouterBgpPeerCustomLearnedIpRange.fromJson(i),
      ],
      _ => throw const FormatException(
        '"customLearnedIpRanges" is not a list',
      ),
    },
    customLearnedRoutePriority: switch (json['customLearnedRoutePriority']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    enable: switch (json['enable']) {
      null => null,
      Object $1 => decodeString($1),
    },
    enableIpv4: switch (json['enableIpv4']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    enableIpv6: switch (json['enableIpv6']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    exportPolicies: switch (json['exportPolicies']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"exportPolicies" is not a list'),
    },
    importPolicies: switch (json['importPolicies']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"importPolicies" is not a list'),
    },
    interfaceName: switch (json['interfaceName']) {
      null => null,
      Object $1 => decodeString($1),
    },
    ipAddress: switch (json['ipAddress']) {
      null => null,
      Object $1 => decodeString($1),
    },
    ipv4NexthopAddress: switch (json['ipv4NexthopAddress']) {
      null => null,
      Object $1 => decodeString($1),
    },
    ipv6NexthopAddress: switch (json['ipv6NexthopAddress']) {
      null => null,
      Object $1 => decodeString($1),
    },
    managementType: switch (json['managementType']) {
      null => null,
      Object $1 => decodeString($1),
    },
    md5AuthenticationKeyName: switch (json['md5AuthenticationKeyName']) {
      null => null,
      Object $1 => decodeString($1),
    },
    name: switch (json['name']) {
      null => null,
      Object $1 => decodeString($1),
    },
    peerAsn: switch (json['peerAsn']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    peerIpAddress: switch (json['peerIpAddress']) {
      null => null,
      Object $1 => decodeString($1),
    },
    peerIpv4NexthopAddress: switch (json['peerIpv4NexthopAddress']) {
      null => null,
      Object $1 => decodeString($1),
    },
    peerIpv6NexthopAddress: switch (json['peerIpv6NexthopAddress']) {
      null => null,
      Object $1 => decodeString($1),
    },
    routerApplianceInstance: switch (json['routerApplianceInstance']) {
      null => null,
      Object $1 => decodeString($1),
    },
  );
}