Backend.fromJson constructor

Backend.fromJson(
  1. Object? j
)

Implementation

factory Backend.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return Backend(
    balancingMode: switch (json['balancingMode']) {
      null => null,
      Object $1 => decodeString($1),
    },
    capacityScaler: switch (json['capacityScaler']) {
      null => null,
      Object $1 => decodeDouble($1),
    },
    customMetrics: switch (json['customMetrics']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) BackendCustomMetric.fromJson(i),
      ],
      _ => throw const FormatException('"customMetrics" is not a list'),
    },
    description: switch (json['description']) {
      null => null,
      Object $1 => decodeString($1),
    },
    failover: switch (json['failover']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    group: switch (json['group']) {
      null => null,
      Object $1 => decodeString($1),
    },
    maxConnections: switch (json['maxConnections']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    maxConnectionsPerEndpoint: switch (json['maxConnectionsPerEndpoint']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    maxConnectionsPerInstance: switch (json['maxConnectionsPerInstance']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    maxInFlightRequests: switch (json['maxInFlightRequests']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    maxInFlightRequestsPerEndpoint:
        switch (json['maxInFlightRequestsPerEndpoint']) {
          null => null,
          Object $1 => decodeInt($1),
        },
    maxInFlightRequestsPerInstance:
        switch (json['maxInFlightRequestsPerInstance']) {
          null => null,
          Object $1 => decodeInt($1),
        },
    maxRate: switch (json['maxRate']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    maxRatePerEndpoint: switch (json['maxRatePerEndpoint']) {
      null => null,
      Object $1 => decodeDouble($1),
    },
    maxRatePerInstance: switch (json['maxRatePerInstance']) {
      null => null,
      Object $1 => decodeDouble($1),
    },
    maxUtilization: switch (json['maxUtilization']) {
      null => null,
      Object $1 => decodeDouble($1),
    },
    orchestrationInfo: switch (json['orchestrationInfo']) {
      null => null,
      Object $1 => BackendBackendOrchestrationInfo.fromJson($1),
    },
    preference: switch (json['preference']) {
      null => null,
      Object $1 => decodeString($1),
    },
    trafficDuration: switch (json['trafficDuration']) {
      null => null,
      Object $1 => decodeString($1),
    },
  );
}