Current section
Files
Jump to
Current section
Files
src/dagger/dsl/engine_cache_entry.gleam
// AUTO-GENERATED BY DAGGER_GLEAM - DO NOT EDIT
import dagger/types.{type Client, type Try} as types
import dagger/interpreter
import dagger/dsl/types as t
import gleam/dynamic/decode
import gleam/list
pub fn engine_cache_entry(id id: t.EngineCacheEntry) -> t.EngineCacheEntry {
let field = types.Field(name: "loadEngineCacheEntryFromID", args: [#("id", types.GDeferred(id.op))], subfields: [])
t.EngineCacheEntry(op: types.Pure([field]))
}
/// Whether the cache entry is actively being used.
pub fn actively_used(parent: t.EngineCacheEntry, client client: Client, then handler: fn(Try(Bool)) -> a) -> a {
let field = types.Field(name: "activelyUsed", args: [], subfields: [])
let op = {
use q <- types.bind(parent.op)
let full_query = list.append(q, [field])
types.Fetch(
fields: full_query,
decoder: decode.dynamic,
next: fn(dyn) {
let path = types.make_path(full_query)
case decode.run(dyn, decode.at(path, decode.bool)) {
Ok(val) -> types.Pure(Ok(val))
Error(_) -> types.Pure(Error(types.DecodingError("activelyUsed")))
}
}
)
}
handler(interpreter.run(op, client))
}
/// The time the cache entry was created, in Unix nanoseconds.
pub fn created_time_unix_nano(parent: t.EngineCacheEntry, client client: Client, then handler: fn(Try(Int)) -> a) -> a {
let field = types.Field(name: "createdTimeUnixNano", args: [], subfields: [])
let op = {
use q <- types.bind(parent.op)
let full_query = list.append(q, [field])
types.Fetch(
fields: full_query,
decoder: decode.dynamic,
next: fn(dyn) {
let path = types.make_path(full_query)
case decode.run(dyn, decode.at(path, decode.int)) {
Ok(val) -> types.Pure(Ok(val))
Error(_) -> types.Pure(Error(types.DecodingError("createdTimeUnixNano")))
}
}
)
}
handler(interpreter.run(op, client))
}
/// The description of the cache entry.
pub fn description(parent: t.EngineCacheEntry, client client: Client, then handler: fn(Try(String)) -> a) -> a {
let field = types.Field(name: "description", args: [], subfields: [])
let op = {
use q <- types.bind(parent.op)
let full_query = list.append(q, [field])
types.Fetch(
fields: full_query,
decoder: decode.dynamic,
next: fn(dyn) {
let path = types.make_path(full_query)
case decode.run(dyn, decode.at(path, decode.string)) {
Ok(val) -> types.Pure(Ok(val))
Error(_) -> types.Pure(Error(types.DecodingError("description")))
}
}
)
}
handler(interpreter.run(op, client))
}
/// The disk space used by the cache entry.
pub fn disk_space_bytes(parent: t.EngineCacheEntry, client client: Client, then handler: fn(Try(Int)) -> a) -> a {
let field = types.Field(name: "diskSpaceBytes", args: [], subfields: [])
let op = {
use q <- types.bind(parent.op)
let full_query = list.append(q, [field])
types.Fetch(
fields: full_query,
decoder: decode.dynamic,
next: fn(dyn) {
let path = types.make_path(full_query)
case decode.run(dyn, decode.at(path, decode.int)) {
Ok(val) -> types.Pure(Ok(val))
Error(_) -> types.Pure(Error(types.DecodingError("diskSpaceBytes")))
}
}
)
}
handler(interpreter.run(op, client))
}
/// A unique identifier for this EngineCacheEntry.
pub fn id(parent: t.EngineCacheEntry) -> t.EngineCacheEntry {
let field = types.Field(name: "id", args: [], subfields: [])
let new_op = {
use q <- types.bind(parent.op)
types.Pure(list.append(q, [field]))
}
t.EngineCacheEntry(op: new_op)
}
/// The most recent time the cache entry was used, in Unix nanoseconds.
pub fn most_recent_use_time_unix_nano(parent: t.EngineCacheEntry, client client: Client, then handler: fn(Try(Int)) -> a) -> a {
let field = types.Field(name: "mostRecentUseTimeUnixNano", args: [], subfields: [])
let op = {
use q <- types.bind(parent.op)
let full_query = list.append(q, [field])
types.Fetch(
fields: full_query,
decoder: decode.dynamic,
next: fn(dyn) {
let path = types.make_path(full_query)
case decode.run(dyn, decode.at(path, decode.int)) {
Ok(val) -> types.Pure(Ok(val))
Error(_) -> types.Pure(Error(types.DecodingError("mostRecentUseTimeUnixNano")))
}
}
)
}
handler(interpreter.run(op, client))
}