Router.fromJson constructor

Router.fromJson(
  1. Object? j
)

Implementation

factory Router.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return Router(
    bgp: switch (json['bgp']) {
      null => null,
      Object $1 => RouterBgp.fromJson($1),
    },
    bgpPeers: switch (json['bgpPeers']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) RouterBgpPeer.fromJson(i)],
      _ => throw const FormatException('"bgpPeers" is not a list'),
    },
    creationTimestamp: switch (json['creationTimestamp']) {
      null => null,
      Object $1 => decodeString($1),
    },
    description: switch (json['description']) {
      null => null,
      Object $1 => decodeString($1),
    },
    encryptedInterconnectRouter:
        switch (json['encryptedInterconnectRouter']) {
          null => null,
          Object $1 => decodeBool($1),
        },
    id: switch (json['id']) {
      null => null,
      Object $1 => decodeUint64($1),
    },
    interfaces: switch (json['interfaces']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) RouterInterface.fromJson(i)],
      _ => throw const FormatException('"interfaces" is not a list'),
    },
    kind: switch (json['kind']) {
      null => null,
      Object $1 => decodeString($1),
    },
    md5AuthenticationKeys: switch (json['md5AuthenticationKeys']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) RouterMd5AuthenticationKey.fromJson(i),
      ],
      _ => throw const FormatException(
        '"md5AuthenticationKeys" is not a list',
      ),
    },
    name: switch (json['name']) {
      null => null,
      Object $1 => decodeString($1),
    },
    nats: switch (json['nats']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) RouterNat.fromJson(i)],
      _ => throw const FormatException('"nats" is not a list'),
    },
    nccGateway: switch (json['nccGateway']) {
      null => null,
      Object $1 => decodeString($1),
    },
    network: switch (json['network']) {
      null => null,
      Object $1 => decodeString($1),
    },
    params: switch (json['params']) {
      null => null,
      Object $1 => RouterParams.fromJson($1),
    },
    region: switch (json['region']) {
      null => null,
      Object $1 => decodeString($1),
    },
    selfLink: switch (json['selfLink']) {
      null => null,
      Object $1 => decodeString($1),
    },
  );
}