Packages
testcontainers
2.0.0-rc
2.3.1
2.3.0
2.2.0
2.1.0
2.1.0-rc1
2.0.0
2.0.0-rc3
2.0.0-rc2
2.0.0-rc
1.14.1
1.14.0
1.13.5
1.13.4
1.13.3
1.13.2
1.13.1
1.13.0
1.12.0
1.11.8
1.11.7
1.11.6
1.11.5
1.11.4
1.11.3
1.11.2
1.11.1
1.11.0
1.10.5
1.10.4
1.10.3
1.10.2
1.10.1
1.10.0
1.9.0
1.8.4
1.8.3
1.8.2
1.8.1
1.8.0
1.7.0
1.6.0
1.5.1
1.5.0
1.4.2
1.4.1
1.4.0
1.3.1
1.3.0
1.2.11
1.2.10
1.2.9
1.2.8
1.2.7
1.2.6
1.2.5
1.2.4
1.2.3
1.2.2
1.2.1
1.2.0
1.1.3
1.1.2
1.1.1
1.1.0
1.0.1
1.0.0
1.0.0-beta.1
1.0.0-beta
0.9.3
0.9.2
0.9.1
0.9.0
Testcontainers is an Elixir library that supports ExUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.
Current section
Files
Jump to
Current section
Files
docker_engine_api/api/exec.ex
# NOTE: This file is auto generated by OpenAPI Generator 7.0.1 (https://openapi-generator.tech).
# Do not edit this file manually.
defmodule DockerEngineAPI.Api.Exec do
@moduledoc """
API calls for all endpoints tagged `Exec`.
"""
alias DockerEngineAPI.Connection
import DockerEngineAPI.RequestBuilder
@doc """
Create an exec instance
Run a command inside a running container.
### Parameters
- `connection` (DockerEngineAPI.Connection): Connection to server
- `id` (String.t): ID or name of container
- `exec_config` (ExecConfig): Exec configuration
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, DockerEngineAPI.Model.IdResponse.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec container_exec(Tesla.Env.client, String.t, DockerEngineAPI.Model.ExecConfig.t, keyword()) :: {:ok, DockerEngineAPI.Model.ErrorResponse.t} | {:ok, DockerEngineAPI.Model.IdResponse.t} | {:error, Tesla.Env.t}
def container_exec(connection, id, exec_config, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/containers/#{id}/exec")
|> add_param(:body, :body, exec_config)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{201, DockerEngineAPI.Model.IdResponse},
{404, DockerEngineAPI.Model.ErrorResponse},
{409, DockerEngineAPI.Model.ErrorResponse},
{500, DockerEngineAPI.Model.ErrorResponse}
])
end
@doc """
Inspect an exec instance
Return low-level information about an exec instance.
### Parameters
- `connection` (DockerEngineAPI.Connection): Connection to server
- `id` (String.t): Exec instance ID
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, DockerEngineAPI.Model.ExecInspectResponse.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec exec_inspect(Tesla.Env.client, String.t, keyword()) :: {:ok, DockerEngineAPI.Model.ErrorResponse.t} | {:ok, DockerEngineAPI.Model.ExecInspectResponse.t} | {:error, Tesla.Env.t}
def exec_inspect(connection, id, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/exec/#{id}/json")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, DockerEngineAPI.Model.ExecInspectResponse},
{404, DockerEngineAPI.Model.ErrorResponse},
{500, DockerEngineAPI.Model.ErrorResponse}
])
end
@doc """
Resize an exec instance
Resize the TTY session used by an exec instance. This endpoint only works if `tty` was specified as part of creating and starting the exec instance.
### Parameters
- `connection` (DockerEngineAPI.Connection): Connection to server
- `id` (String.t): Exec instance ID
- `opts` (keyword): Optional parameters
- `:h` (integer()): Height of the TTY session in characters
- `:w` (integer()): Width of the TTY session in characters
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec exec_resize(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, DockerEngineAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def exec_resize(connection, id, opts \\ []) do
optional_params = %{
:h => :query,
:w => :query
}
request =
%{}
|> method(:post)
|> url("/exec/#{id}/resize")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, false},
{400, DockerEngineAPI.Model.ErrorResponse},
{404, DockerEngineAPI.Model.ErrorResponse},
{500, DockerEngineAPI.Model.ErrorResponse}
])
end
@doc """
Start an exec instance
Starts a previously set up exec instance. If detach is true, this endpoint returns immediately after starting the command. Otherwise, it sets up an interactive session with the command.
### Parameters
- `connection` (DockerEngineAPI.Connection): Connection to server
- `id` (String.t): Exec instance ID
- `opts` (keyword): Optional parameters
- `:body` (ExecStartConfig):
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec exec_start(Tesla.Env.client, String.t, keyword()) :: {:ok, Tesla.Env.t | DockerEngineAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def exec_start(connection, id, opts \\ []) do
optional_params = %{
:body => :body
}
request =
%{}
|> method(:post)
|> url("/exec/#{id}/start")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, false},
{404, DockerEngineAPI.Model.ErrorResponse},
{409, DockerEngineAPI.Model.ErrorResponse}
])
end
end