NotebookRuntime.fromJson constructor

NotebookRuntime.fromJson(
  1. Object? j
)

Implementation

factory NotebookRuntime.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return NotebookRuntime(
    name: switch (json['name']) {
      null => '',
      Object $1 => decodeString($1),
    },
    runtimeUser: switch (json['runtimeUser']) {
      null => '',
      Object $1 => decodeString($1),
    },
    notebookRuntimeTemplateRef: switch (json['notebookRuntimeTemplateRef']) {
      null => null,
      Object $1 => NotebookRuntimeTemplateRef.fromJson($1),
    },
    proxyUri: switch (json['proxyUri']) {
      null => '',
      Object $1 => decodeString($1),
    },
    createTime: switch (json['createTime']) {
      null => null,
      Object $1 => protobuf.Timestamp.fromJson($1),
    },
    updateTime: switch (json['updateTime']) {
      null => null,
      Object $1 => protobuf.Timestamp.fromJson($1),
    },
    healthState: switch (json['healthState']) {
      null => NotebookRuntime_HealthState.$default,
      Object $1 => NotebookRuntime_HealthState.fromJson($1),
    },
    displayName: switch (json['displayName']) {
      null => '',
      Object $1 => decodeString($1),
    },
    description: switch (json['description']) {
      null => '',
      Object $1 => decodeString($1),
    },
    serviceAccount: switch (json['serviceAccount']) {
      null => '',
      Object $1 => decodeString($1),
    },
    runtimeState: switch (json['runtimeState']) {
      null => NotebookRuntime_RuntimeState.$default,
      Object $1 => NotebookRuntime_RuntimeState.fromJson($1),
    },
    isUpgradable: switch (json['isUpgradable']) {
      null => false,
      Object $1 => decodeBool($1),
    },
    labels: switch (json['labels']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key): decodeString(e.value),
      },
      _ => throw const FormatException('"labels" is not an object'),
    },
    expirationTime: switch (json['expirationTime']) {
      null => null,
      Object $1 => protobuf.Timestamp.fromJson($1),
    },
    version: switch (json['version']) {
      null => '',
      Object $1 => decodeString($1),
    },
    notebookRuntimeType: switch (json['notebookRuntimeType']) {
      null => NotebookRuntimeType.$default,
      Object $1 => NotebookRuntimeType.fromJson($1),
    },
    machineSpec: switch (json['machineSpec']) {
      null => null,
      Object $1 => MachineSpec.fromJson($1),
    },
    dataPersistentDiskSpec: switch (json['dataPersistentDiskSpec']) {
      null => null,
      Object $1 => PersistentDiskSpec.fromJson($1),
    },
    networkSpec: switch (json['networkSpec']) {
      null => null,
      Object $1 => NetworkSpec.fromJson($1),
    },
    idleShutdownConfig: switch (json['idleShutdownConfig']) {
      null => null,
      Object $1 => NotebookIdleShutdownConfig.fromJson($1),
    },
    eucConfig: switch (json['eucConfig']) {
      null => null,
      Object $1 => NotebookEucConfig.fromJson($1),
    },
    shieldedVmConfig: switch (json['shieldedVmConfig']) {
      null => null,
      Object $1 => ShieldedVmConfig.fromJson($1),
    },
    networkTags: switch (json['networkTags']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"networkTags" is not a list'),
    },
    softwareConfig: switch (json['softwareConfig']) {
      null => null,
      Object $1 => NotebookSoftwareConfig.fromJson($1),
    },
    encryptionSpec: switch (json['encryptionSpec']) {
      null => null,
      Object $1 => EncryptionSpec.fromJson($1),
    },
    satisfiesPzs: switch (json['satisfiesPzs']) {
      null => false,
      Object $1 => decodeBool($1),
    },
    satisfiesPzi: switch (json['satisfiesPzi']) {
      null => false,
      Object $1 => decodeBool($1),
    },
  );
}