ReasoningEngineSpec_DeploymentSpec.fromJson constructor

ReasoningEngineSpec_DeploymentSpec.fromJson(
  1. Object? j
)

Implementation

factory ReasoningEngineSpec_DeploymentSpec.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return ReasoningEngineSpec_DeploymentSpec(
    env: switch (json['env']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) EnvVar.fromJson(i)],
      _ => throw const FormatException('"env" is not a list'),
    },
    secretEnv: switch (json['secretEnv']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) SecretEnvVar.fromJson(i)],
      _ => throw const FormatException('"secretEnv" is not a list'),
    },
    pscInterfaceConfig: switch (json['pscInterfaceConfig']) {
      null => null,
      Object $1 => PscInterfaceConfig.fromJson($1),
    },
    minInstances: switch (json['minInstances']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    maxInstances: switch (json['maxInstances']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    resourceLimits: switch (json['resourceLimits']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key): decodeString(e.value),
      },
      _ => throw const FormatException('"resourceLimits" is not an object'),
    },
    containerConcurrency: switch (json['containerConcurrency']) {
      null => null,
      Object $1 => decodeInt($1),
    },
  );
}