NodeGroupNode.fromJson constructor

NodeGroupNode.fromJson(
  1. Object? j
)

Implementation

factory NodeGroupNode.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return NodeGroupNode(
    accelerators: switch (json['accelerators']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) AcceleratorConfig.fromJson(i)],
      _ => throw const FormatException('"accelerators" is not a list'),
    },
    consumedResources: switch (json['consumedResources']) {
      null => null,
      Object $1 => InstanceConsumptionInfo.fromJson($1),
    },
    cpuOvercommitType: switch (json['cpuOvercommitType']) {
      null => null,
      Object $1 => decodeString($1),
    },
    disks: switch (json['disks']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) LocalDisk.fromJson(i)],
      _ => throw const FormatException('"disks" is not a list'),
    },
    instanceConsumptionData: switch (json['instanceConsumptionData']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) InstanceConsumptionData.fromJson(i),
      ],
      _ => throw const FormatException(
        '"instanceConsumptionData" is not a list',
      ),
    },
    instances: switch (json['instances']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"instances" is not a list'),
    },
    name: switch (json['name']) {
      null => null,
      Object $1 => decodeString($1),
    },
    nodeType: switch (json['nodeType']) {
      null => null,
      Object $1 => decodeString($1),
    },
    satisfiesPzs: switch (json['satisfiesPzs']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    serverBinding: switch (json['serverBinding']) {
      null => null,
      Object $1 => ServerBinding.fromJson($1),
    },
    serverId: switch (json['serverId']) {
      null => null,
      Object $1 => decodeString($1),
    },
    status: switch (json['status']) {
      null => null,
      Object $1 => decodeString($1),
    },
    totalResources: switch (json['totalResources']) {
      null => null,
      Object $1 => InstanceConsumptionInfo.fromJson($1),
    },
    upcomingMaintenance: switch (json['upcomingMaintenance']) {
      null => null,
      Object $1 => UpcomingMaintenance.fromJson($1),
    },
  );
}