// 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 binding(id id: t.Binding) -> t.Binding { let field = types.Field(name: "loadBindingFromID", args: [#("id", types.GDeferred(id.op))], subfields: []) t.Binding(op: types.Pure([field])) } /// Retrieve the binding value, as type Address pub fn as_address(parent: t.Binding) -> t.Address { let field = types.Field(name: "asAddress", args: [], subfields: []) let new_op = { use q <- types.bind(parent.op) types.Pure(list.append(q, [field])) } t.Address(op: new_op) } /// Retrieve the binding value, as type CacheVolume pub fn as_cache_volume(parent: t.Binding) -> t.CacheVolume { let field = types.Field(name: "asCacheVolume", args: [], subfields: []) let new_op = { use q <- types.bind(parent.op) types.Pure(list.append(q, [field])) } t.CacheVolume(op: new_op) } /// Retrieve the binding value, as type Changeset pub fn as_changeset(parent: t.Binding) -> t.Changeset { let field = types.Field(name: "asChangeset", args: [], subfields: []) let new_op = { use q <- types.bind(parent.op) types.Pure(list.append(q, [field])) } t.Changeset(op: new_op) } /// Retrieve the binding value, as type Check pub fn as_check(parent: t.Binding) -> t.Check { let field = types.Field(name: "asCheck", args: [], subfields: []) let new_op = { use q <- types.bind(parent.op) types.Pure(list.append(q, [field])) } t.Check(op: new_op) } /// Retrieve the binding value, as type CheckGroup pub fn as_check_group(parent: t.Binding) -> t.CheckGroup { let field = types.Field(name: "asCheckGroup", args: [], subfields: []) let new_op = { use q <- types.bind(parent.op) types.Pure(list.append(q, [field])) } t.CheckGroup(op: new_op) } /// Retrieve the binding value, as type Cloud pub fn as_cloud(parent: t.Binding) -> t.Cloud { let field = types.Field(name: "asCloud", args: [], subfields: []) let new_op = { use q <- types.bind(parent.op) types.Pure(list.append(q, [field])) } t.Cloud(op: new_op) } /// Retrieve the binding value, as type Container pub fn as_container(parent: t.Binding) -> t.Container { let field = types.Field(name: "asContainer", args: [], subfields: []) let new_op = { use q <- types.bind(parent.op) types.Pure(list.append(q, [field])) } t.Container(op: new_op) } /// Retrieve the binding value, as type Directory pub fn as_directory(parent: t.Binding) -> t.Directory { let field = types.Field(name: "asDirectory", args: [], subfields: []) let new_op = { use q <- types.bind(parent.op) types.Pure(list.append(q, [field])) } t.Directory(op: new_op) } /// Retrieve the binding value, as type Env pub fn as_env(parent: t.Binding) -> t.Env { let field = types.Field(name: "asEnv", args: [], subfields: []) let new_op = { use q <- types.bind(parent.op) types.Pure(list.append(q, [field])) } t.Env(op: new_op) } /// Retrieve the binding value, as type EnvFile pub fn as_env_file(parent: t.Binding) -> t.EnvFile { let field = types.Field(name: "asEnvFile", args: [], subfields: []) let new_op = { use q <- types.bind(parent.op) types.Pure(list.append(q, [field])) } t.EnvFile(op: new_op) } /// Retrieve the binding value, as type File pub fn as_file(parent: t.Binding) -> t.File { let field = types.Field(name: "asFile", args: [], subfields: []) let new_op = { use q <- types.bind(parent.op) types.Pure(list.append(q, [field])) } t.File(op: new_op) } /// Retrieve the binding value, as type Generator pub fn as_generator(parent: t.Binding) -> t.Generator { let field = types.Field(name: "asGenerator", args: [], subfields: []) let new_op = { use q <- types.bind(parent.op) types.Pure(list.append(q, [field])) } t.Generator(op: new_op) } /// Retrieve the binding value, as type GeneratorGroup pub fn as_generator_group(parent: t.Binding) -> t.GeneratorGroup { let field = types.Field(name: "asGeneratorGroup", args: [], subfields: []) let new_op = { use q <- types.bind(parent.op) types.Pure(list.append(q, [field])) } t.GeneratorGroup(op: new_op) } /// Retrieve the binding value, as type GitRef pub fn as_git_ref(parent: t.Binding) -> t.GitRef { let field = types.Field(name: "asGitRef", args: [], subfields: []) let new_op = { use q <- types.bind(parent.op) types.Pure(list.append(q, [field])) } t.GitRef(op: new_op) } /// Retrieve the binding value, as type GitRepository pub fn as_git_repository(parent: t.Binding) -> t.GitRepository { let field = types.Field(name: "asGitRepository", args: [], subfields: []) let new_op = { use q <- types.bind(parent.op) types.Pure(list.append(q, [field])) } t.GitRepository(op: new_op) } /// Retrieve the binding value, as type JSONValue pub fn as_j_s_o_n_value(parent: t.Binding) -> t.JSONValue { let field = types.Field(name: "asJSONValue", args: [], subfields: []) let new_op = { use q <- types.bind(parent.op) types.Pure(list.append(q, [field])) } t.JSONValue(op: new_op) } /// Retrieve the binding value, as type Module pub fn as_module(parent: t.Binding) -> t.Module { let field = types.Field(name: "asModule", args: [], subfields: []) let new_op = { use q <- types.bind(parent.op) types.Pure(list.append(q, [field])) } t.Module(op: new_op) } /// Retrieve the binding value, as type ModuleConfigClient pub fn as_module_config_client(parent: t.Binding) -> t.ModuleConfigClient { let field = types.Field(name: "asModuleConfigClient", args: [], subfields: []) let new_op = { use q <- types.bind(parent.op) types.Pure(list.append(q, [field])) } t.ModuleConfigClient(op: new_op) } /// Retrieve the binding value, as type ModuleSource pub fn as_module_source(parent: t.Binding) -> t.ModuleSource { let field = types.Field(name: "asModuleSource", args: [], subfields: []) let new_op = { use q <- types.bind(parent.op) types.Pure(list.append(q, [field])) } t.ModuleSource(op: new_op) } /// Retrieve the binding value, as type SearchResult pub fn as_search_result(parent: t.Binding) -> t.SearchResult { let field = types.Field(name: "asSearchResult", args: [], subfields: []) let new_op = { use q <- types.bind(parent.op) types.Pure(list.append(q, [field])) } t.SearchResult(op: new_op) } /// Retrieve the binding value, as type SearchSubmatch pub fn as_search_submatch(parent: t.Binding) -> t.SearchSubmatch { let field = types.Field(name: "asSearchSubmatch", args: [], subfields: []) let new_op = { use q <- types.bind(parent.op) types.Pure(list.append(q, [field])) } t.SearchSubmatch(op: new_op) } /// Retrieve the binding value, as type Secret pub fn as_secret(parent: t.Binding) -> t.Secret { let field = types.Field(name: "asSecret", args: [], subfields: []) let new_op = { use q <- types.bind(parent.op) types.Pure(list.append(q, [field])) } t.Secret(op: new_op) } /// Retrieve the binding value, as type Service pub fn as_service(parent: t.Binding) -> t.Service { let field = types.Field(name: "asService", args: [], subfields: []) let new_op = { use q <- types.bind(parent.op) types.Pure(list.append(q, [field])) } t.Service(op: new_op) } /// Retrieve the binding value, as type Socket pub fn as_socket(parent: t.Binding) -> t.Socket { let field = types.Field(name: "asSocket", args: [], subfields: []) let new_op = { use q <- types.bind(parent.op) types.Pure(list.append(q, [field])) } t.Socket(op: new_op) } /// Retrieve the binding value, as type Stat pub fn as_stat(parent: t.Binding) -> t.Stat { let field = types.Field(name: "asStat", args: [], subfields: []) let new_op = { use q <- types.bind(parent.op) types.Pure(list.append(q, [field])) } t.Stat(op: new_op) } /// Returns the binding's string value pub fn as_string(parent: t.Binding, client client: Client, then handler: fn(Try(String)) -> a) -> a { let field = types.Field(name: "asString", 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("asString"))) } } ) } handler(interpreter.run(op, client)) } /// Retrieve the binding value, as type Workspace pub fn as_workspace(parent: t.Binding) -> t.Workspace { let field = types.Field(name: "asWorkspace", args: [], subfields: []) let new_op = { use q <- types.bind(parent.op) types.Pure(list.append(q, [field])) } t.Workspace(op: new_op) } /// Returns the digest of the binding value pub fn digest(parent: t.Binding, client client: Client, then handler: fn(Try(String)) -> a) -> a { let field = types.Field(name: "digest", 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("digest"))) } } ) } handler(interpreter.run(op, client)) } /// A unique identifier for this Binding. pub fn id(parent: t.Binding) -> t.Binding { let field = types.Field(name: "id", args: [], subfields: []) let new_op = { use q <- types.bind(parent.op) types.Pure(list.append(q, [field])) } t.Binding(op: new_op) } /// Returns true if the binding is null pub fn is_null(parent: t.Binding, client client: Client, then handler: fn(Try(Bool)) -> a) -> a { let field = types.Field(name: "isNull", 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("isNull"))) } } ) } handler(interpreter.run(op, client)) } /// Returns the binding name pub fn name(parent: t.Binding, 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)) } /// Returns the binding type pub fn type_name(parent: t.Binding, client client: Client, then handler: fn(Try(String)) -> a) -> a { let field = types.Field(name: "typeName", 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("typeName"))) } } ) } handler(interpreter.run(op, client)) }