Current section

Files

Jump to
dagger lib dagger gen current_module.ex
Raw

lib/dagger/gen/current_module.ex

# This file generated by `dagger_codegen`. Please DO NOT EDIT.
defmodule Dagger.CurrentModule do
@moduledoc "Reflective module API provided to functions at runtime."
use Dagger.Core.QueryBuilder
@derive Dagger.ID
defstruct [:selection, :client]
@type t() :: %__MODULE__{}
@doc "A unique identifier for this CurrentModule."
@spec id(t()) :: {:ok, Dagger.CurrentModuleID.t()} | {:error, term()}
def id(%__MODULE__{} = current_module) do
selection =
current_module.selection |> select("id")
execute(selection, current_module.client)
end
@doc "The name of the module being executed in"
@spec name(t()) :: {:ok, String.t()} | {:error, term()}
def name(%__MODULE__{} = current_module) do
selection =
current_module.selection |> select("name")
execute(selection, current_module.client)
end
@doc "The directory containing the module's source code loaded into the engine (plus any generated code that may have been created)."
@spec source(t()) :: Dagger.Directory.t()
def source(%__MODULE__{} = current_module) do
selection =
current_module.selection |> select("source")
%Dagger.Directory{
selection: selection,
client: current_module.client
}
end
@doc "Load a directory from the module's scratch working directory, including any changes that may have been made to it during module function execution."
@spec workdir(t(), String.t(), [{:exclude, [String.t()]}, {:include, [String.t()]}]) ::
Dagger.Directory.t()
def workdir(%__MODULE__{} = current_module, path, optional_args \\ []) do
selection =
current_module.selection
|> select("workdir")
|> put_arg("path", path)
|> maybe_put_arg("exclude", optional_args[:exclude])
|> maybe_put_arg("include", optional_args[:include])
%Dagger.Directory{
selection: selection,
client: current_module.client
}
end
@doc "Load a file from the module's scratch working directory, including any changes that may have been made to it during module function execution.Load a file from the module's scratch working directory, including any changes that may have been made to it during module function execution."
@spec workdir_file(t(), String.t()) :: Dagger.File.t()
def workdir_file(%__MODULE__{} = current_module, path) do
selection =
current_module.selection |> select("workdirFile") |> put_arg("path", path)
%Dagger.File{
selection: selection,
client: current_module.client
}
end
end