Packages

A docker engine api client generated using swagger codegen.

Current section

Files

Jump to
docker_engine_api lib docker_engine_api api service.ex
Raw

lib/docker_engine_api/api/service.ex

# NOTE: This class is auto generated by the swagger code generator program.
# https://github.com/swagger-api/swagger-codegen.git
# Do not edit the class manually.
defmodule DockerEngineAPI.Api.Service do
@moduledoc """
API calls for all endpoints tagged `Service`.
"""
alias DockerEngineAPI.Connection
import DockerEngineAPI.RequestBuilder
@doc """
Create a service
## Parameters
- connection (DockerEngineAPI.Connection): Connection to server
- body (object):
- opts (KeywordList): [optional] Optional parameters
- :x_registry_auth (String.t): A base64url-encoded auth configuration for pulling from private registries. Refer to the [authentication section](#section/Authentication) for details.
## Returns
{:ok, %DockerEngineAPI.Model.ServiceCreateResponse{}} on success
{:error, info} on failure
"""
def service_create(connection, body, opts \\ []) do
optional_params = %{
:"X-Registry-Auth" => :headers
}
%{}
|> method(:post)
|> url("/services/create")
|> add_param(:body, :body, body)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%DockerEngineAPI.Model.ServiceCreateResponse{})
end
@doc """
Delete a service
## Parameters
- connection (DockerEngineAPI.Connection): Connection to server
- id (String.t): ID or name of service.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, %{}} on success
{:error, info} on failure
"""
def service_delete(connection, id, _opts \\ []) do
%{}
|> method(:delete)
|> url("/services/#{id}")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(false)
end
@doc """
Inspect a service
## Parameters
- connection (DockerEngineAPI.Connection): Connection to server
- id (String.t): ID or name of service.
- opts (KeywordList): [optional] Optional parameters
- :insert_defaults (boolean()): Fill empty fields with default values.
## Returns
{:ok, %DockerEngineAPI.Model.Service{}} on success
{:error, info} on failure
"""
def service_inspect(connection, id, opts \\ []) do
optional_params = %{
:insertDefaults => :query
}
%{}
|> method(:get)
|> url("/services/#{id}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%DockerEngineAPI.Model.Service{})
end
@doc """
List services
## Parameters
- connection (DockerEngineAPI.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :filters (String.t): A JSON encoded value of the filters (a `map[string][]string`) to process on the services list. Available filters: - `id=<service id>` - `label=<service label>` - `mode=[\"replicated\"|\"global\"]` - `name=<service name>`
- :status (boolean()): Include service status, with count of running and desired tasks.
## Returns
{:ok, [%Service{}, ...]} on success
{:error, info} on failure
"""
def service_list(connection, opts \\ []) do
optional_params = %{
:filters => :query,
:status => :query
}
%{}
|> method(:get)
|> url("/services")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode([%DockerEngineAPI.Model.Service{}])
end
@doc """
Get service logs
Get `stdout` and `stderr` logs from a service. See also [`/containers/{id}/logs`](#operation/ContainerLogs). **Note**: This endpoint works only for services with the `local`, `json-file` or `journald` logging drivers.
## Parameters
- connection (DockerEngineAPI.Connection): Connection to server
- id (String.t): ID or name of the service
- opts (KeywordList): [optional] Optional parameters
- :details (boolean()): Show service context and extra details provided to logs.
- :follow (boolean()): Keep connection after returning logs.
- :stdout (boolean()): Return logs from `stdout`
- :stderr (boolean()): Return logs from `stderr`
- :since (integer()): Only return logs since this time, as a UNIX timestamp
- :timestamps (boolean()): Add timestamps to every log line
- :tail (String.t): Only return this number of log lines from the end of the logs. Specify as an integer or `all` to output all log lines.
## Returns
{:ok, %DockerEngineAPI.Model.binary(){}} on success
{:error, info} on failure
"""
def service_logs(connection, id, opts \\ []) do
optional_params = %{
:details => :query,
:follow => :query,
:stdout => :query,
:stderr => :query,
:since => :query,
:timestamps => :query,
:tail => :query
}
%{}
|> method(:get)
|> url("/services/#{id}/logs")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(false)
end
@doc """
Update a service
## Parameters
- connection (DockerEngineAPI.Connection): Connection to server
- id (String.t): ID or name of service.
- body (object):
- version (integer()): The version number of the service object being updated. This is required to avoid conflicting writes. This version number should be the value as currently set on the service *before* the update. You can find the current version by calling `GET /services/{id}`
- opts (KeywordList): [optional] Optional parameters
- :registry_auth_from (String.t): If the `X-Registry-Auth` header is not specified, this parameter indicates where to find registry authorization credentials.
- :rollback (String.t): Set to this parameter to `previous` to cause a server-side rollback to the previous service spec. The supplied spec will be ignored in this case.
- :x_registry_auth (String.t): A base64url-encoded auth configuration for pulling from private registries. Refer to the [authentication section](#section/Authentication) for details.
## Returns
{:ok, %DockerEngineAPI.Model.ServiceUpdateResponse{}} on success
{:error, info} on failure
"""
def service_update(connection, id, body, version, opts \\ []) do
optional_params = %{
:registryAuthFrom => :query,
:rollback => :query,
:"X-Registry-Auth" => :headers
}
%{}
|> method(:post)
|> url("/services/#{id}/update")
|> add_param(:body, :body, body)
|> add_param(:query, :version, version)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%DockerEngineAPI.Model.ServiceUpdateResponse{})
end
end