RaySpec.fromJson constructor

RaySpec.fromJson(
  1. Object? j
)

Implementation

factory RaySpec.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return RaySpec(
    imageUri: switch (json['imageUri']) {
      null => '',
      Object $1 => decodeString($1),
    },
    nfsMounts: switch (json['nfsMounts']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) NfsMount.fromJson(i)],
      _ => throw const FormatException('"nfsMounts" is not a list'),
    },
    resourcePoolImages: switch (json['resourcePoolImages']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key): decodeString(e.value),
      },
      _ => throw const FormatException(
        '"resourcePoolImages" is not an object',
      ),
    },
    headNodeResourcePoolId: switch (json['headNodeResourcePoolId']) {
      null => '',
      Object $1 => decodeString($1),
    },
    rayMetricSpec: switch (json['rayMetricSpec']) {
      null => null,
      Object $1 => RayMetricSpec.fromJson($1),
    },
    rayLogsSpec: switch (json['rayLogsSpec']) {
      null => null,
      Object $1 => RayLogsSpec.fromJson($1),
    },
  );
}