Packages

Gleam SDK for Dagger — type-safe pipelines via GraphQL codegen

Current section

Files

Jump to
dagger_gleam src dagger dsl function_arg.gleam
Raw

src/dagger/dsl/function_arg.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 function_arg(id id: t.FunctionArg) -> t.FunctionArg {
let field = types.Field(name: "loadFunctionArgFromID", args: [#("id", types.GDeferred(id.op))], subfields: [])
t.FunctionArg(op: types.Pure([field]))
}
/// Only applies to arguments of type Container. If the argument is not set, load it from the given address (e.g. alpine:latest)
pub fn default_address(parent: t.FunctionArg, client client: Client, then handler: fn(Try(String)) -> a) -> a {
let field = types.Field(name: "defaultAddress", 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("defaultAddress")))
}
}
)
}
handler(interpreter.run(op, client))
}
/// Only applies to arguments of type File or Directory. If the argument is not set, load it from the given path in the context directory
pub fn default_path(parent: t.FunctionArg, client client: Client, then handler: fn(Try(String)) -> a) -> a {
let field = types.Field(name: "defaultPath", 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("defaultPath")))
}
}
)
}
handler(interpreter.run(op, client))
}
/// A default value to use for this argument when not explicitly set by the caller, if any.
pub fn default_value(parent: t.FunctionArg, client client: Client, then handler: fn(Try(String)) -> a) -> a {
let field = types.Field(name: "defaultValue", 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("defaultValue")))
}
}
)
}
handler(interpreter.run(op, client))
}
/// The reason this function is deprecated, if any.
pub fn deprecated(parent: t.FunctionArg, client client: Client, then handler: fn(Try(String)) -> a) -> a {
let field = types.Field(name: "deprecated", 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("deprecated")))
}
}
)
}
handler(interpreter.run(op, client))
}
/// A doc string for the argument, if any.
pub fn description(parent: t.FunctionArg, 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))
}
/// A unique identifier for this FunctionArg.
pub fn id(parent: t.FunctionArg) -> t.FunctionArg {
let field = types.Field(name: "id", args: [], subfields: [])
let new_op = {
use q <- types.bind(parent.op)
types.Pure(list.append(q, [field]))
}
t.FunctionArg(op: new_op)
}
/// Only applies to arguments of type Directory. The ignore patterns are applied to the input directory, and matching entries are filtered out, in a cache-efficient manner.
pub fn ignore(parent: t.FunctionArg, client client: Client, then handler: fn(Try(List(String))) -> a) -> a {
let field = types.Field(name: "ignore", 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.list(decode.string))) {
Ok(val) -> types.Pure(Ok(val))
Error(_) -> types.Pure(Error(types.DecodingError("ignore")))
}
}
)
}
handler(interpreter.run(op, client))
}
/// The name of the argument in lowerCamelCase format.
pub fn name(parent: t.FunctionArg, client client: Client, then handler: fn(Try(String)) -> a) -> a {
let field = types.Field(name: "name", 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("name")))
}
}
)
}
handler(interpreter.run(op, client))
}
/// The location of this arg declaration.
pub fn source_map(parent: t.FunctionArg) -> t.SourceMap {
let field = types.Field(name: "sourceMap", args: [], subfields: [])
let new_op = {
use q <- types.bind(parent.op)
types.Pure(list.append(q, [field]))
}
t.SourceMap(op: new_op)
}
/// The type of the argument.
pub fn type_def(parent: t.FunctionArg) -> t.TypeDef {
let field = types.Field(name: "typeDef", args: [], subfields: [])
let new_op = {
use q <- types.bind(parent.op)
types.Pure(list.append(q, [field]))
}
t.TypeDef(op: new_op)
}