Current section
Files
Jump to
Current section
Files
lib/docker_engine_api/api/config.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.Config do
@moduledoc """
API calls for all endpoints tagged `Config`.
"""
alias DockerEngineAPI.Connection
import DockerEngineAPI.RequestBuilder
@doc """
Create a config
### Parameters
- `connection` (DockerEngineAPI.Connection): Connection to server
- `opts` (keyword): Optional parameters
- `:body` (ConfigCreateRequest):
### Returns
- `{:ok, DockerEngineAPI.Model.IdResponse.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec config_create(Tesla.Env.client, keyword()) :: {:ok, DockerEngineAPI.Model.ErrorResponse.t} | {:ok, DockerEngineAPI.Model.IdResponse.t} | {:error, Tesla.Env.t}
def config_create(connection, opts \\ []) do
optional_params = %{
:body => :body
}
request =
%{}
|> method(:post)
|> url("/configs/create")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{201, DockerEngineAPI.Model.IdResponse},
{409, DockerEngineAPI.Model.ErrorResponse},
{500, DockerEngineAPI.Model.ErrorResponse},
{503, DockerEngineAPI.Model.ErrorResponse}
])
end
@doc """
Delete a config
### Parameters
- `connection` (DockerEngineAPI.Connection): Connection to server
- `id` (String.t): ID of the config
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec config_delete(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, DockerEngineAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def config_delete(connection, id, _opts \\ []) do
request =
%{}
|> method(:delete)
|> url("/configs/#{id}")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{204, false},
{404, DockerEngineAPI.Model.ErrorResponse},
{500, DockerEngineAPI.Model.ErrorResponse},
{503, DockerEngineAPI.Model.ErrorResponse}
])
end
@doc """
Inspect a config
### Parameters
- `connection` (DockerEngineAPI.Connection): Connection to server
- `id` (String.t): ID of the config
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, DockerEngineAPI.Model.Config.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec config_inspect(Tesla.Env.client, String.t, keyword()) :: {:ok, DockerEngineAPI.Model.ErrorResponse.t} | {:ok, DockerEngineAPI.Model.Config.t} | {:error, Tesla.Env.t}
def config_inspect(connection, id, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/configs/#{id}")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, DockerEngineAPI.Model.Config},
{404, DockerEngineAPI.Model.ErrorResponse},
{500, DockerEngineAPI.Model.ErrorResponse},
{503, DockerEngineAPI.Model.ErrorResponse}
])
end
@doc """
List configs
### Parameters
- `connection` (DockerEngineAPI.Connection): Connection to server
- `opts` (keyword): Optional parameters
- `:filters` (String.t): A JSON encoded value of the filters (a `map[string][]string`) to process on the configs list. Available filters: - `id=<config id>` - `label=<key> or label=<key>=value` - `name=<config name>` - `names=<config name>`
### Returns
- `{:ok, [%Config{}, ...]}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec config_list(Tesla.Env.client, keyword()) :: {:ok, DockerEngineAPI.Model.ErrorResponse.t} | {:ok, list(DockerEngineAPI.Model.Config.t)} | {:error, Tesla.Env.t}
def config_list(connection, opts \\ []) do
optional_params = %{
:filters => :query
}
request =
%{}
|> method(:get)
|> url("/configs")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, DockerEngineAPI.Model.Config},
{500, DockerEngineAPI.Model.ErrorResponse},
{503, DockerEngineAPI.Model.ErrorResponse}
])
end
@doc """
Update a Config
### Parameters
- `connection` (DockerEngineAPI.Connection): Connection to server
- `id` (String.t): The ID or name of the config
- `version` (integer()): The version number of the config object being updated. This is required to avoid conflicting writes.
- `opts` (keyword): Optional parameters
- `:body` (ConfigSpec): The spec of the config to update. Currently, only the Labels field can be updated. All other fields must remain unchanged from the [ConfigInspect endpoint](#operation/ConfigInspect) response values.
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec config_update(Tesla.Env.client, String.t, integer(), keyword()) :: {:ok, nil} | {:ok, DockerEngineAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def config_update(connection, id, version, opts \\ []) do
optional_params = %{
:body => :body
}
request =
%{}
|> method(:post)
|> url("/configs/#{id}/update")
|> add_param(:query, :version, version)
|> 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},
{503, DockerEngineAPI.Model.ErrorResponse}
])
end
end