HealthStatus.fromJson constructor

HealthStatus.fromJson(
  1. Object? j
)

Implementation

factory HealthStatus.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return HealthStatus(
    annotations: switch (json['annotations']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key): decodeString(e.value),
      },
      _ => throw const FormatException('"annotations" is not an object'),
    },
    forwardingRule: switch (json['forwardingRule']) {
      null => null,
      Object $1 => decodeString($1),
    },
    forwardingRuleIp: switch (json['forwardingRuleIp']) {
      null => null,
      Object $1 => decodeString($1),
    },
    healthState: switch (json['healthState']) {
      null => null,
      Object $1 => decodeString($1),
    },
    instance: switch (json['instance']) {
      null => null,
      Object $1 => decodeString($1),
    },
    ipAddress: switch (json['ipAddress']) {
      null => null,
      Object $1 => decodeString($1),
    },
    ipv6Address: switch (json['ipv6Address']) {
      null => null,
      Object $1 => decodeString($1),
    },
    ipv6HealthState: switch (json['ipv6HealthState']) {
      null => null,
      Object $1 => decodeString($1),
    },
    port: switch (json['port']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    weight: switch (json['weight']) {
      null => null,
      Object $1 => decodeString($1),
    },
    weightError: switch (json['weightError']) {
      null => null,
      Object $1 => decodeString($1),
    },
  );
}