mirror of
https://github.com/hanzo-dart/sdk.git
synced 2026-10-30 19:32:47 +00:00
The projection these were generated from predated the compute migration, so they described /v1/visor — which the API serves at zero paths now. No /v1/visor path survives here.
263 lines
10 KiB
Dart
263 lines
10 KiB
Dart
//
|
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
|
//
|
|
// @dart=2.18
|
|
|
|
// ignore_for_file: unused_element, unused_import
|
|
// ignore_for_file: always_put_required_named_parameters_first
|
|
// ignore_for_file: constant_identifier_names
|
|
// ignore_for_file: lines_longer_than_80_chars
|
|
|
|
part of hanzoai.cloud;
|
|
|
|
class GpuView {
|
|
/// Returns a new [GpuView] instance.
|
|
GpuView({
|
|
this.id,
|
|
this.location,
|
|
this.machine,
|
|
this.memory,
|
|
this.model,
|
|
this.name,
|
|
this.provider,
|
|
this.region,
|
|
this.status,
|
|
});
|
|
/// ID is the card's address: its host machine's id, \"#\", and the card's ordinal within that machine (\"gpu-1#0\"). Stable for as long as the machine is, and the only id a single accelerator has — providers do not name cards.
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? id;
|
|
|
|
/// Location is where the card physically sits, which for every source today is the same value Region carries — the console renders it in its own column.
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? location;
|
|
|
|
/// Machine is the id of the machine holding this card, addressable as-is on /v1/compute/machines/:id.
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? machine;
|
|
|
|
/// Memory is the card's VRAM as its own tooling reported it (\"122880 MiB\") — a display string in the reporter's units, not a byte count. BYO cards carry it (nvidia-smi); Visor's machine object states no VRAM, so a rented card leaves it empty and the console renders \"—\" rather than a fabricated 0.
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? memory;
|
|
|
|
/// Model is the accelerator: the model token read out of the size slug for a Visor GPU droplet (\"H100\", \"MI300X\"), or the name nvidia-smi reported for a BYO card (\"NVIDIA GB10\").
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? model;
|
|
|
|
/// Name is the HOST MACHINE's display name, not the card's — every card in a gpu-h100x8 node repeats it. Model is what says which accelerator this is.
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? name;
|
|
|
|
/// Provider distinguishes a BYO accelerator (\"byo\") from a Visor-provisioned one (the host machine's real provider). It is what tells a card the org owns from a card the org rents.
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? provider;
|
|
|
|
/// Region is the host machine's provider region slug; \"on-prem\" for a BYO card.
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? region;
|
|
|
|
/// Status is the HOST MACHINE's lifecycle state, because nothing upstream reports a card's own health. A card reads running because its machine does.
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? status;
|
|
|
|
@override
|
|
bool operator ==(Object other) => identical(this, other) || other is GpuView &&
|
|
other.id == id &&
|
|
other.location == location &&
|
|
other.machine == machine &&
|
|
other.memory == memory &&
|
|
other.model == model &&
|
|
other.name == name &&
|
|
other.provider == provider &&
|
|
other.region == region &&
|
|
other.status == status;
|
|
|
|
@override
|
|
int get hashCode =>
|
|
// ignore: unnecessary_parenthesis
|
|
(id == null ? 0 : id!.hashCode) +
|
|
(location == null ? 0 : location!.hashCode) +
|
|
(machine == null ? 0 : machine!.hashCode) +
|
|
(memory == null ? 0 : memory!.hashCode) +
|
|
(model == null ? 0 : model!.hashCode) +
|
|
(name == null ? 0 : name!.hashCode) +
|
|
(provider == null ? 0 : provider!.hashCode) +
|
|
(region == null ? 0 : region!.hashCode) +
|
|
(status == null ? 0 : status!.hashCode);
|
|
|
|
@override
|
|
String toString() => 'GpuView[id=$id, location=$location, machine=$machine, memory=$memory, model=$model, name=$name, provider=$provider, region=$region, status=$status]';
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final json = <String, dynamic>{};
|
|
if (this.id != null) {
|
|
json[r'id'] = this.id;
|
|
} else {
|
|
json[r'id'] = null;
|
|
}
|
|
if (this.location != null) {
|
|
json[r'location'] = this.location;
|
|
} else {
|
|
json[r'location'] = null;
|
|
}
|
|
if (this.machine != null) {
|
|
json[r'machine'] = this.machine;
|
|
} else {
|
|
json[r'machine'] = null;
|
|
}
|
|
if (this.memory != null) {
|
|
json[r'memory'] = this.memory;
|
|
} else {
|
|
json[r'memory'] = null;
|
|
}
|
|
if (this.model != null) {
|
|
json[r'model'] = this.model;
|
|
} else {
|
|
json[r'model'] = null;
|
|
}
|
|
if (this.name != null) {
|
|
json[r'name'] = this.name;
|
|
} else {
|
|
json[r'name'] = null;
|
|
}
|
|
if (this.provider != null) {
|
|
json[r'provider'] = this.provider;
|
|
} else {
|
|
json[r'provider'] = null;
|
|
}
|
|
if (this.region != null) {
|
|
json[r'region'] = this.region;
|
|
} else {
|
|
json[r'region'] = null;
|
|
}
|
|
if (this.status != null) {
|
|
json[r'status'] = this.status;
|
|
} else {
|
|
json[r'status'] = null;
|
|
}
|
|
return json;
|
|
}
|
|
|
|
/// Returns a new [GpuView] instance and imports its values from
|
|
/// [value] if it's a [Map], null otherwise.
|
|
// ignore: prefer_constructors_over_static_methods
|
|
static GpuView? fromJson(dynamic value) {
|
|
if (value is Map) {
|
|
final json = value.cast<String, dynamic>();
|
|
|
|
// Ensure that the map contains the required keys.
|
|
// Note 1: the values aren't checked for validity beyond being non-null.
|
|
// Note 2: this code is stripped in release mode!
|
|
assert(() {
|
|
requiredKeys.forEach((key) {
|
|
assert(json.containsKey(key), 'Required key "GpuView[$key]" is missing from JSON.');
|
|
assert(json[key] != null, 'Required key "GpuView[$key]" has a null value in JSON.');
|
|
});
|
|
return true;
|
|
}());
|
|
|
|
return GpuView(
|
|
id: mapValueOfType<String>(json, r'id'),
|
|
location: mapValueOfType<String>(json, r'location'),
|
|
machine: mapValueOfType<String>(json, r'machine'),
|
|
memory: mapValueOfType<String>(json, r'memory'),
|
|
model: mapValueOfType<String>(json, r'model'),
|
|
name: mapValueOfType<String>(json, r'name'),
|
|
provider: mapValueOfType<String>(json, r'provider'),
|
|
region: mapValueOfType<String>(json, r'region'),
|
|
status: mapValueOfType<String>(json, r'status'),
|
|
);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
static List<GpuView> listFromJson(dynamic json, {bool growable = false,}) {
|
|
final result = <GpuView>[];
|
|
if (json is List && json.isNotEmpty) {
|
|
for (final row in json) {
|
|
final value = GpuView.fromJson(row);
|
|
if (value != null) {
|
|
result.add(value);
|
|
}
|
|
}
|
|
}
|
|
return result.toList(growable: growable);
|
|
}
|
|
|
|
static Map<String, GpuView> mapFromJson(dynamic json) {
|
|
final map = <String, GpuView>{};
|
|
if (json is Map && json.isNotEmpty) {
|
|
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
|
for (final entry in json.entries) {
|
|
final value = GpuView.fromJson(entry.value);
|
|
if (value != null) {
|
|
map[entry.key] = value;
|
|
}
|
|
}
|
|
}
|
|
return map;
|
|
}
|
|
|
|
// maps a json object with a list of GpuView-objects as value to a dart map
|
|
static Map<String, List<GpuView>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
|
final map = <String, List<GpuView>>{};
|
|
if (json is Map && json.isNotEmpty) {
|
|
// ignore: parameter_assignments
|
|
json = json.cast<String, dynamic>();
|
|
for (final entry in json.entries) {
|
|
map[entry.key] = GpuView.listFromJson(entry.value, growable: growable,);
|
|
}
|
|
}
|
|
return map;
|
|
}
|
|
|
|
/// The list of required keys that must be present in a JSON.
|
|
static const requiredKeys = <String>{
|
|
};
|
|
}
|
|
|