Packages
dagger
0.10.2
0.21.7
0.21.6
0.21.5
0.21.4
0.21.3
0.21.2
0.21.1
0.21.0
0.20.8
0.20.7
0.20.6
0.20.5
0.20.4
0.20.3
0.20.2
0.20.1
0.20.0
0.19.11
0.19.10
0.19.9
0.19.8
0.19.7
0.19.6
0.19.5
0.19.4
0.19.3
0.19.2
0.19.1
0.19.0
0.18.19
0.18.18
0.18.17
0.18.16
0.18.15
0.18.14
0.18.13
0.18.12
0.18.11
0.18.10
0.18.9
0.18.8
0.18.7
0.18.5
0.18.4
0.18.3
0.18.2
0.18.1
0.18.0
0.17.2
0.17.1
0.17.0
0.16.3
0.16.2
0.16.1
0.16.0
0.15.4
0.15.3
0.15.2
0.15.1
0.15.0
0.14.0
0.13.7
0.13.6
0.13.5
0.13.4
0.13.3
0.13.2
0.13.1
0.13.0
0.12.7
0.12.6
0.12.5
0.12.4
0.12.3
0.12.2
0.12.1
0.12.0
0.11.9
0.11.8
0.11.7
0.11.6
0.11.5
0.11.4
0.11.3
0.11.2
0.11.1
0.11.0
0.10.3
0.10.2
0.10.1
0.10.0
0.9.11
0.9.10
0.9.9
0.9.8
0.9.7
0.9.6
0.9.5
0.9.4
0.9.3
0.9.2
0.9.1
0.9.0
0.8.8
0.8.7
0.8.6
0.8.5
0.8.4
0.8.2
0.0.0
retired
Dagger SDK for Elixir
Current section
Files
Jump to
Current section
Files
lib/dagger/gen/module.ex
# This file generated by `mix dagger.gen`. Please DO NOT EDIT.
defmodule Dagger.Module do
@moduledoc "A Dagger module."
use Dagger.Core.QueryBuilder
@type t() :: %__MODULE__{}
defstruct [:selection, :client]
(
@doc "Modules used by this module."
@spec dependencies(t()) :: {:ok, [Dagger.Module.t()]} | {:error, term()}
def dependencies(%__MODULE__{} = module) do
selection = select(module.selection, "dependencies")
selection =
select(
selection,
"dependencies dependencyConfig description generatedContextDiff generatedContextDirectory id initialize interfaces name objects runtime sdk serve source withDescription withInterface withObject withSource"
)
with {:ok, data} <- execute(selection, module.client) do
{:ok,
data
|> Enum.map(fn value ->
elem_selection = Dagger.Core.QueryBuilder.Selection.query()
elem_selection = select(elem_selection, "loadModuleFromID")
elem_selection = arg(elem_selection, "id", value["id"])
%Dagger.Module{selection: elem_selection, client: module.client}
end)}
end
end
)
(
@doc "The dependencies as configured by the module."
@spec dependency_config(t()) :: {:ok, [Dagger.ModuleDependency.t()]} | {:error, term()}
def dependency_config(%__MODULE__{} = module) do
selection = select(module.selection, "dependencyConfig")
selection = select(selection, "id name source")
with {:ok, data} <- execute(selection, module.client) do
{:ok,
data
|> Enum.map(fn value ->
elem_selection = Dagger.Core.QueryBuilder.Selection.query()
elem_selection = select(elem_selection, "loadModuleDependencyFromID")
elem_selection = arg(elem_selection, "id", value["id"])
%Dagger.ModuleDependency{selection: elem_selection, client: module.client}
end)}
end
end
)
(
@doc "The doc string of the module, if any"
@spec description(t()) :: {:ok, Dagger.String.t()} | {:error, term()}
def description(%__MODULE__{} = module) do
selection = select(module.selection, "description")
execute(selection, module.client)
end
)
(
@doc "The generated files and directories made on top of the module source's context directory."
@spec generated_context_diff(t()) :: Dagger.Directory.t()
def generated_context_diff(%__MODULE__{} = module) do
selection = select(module.selection, "generatedContextDiff")
%Dagger.Directory{selection: selection, client: module.client}
end
)
(
@doc "The module source's context plus any configuration and source files created by codegen."
@spec generated_context_directory(t()) :: Dagger.Directory.t()
def generated_context_directory(%__MODULE__{} = module) do
selection = select(module.selection, "generatedContextDirectory")
%Dagger.Directory{selection: selection, client: module.client}
end
)
(
@doc "A unique identifier for this Module."
@spec id(t()) :: {:ok, Dagger.ModuleID.t()} | {:error, term()}
def id(%__MODULE__{} = module) do
selection = select(module.selection, "id")
execute(selection, module.client)
end
)
(
@doc "Retrieves the module with the objects loaded via its SDK."
@spec initialize(t()) :: Dagger.Module.t()
def initialize(%__MODULE__{} = module) do
selection = select(module.selection, "initialize")
%Dagger.Module{selection: selection, client: module.client}
end
)
(
@doc "Interfaces served by this module."
@spec interfaces(t()) :: {:ok, [Dagger.TypeDef.t()]} | {:error, term()}
def interfaces(%__MODULE__{} = module) do
selection = select(module.selection, "interfaces")
selection =
select(
selection,
"asInput asInterface asList asObject id kind optional withConstructor withField withFunction withInterface withKind withListOf withObject withOptional"
)
with {:ok, data} <- execute(selection, module.client) do
{:ok,
data
|> Enum.map(fn value ->
elem_selection = Dagger.Core.QueryBuilder.Selection.query()
elem_selection = select(elem_selection, "loadTypeDefFromID")
elem_selection = arg(elem_selection, "id", value["id"])
%Dagger.TypeDef{selection: elem_selection, client: module.client}
end)}
end
end
)
(
@doc "The name of the module"
@spec name(t()) :: {:ok, Dagger.String.t()} | {:error, term()}
def name(%__MODULE__{} = module) do
selection = select(module.selection, "name")
execute(selection, module.client)
end
)
(
@doc "Objects served by this module."
@spec objects(t()) :: {:ok, [Dagger.TypeDef.t()]} | {:error, term()}
def objects(%__MODULE__{} = module) do
selection = select(module.selection, "objects")
selection =
select(
selection,
"asInput asInterface asList asObject id kind optional withConstructor withField withFunction withInterface withKind withListOf withObject withOptional"
)
with {:ok, data} <- execute(selection, module.client) do
{:ok,
data
|> Enum.map(fn value ->
elem_selection = Dagger.Core.QueryBuilder.Selection.query()
elem_selection = select(elem_selection, "loadTypeDefFromID")
elem_selection = arg(elem_selection, "id", value["id"])
%Dagger.TypeDef{selection: elem_selection, client: module.client}
end)}
end
end
)
(
@doc "The container that runs the module's entrypoint. It will fail to execute if the module doesn't compile."
@spec runtime(t()) :: Dagger.Container.t()
def runtime(%__MODULE__{} = module) do
selection = select(module.selection, "runtime")
%Dagger.Container{selection: selection, client: module.client}
end
)
(
@doc "The SDK used by this module. Either a name of a builtin SDK or a module source ref string pointing to the SDK's implementation."
@spec sdk(t()) :: {:ok, Dagger.String.t()} | {:error, term()}
def sdk(%__MODULE__{} = module) do
selection = select(module.selection, "sdk")
execute(selection, module.client)
end
)
(
@doc "Serve a module's API in the current session.\n\nNote: this can only be called once per session. In the future, it could return a stream or service to remove the side effect."
@spec serve(t()) :: {:ok, Dagger.Void.t() | nil} | {:error, term()}
def serve(%__MODULE__{} = module) do
selection = select(module.selection, "serve")
execute(selection, module.client)
end
)
(
@doc "The source for the module."
@spec source(t()) :: Dagger.ModuleSource.t()
def source(%__MODULE__{} = module) do
selection = select(module.selection, "source")
%Dagger.ModuleSource{selection: selection, client: module.client}
end
)
(
@doc "Retrieves the module with the given description\n\n## Required Arguments\n\n* `description` - The description to set"
@spec with_description(t(), Dagger.String.t()) :: Dagger.Module.t()
def with_description(%__MODULE__{} = module, description) do
selection = select(module.selection, "withDescription")
selection = arg(selection, "description", description)
%Dagger.Module{selection: selection, client: module.client}
end
)
(
@doc "This module plus the given Interface type and associated functions\n\n## Required Arguments\n\n* `iface` -"
@spec with_interface(t(), Dagger.TypeDef.t()) :: Dagger.Module.t()
def with_interface(%__MODULE__{} = module, iface) do
selection = select(module.selection, "withInterface")
(
{:ok, id} = Dagger.TypeDef.id(iface)
selection = arg(selection, "iface", id)
)
%Dagger.Module{selection: selection, client: module.client}
end
)
(
@doc "This module plus the given Object type and associated functions.\n\n## Required Arguments\n\n* `object` -"
@spec with_object(t(), Dagger.TypeDef.t()) :: Dagger.Module.t()
def with_object(%__MODULE__{} = module, object) do
selection = select(module.selection, "withObject")
(
{:ok, id} = Dagger.TypeDef.id(object)
selection = arg(selection, "object", id)
)
%Dagger.Module{selection: selection, client: module.client}
end
)
(
@doc "Retrieves the module with basic configuration loaded if present.\n\n## Required Arguments\n\n* `source` - The module source to initialize from."
@spec with_source(t(), Dagger.ModuleSource.t()) :: Dagger.Module.t()
def with_source(%__MODULE__{} = module, source) do
selection = select(module.selection, "withSource")
selection = arg(selection, "source", source)
%Dagger.Module{selection: selection, client: module.client}
end
)
end