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:



80
81
82
# File 'lib/docker_engine_ruby/resources/tasks.rb', line 80

def initialize(client:)
  @client = client
end

Instance Method Details

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

Inspect a task

Parameters:

Returns:

See Also:



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

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
26
# File 'lib/docker_engine_ruby/resources/tasks.rb', line 16

def list(params = {})
  parsed, options = DockerEngineRuby::TaskListParams.dump_request(params)
  query = DockerEngineRuby::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "tasks",
    query: query,
    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:

  • id (String)
  • details (Boolean)
  • follow (Boolean)
  • since (Integer)
  • stderr (Boolean)
  • stdout (Boolean)
  • tail (String)
  • timestamps (Boolean)
  • request_options (DockerEngineRuby::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (StringIO)

See Also:



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

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