MachineSpec.fromJson constructor

MachineSpec.fromJson(
  1. Object? j
)

Implementation

factory MachineSpec.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return MachineSpec(
    machineType: switch (json['machineType']) {
      null => '',
      Object $1 => decodeString($1),
    },
    acceleratorType: switch (json['acceleratorType']) {
      null => AcceleratorType.$default,
      Object $1 => AcceleratorType.fromJson($1),
    },
    acceleratorCount: switch (json['acceleratorCount']) {
      null => 0,
      Object $1 => decodeInt($1),
    },
    gpuPartitionSize: switch (json['gpuPartitionSize']) {
      null => '',
      Object $1 => decodeString($1),
    },
    tpuTopology: switch (json['tpuTopology']) {
      null => '',
      Object $1 => decodeString($1),
    },
    multihostGpuNodeCount: switch (json['multihostGpuNodeCount']) {
      null => 0,
      Object $1 => decodeInt($1),
    },
    reservationAffinity: switch (json['reservationAffinity']) {
      null => null,
      Object $1 => ReservationAffinity.fromJson($1),
    },
  );
}