Current section
Files
Jump to
Current section
Files
lib/docker_engine_api/api/swarm.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.Swarm do
@moduledoc """
API calls for all endpoints tagged `Swarm`.
"""
alias DockerEngineAPI.Connection
import DockerEngineAPI.RequestBuilder
@doc """
Initialize a new swarm
### Parameters
- `connection` (DockerEngineAPI.Connection): Connection to server
- `body` (SwarmInitRequest):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, String.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec swarm_init(Tesla.Env.client, DockerEngineAPI.Model.SwarmInitRequest.t, keyword()) :: {:ok, DockerEngineAPI.Model.ErrorResponse.t} | {:ok, String.t} | {:error, Tesla.Env.t}
def swarm_init(connection, body, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/swarm/init")
|> add_param(:body, :body, body)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, false},
{400, DockerEngineAPI.Model.ErrorResponse},
{500, DockerEngineAPI.Model.ErrorResponse},
{503, DockerEngineAPI.Model.ErrorResponse}
])
end
@doc """
Inspect swarm
### Parameters
- `connection` (DockerEngineAPI.Connection): Connection to server
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, DockerEngineAPI.Model.Swarm.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec swarm_inspect(Tesla.Env.client, keyword()) :: {:ok, DockerEngineAPI.Model.Swarm.t} | {:ok, DockerEngineAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def swarm_inspect(connection, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/swarm")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, DockerEngineAPI.Model.Swarm},
{404, DockerEngineAPI.Model.ErrorResponse},
{500, DockerEngineAPI.Model.ErrorResponse},
{503, DockerEngineAPI.Model.ErrorResponse}
])
end
@doc """
Join an existing swarm
### Parameters
- `connection` (DockerEngineAPI.Connection): Connection to server
- `body` (SwarmJoinRequest):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec swarm_join(Tesla.Env.client, DockerEngineAPI.Model.SwarmJoinRequest.t, keyword()) :: {:ok, nil} | {:ok, DockerEngineAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def swarm_join(connection, body, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/swarm/join")
|> add_param(:body, :body, body)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, false},
{400, DockerEngineAPI.Model.ErrorResponse},
{500, DockerEngineAPI.Model.ErrorResponse},
{503, DockerEngineAPI.Model.ErrorResponse}
])
end
@doc """
Leave a swarm
### Parameters
- `connection` (DockerEngineAPI.Connection): Connection to server
- `opts` (keyword): Optional parameters
- `:force` (boolean()): Force leave swarm, even if this is the last manager or that it will break the cluster.
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec swarm_leave(Tesla.Env.client, keyword()) :: {:ok, nil} | {:ok, DockerEngineAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def swarm_leave(connection, opts \\ []) do
optional_params = %{
:force => :query
}
request =
%{}
|> method(:post)
|> url("/swarm/leave")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, false},
{500, DockerEngineAPI.Model.ErrorResponse},
{503, DockerEngineAPI.Model.ErrorResponse}
])
end
@doc """
Unlock a locked manager
### Parameters
- `connection` (DockerEngineAPI.Connection): Connection to server
- `body` (SwarmUnlockRequest):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec swarm_unlock(Tesla.Env.client, DockerEngineAPI.Model.SwarmUnlockRequest.t, keyword()) :: {:ok, nil} | {:ok, DockerEngineAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def swarm_unlock(connection, body, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/swarm/unlock")
|> add_param(:body, :body, body)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, false},
{500, DockerEngineAPI.Model.ErrorResponse},
{503, DockerEngineAPI.Model.ErrorResponse}
])
end
@doc """
Get the unlock key
### Parameters
- `connection` (DockerEngineAPI.Connection): Connection to server
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, DockerEngineAPI.Model.UnlockKeyResponse.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec swarm_unlockkey(Tesla.Env.client, keyword()) :: {:ok, DockerEngineAPI.Model.UnlockKeyResponse.t} | {:ok, DockerEngineAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def swarm_unlockkey(connection, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/swarm/unlockkey")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, DockerEngineAPI.Model.UnlockKeyResponse},
{500, DockerEngineAPI.Model.ErrorResponse},
{503, DockerEngineAPI.Model.ErrorResponse}
])
end
@doc """
Update a swarm
### Parameters
- `connection` (DockerEngineAPI.Connection): Connection to server
- `version` (integer()): The version number of the swarm object being updated. This is required to avoid conflicting writes.
- `body` (SwarmSpec):
- `opts` (keyword): Optional parameters
- `:rotateWorkerToken` (boolean()): Rotate the worker join token.
- `:rotateManagerToken` (boolean()): Rotate the manager join token.
- `:rotateManagerUnlockKey` (boolean()): Rotate the manager unlock key.
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec swarm_update(Tesla.Env.client, integer(), DockerEngineAPI.Model.SwarmSpec.t, keyword()) :: {:ok, nil} | {:ok, DockerEngineAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def swarm_update(connection, version, body, opts \\ []) do
optional_params = %{
:rotateWorkerToken => :query,
:rotateManagerToken => :query,
:rotateManagerUnlockKey => :query
}
request =
%{}
|> method(:post)
|> url("/swarm/update")
|> add_param(:query, :version, version)
|> add_param(:body, :body, body)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, false},
{400, DockerEngineAPI.Model.ErrorResponse},
{500, DockerEngineAPI.Model.ErrorResponse},
{503, DockerEngineAPI.Model.ErrorResponse}
])
end
end