Class: DockerEngineAPI::Resources::Tasks

Inherits:
Object
  • Object
show all
Defined in:
lib/docker_engine_api/resources/tasks.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Tasks

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Tasks.

Parameters:



98
99
100
# File 'lib/docker_engine_api/resources/tasks.rb', line 98

def initialize(client:)
  @client = client
end

Instance Method Details

#inspect_(id, request_options: {}) ⇒ DockerEngineAPI::Models::Task

Inspect a task

Parameters:

Returns:

See Also:



42
43
44
45
46
47
48
49
# File 'lib/docker_engine_api/resources/tasks.rb', line 42

def inspect_(id, params = {})
  @client.request(
    method: :get,
    path: ["tasks/%1$s", id],
    model: DockerEngineAPI::Task,
    options: params[:request_options]
  )
end

#list(filters: nil, request_options: {}) ⇒ Array<DockerEngineAPI::Models::Task>

Some parameter documentations has been truncated, see Models::TaskListParams for more details.

List tasks

Parameters:

  • filters (String)

    A JSON encoded value of the filters (a map[string][]string) to

  • request_options (DockerEngineAPI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



20
21
22
23
24
25
26
27
28
29
# File 'lib/docker_engine_api/resources/tasks.rb', line 20

def list(params = {})
  parsed, options = DockerEngineAPI::TaskListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "tasks",
    query: parsed,
    model: DockerEngineAPI::Internal::Type::ArrayOf[DockerEngineAPI::Task],
    options: options
  )
end

#logs(id, details: nil, follow: nil, since: nil, stderr: nil, stdout: nil, tail: nil, timestamps: nil, request_options: {}) ⇒ StringIO

Some parameter documentations has been truncated, see Models::TaskLogsParams for more details.

Get stdout and stderr logs from a task. See also [‘/containers/id/logs`](#operation/ContainerLogs).

Note: This endpoint works only for services with the local, json-file or journald logging drivers.

Parameters:

  • id (String)

    ID of the task

  • details (Boolean)

    Show task context and extra details provided to logs.

  • follow (Boolean)

    Keep connection after returning logs.

  • since (Integer)

    Only return logs since this time, as a UNIX timestamp

  • stderr (Boolean)

    Return logs from stderr

  • stdout (Boolean)

    Return logs from stdout

  • tail (String)

    Only return this number of log lines from the end of the logs.

  • timestamps (Boolean)

    Add timestamps to every log line

  • request_options (DockerEngineAPI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (StringIO)

See Also:



83
84
85
86
87
88
89
90
91
92
93
# File 'lib/docker_engine_api/resources/tasks.rb', line 83

def logs(id, params = {})
  parsed, options = DockerEngineAPI::TaskLogsParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["tasks/%1$s/logs", id],
    query: parsed,
    headers: {"accept" => "application/vnd.docker.multiplexed-stream"},
    model: StringIO,
    options: options
  )
end