Packages
dagger
0.11.8
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/service.ex
# This file generated by `dagger_codegen`. Please DO NOT EDIT.
defmodule Dagger.Service do
@moduledoc "A content-addressed service providing TCP connectivity."
use Dagger.Core.QueryBuilder
@derive Dagger.ID
defstruct [:selection, :client]
@type t() :: %__MODULE__{}
@doc """
Retrieves an endpoint that clients can use to reach this container.
If no port is specified, the first exposed port is used. If none exist an error is returned.
If a scheme is specified, a URL is returned. Otherwise, a host:port pair is returned.
"""
@spec endpoint(t(), [{:port, integer() | nil}, {:scheme, String.t() | nil}]) ::
{:ok, String.t()} | {:error, term()}
def endpoint(%__MODULE__{} = service, optional_args \\ []) do
selection =
service.selection
|> select("endpoint")
|> maybe_put_arg("port", optional_args[:port])
|> maybe_put_arg("scheme", optional_args[:scheme])
execute(selection, service.client)
end
@doc "Retrieves a hostname which can be used by clients to reach this container."
@spec hostname(t()) :: {:ok, String.t()} | {:error, term()}
def hostname(%__MODULE__{} = service) do
selection =
service.selection |> select("hostname")
execute(selection, service.client)
end
@doc "A unique identifier for this Service."
@spec id(t()) :: {:ok, Dagger.ServiceID.t()} | {:error, term()}
def id(%__MODULE__{} = service) do
selection =
service.selection |> select("id")
execute(selection, service.client)
end
@doc "Retrieves the list of ports provided by the service."
@spec ports(t()) :: {:ok, [Dagger.Port.t()]} | {:error, term()}
def ports(%__MODULE__{} = service) do
selection =
service.selection |> select("ports") |> select("id")
with {:ok, items} <- execute(selection, service.client) do
{:ok,
for %{"id" => id} <- items do
%Dagger.Port{
selection:
query()
|> select("loadPortFromID")
|> arg("id", id),
client: service.client
}
end}
end
end
@doc """
Start the service and wait for its health checks to succeed.
Services bound to a Container do not need to be manually started.
"""
@spec start(t()) :: {:ok, Dagger.ServiceID.t()} | {:error, term()}
def start(%__MODULE__{} = service) do
selection =
service.selection |> select("start")
execute(selection, service.client)
end
@doc "Stop the service."
@spec stop(t(), [{:kill, boolean() | nil}]) :: {:ok, Dagger.ServiceID.t()} | {:error, term()}
def stop(%__MODULE__{} = service, optional_args \\ []) do
selection =
service.selection |> select("stop") |> maybe_put_arg("kill", optional_args[:kill])
execute(selection, service.client)
end
@doc "Creates a tunnel that forwards traffic from the caller's network to this service."
@spec up(t(), [{:ports, [Dagger.PortForward.t()]}, {:random, boolean() | nil}]) ::
{:ok, Dagger.Void.t() | nil} | {:error, term()}
def up(%__MODULE__{} = service, optional_args \\ []) do
selection =
service.selection
|> select("up")
|> maybe_put_arg("ports", optional_args[:ports])
|> maybe_put_arg("random", optional_args[:random])
execute(selection, service.client)
end
end