Current section
Files
Jump to
Current section
Files
lib/docker_engine_api/api/plugin.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.Plugin do
@moduledoc """
API calls for all endpoints tagged `Plugin`.
"""
alias DockerEngineAPI.Connection
import DockerEngineAPI.RequestBuilder
@doc """
Get plugin privileges
### Parameters
- `connection` (DockerEngineAPI.Connection): Connection to server
- `remote` (String.t): The name of the plugin. The `:latest` tag is optional, and is the default if omitted.
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, [%PluginPrivilege{}, ...]}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec get_plugin_privileges(Tesla.Env.client, String.t, keyword()) :: {:ok, list(DockerEngineAPI.Model.PluginPrivilege.t)} | {:ok, DockerEngineAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def get_plugin_privileges(connection, remote, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/plugins/privileges")
|> add_param(:query, :remote, remote)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, DockerEngineAPI.Model.PluginPrivilege},
{500, DockerEngineAPI.Model.ErrorResponse}
])
end
@doc """
Create a plugin
### Parameters
- `connection` (DockerEngineAPI.Connection): Connection to server
- `name` (String.t): The name of the plugin. The `:latest` tag is optional, and is the default if omitted.
- `opts` (keyword): Optional parameters
- `:body` (String.t): Path to tar containing plugin rootfs and manifest
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec plugin_create(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, DockerEngineAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def plugin_create(connection, name, opts \\ []) do
optional_params = %{
:body => :body
}
request =
%{}
|> method(:post)
|> url("/plugins/create")
|> add_param(:query, :name, name)
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{204, false},
{500, DockerEngineAPI.Model.ErrorResponse}
])
end
@doc """
Remove a plugin
### Parameters
- `connection` (DockerEngineAPI.Connection): Connection to server
- `name` (String.t): The name of the plugin. The `:latest` tag is optional, and is the default if omitted.
- `opts` (keyword): Optional parameters
- `:force` (boolean()): Disable the plugin before removing. This may result in issues if the plugin is in use by a container.
### Returns
- `{:ok, DockerEngineAPI.Model.Plugin.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec plugin_delete(Tesla.Env.client, String.t, keyword()) :: {:ok, DockerEngineAPI.Model.Plugin.t} | {:ok, DockerEngineAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def plugin_delete(connection, name, opts \\ []) do
optional_params = %{
:force => :query
}
request =
%{}
|> method(:delete)
|> url("/plugins/#{name}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, DockerEngineAPI.Model.Plugin},
{404, DockerEngineAPI.Model.ErrorResponse},
{500, DockerEngineAPI.Model.ErrorResponse}
])
end
@doc """
Disable a plugin
### Parameters
- `connection` (DockerEngineAPI.Connection): Connection to server
- `name` (String.t): The name of the plugin. The `:latest` tag is optional, and is the default if omitted.
- `opts` (keyword): Optional parameters
- `:force` (boolean()): Force disable a plugin even if still in use.
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec plugin_disable(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, DockerEngineAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def plugin_disable(connection, name, opts \\ []) do
optional_params = %{
:force => :query
}
request =
%{}
|> method(:post)
|> url("/plugins/#{name}/disable")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, false},
{404, DockerEngineAPI.Model.ErrorResponse},
{500, DockerEngineAPI.Model.ErrorResponse}
])
end
@doc """
Enable a plugin
### Parameters
- `connection` (DockerEngineAPI.Connection): Connection to server
- `name` (String.t): The name of the plugin. The `:latest` tag is optional, and is the default if omitted.
- `opts` (keyword): Optional parameters
- `:timeout` (integer()): Set the HTTP client timeout (in seconds)
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec plugin_enable(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, DockerEngineAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def plugin_enable(connection, name, opts \\ []) do
optional_params = %{
:timeout => :query
}
request =
%{}
|> method(:post)
|> url("/plugins/#{name}/enable")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, false},
{404, DockerEngineAPI.Model.ErrorResponse},
{500, DockerEngineAPI.Model.ErrorResponse}
])
end
@doc """
Inspect a plugin
### Parameters
- `connection` (DockerEngineAPI.Connection): Connection to server
- `name` (String.t): The name of the plugin. The `:latest` tag is optional, and is the default if omitted.
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, DockerEngineAPI.Model.Plugin.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec plugin_inspect(Tesla.Env.client, String.t, keyword()) :: {:ok, DockerEngineAPI.Model.Plugin.t} | {:ok, DockerEngineAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def plugin_inspect(connection, name, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/plugins/#{name}/json")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, DockerEngineAPI.Model.Plugin},
{404, DockerEngineAPI.Model.ErrorResponse},
{500, DockerEngineAPI.Model.ErrorResponse}
])
end
@doc """
List plugins
Returns information about installed plugins.
### 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 plugin list. Available filters: - `capability=<capability name>` - `enable=<true>|<false>`
### Returns
- `{:ok, [%Plugin{}, ...]}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec plugin_list(Tesla.Env.client, keyword()) :: {:ok, DockerEngineAPI.Model.ErrorResponse.t} | {:ok, list(DockerEngineAPI.Model.Plugin.t)} | {:error, Tesla.Env.t}
def plugin_list(connection, opts \\ []) do
optional_params = %{
:filters => :query
}
request =
%{}
|> method(:get)
|> url("/plugins")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, DockerEngineAPI.Model.Plugin},
{500, DockerEngineAPI.Model.ErrorResponse}
])
end
@doc """
Install a plugin
Pulls and installs a plugin. After the plugin is installed, it can be enabled using the [`POST /plugins/{name}/enable` endpoint](#operation/PostPluginsEnable).
### Parameters
- `connection` (DockerEngineAPI.Connection): Connection to server
- `remote` (String.t): Remote reference for plugin to install. The `:latest` tag is optional, and is used as the default if omitted.
- `opts` (keyword): Optional parameters
- `:name` (String.t): Local name for the pulled plugin. The `:latest` tag is optional, and is used as the default if omitted.
- `:"X-Registry-Auth"` (String.t): A base64url-encoded auth configuration to use when pulling a plugin from a registry. Refer to the [authentication section](#section/Authentication) for details.
- `:body` ([DockerEngineAPI.Model.PluginPrivilege.t]):
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec plugin_pull(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, DockerEngineAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def plugin_pull(connection, remote, opts \\ []) do
optional_params = %{
:name => :query,
:"X-Registry-Auth" => :headers,
:body => :body
}
request =
%{}
|> method(:post)
|> url("/plugins/pull")
|> add_param(:query, :remote, remote)
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{204, false},
{500, DockerEngineAPI.Model.ErrorResponse}
])
end
@doc """
Push a plugin
Push a plugin to the registry.
### Parameters
- `connection` (DockerEngineAPI.Connection): Connection to server
- `name` (String.t): The name of the plugin. The `:latest` tag is optional, and is the default if omitted.
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec plugin_push(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, DockerEngineAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def plugin_push(connection, name, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/plugins/#{name}/push")
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, false},
{404, DockerEngineAPI.Model.ErrorResponse},
{500, DockerEngineAPI.Model.ErrorResponse}
])
end
@doc """
Configure a plugin
### Parameters
- `connection` (DockerEngineAPI.Connection): Connection to server
- `name` (String.t): The name of the plugin. The `:latest` tag is optional, and is the default if omitted.
- `opts` (keyword): Optional parameters
- `:body` ([String.t]):
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec plugin_set(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, DockerEngineAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def plugin_set(connection, name, opts \\ []) do
optional_params = %{
:body => :body
}
request =
%{}
|> method(:post)
|> url("/plugins/#{name}/set")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{204, false},
{404, DockerEngineAPI.Model.ErrorResponse},
{500, DockerEngineAPI.Model.ErrorResponse}
])
end
@doc """
Upgrade a plugin
### Parameters
- `connection` (DockerEngineAPI.Connection): Connection to server
- `name` (String.t): The name of the plugin. The `:latest` tag is optional, and is the default if omitted.
- `remote` (String.t): Remote reference to upgrade to. The `:latest` tag is optional, and is used as the default if omitted.
- `opts` (keyword): Optional parameters
- `:"X-Registry-Auth"` (String.t): A base64url-encoded auth configuration to use when pulling a plugin from a registry. Refer to the [authentication section](#section/Authentication) for details.
- `:body` ([DockerEngineAPI.Model.PluginPrivilege.t]):
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec plugin_upgrade(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, nil} | {:ok, DockerEngineAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def plugin_upgrade(connection, name, remote, opts \\ []) do
optional_params = %{
:"X-Registry-Auth" => :headers,
:body => :body
}
request =
%{}
|> method(:post)
|> url("/plugins/#{name}/upgrade")
|> add_param(:query, :remote, remote)
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{204, false},
{404, DockerEngineAPI.Model.ErrorResponse},
{500, DockerEngineAPI.Model.ErrorResponse}
])
end
end