Packages
lexdee
2.4.2
2.6.4
2.6.3
2.6.2
2.6.1
2.6.0
2.5.1
2.5.0
2.4.5
2.4.4
2.4.3
2.4.2
2.4.1
2.4.0
2.3.11
2.3.10
2.3.9
2.3.8
2.3.7
2.3.6
2.3.5
2.3.4
2.3.3
2.3.2
2.3.0
2.2.7
2.2.6
2.2.5
2.2.3
2.2.2
2.2.1
2.2.0
2.1.1
2.0.2
2.0.1
2.0.0
1.0.6
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
0.3.3
0.3.2
0.3.1
0.3.0
0.2.5
0.2.4
0.2.3
0.2.2
0.2.1
0.2.0
0.1.10
0.1.9
0.1.8
0.1.7
0.1.6
0.1.5
0.1.4
0.1.3
Client library for LXD
Current section
Files
Jump to
Current section
Files
lib/lexdee/instances/exec.ex
defmodule Lexdee.Instances.Exec do
use Tesla
alias Lexdee.Instances
@path "/exec"
@spec perform(Tesla.Client.t(), list(String.t()), Keyword.t()) ::
{:error, any} | {:ok, Tesla.Env.t()}
def perform(client, id, command, opts \\ []) do
settings = Keyword.get(opts, :settings, %{})
params = %{
"command" => ["/bin/sh", "-c", command],
"environment" => Map.get(settings, :environment, %{}),
"wait-for-websocket" => Map.get(settings, :wait_for_websocket, false),
"record-output" => Map.get(settings, :record_output, true),
"interactive" => Map.get(settings, :interactive, false)
}
path =
[Instances.base_path(), id, @path]
|> Path.join()
client
|> post(path, params, Keyword.delete(opts, :settings))
end
end