Class: DockerEngineRuby::Resources::Tasks

Inherits:
Object
  • Object
show all
Defined in:
lib/docker_engine_ruby/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:

API:

  • private



78
79
80
# File 'lib/docker_engine_ruby/resources/tasks.rb', line 78

def initialize(client:)
  @client = client
end

Instance Method Details

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

Inspect a task

Parameters:

Returns:

See Also:



37
38
39
40
41
42
43
44
# File 'lib/docker_engine_ruby/resources/tasks.rb', line 37

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

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

List tasks

Parameters:

Returns:

See Also:



16
17
18
19
20
21
22
23
24
25
# File 'lib/docker_engine_ruby/resources/tasks.rb', line 16

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

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

Get task logs

Parameters:

Returns:

See Also:



63
64
65
66
67
68
69
70
71
72
73
# File 'lib/docker_engine_ruby/resources/tasks.rb', line 63

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