Dagger.Client (dagger v1.0.0-beta.19)

Copy Markdown View Source

The root of the DAG.

Summary

Functions

Resolve external references only.

Creates a file from arbitrary binary contents.

Constructs a cache volume for a given cache key.

Creates an empty changeset

Dagger Cloud configuration and state

Creates a scratch container, with no image or metadata.

The FunctionCall context that the SDK caller is currently executing in.

The module currently being served in the session, if any.

The object that received the current module function call, as a Node. Errors when there is no current call, or the call is top-level (e.g. a module constructor).

The current UTC time in RFC3339 format. Never cached.

The TypeDef representations of the objects currently being served in the session.

Detect and return the current workspace.

The default platform of the engine.

Creates an empty directory.

The Dagger engine container configuration and state

Constructs an engine-managed volume backed by operator-provided storage beneath the configured engine state root.

Initialize an environment file

Create a new error.

Creates a file with the specified contents.

Format many names at once, for codegen. Returns them in input order.

Create a code generation result, given a directory containing the generated code.

Queries a Git repository.

Queries the host environment.

Returns a file containing an http remote url content.

A unique identifier for this Query.

Parse a name in any casing into words.

Initialize a JSON value

Initialize a new LLM conversation.

Start an empty run of text and media content, independent of any conversation.

Create a new module.

Create a new module source instance from a source ref string

The acronyms and terms used to parse and format identifiers.

Load any object by its ID.

Load a GraphQL introspection schema for merging.

Load the module at the given address and serve its API in the current session.

Sets a secret given a user defined name to its plaintext and returns the secret.

Name the current session.

Creates source map metadata.

Create a new TypeDef.

Get the current Dagger Engine version.

Types

t()

@type t() :: %Dagger.Client{client: term(), query_builder: term()}

Functions

address(client, value)

@spec address(t(), String.t()) :: Dagger.Address.t()

Resolve external references only.

blob(client, name, contents, optional_args \\ [])

@spec blob(t(), String.t(), Dagger.Bytes.t(), [{:permissions, integer() | nil}]) ::
  Dagger.File.t()

Creates a file from arbitrary binary contents.

cache_volume(client, key, optional_args \\ [])

@spec cache_volume(t(), String.t(),
  source: Dagger.Directory.t() | nil,
  sharing: Dagger.CacheSharingMode.t() | nil,
  owner: String.t() | nil
) :: Dagger.CacheVolume.t()

Constructs a cache volume for a given cache key.

changeset(client)

@spec changeset(t()) :: Dagger.Changeset.t()

Creates an empty changeset

cloud(client)

@spec cloud(t()) :: Dagger.Cloud.t()

Dagger Cloud configuration and state

container(client, optional_args \\ [])

@spec container(t(), [{:platform, Dagger.Platform.t() | nil}]) :: Dagger.Container.t()

Creates a scratch container, with no image or metadata.

To pull an image, follow up with the "from" function.

current_function_call(client)

@spec current_function_call(t()) :: Dagger.FunctionCall.t()

The FunctionCall context that the SDK caller is currently executing in.

If the caller is not currently executing in a function, this will return an error.

current_module(client)

@spec current_module(t()) :: Dagger.CurrentModule.t()

The module currently being served in the session, if any.

current_node(client)

@spec current_node(t()) :: Dagger.Node.t()

The object that received the current module function call, as a Node. Errors when there is no current call, or the call is top-level (e.g. a module constructor).

current_timestamp(client)

@spec current_timestamp(t()) :: {:ok, String.t()} | {:error, term()}

The current UTC time in RFC3339 format. Never cached.

current_type_defs(client, optional_args \\ [])

@spec current_type_defs(t(),
  return_all_types: boolean() | nil,
  hide_core: boolean() | nil
) ::
  {:ok, [Dagger.TypeDef.t()]} | {:error, term()}

The TypeDef representations of the objects currently being served in the session.

current_workspace(client)

@spec current_workspace(t()) :: Dagger.Workspace.t()

Detect and return the current workspace.

Experimental

"Highly experimental API extracted from a more ambitious workspace implementation."

default_platform(client)

@spec default_platform(t()) :: {:ok, Dagger.Platform.t()} | {:error, term()}

The default platform of the engine.

directory(client)

@spec directory(t()) :: Dagger.Directory.t()

Creates an empty directory.

engine(client)

@spec engine(t()) :: Dagger.Engine.t()

The Dagger engine container configuration and state

engine_volume(client, name, optional_args \\ [])

@spec engine_volume(t(), String.t(), [{:subdir, String.t() | nil}]) ::
  Dagger.Volume.t()

Constructs an engine-managed volume backed by operator-provided storage beneath the configured engine state root.

env_file(client, optional_args \\ [])

@spec env_file(t(), [{:expand, boolean() | nil}]) :: Dagger.EnvFile.t()

Initialize an environment file

error(client, message)

@spec error(t(), String.t()) :: Dagger.Error.t()

Create a new error.

file(client, name, contents, optional_args \\ [])

@spec file(t(), String.t(), String.t(), [{:permissions, integer() | nil}]) ::
  Dagger.File.t()

Creates a file with the specified contents.

format_identifiers(client, names, casing, optional_args \\ [])

@spec format_identifiers(t(), [String.t()], Dagger.Casing.t(),
  acronyms: Dagger.AcronymStyle.t() | nil,
  version: String.t() | nil
) :: {:ok, [String.t()]} | {:error, term()}

Format many names at once, for codegen. Returns them in input order.

