NodeTemplate.fromJson constructor
NodeTemplate.fromJson(
- Object? j
Implementation
factory NodeTemplate.fromJson(Object? j) {
final json = j as Map<String, Object?>;
return NodeTemplate(
accelerators: switch (json['accelerators']) {
null => [],
List<Object?> $1 => [for (final i in $1) AcceleratorConfig.fromJson(i)],
_ => throw const FormatException('"accelerators" is not a list'),
},
cpuOvercommitType: switch (json['cpuOvercommitType']) {
null => null,
Object $1 => decodeString($1),
},
creationTimestamp: switch (json['creationTimestamp']) {
null => null,
Object $1 => decodeString($1),
},
description: switch (json['description']) {
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'),
},
id: switch (json['id']) {
null => null,
Object $1 => decodeUint64($1),
},
kind: switch (json['kind']) {
null => null,
Object $1 => decodeString($1),
},
name: switch (json['name']) {
null => null,
Object $1 => decodeString($1),
},
nodeAffinityLabels: switch (json['nodeAffinityLabels']) {
null => {},
Map<String, Object?> $1 => {
for (final e in $1.entries)
decodeString(e.key): decodeString(e.value),
},
_ => throw const FormatException(
'"nodeAffinityLabels" is not an object',
),
},
nodeType: switch (json['nodeType']) {
null => null,
Object $1 => decodeString($1),
},
nodeTypeFlexibility: switch (json['nodeTypeFlexibility']) {
null => null,
Object $1 => NodeTemplateNodeTypeFlexibility.fromJson($1),
},
region: switch (json['region']) {
null => null,
Object $1 => decodeString($1),
},
selfLink: switch (json['selfLink']) {
null => null,
Object $1 => decodeString($1),
},
serverBinding: switch (json['serverBinding']) {
null => null,
Object $1 => ServerBinding.fromJson($1),
},
status: switch (json['status']) {
null => null,
Object $1 => decodeString($1),
},
statusMessage: switch (json['statusMessage']) {
null => null,
Object $1 => decodeString($1),
},
);
}