Experimental

"Identifier casing APIs are likely to change."

function(client, name, return_type)

@spec function(t(), String.t(), Dagger.TypeDef.t()) :: Dagger.Function.t()

Creates a function.

generated_code(client, code)

@spec generated_code(t(), Dagger.Directory.t()) :: Dagger.GeneratedCode.t()

Create a code generation result, given a directory containing the generated code.

git(client, url, optional_args \\ [])

@spec git(t(), String.t(),
  keep_git_dir: boolean() | nil,
  ssh_known_hosts: String.t() | nil,
  ssh_auth_socket: Dagger.Socket.t() | nil,
  http_auth_username: String.t() | nil,
  http_auth_token: Dagger.Secret.t() | nil,
  http_auth_header: Dagger.Secret.t() | nil,
  experimental_service_host: Dagger.Service.t() | nil
) :: Dagger.GitRepository.t()

Queries a Git repository.

host(client)

@spec host(t()) :: Dagger.Host.t()

Queries the host environment.

http(client, url, optional_args \\ [])

@spec http(t(), String.t(),
  name: String.t() | nil,
  permissions: integer() | nil,
  checksum: String.t() | nil,
  auth_header: Dagger.Secret.t() | nil,
  experimental_service_host: Dagger.Service.t() | nil
) :: Dagger.File.t()

Returns a file containing an http remote url content.

id(client)

@spec id(t()) :: {:ok, String.t()} | {:error, term()}

A unique identifier for this Query.

identifier(client, name)

@spec identifier(t(), String.t()) :: Dagger.Identifier.t()

Parse a name in any casing into words.

Known acronyms and terms come from the naming dictionary; everything else falls back to the case heuristic. Errors on non-ASCII input, input with no letters or digits, or input over 256 bytes.

Experimental

"Identifier casing APIs are likely to change."

json(client)

@spec json(t()) :: Dagger.JSONValue.t()

Initialize a JSON value

llm(client, optional_args \\ [])

@spec llm(t(), model: String.t() | nil, provider: String.t() | nil) :: Dagger.LLM.t()

Initialize a new LLM conversation.

Experimental

"LLM support is not yet stabilized"

llm_content(client)

@spec llm_content(t()) :: Dagger.LLMContent.t()

Start an empty run of text and media content, independent of any conversation.

Add blocks with withText, withFile, and withData. A function exposed as an LLM tool can return the content to give the model text and media as the tool's result, e.g. a caption and a screenshot for the model to look at.

Experimental

"LLM support is not yet stabilized"

module(client)

@spec module(t()) :: Dagger.Module.t()

Create a new module.

module_source(client, ref_string, optional_args \\ [])

@spec module_source(t(), String.t(),
  version: String.t() | nil,
  ref_pin: String.t() | nil,
  disable_find_up: boolean() | nil,
  allow_not_exists: boolean() | nil,
  require_kind: Dagger.ModuleSourceKind.t() | nil
) :: Dagger.ModuleSource.t()

Create a new module source instance from a source ref string

naming_dictionary(client)

@spec naming_dictionary(t()) :: {:ok, [Dagger.NamingTerm.t()]} | {:error, term()}

The acronyms and terms used to parse and format identifiers.

Experimental

"Identifier casing APIs are likely to change."

node(client, id)

@spec node(t(), String.t()) :: {:ok, Dagger.Node.t() | nil} | {:error, term()}

Load any object by its ID.

schema(client, json)

@spec schema(t(), Dagger.JSON.t()) :: Dagger.Schema.t()

Load a GraphQL introspection schema for merging.

secret(client, uri, optional_args \\ [])

@spec secret(t(), String.t(), [{:cache_key, String.t() | nil}]) :: Dagger.Secret.t()

Creates a new secret.

serve_module(client, address, optional_args \\ [])

@spec serve_module(t(), String.t(), [{:ref_pin, String.t() | nil}]) ::
  :ok | {:error, term()}

Load the module at the given address and serve its API in the current session.

A local address resolves against the caller's workspace, so a generated client can serve the module it is bound to without reaching for the workspace itself.

set_secret(client, name, plaintext)

@spec set_secret(t(), String.t(), String.t()) :: Dagger.Secret.t()

Sets a secret given a user defined name to its plaintext and returns the secret.

The plaintext value is limited to a size of 128000 bytes.

set_session_title(client, title)

@spec set_session_title(t(), String.t()) :: :ok | {:error, term()}

Name the current session.

The title renames the session wherever its telemetry is shown (the calling client's primary span, e.g. the CLI's command span) and labels its engine archive, as listed by dagger agent --resume. The latest title wins. Only the session's main client may set it.

Experimental

"Session APIs are likely to change."

source_map(client, filename, line, column)

@spec source_map(t(), String.t(), integer(), integer()) :: Dagger.SourceMap.t()

Creates source map metadata.

sshfs_volume(client, endpoint, private_key, optional_args \\ [])

@spec sshfs_volume(t(), String.t(), Dagger.Secret.t(),
  known_hosts: Dagger.Secret.t() | nil,
  cache_key: String.t() | nil,
  insecure_skip_host_key_check: boolean() | nil,
  experimental_service_host: Dagger.Service.t() | nil
) :: Dagger.Volume.t()

Constructs an SSHFS volume.

type_def(client)

@spec type_def(t()) :: Dagger.TypeDef.t()

Create a new TypeDef.

version(client)

@spec version(t()) :: {:ok, String.t()} | {:error, term()}

Get the current Dagger Engine version.