docker-api-ng 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +202 -0
  3. data/NOTICE +12 -0
  4. data/README.md +278 -0
  5. data/docker-api-ng.gemspec +42 -0
  6. data/docs/building-images.md +98 -0
  7. data/docs/connecting.md +111 -0
  8. data/docs/errors.md +89 -0
  9. data/docs/exec.md +100 -0
  10. data/docs/extending.md +109 -0
  11. data/docs/migrating-from-docker-api.md +156 -0
  12. data/docs/streaming.md +91 -0
  13. data/lib/docker/api/auth.rb +154 -0
  14. data/lib/docker/api/body.rb +47 -0
  15. data/lib/docker/api/client.rb +117 -0
  16. data/lib/docker/api/collection.rb +60 -0
  17. data/lib/docker/api/collections/containers.rb +78 -0
  18. data/lib/docker/api/collections/images.rb +221 -0
  19. data/lib/docker/api/collections/networks.rb +85 -0
  20. data/lib/docker/api/collections/system.rb +98 -0
  21. data/lib/docker/api/collections/volumes.rb +54 -0
  22. data/lib/docker/api/config.rb +163 -0
  23. data/lib/docker/api/connection.rb +333 -0
  24. data/lib/docker/api/context.rb +124 -0
  25. data/lib/docker/api/errors.rb +159 -0
  26. data/lib/docker/api/operations.rb +3064 -0
  27. data/lib/docker/api/path.rb +33 -0
  28. data/lib/docker/api/platform.rb +68 -0
  29. data/lib/docker/api/query.rb +76 -0
  30. data/lib/docker/api/resource.rb +174 -0
  31. data/lib/docker/api/resources/container.rb +378 -0
  32. data/lib/docker/api/resources/exec.rb +48 -0
  33. data/lib/docker/api/resources/image.rb +209 -0
  34. data/lib/docker/api/resources/network.rb +90 -0
  35. data/lib/docker/api/resources/volume.rb +51 -0
  36. data/lib/docker/api/response.rb +110 -0
  37. data/lib/docker/api/session.rb +70 -0
  38. data/lib/docker/api/stream.rb +142 -0
  39. data/lib/docker/api/tar.rb +157 -0
  40. data/lib/docker/api/transport/base.rb +62 -0
  41. data/lib/docker/api/transport/fake.rb +154 -0
  42. data/lib/docker/api/transport/named_pipe.rb +58 -0
  43. data/lib/docker/api/transport/tcp.rb +49 -0
  44. data/lib/docker/api/transport/tls.rb +84 -0
  45. data/lib/docker/api/transport/unix.rb +35 -0
  46. data/lib/docker/api/transport.rb +113 -0
  47. data/lib/docker/api/version.rb +21 -0
  48. data/lib/docker/api.rb +68 -0
  49. data/sig/docker/api/core.rbs +109 -0
  50. data/sig/docker/api/operations.rbs +123 -0
  51. metadata +97 -0
@@ -0,0 +1,3064 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # Copyright 2026 Tim Smith
4
+ # SPDX-License-Identifier: Apache-2.0
5
+ #
6
+ # GENERATED -- do not edit.
7
+ #
8
+ # Source: data/swagger/v1.55.yaml (Docker Engine API v1.55)
9
+ # Generator: tools/generator/operations_emitter.rb
10
+ # Regenerate: bundle exec rake api:generate
11
+ # Upgrade: bundle exec rake api:sync[1.56]
12
+ #
13
+ # Editing this file by hand means the next regeneration silently reverts
14
+ # your change. Fix the emitter or the vendored specification instead.
15
+
16
+ module Docker
17
+ module API
18
+ # Every operation the Docker Engine API defines, one method each.
19
+ #
20
+ # This layer is generated from Docker's own specification, so it is
21
+ # complete by construction: if the daemon documents an endpoint, there is
22
+ # a method for it, with every parameter that endpoint accepts. It is also
23
+ # public API rather than an escape hatch -- reach for it directly whenever
24
+ # the ergonomic layer has not grown sugar for what you need.
25
+ #
26
+ # Methods take keyword arguments named after the specification's
27
+ # parameters, return a {Docker::API::Response}, and raise a
28
+ # {Docker::API::Error} subclass for any status the endpoint does not
29
+ # document as success.
30
+ #
31
+ # @example Calling an endpoint with no ergonomic wrapper
32
+ # client.operations.container_prune(filters: { "until" => ["24h"] })
33
+ #
34
+ # @example Streaming, by passing a block
35
+ # client.operations.system_events { |chunk| puts chunk }
36
+ class Operations
37
+ # @param connection [Docker::API::Connection] the connection to issue requests on
38
+ def initialize(connection)
39
+ @connection = connection
40
+ end
41
+
42
+ # @return [Docker::API::Connection] the connection in use
43
+ attr_reader :connection
44
+
45
+ # Create a config
46
+ #
47
+ # @!method config_create
48
+ # Engine API: POST /configs/create
49
+ #
50
+ # @param body [Hash, nil] (body parameter 'body' in the API specification)
51
+ # @yieldparam chunk [String] successive body chunks, when a block is given
52
+ # @return [Docker::API::Response]
53
+ # @raise [Docker::API::Conflict] 409 -- name conflicts with an existing
54
+ # object
55
+ # @raise [Docker::API::ServerError] 500 -- server error
56
+ # @raise [Docker::API::ServerError] 503 -- node is not part of a swarm
57
+ def config_create(body: nil, &block)
58
+ connection.request(
59
+ :post,
60
+ "/configs/create",
61
+ body: body,
62
+ expects: [201],
63
+ operation: "config_create",
64
+ &block
65
+ )
66
+ end
67
+
68
+ # Delete a config
69
+ #
70
+ # @!method config_delete
71
+ # Engine API: DELETE /configs/{id}
72
+ #
73
+ # @param id [String] ID of the config
74
+ # @yieldparam chunk [String] successive body chunks, when a block is given
75
+ # @return [Docker::API::Response]
76
+ # @raise [Docker::API::NotFound] 404 -- config not found
77
+ # @raise [Docker::API::ServerError] 500 -- server error
78
+ # @raise [Docker::API::ServerError] 503 -- node is not part of a swarm
79
+ def config_delete(id:, &block)
80
+ connection.request(
81
+ :delete,
82
+ "/configs/#{Path.escape(id)}",
83
+ expects: [204],
84
+ operation: "config_delete",
85
+ &block
86
+ )
87
+ end
88
+
89
+ # Inspect a config
90
+ #
91
+ # @!method config_inspect
92
+ # Engine API: GET /configs/{id}
93
+ #
94
+ # @param id [String] ID of the config
95
+ # @yieldparam chunk [String] successive body chunks, when a block is given
96
+ # @return [Docker::API::Response]
97
+ # @raise [Docker::API::NotFound] 404 -- config not found
98
+ # @raise [Docker::API::ServerError] 500 -- server error
99
+ # @raise [Docker::API::ServerError] 503 -- node is not part of a swarm
100
+ def config_inspect(id:, &block)
101
+ connection.request(
102
+ :get,
103
+ "/configs/#{Path.escape(id)}",
104
+ expects: [200],
105
+ operation: "config_inspect",
106
+ &block
107
+ )
108
+ end
109
+
110
+ # List configs
111
+ #
112
+ # @!method config_list
113
+ # Engine API: GET /configs
114
+ #
115
+ # @param filters [String, nil] A JSON encoded value of the filters (a
116
+ # `map[string][]string`) to process on the configs list.
117
+ # @yieldparam chunk [String] successive body chunks, when a block is given
118
+ # @return [Docker::API::Response]
119
+ # @raise [Docker::API::ServerError] 500 -- server error
120
+ # @raise [Docker::API::ServerError] 503 -- node is not part of a swarm
121
+ def config_list(filters: nil, &block)
122
+ connection.request(
123
+ :get,
124
+ "/configs",
125
+ query: { "filters" => filters },
126
+ expects: [200],
127
+ operation: "config_list",
128
+ &block
129
+ )
130
+ end
131
+
132
+ # Update a Config
133
+ #
134
+ # @!method config_update
135
+ # Engine API: POST /configs/{id}/update
136
+ #
137
+ # @param id [String] The ID or name of the config
138
+ # @param version [Integer] The version number of the config object being
139
+ # updated. This is required to avoid conflicting writes.
140
+ # @param body [Hash, nil] The spec of the config to update. Currently,
141
+ # only the Labels field can be updated. All other fields must remain
142
+ # unchanged from the [ConfigInspect endpoint](#ope... (body parameter
143
+ # 'body' in the API specification)
144
+ # @yieldparam chunk [String] successive body chunks, when a block is given
145
+ # @return [Docker::API::Response]
146
+ # @raise [Docker::API::BadRequest] 400 -- bad parameter
147
+ # @raise [Docker::API::NotFound] 404 -- no such config
148
+ # @raise [Docker::API::ServerError] 500 -- server error
149
+ # @raise [Docker::API::ServerError] 503 -- node is not part of a swarm
150
+ def config_update(id:, version:, body: nil, &block)
151
+ connection.request(
152
+ :post,
153
+ "/configs/#{Path.escape(id)}/update",
154
+ query: { "version" => version },
155
+ body: body,
156
+ expects: [200],
157
+ operation: "config_update",
158
+ &block
159
+ )
160
+ end
161
+
162
+ # Get an archive of a filesystem resource in a container
163
+ #
164
+ # Get a tar archive of a resource in the filesystem of container id.
165
+ #
166
+ # @!method container_archive
167
+ # Engine API: GET /containers/{id}/archive
168
+ #
169
+ # @param id [String] ID or name of the container
170
+ # @param path [String] Resource in the container’s filesystem to archive.
171
+ # @yieldparam chunk [String] successive body chunks, when a block is given
172
+ # @return [Docker::API::Response]
173
+ # @raise [Docker::API::BadRequest] 400 -- Bad parameter
174
+ # @raise [Docker::API::NotFound] 404 -- Container or path does not exist
175
+ # @raise [Docker::API::ServerError] 500 -- server error
176
+ def container_archive(id:, path:, &block)
177
+ connection.request(
178
+ :get,
179
+ "/containers/#{Path.escape(id)}/archive",
180
+ query: { "path" => path },
181
+ expects: [200],
182
+ operation: "container_archive",
183
+ &block
184
+ )
185
+ end
186
+
187
+ # Get information about files in a container
188
+ #
189
+ # A response header `X-Docker-Container-Path-Stat` is returned, containing a
190
+ # base64 - encoded JSON object with some filesystem header information about
191
+ # the path.
192
+ #
193
+ # @!method container_archive_info
194
+ # Engine API: HEAD /containers/{id}/archive
195
+ #
196
+ # @param id [String] ID or name of the container
197
+ # @param path [String] Resource in the container’s filesystem to archive.
198
+ # @yieldparam chunk [String] successive body chunks, when a block is given
199
+ # @return [Docker::API::Response]
200
+ # @raise [Docker::API::BadRequest] 400 -- Bad parameter
201
+ # @raise [Docker::API::NotFound] 404 -- Container or path does not exist
202
+ # @raise [Docker::API::ServerError] 500 -- Server error
203
+ def container_archive_info(id:, path:, &block)
204
+ connection.request(
205
+ :head,
206
+ "/containers/#{Path.escape(id)}/archive",
207
+ query: { "path" => path },
208
+ expects: [200],
209
+ operation: "container_archive_info",
210
+ &block
211
+ )
212
+ end
213
+
214
+ # Attach to a container
215
+ #
216
+ # Attach to a container to read its output or send it input. You can attach
217
+ # to the same container multiple times and you can reattach to containers
218
+ # that have been detached.
219
+ #
220
+ # @!method container_attach
221
+ # Engine API: POST /containers/{id}/attach
222
+ #
223
+ # @param id [String] ID or name of the container
224
+ # @param detach_keys [String, nil] Override the key sequence for detaching
225
+ # a container.Format is a single character `[a-Z]` or `ctrl-<value>` where
226
+ # `<value>` is one of: `a-z`, `@`, `^`, `[`, `,`... (sent to the daemon as
227
+ # 'detachKeys')
228
+ # @param logs [Boolean, nil] Replay previous logs from the container.
229
+ # @param stream [Boolean, nil] Stream attached streams from the time the
230
+ # request was made onwards.
231
+ # @param stdin [Boolean, nil] Attach to `stdin`
232
+ # @param stdout [Boolean, nil] Attach to `stdout`
233
+ # @param stderr [Boolean, nil] Attach to `stderr`
234
+ # @yieldparam chunk [String] successive body chunks, when a block is given
235
+ # @return [Docker::API::Response]
236
+ # @raise [Docker::API::ClientError] 101 -- no error, hints proxy about
237
+ # hijacking
238
+ # @raise [Docker::API::BadRequest] 400 -- bad parameter
239
+ # @raise [Docker::API::NotFound] 404 -- no such container
240
+ # @raise [Docker::API::ServerError] 500 -- server error
241
+ def container_attach(id:, detach_keys: nil, logs: nil, stream: nil, stdin: nil, stdout: nil, stderr: nil, &block)
242
+ connection.request(
243
+ :post,
244
+ "/containers/#{Path.escape(id)}/attach",
245
+ query: {
246
+ "detachKeys" => detach_keys,
247
+ "logs" => logs,
248
+ "stream" => stream,
249
+ "stdin" => stdin,
250
+ "stdout" => stdout,
251
+ "stderr" => stderr,
252
+ },
253
+ expects: [200],
254
+ operation: "container_attach",
255
+ &block
256
+ )
257
+ end
258
+
259
+ # Attach to a container via a websocket
260
+ #
261
+ # @!method container_attach_websocket
262
+ # Engine API: GET /containers/{id}/attach/ws
263
+ #
264
+ # @param id [String] ID or name of the container
265
+ # @param detach_keys [String, nil] Override the key sequence for detaching
266
+ # a container.Format is a single character `[a-Z]` or `ctrl-<value>` where
267
+ # `<value>` is one of: `a-z`, `@`, `^`, `[`, `,`,... (sent to the daemon
268
+ # as 'detachKeys')
269
+ # @param logs [Boolean, nil] Return logs
270
+ # @param stream [Boolean, nil] Return stream
271
+ # @param stdin [Boolean, nil] Attach to `stdin`
272
+ # @param stdout [Boolean, nil] Attach to `stdout`
273
+ # @param stderr [Boolean, nil] Attach to `stderr`
274
+ # @yieldparam chunk [String] successive body chunks, when a block is given
275
+ # @return [Docker::API::Response]
276
+ # @raise [Docker::API::ClientError] 101 -- no error, hints proxy about
277
+ # hijacking
278
+ # @raise [Docker::API::BadRequest] 400 -- bad parameter
279
+ # @raise [Docker::API::NotFound] 404 -- no such container
280
+ # @raise [Docker::API::ServerError] 500 -- server error
281
+ def container_attach_websocket(id:, detach_keys: nil, logs: nil, stream: nil, stdin: nil, stdout: nil, stderr: nil, &block)
282
+ connection.request(
283
+ :get,
284
+ "/containers/#{Path.escape(id)}/attach/ws",
285
+ query: {
286
+ "detachKeys" => detach_keys,
287
+ "logs" => logs,
288
+ "stream" => stream,
289
+ "stdin" => stdin,
290
+ "stdout" => stdout,
291
+ "stderr" => stderr,
292
+ },
293
+ expects: [200],
294
+ operation: "container_attach_websocket",
295
+ &block
296
+ )
297
+ end
298
+
299
+ # Get changes on a container’s filesystem
300
+ #
301
+ # Returns which files in a container's filesystem have been added, deleted,
302
+ # or modified. The `Kind` of modification can be one of:
303
+ #
304
+ # @!method container_changes
305
+ # Engine API: GET /containers/{id}/changes
306
+ #
307
+ # @param id [String] ID or name of the container
308
+ # @yieldparam chunk [String] successive body chunks, when a block is given
309
+ # @return [Docker::API::Response]
310
+ # @raise [Docker::API::NotFound] 404 -- no such container
311
+ # @raise [Docker::API::ServerError] 500 -- server error
312
+ def container_changes(id:, &block)
313
+ connection.request(
314
+ :get,
315
+ "/containers/#{Path.escape(id)}/changes",
316
+ expects: [200],
317
+ operation: "container_changes",
318
+ &block
319
+ )
320
+ end
321
+
322
+ # Create a container
323
+ #
324
+ # @!method container_create
325
+ # Engine API: POST /containers/create
326
+ #
327
+ # @param body [Hash] Container to create (body parameter 'body' in the API
328
+ # specification)
329
+ # @param name [String, nil] Assign the specified name to the container.
330
+ # Must match `/?[a-zA-Z0-9][a-zA-Z0-9_.-]+`.
331
+ # @param platform [String, nil] Platform in the format
332
+ # `os[/arch[/variant]]` used for image lookup.
333
+ # @yieldparam chunk [String] successive body chunks, when a block is given
334
+ # @return [Docker::API::Response]
335
+ # @raise [Docker::API::BadRequest] 400 -- bad parameter
336
+ # @raise [Docker::API::NotFound] 404 -- no such image
337
+ # @raise [Docker::API::Conflict] 409 -- conflict
338
+ # @raise [Docker::API::ServerError] 500 -- server error
339
+ def container_create(body:, name: nil, platform: nil, &block)
340
+ connection.request(
341
+ :post,
342
+ "/containers/create",
343
+ query: { "name" => name, "platform" => platform },
344
+ body: body,
345
+ expects: [201],
346
+ operation: "container_create",
347
+ &block
348
+ )
349
+ end
350
+
351
+ # Remove a container
352
+ #
353
+ # @!method container_delete
354
+ # Engine API: DELETE /containers/{id}
355
+ #
356
+ # @param id [String] ID or name of the container
357
+ # @param v [Boolean, nil] Remove anonymous volumes associated with the
358
+ # container.
359
+ # @param force [Boolean, nil] If the container is running, kill it before
360
+ # removing it.
361
+ # @param link [Boolean, nil] Remove the specified link associated with the
362
+ # container.
363
+ # @yieldparam chunk [String] successive body chunks, when a block is given
364
+ # @return [Docker::API::Response]
365
+ # @raise [Docker::API::BadRequest] 400 -- bad parameter
366
+ # @raise [Docker::API::NotFound] 404 -- no such container
367
+ # @raise [Docker::API::Conflict] 409 -- conflict
368
+ # @raise [Docker::API::ServerError] 500 -- server error
369
+ def container_delete(id:, v: nil, force: nil, link: nil, &block)
370
+ connection.request(
371
+ :delete,
372
+ "/containers/#{Path.escape(id)}",
373
+ query: { "v" => v, "force" => force, "link" => link },
374
+ expects: [204],
375
+ operation: "container_delete",
376
+ &block
377
+ )
378
+ end
379
+
380
+ # Export a container
381
+ #
382
+ # Export the contents of a container as a tarball.
383
+ #
384
+ # @!method container_export
385
+ # Engine API: GET /containers/{id}/export
386
+ #
387
+ # @param id [String] ID or name of the container
388
+ # @yieldparam chunk [String] successive body chunks, when a block is given
389
+ # @return [Docker::API::Response]
390
+ # @raise [Docker::API::NotFound] 404 -- no such container
391
+ # @raise [Docker::API::ServerError] 500 -- server error
392
+ def container_export(id:, &block)
393
+ connection.request(
394
+ :get,
395
+ "/containers/#{Path.escape(id)}/export",
396
+ expects: [200],
397
+ operation: "container_export",
398
+ &block
399
+ )
400
+ end
401
+
402
+ # Inspect a container
403
+ #
404
+ # Return low-level information about a container.
405
+ #
406
+ # @!method container_inspect
407
+ # Engine API: GET /containers/{id}/json
408
+ #
409
+ # @param id [String] ID or name of the container
410
+ # @param size [Boolean, nil] Return the size of container as fields
411
+ # `SizeRw` and `SizeRootFs`
412
+ # @yieldparam chunk [String] successive body chunks, when a block is given
413
+ # @return [Docker::API::Response]
414
+ # @raise [Docker::API::NotFound] 404 -- no such container
415
+ # @raise [Docker::API::ServerError] 500 -- server error
416
+ def container_inspect(id:, size: nil, &block)
417
+ connection.request(
418
+ :get,
419
+ "/containers/#{Path.escape(id)}/json",
420
+ query: { "size" => size },
421
+ expects: [200],
422
+ operation: "container_inspect",
423
+ &block
424
+ )
425
+ end
426
+
427
+ # Kill a container
428
+ #
429
+ # Send a POSIX signal to a container, defaulting to killing to the
430
+ # container.
431
+ #
432
+ # @!method container_kill
433
+ # Engine API: POST /containers/{id}/kill
434
+ #
435
+ # @param id [String] ID or name of the container
436
+ # @param signal [String, nil] Signal to send to the container as an
437
+ # integer or string (e.g. `SIGINT`).
438
+ # @yieldparam chunk [String] successive body chunks, when a block is given
439
+ # @return [Docker::API::Response]
440
+ # @raise [Docker::API::NotFound] 404 -- no such container
441
+ # @raise [Docker::API::Conflict] 409 -- container is not running
442
+ # @raise [Docker::API::ServerError] 500 -- server error
443
+ def container_kill(id:, signal: nil, &block)
444
+ connection.request(
445
+ :post,
446
+ "/containers/#{Path.escape(id)}/kill",
447
+ query: { "signal" => signal },
448
+ expects: [204],
449
+ operation: "container_kill",
450
+ &block
451
+ )
452
+ end
453
+
454
+ # List containers
455
+ #
456
+ # Returns a list of containers. For details on the format, see the [inspect
457
+ # endpoint](#operation/ContainerInspect).
458
+ #
459
+ # @!method container_list
460
+ # Engine API: GET /containers/json
461
+ #
462
+ # @param all [Boolean, nil] Return all containers. By default, only
463
+ # running containers are shown.
464
+ # @param limit [Integer, nil] Return this number of most recently created
465
+ # containers, including non-running ones.
466
+ # @param size [Boolean, nil] Return the size of container as fields
467
+ # `SizeRw` and `SizeRootFs`.
468
+ # @param filters [String, nil] Filters to process on the container list,
469
+ # encoded as JSON (a `map[string][]string`). For example, `{"status":
470
+ # ["paused"]}` will only return paused containers.
471
+ # @yieldparam chunk [String] successive body chunks, when a block is given
472
+ # @return [Docker::API::Response]
473
+ # @raise [Docker::API::BadRequest] 400 -- bad parameter
474
+ # @raise [Docker::API::ServerError] 500 -- server error
475
+ def container_list(all: nil, limit: nil, size: nil, filters: nil, &block)
476
+ connection.request(
477
+ :get,
478
+ "/containers/json",
479
+ query: { "all" => all, "limit" => limit, "size" => size, "filters" => filters },
480
+ expects: [200],
481
+ operation: "container_list",
482
+ &block
483
+ )
484
+ end
485
+
486
+ # Get container logs
487
+ #
488
+ # Get `stdout` and `stderr` logs from a container.
489
+ #
490
+ # @!method container_logs
491
+ # Engine API: GET /containers/{id}/logs
492
+ #
493
+ # @param id [String] ID or name of the container
494
+ # @param follow [Boolean, nil] Keep connection after returning logs.
495
+ # @param stdout [Boolean, nil] Return logs from `stdout`
496
+ # @param stderr [Boolean, nil] Return logs from `stderr`
497
+ # @param since [Integer, nil] Only return logs since this time, as a UNIX
498
+ # timestamp
499
+ # @param until_ [Integer, nil] Only return logs before this time, as a
500
+ # UNIX timestamp (sent to the daemon as 'until')
501
+ # @param timestamps [Boolean, nil] Add timestamps to every log line
502
+ # @param tail [String, nil] Only return this number of log lines from the
503
+ # end of the logs. Specify as an integer or `all` to output all log lines.
504
+ # @yieldparam chunk [String] successive body chunks, when a block is given
505
+ # @return [Docker::API::Response]
506
+ # @raise [Docker::API::NotFound] 404 -- no such container
507
+ # @raise [Docker::API::ServerError] 500 -- server error
508
+ def container_logs(
509
+ id:,
510
+ follow: nil,
511
+ stdout: nil,
512
+ stderr: nil,
513
+ since: nil,
514
+ until_: nil,
515
+ timestamps: nil,
516
+ tail: nil,
517
+ &block
518
+ )
519
+ connection.request(
520
+ :get,
521
+ "/containers/#{Path.escape(id)}/logs",
522
+ query: {
523
+ "follow" => follow,
524
+ "stdout" => stdout,
525
+ "stderr" => stderr,
526
+ "since" => since,
527
+ "until" => until_,
528
+ "timestamps" => timestamps,
529
+ "tail" => tail,
530
+ },
531
+ expects: [200],
532
+ operation: "container_logs",
533
+ &block
534
+ )
535
+ end
536
+
537
+ # Pause a container
538
+ #
539
+ # Use the freezer cgroup to suspend all processes in a container.
540
+ #
541
+ # @!method container_pause
542
+ # Engine API: POST /containers/{id}/pause
543
+ #
544
+ # @param id [String] ID or name of the container
545
+ # @yieldparam chunk [String] successive body chunks, when a block is given
546
+ # @return [Docker::API::Response]
547
+ # @raise [Docker::API::NotFound] 404 -- no such container
548
+ # @raise [Docker::API::ServerError] 500 -- server error
549
+ def container_pause(id:, &block)
550
+ connection.request(
551
+ :post,
552
+ "/containers/#{Path.escape(id)}/pause",
553
+ expects: [204],
554
+ operation: "container_pause",
555
+ &block
556
+ )
557
+ end
558
+
559
+ # Delete stopped containers
560
+ #
561
+ # @!method container_prune
562
+ # Engine API: POST /containers/prune
563
+ #
564
+ # @param filters [String, nil] Filters to process on the prune list,
565
+ # encoded as JSON (a `map[string][]string`).
566
+ # @yieldparam chunk [String] successive body chunks, when a block is given
567
+ # @return [Docker::API::Response]
568
+ # @raise [Docker::API::ServerError] 500 -- Server error
569
+ def container_prune(filters: nil, &block)
570
+ connection.request(
571
+ :post,
572
+ "/containers/prune",
573
+ query: { "filters" => filters },
574
+ expects: [200],
575
+ operation: "container_prune",
576
+ &block
577
+ )
578
+ end
579
+
580
+ # Rename a container
581
+ #
582
+ # @!method container_rename
583
+ # Engine API: POST /containers/{id}/rename
584
+ #
585
+ # @param id [String] ID or name of the container
586
+ # @param name [String] New name for the container
587
+ # @yieldparam chunk [String] successive body chunks, when a block is given
588
+ # @return [Docker::API::Response]
589
+ # @raise [Docker::API::NotFound] 404 -- no such container
590
+ # @raise [Docker::API::Conflict] 409 -- name already in use
591
+ # @raise [Docker::API::ServerError] 500 -- server error
592
+ def container_rename(id:, name:, &block)
593
+ connection.request(
594
+ :post,
595
+ "/containers/#{Path.escape(id)}/rename",
596
+ query: { "name" => name },
597
+ expects: [204],
598
+ operation: "container_rename",
599
+ &block
600
+ )
601
+ end
602
+
603
+ # Resize a container TTY
604
+ #
605
+ # Resize the TTY for a container.
606
+ #
607
+ # @!method container_resize
608
+ # Engine API: POST /containers/{id}/resize
609
+ #
610
+ # @param id [String] ID or name of the container
611
+ # @param h [Integer] Height of the TTY session in characters
612
+ # @param w [Integer] Width of the TTY session in characters
613
+ # @yieldparam chunk [String] successive body chunks, when a block is given
614
+ # @return [Docker::API::Response]
615
+ # @raise [Docker::API::NotFound] 404 -- no such container
616
+ # @raise [Docker::API::ServerError] 500 -- cannot resize container
617
+ def container_resize(id:, h:, w:, &block)
618
+ connection.request(
619
+ :post,
620
+ "/containers/#{Path.escape(id)}/resize",
621
+ query: { "h" => h, "w" => w },
622
+ expects: [200],
623
+ operation: "container_resize",
624
+ &block
625
+ )
626
+ end
627
+
628
+ # Restart a container
629
+ #
630
+ # @!method container_restart
631
+ # Engine API: POST /containers/{id}/restart
632
+ #
633
+ # @param id [String] ID or name of the container
634
+ # @param signal [String, nil] Signal to send to the container as an
635
+ # integer or string (e.g. `SIGINT`).
636
+ # @param t [Integer, nil] Number of seconds to wait before killing the
637
+ # container
638
+ # @yieldparam chunk [String] successive body chunks, when a block is given
639
+ # @return [Docker::API::Response]
640
+ # @raise [Docker::API::NotFound] 404 -- no such container
641
+ # @raise [Docker::API::ServerError] 500 -- server error
642
+ def container_restart(id:, signal: nil, t: nil, &block)
643
+ connection.request(
644
+ :post,
645
+ "/containers/#{Path.escape(id)}/restart",
646
+ query: { "signal" => signal, "t" => t },
647
+ expects: [204],
648
+ operation: "container_restart",
649
+ &block
650
+ )
651
+ end
652
+
653
+ # Start a container
654
+ #
655
+ # @!method container_start
656
+ # Engine API: POST /containers/{id}/start
657
+ #
658
+ # @param id [String] ID or name of the container
659
+ # @param detach_keys [String, nil] Override the key sequence for detaching
660
+ # a container. Format is a single character `[a-Z]` or `ctrl-<value>`
661
+ # where `<value>` is one of: `a-z`, `@`, `^`, `[`, `,`... (sent to the
662
+ # daemon as 'detachKeys')
663
+ # @yieldparam chunk [String] successive body chunks, when a block is given
664
+ # @return [Docker::API::Response]
665
+ # @raise [Docker::API::NotModified] 304 -- container already started
666
+ # @raise [Docker::API::NotFound] 404 -- no such container
667
+ # @raise [Docker::API::ServerError] 500 -- server error
668
+ def container_start(id:, detach_keys: nil, &block)
669
+ connection.request(
670
+ :post,
671
+ "/containers/#{Path.escape(id)}/start",
672
+ query: { "detachKeys" => detach_keys },
673
+ expects: [204],
674
+ operation: "container_start",
675
+ &block
676
+ )
677
+ end
678
+
679
+ # Get container stats based on resource usage
680
+ #
681
+ # This endpoint returns a live stream of a container’s resource usage
682
+ # statistics.
683
+ #
684
+ # @!method container_stats
685
+ # Engine API: GET /containers/{id}/stats
686
+ #
687
+ # @param id [String] ID or name of the container
688
+ # @param stream [Boolean, nil] Stream the output. If false, the stats will
689
+ # be output once and then it will disconnect.
690
+ # @param one_shot [Boolean, nil] Only get a single stat instead of waiting
691
+ # for 2 cycles. Must be used with `stream=false`. (sent to the daemon as
692
+ # 'one-shot')
693
+ # @yieldparam chunk [String] successive body chunks, when a block is given
694
+ # @return [Docker::API::Response]
695
+ # @raise [Docker::API::NotFound] 404 -- no such container
696
+ # @raise [Docker::API::ServerError] 500 -- server error
697
+ def container_stats(id:, stream: nil, one_shot: nil, &block)
698
+ connection.request(
699
+ :get,
700
+ "/containers/#{Path.escape(id)}/stats",
701
+ query: { "stream" => stream, "one-shot" => one_shot },
702
+ expects: [200],
703
+ operation: "container_stats",
704
+ &block
705
+ )
706
+ end
707
+
708
+ # Stop a container
709
+ #
710
+ # @!method container_stop
711
+ # Engine API: POST /containers/{id}/stop
712
+ #
713
+ # @param id [String] ID or name of the container
714
+ # @param signal [String, nil] Signal to send to the container as an
715
+ # integer or string (e.g. `SIGINT`).
716
+ # @param t [Integer, nil] Number of seconds to wait before killing the
717
+ # container
718
+ # @yieldparam chunk [String] successive body chunks, when a block is given
719
+ # @return [Docker::API::Response]
720
+ # @raise [Docker::API::NotModified] 304 -- container already stopped
721
+ # @raise [Docker::API::NotFound] 404 -- no such container
722
+ # @raise [Docker::API::ServerError] 500 -- server error
723
+ def container_stop(id:, signal: nil, t: nil, &block)
724
+ connection.request(
725
+ :post,
726
+ "/containers/#{Path.escape(id)}/stop",
727
+ query: { "signal" => signal, "t" => t },
728
+ expects: [204],
729
+ operation: "container_stop",
730
+ &block
731
+ )
732
+ end
733
+
734
+ # List processes running inside a container
735
+ #
736
+ # On Unix systems, this is done by running the `ps` command. This endpoint
737
+ # is not supported on Windows.
738
+ #
739
+ # @!method container_top
740
+ # Engine API: GET /containers/{id}/top
741
+ #
742
+ # @param id [String] ID or name of the container
743
+ # @param ps_args [String, nil] The arguments to pass to `ps`. For example,
744
+ # `aux`
745
+ # @yieldparam chunk [String] successive body chunks, when a block is given
746
+ # @return [Docker::API::Response]
747
+ # @raise [Docker::API::NotFound] 404 -- no such container
748
+ # @raise [Docker::API::ServerError] 500 -- server error
749
+ def container_top(id:, ps_args: nil, &block)
750
+ connection.request(
751
+ :get,
752
+ "/containers/#{Path.escape(id)}/top",
753
+ query: { "ps_args" => ps_args },
754
+ expects: [200],
755
+ operation: "container_top",
756
+ &block
757
+ )
758
+ end
759
+
760
+ # Unpause a container
761
+ #
762
+ # Resume a container which has been paused.
763
+ #
764
+ # @!method container_unpause
765
+ # Engine API: POST /containers/{id}/unpause
766
+ #
767
+ # @param id [String] ID or name of the container
768
+ # @yieldparam chunk [String] successive body chunks, when a block is given
769
+ # @return [Docker::API::Response]
770
+ # @raise [Docker::API::NotFound] 404 -- no such container
771
+ # @raise [Docker::API::ServerError] 500 -- server error
772
+ def container_unpause(id:, &block)
773
+ connection.request(
774
+ :post,
775
+ "/containers/#{Path.escape(id)}/unpause",
776
+ expects: [204],
777
+ operation: "container_unpause",
778
+ &block
779
+ )
780
+ end
781
+
782
+ # Update a container
783
+ #
784
+ # Change various configuration options of a container without having to
785
+ # recreate it.
786
+ #
787
+ # @!method container_update
788
+ # Engine API: POST /containers/{id}/update
789
+ #
790
+ # @param id [String] ID or name of the container
791
+ # @param body [Hash] (body parameter 'update' in the API specification)
792
+ # @yieldparam chunk [String] successive body chunks, when a block is given
793
+ # @return [Docker::API::Response]
794
+ # @raise [Docker::API::NotFound] 404 -- no such container
795
+ # @raise [Docker::API::ServerError] 500 -- server error
796
+ def container_update(id:, body:, &block)
797
+ connection.request(
798
+ :post,
799
+ "/containers/#{Path.escape(id)}/update",
800
+ body: body,
801
+ expects: [200],
802
+ operation: "container_update",
803
+ &block
804
+ )
805
+ end
806
+
807
+ # Wait for a container
808
+ #
809
+ # Block until a container stops, then returns the exit code.
810
+ #
811
+ # @!method container_wait
812
+ # Engine API: POST /containers/{id}/wait
813
+ #
814
+ # @param id [String] ID or name of the container
815
+ # @param condition [String, nil] Wait until a container state reaches the
816
+ # given condition.
817
+ # @yieldparam chunk [String] successive body chunks, when a block is given
818
+ # @return [Docker::API::Response]
819
+ # @raise [Docker::API::BadRequest] 400 -- bad parameter
820
+ # @raise [Docker::API::NotFound] 404 -- no such container
821
+ # @raise [Docker::API::ServerError] 500 -- server error
822
+ def container_wait(id:, condition: nil, &block)
823
+ connection.request(
824
+ :post,
825
+ "/containers/#{Path.escape(id)}/wait",
826
+ query: { "condition" => condition },
827
+ expects: [200],
828
+ operation: "container_wait",
829
+ &block
830
+ )
831
+ end
832
+
833
+ # Extract an archive of files or folders to a directory in a container
834
+ #
835
+ # Upload a tar archive to be extracted to a path in the filesystem of
836
+ # container id. `path` parameter is asserted to be a directory. If it exists
837
+ # as a file, 400 error will be returned with message "not a directory".
838
+ #
839
+ # @!method put_container_archive
840
+ # Engine API: PUT /containers/{id}/archive
841
+ #
842
+ # @param id [String] ID or name of the container
843
+ # @param path [String] Path to a directory in the container to extract the
844
+ # archive’s contents into.
845
+ # @param body [Hash] The input stream must be a tar archive compressed
846
+ # with one of the following algorithms: `identity` (no compression),
847
+ # `gzip`, `bzip2`, or `xz`. (body parameter 'inputStream' in the API
848
+ # specification)
849
+ # @param no_overwrite_dir_non_dir [String, nil] If `1`, `true`, or `True`
850
+ # then it will be an error if unpacking the given content would cause an
851
+ # existing directory to be replaced with a non-directory and vice... (sent
852
+ # to the daemon as 'noOverwriteDirNonDir')
853
+ # @param copy_uidgid [String, nil] If `1`, `true`, then it will copy
854
+ # UID/GID maps to the dest file or dir (sent to the daemon as
855
+ # 'copyUIDGID')
856
+ # @yieldparam chunk [String] successive body chunks, when a block is given
857
+ # @return [Docker::API::Response]
858
+ # @raise [Docker::API::BadRequest] 400 -- Bad parameter
859
+ # @raise [Docker::API::Forbidden] 403 -- Permission denied, the volume or
860
+ # container rootfs is marked as read-only.
861
+ # @raise [Docker::API::NotFound] 404 -- No such container or path does not
862
+ # exist inside the container
863
+ # @raise [Docker::API::ServerError] 500 -- Server error
864
+ def put_container_archive(id:, path:, body:, no_overwrite_dir_non_dir: nil, copy_uidgid: nil, &block)
865
+ connection.request(
866
+ :put,
867
+ "/containers/#{Path.escape(id)}/archive",
868
+ query: {
869
+ "path" => path,
870
+ "noOverwriteDirNonDir" => no_overwrite_dir_non_dir,
871
+ "copyUIDGID" => copy_uidgid,
872
+ },
873
+ body: body,
874
+ expects: [200],
875
+ operation: "put_container_archive",
876
+ &block
877
+ )
878
+ end
879
+
880
+ # Get image information from the registry
881
+ #
882
+ # Return image digest and platform information by contacting the registry.
883
+ #
884
+ # @!method distribution_inspect
885
+ # Engine API: GET /distribution/{name}/json
886
+ #
887
+ # @param name [String] Image name or id
888
+ # @yieldparam chunk [String] successive body chunks, when a block is given
889
+ # @return [Docker::API::Response]
890
+ # @raise [Docker::API::Unauthorized] 401 -- Failed authentication or no
891
+ # image found
892
+ # @raise [Docker::API::ServerError] 500 -- Server error
893
+ def distribution_inspect(name:, &block)
894
+ connection.request(
895
+ :get,
896
+ "/distribution/#{Path.escape(name)}/json",
897
+ expects: [200],
898
+ operation: "distribution_inspect",
899
+ &block
900
+ )
901
+ end
902
+
903
+ # Create an exec instance
904
+ #
905
+ # Run a command inside a running container.
906
+ #
907
+ # @!method container_exec
908
+ # Engine API: POST /containers/{id}/exec
909
+ #
910
+ # @param id [String] ID or name of container
911
+ # @param body [Hash] Exec configuration (body parameter 'execConfig' in
912
+ # the API specification)
913
+ # @yieldparam chunk [String] successive body chunks, when a block is given
914
+ # @return [Docker::API::Response]
915
+ # @raise [Docker::API::NotFound] 404 -- no such container
916
+ # @raise [Docker::API::Conflict] 409 -- container is paused
917
+ # @raise [Docker::API::ServerError] 500 -- Server error
918
+ def container_exec(id:, body:, &block)
919
+ connection.request(
920
+ :post,
921
+ "/containers/#{Path.escape(id)}/exec",
922
+ body: body,
923
+ expects: [201],
924
+ operation: "container_exec",
925
+ &block
926
+ )
927
+ end
928
+
929
+ # Inspect an exec instance
930
+ #
931
+ # Return low-level information about an exec instance.
932
+ #
933
+ # @!method exec_inspect
934
+ # Engine API: GET /exec/{id}/json
935
+ #
936
+ # @param id [String] Exec instance ID
937
+ # @yieldparam chunk [String] successive body chunks, when a block is given
938
+ # @return [Docker::API::Response]
939
+ # @raise [Docker::API::NotFound] 404 -- No such exec instance
940
+ # @raise [Docker::API::ServerError] 500 -- Server error
941
+ def exec_inspect(id:, &block)
942
+ connection.request(
943
+ :get,
944
+ "/exec/#{Path.escape(id)}/json",
945
+ expects: [200],
946
+ operation: "exec_inspect",
947
+ &block
948
+ )
949
+ end
950
+
951
+ # Resize an exec instance
952
+ #
953
+ # Resize the TTY session used by an exec instance. This endpoint only works
954
+ # if `tty` was specified as part of creating and starting the exec instance.
955
+ #
956
+ # @!method exec_resize
957
+ # Engine API: POST /exec/{id}/resize
958
+ #
959
+ # @param id [String] Exec instance ID
960
+ # @param h [Integer] Height of the TTY session in characters
961
+ # @param w [Integer] Width of the TTY session in characters
962
+ # @yieldparam chunk [String] successive body chunks, when a block is given
963
+ # @return [Docker::API::Response]
964
+ # @raise [Docker::API::BadRequest] 400 -- bad parameter
965
+ # @raise [Docker::API::NotFound] 404 -- No such exec instance
966
+ # @raise [Docker::API::ServerError] 500 -- Server error
967
+ def exec_resize(id:, h:, w:, &block)
968
+ connection.request(
969
+ :post,
970
+ "/exec/#{Path.escape(id)}/resize",
971
+ query: { "h" => h, "w" => w },
972
+ expects: [200],
973
+ operation: "exec_resize",
974
+ &block
975
+ )
976
+ end
977
+
978
+ # Start an exec instance
979
+ #
980
+ # Starts a previously set up exec instance. If detach is true, this endpoint
981
+ # returns immediately after starting the command. Otherwise, it sets up an
982
+ # interactive session with the command.
983
+ #
984
+ # @!method exec_start
985
+ # Engine API: POST /exec/{id}/start
986
+ #
987
+ # @param id [String] Exec instance ID
988
+ # @param body [Hash, nil] (body parameter 'execStartConfig' in the API
989
+ # specification)
990
+ # @yieldparam chunk [String] successive body chunks, when a block is given
991
+ # @return [Docker::API::Response]
992
+ # @raise [Docker::API::NotFound] 404 -- No such exec instance
993
+ # @raise [Docker::API::Conflict] 409 -- Container is stopped or paused
994
+ def exec_start(id:, body: nil, &block)
995
+ connection.request(
996
+ :post,
997
+ "/exec/#{Path.escape(id)}/start",
998
+ body: body,
999
+ expects: [200],
1000
+ operation: "exec_start",
1001
+ &block
1002
+ )
1003
+ end
1004
+
1005
+ # Delete builder cache
1006
+ #
1007
+ # @!method build_prune
1008
+ # Engine API: POST /build/prune
1009
+ #
1010
+ # @param reserved_space [Integer, nil] Amount of disk space in bytes to
1011
+ # keep for cache (sent to the daemon as 'reserved-space')
1012
+ # @param max_used_space [Integer, nil] Maximum amount of disk space
1013
+ # allowed to keep for cache (sent to the daemon as 'max-used-space')
1014
+ # @param min_free_space [Integer, nil] Target amount of free disk space
1015
+ # after pruning (sent to the daemon as 'min-free-space')
1016
+ # @param all [Boolean, nil] Remove all types of build cache
1017
+ # @param filters [String, nil] A JSON encoded value of the filters (a
1018
+ # `map[string][]string`) to process on the list of build cache objects.
1019
+ # @yieldparam chunk [String] successive body chunks, when a block is given
1020
+ # @return [Docker::API::Response]
1021
+ # @raise [Docker::API::ServerError] 500 -- Server error
1022
+ def build_prune(reserved_space: nil, max_used_space: nil, min_free_space: nil, all: nil, filters: nil, &block)
1023
+ connection.request(
1024
+ :post,
1025
+ "/build/prune",
1026
+ query: {
1027
+ "reserved-space" => reserved_space,
1028
+ "max-used-space" => max_used_space,
1029
+ "min-free-space" => min_free_space,
1030
+ "all" => all,
1031
+ "filters" => filters,
1032
+ },
1033
+ expects: [200],
1034
+ operation: "build_prune",
1035
+ &block
1036
+ )
1037
+ end
1038
+
1039
+ # Get attestation statements for an image
1040
+ #
1041
+ # Return the in-toto attestation statements attached to the image for the
1042
+ # given platform. The daemon locates the attestation manifest(s) that
1043
+ # reference the matching platform image manifest, reads their statement
1044
+ # layers, and returns the verbatim statement JSON together with layer
1045
+ # metadata.
1046
+ #
1047
+ # @!method image_attestations
1048
+ # Engine API: GET /images/{name}/attestations
1049
+ #
1050
+ # @param name [String] Image name or id
1051
+ # @param platform [Array<String>, nil] JSON-encoded OCI platform to select
1052
+ # the image variant whose attestations to return. If omitted, the daemon's
1053
+ # default (host) platform is used.
1054
+ # @param type [Array<String>, nil] In-toto predicate type URI to filter
1055
+ # returned statements. May be repeated to accept any of several predicate
1056
+ # types. If omitted, all statements are returned.
1057
+ # @param statement [Boolean, nil] Include the verbatim in-toto statement
1058
+ # body in each returned entry. Defaults to false; when omitted or false,
1059
+ # only the descriptor and predicate type are returne...
1060
+ # @yieldparam chunk [String] successive body chunks, when a block is given
1061
+ # @return [Docker::API::Response]
1062
+ # @raise [Docker::API::BadRequest] 400 -- Bad parameter (e.g. malformed
1063
+ # `platform` value)
1064
+ # @raise [Docker::API::NotFound] 404 -- No such image, or no manifest
1065
+ # found for the requested platform
1066
+ # @raise [Docker::API::ServerError] 500 -- Server error
1067
+ # @raise [Docker::API::ServerError] 501 -- The daemon's image backend does
1068
+ # not support attestations. This is returned by the legacy (...
1069
+ def image_attestations(name:, platform: nil, type: nil, statement: nil, &block)
1070
+ connection.request(
1071
+ :get,
1072
+ "/images/#{Path.escape(name)}/attestations",
1073
+ query: { "platform" => platform, "type" => type, "statement" => statement },
1074
+ expects: [200],
1075
+ operation: "image_attestations",
1076
+ &block
1077
+ )
1078
+ end
1079
+
1080
+ # Build an image
1081
+ #
1082
+ # Build an image from a tar archive with a `Dockerfile` in it.
1083
+ #
1084
+ # @!method image_build
1085
+ # Engine API: POST /build
1086
+ #
1087
+ # @param dockerfile [String, nil] Path within the build context to the
1088
+ # `Dockerfile`. This is ignored if `remote` is specified and points to an
1089
+ # external `Dockerfile`.
1090
+ # @param t [String, nil] A name and optional tag to apply to the image in
1091
+ # the `name:tag` format. If you omit the tag the default `latest` value is
1092
+ # assumed. You can provide several `t` p...
1093
+ # @param extrahosts [String, nil] Extra hosts to add to /etc/hosts
1094
+ # @param remote [String, nil] A Git repository URI or HTTP/HTTPS context
1095
+ # URI. If the URI points to a single text file, the file’s contents are
1096
+ # placed into a file called `Dockerfile` and the...
1097
+ # @param q [Boolean, nil] Suppress verbose build output.
1098
+ # @param nocache [Boolean, nil] Do not use the cache when building the
1099
+ # image.
1100
+ # @param cachefrom [String, nil] JSON array of images used for build cache
1101
+ # resolution.
1102
+ # @param pull [String, nil] Attempt to pull the image even if an older
1103
+ # image exists locally.
1104
+ # @param rm [Boolean, nil] Remove intermediate containers after a
1105
+ # successful build.
1106
+ # @param forcerm [Boolean, nil] Always remove intermediate containers,
1107
+ # even upon failure.
1108
+ # @param memory [Integer, nil] Set memory limit for build.
1109
+ # @param memswap [Integer, nil] Total memory (memory + swap). Set as `-1`
1110
+ # to disable swap.
1111
+ # @param cpushares [Integer, nil] CPU shares (relative weight).
1112
+ # @param cpusetcpus [String, nil] CPUs in which to allow execution (e.g.,
1113
+ # `0-3`, `0,1`).
1114
+ # @param cpuperiod [Integer, nil] The length of a CPU period in
1115
+ # microseconds.
1116
+ # @param cpuquota [Integer, nil] Microseconds of CPU time that the
1117
+ # container can get in a CPU period.
1118
+ # @param buildargs [String, nil] JSON map of string pairs for build-time
1119
+ # variables. Users pass these values at build-time. Docker uses the
1120
+ # buildargs as the environment context for commands run...
1121
+ # @param shmsize [Integer, nil] Size of `/dev/shm` in bytes. The size must
1122
+ # be greater than 0. If omitted the system uses 64MB.
1123
+ # @param squash [Boolean, nil] Squash the resulting images layers into a
1124
+ # single layer. *(Experimental release only.)*
1125
+ # @param labels [String, nil] Arbitrary key/value labels to set on the
1126
+ # image, as a JSON map of string pairs.
1127
+ # @param networkmode [String, nil] Sets the networking mode for the run
1128
+ # commands during build. Supported standard values are: `bridge`, `host`,
1129
+ # `none`, and `container:<name|id>`. Any other value...
1130
+ # @param platform [String, nil] Platform in the format os[/arch[/variant]]
1131
+ # @param target [String, nil] Target build stage
1132
+ # @param outputs [String, nil] BuildKit output configuration in the format
1133
+ # of a stringified JSON array of objects. Each object must have two
1134
+ # top-level properties: `Type` and `Attrs`. The `Typ...
1135
+ # @param version [String, nil] Version of the builder backend to use.
1136
+ # @param content_type [String, nil] (sent to the daemon as 'Content-type')
1137
+ # @param x_registry_config [String, nil] This is a base64-encoded JSON
1138
+ # object with auth configurations for multiple registries that a build may
1139
+ # refer to. (sent to the daemon as 'X-Registry-Config')
1140
+ # @param body [Hash, nil] A tar archive compressed with one of the
1141
+ # following algorithms: identity (no compression), gzip, bzip2, xz. (body
1142
+ # parameter 'inputStream' in the API specification)
1143
+ # @yieldparam chunk [String] successive body chunks, when a block is given
1144
+ # @return [Docker::API::Response]
1145
+ # @raise [Docker::API::BadRequest] 400 -- Bad parameter
1146
+ # @raise [Docker::API::ServerError] 500 -- server error
1147
+ def image_build(
1148
+ dockerfile: nil,
1149
+ t: nil,
1150
+ extrahosts: nil,
1151
+ remote: nil,
1152
+ q: nil,
1153
+ nocache: nil,
1154
+ cachefrom: nil,
1155
+ pull: nil,
1156
+ rm: nil,
1157
+ forcerm: nil,
1158
+ memory: nil,
1159
+ memswap: nil,
1160
+ cpushares: nil,
1161
+ cpusetcpus: nil,
1162
+ cpuperiod: nil,
1163
+ cpuquota: nil,
1164
+ buildargs: nil,
1165
+ shmsize: nil,
1166
+ squash: nil,
1167
+ labels: nil,
1168
+ networkmode: nil,
1169
+ platform: nil,
1170
+ target: nil,
1171
+ outputs: nil,
1172
+ version: nil,
1173
+ content_type: nil,
1174
+ x_registry_config: nil,
1175
+ body: nil,
1176
+ &block
1177
+ )
1178
+ connection.request(
1179
+ :post,
1180
+ "/build",
1181
+ query: {
1182
+ "dockerfile" => dockerfile,
1183
+ "t" => t,
1184
+ "extrahosts" => extrahosts,
1185
+ "remote" => remote,
1186
+ "q" => q,
1187
+ "nocache" => nocache,
1188
+ "cachefrom" => cachefrom,
1189
+ "pull" => pull,
1190
+ "rm" => rm,
1191
+ "forcerm" => forcerm,
1192
+ "memory" => memory,
1193
+ "memswap" => memswap,
1194
+ "cpushares" => cpushares,
1195
+ "cpusetcpus" => cpusetcpus,
1196
+ "cpuperiod" => cpuperiod,
1197
+ "cpuquota" => cpuquota,
1198
+ "buildargs" => buildargs,
1199
+ "shmsize" => shmsize,
1200
+ "squash" => squash,
1201
+ "labels" => labels,
1202
+ "networkmode" => networkmode,
1203
+ "platform" => platform,
1204
+ "target" => target,
1205
+ "outputs" => outputs,
1206
+ "version" => version,
1207
+ },
1208
+ headers: { "Content-type" => content_type, "X-Registry-Config" => x_registry_config }.compact,
1209
+ body: body,
1210
+ expects: [200],
1211
+ operation: "image_build",
1212
+ &block
1213
+ )
1214
+ end
1215
+
1216
+ # Create a new image from a container
1217
+ #
1218
+ # @!method image_commit
1219
+ # Engine API: POST /commit
1220
+ #
1221
+ # @param container [String, nil] The ID or name of the container to commit
1222
+ # @param repo [String, nil] Repository name for the created image
1223
+ # @param tag [String, nil] Tag name for the create image
1224
+ # @param comment [String, nil] Commit message
1225
+ # @param author [String, nil] Author of the image (e.g., `John Hannibal
1226
+ # Smith <hannibal@a-team.com>`)
1227
+ # @param pause [Boolean, nil] Whether to pause the container before
1228
+ # committing
1229
+ # @param changes [String, nil] `Dockerfile` instructions to apply while
1230
+ # committing
1231
+ # @param body [Hash, nil] The container configuration (body parameter
1232
+ # 'containerConfig' in the API specification)
1233
+ # @yieldparam chunk [String] successive body chunks, when a block is given
1234
+ # @return [Docker::API::Response]
1235
+ # @raise [Docker::API::NotFound] 404 -- no such container
1236
+ # @raise [Docker::API::ServerError] 500 -- server error
1237
+ def image_commit(
1238
+ container: nil,
1239
+ repo: nil,
1240
+ tag: nil,
1241
+ comment: nil,
1242
+ author: nil,
1243
+ pause: nil,
1244
+ changes: nil,
1245
+ body: nil,
1246
+ &block
1247
+ )
1248
+ connection.request(
1249
+ :post,
1250
+ "/commit",
1251
+ query: {
1252
+ "container" => container,
1253
+ "repo" => repo,
1254
+ "tag" => tag,
1255
+ "comment" => comment,
1256
+ "author" => author,
1257
+ "pause" => pause,
1258
+ "changes" => changes,
1259
+ },
1260
+ body: body,
1261
+ expects: [201],
1262
+ operation: "image_commit",
1263
+ &block
1264
+ )
1265
+ end
1266
+
1267
+ # Create an image
1268
+ #
1269
+ # Pull or import an image.
1270
+ #
1271
+ # @!method image_create
1272
+ # Engine API: POST /images/create
1273
+ #
1274
+ # @param from_image [String, nil] Name of the image to pull. If the name
1275
+ # includes a tag or digest, specific behavior applies: (sent to the daemon
1276
+ # as 'fromImage')
1277
+ # @param from_src [String, nil] Source to import. The value may be a URL
1278
+ # from which the image can be retrieved or `-` to read the image from the
1279
+ # request body. This parameter may only be used w... (sent to the daemon
1280
+ # as 'fromSrc')
1281
+ # @param repo [String, nil] Repository name given to an image when it is
1282
+ # imported. The repo may include a tag. This parameter may only be used
1283
+ # when importing an image.
1284
+ # @param tag [String, nil] Tag or digest. If empty when pulling an image,
1285
+ # this causes all tags for the given image to be pulled.
1286
+ # @param message [String, nil] Set commit message for imported image.
1287
+ # @param changes [Array<String>, nil] Apply `Dockerfile` instructions to
1288
+ # the image that is created, for example: `changes=ENV DEBUG=true`. Note
1289
+ # that `ENV DEBUG=true` should be URI component encoded.
1290
+ # @param platform [String, nil] Platform in the format
1291
+ # os[/arch[/variant]].
1292
+ # @param x_registry_auth [String, nil] A base64url-encoded auth
1293
+ # configuration. (sent to the daemon as 'X-Registry-Auth')
1294
+ # @param body [Hash, nil] Image content if the value `-` has been
1295
+ # specified in fromSrc query parameter (body parameter 'inputImage' in the
1296
+ # API specification)
1297
+ # @yieldparam chunk [String] successive body chunks, when a block is given
1298
+ # @return [Docker::API::Response]
1299
+ # @raise [Docker::API::NotFound] 404 -- repository does not exist or no
1300
+ # read access
1301
+ # @raise [Docker::API::ServerError] 500 -- server error
1302
+ def image_create(
1303
+ from_image: nil,
1304
+ from_src: nil,
1305
+ repo: nil,
1306
+ tag: nil,
1307
+ message: nil,
1308
+ changes: nil,
1309
+ platform: nil,
1310
+ x_registry_auth: nil,
1311
+ body: nil,
1312
+ &block
1313
+ )
1314
+ connection.request(
1315
+ :post,
1316
+ "/images/create",
1317
+ query: {
1318
+ "fromImage" => from_image,
1319
+ "fromSrc" => from_src,
1320
+ "repo" => repo,
1321
+ "tag" => tag,
1322
+ "message" => message,
1323
+ "changes" => changes,
1324
+ "platform" => platform,
1325
+ },
1326
+ headers: { "X-Registry-Auth" => x_registry_auth }.compact,
1327
+ body: body,
1328
+ expects: [200],
1329
+ operation: "image_create",
1330
+ &block
1331
+ )
1332
+ end
1333
+
1334
+ # Remove an image
1335
+ #
1336
+ # Remove an image, along with any untagged parent images that were
1337
+ # referenced by that image.
1338
+ #
1339
+ # @!method image_delete
1340
+ # Engine API: DELETE /images/{name}
1341
+ #
1342
+ # @param name [String] Image name or ID
1343
+ # @param force [Boolean, nil] Remove the image even if it is being used by
1344
+ # stopped containers or has other tags
1345
+ # @param noprune [Boolean, nil] Do not delete untagged parent images
1346
+ # @param platforms [Array<String>, nil] Select platform-specific content
1347
+ # to delete. Multiple values are accepted. Each platform is a OCI platform
1348
+ # encoded as a JSON string.
1349
+ # @yieldparam chunk [String] successive body chunks, when a block is given
1350
+ # @return [Docker::API::Response]
1351
+ # @raise [Docker::API::NotFound] 404 -- No such image
1352
+ # @raise [Docker::API::Conflict] 409 -- Conflict
1353
+ # @raise [Docker::API::ServerError] 500 -- Server error
1354
+ def image_delete(name:, force: nil, noprune: nil, platforms: nil, &block)
1355
+ connection.request(
1356
+ :delete,
1357
+ "/images/#{Path.escape(name)}",
1358
+ query: { "force" => force, "noprune" => noprune, "platforms" => platforms },
1359
+ expects: [200],
1360
+ operation: "image_delete",
1361
+ &block
1362
+ )
1363
+ end
1364
+
1365
+ # Export an image
1366
+ #
1367
+ # Get a tarball containing all images and metadata for a repository.
1368
+ #
1369
+ # @!method image_get
1370
+ # Engine API: GET /images/{name}/get
1371
+ #
1372
+ # @param name [String] Image name or ID
1373
+ # @param platform [Array<String>, nil] JSON encoded OCI platform
1374
+ # describing a platform which will be used to select a platform-specific
1375
+ # image to be saved if the image is multi-platform. If not provid...
1376
+ # @yieldparam chunk [String] successive body chunks, when a block is given
1377
+ # @return [Docker::API::Response]
1378
+ # @raise [Docker::API::ServerError] 500 -- server error
1379
+ def image_get(name:, platform: nil, &block)
1380
+ connection.request(
1381
+ :get,
1382
+ "/images/#{Path.escape(name)}/get",
1383
+ query: { "platform" => platform },
1384
+ expects: [200],
1385
+ operation: "image_get",
1386
+ &block
1387
+ )
1388
+ end
1389
+
1390
+ # Export several images
1391
+ #
1392
+ # Get a tarball containing all images and metadata for several image
1393
+ # repositories.
1394
+ #
1395
+ # @!method image_get_all
1396
+ # Engine API: GET /images/get
1397
+ #
1398
+ # @param names [Array<String>, nil] Image names to filter by
1399
+ # @param platform [Array<String>, nil] JSON encoded OCI platform(s) which
1400
+ # will be used to select the platform-specific image(s) to be saved if the
1401
+ # image is multi-platform. If not provided, the full m...
1402
+ # @yieldparam chunk [String] successive body chunks, when a block is given
1403
+ # @return [Docker::API::Response]
1404
+ # @raise [Docker::API::ServerError] 500 -- server error
1405
+ def image_get_all(names: nil, platform: nil, &block)
1406
+ connection.request(
1407
+ :get,
1408
+ "/images/get",
1409
+ query: { "names" => names, "platform" => platform },
1410
+ expects: [200],
1411
+ operation: "image_get_all",
1412
+ &block
1413
+ )
1414
+ end
1415
+
1416
+ # Get the history of an image
1417
+ #
1418
+ # Return parent layers of an image.
1419
+ #
1420
+ # @!method image_history
1421
+ # Engine API: GET /images/{name}/history
1422
+ #
1423
+ # @param name [String] Image name or ID
1424
+ # @param platform [String, nil] JSON-encoded OCI platform to select the
1425
+ # platform-variant. If omitted, it defaults to any locally available
1426
+ # platform, prioritizing the daemon's host platform.
1427
+ # @yieldparam chunk [String] successive body chunks, when a block is given
1428
+ # @return [Docker::API::Response]
1429
+ # @raise [Docker::API::NotFound] 404 -- No such image
1430
+ # @raise [Docker::API::ServerError] 500 -- Server error
1431
+ def image_history(name:, platform: nil, &block)
1432
+ connection.request(
1433
+ :get,
1434
+ "/images/#{Path.escape(name)}/history",
1435
+ query: { "platform" => platform },
1436
+ expects: [200],
1437
+ operation: "image_history",
1438
+ &block
1439
+ )
1440
+ end
1441
+
1442
+ # Inspect an image
1443
+ #
1444
+ # Return low-level information about an image.
1445
+ #
1446
+ # @!method image_inspect
1447
+ # Engine API: GET /images/{name}/json
1448
+ #
1449
+ # @param name [String] Image name or id
1450
+ # @param manifests [Boolean, nil] Include Manifests in the image summary.
1451
+ # @param platform [String, nil] JSON-encoded OCI platform to select the
1452
+ # platform-variant. If omitted, it defaults to any locally available
1453
+ # platform, prioritizing the daemon's host platform.
1454
+ # @yieldparam chunk [String] successive body chunks, when a block is given
1455
+ # @return [Docker::API::Response]
1456
+ # @raise [Docker::API::NotFound] 404 -- No such image
1457
+ # @raise [Docker::API::ServerError] 500 -- Server error
1458
+ def image_inspect(name:, manifests: nil, platform: nil, &block)
1459
+ connection.request(
1460
+ :get,
1461
+ "/images/#{Path.escape(name)}/json",
1462
+ query: { "manifests" => manifests, "platform" => platform },
1463
+ expects: [200],
1464
+ operation: "image_inspect",
1465
+ &block
1466
+ )
1467
+ end
1468
+
1469
+ # List Images
1470
+ #
1471
+ # Returns a list of images on the server. Note that it uses a different,
1472
+ # smaller representation of an image than inspecting a single image.
1473
+ #
1474
+ # @!method image_list
1475
+ # Engine API: GET /images/json
1476
+ #
1477
+ # @param all [Boolean, nil] Show all images. Only images from a final
1478
+ # layer (no children) are shown by default.
1479
+ # @param filters [String, nil] A JSON encoded value of the filters (a
1480
+ # `map[string][]string`) to process on the images list.
1481
+ # @param shared_size [Boolean, nil] Compute and show shared size as a
1482
+ # `SharedSize` field on each image. (sent to the daemon as 'shared-size')
1483
+ # @param digests [Boolean, nil] Show digest information as a `RepoDigests`
1484
+ # field on each image.
1485
+ # @param manifests [Boolean, nil] Include `Manifests` in the image
1486
+ # summary.
1487
+ # @param identity [Boolean, nil] Include `Identity` in each manifest
1488
+ # summary. Requires `manifests=1`.
1489
+ # @yieldparam chunk [String] successive body chunks, when a block is given
1490
+ # @return [Docker::API::Response]
1491
+ # @raise [Docker::API::ServerError] 500 -- server error
1492
+ def image_list(all: nil, filters: nil, shared_size: nil, digests: nil, manifests: nil, identity: nil, &block)
1493
+ connection.request(
1494
+ :get,
1495
+ "/images/json",
1496
+ query: {
1497
+ "all" => all,
1498
+ "filters" => filters,
1499
+ "shared-size" => shared_size,
1500
+ "digests" => digests,
1501
+ "manifests" => manifests,
1502
+ "identity" => identity,
1503
+ },
1504
+ expects: [200],
1505
+ operation: "image_list",
1506
+ &block
1507
+ )
1508
+ end
1509
+
1510
+ # Import images
1511
+ #
1512
+ # Load a set of images and tags into a repository.
1513
+ #
1514
+ # @!method image_load
1515
+ # Engine API: POST /images/load
1516
+ #
1517
+ # @param quiet [Boolean, nil] Suppress progress details during load.
1518
+ # @param platform [Array<String>, nil] JSON encoded OCI platform(s) which
1519
+ # will be used to select the platform-specific image(s) to load if the
1520
+ # image is multi-platform. If not provided, the full multi...
1521
+ # @param body [Hash, nil] Tar archive containing images (body parameter
1522
+ # 'imagesTarball' in the API specification)
1523
+ # @yieldparam chunk [String] successive body chunks, when a block is given
1524
+ # @return [Docker::API::Response]
1525
+ # @raise [Docker::API::ServerError] 500 -- server error
1526
+ def image_load(quiet: nil, platform: nil, body: nil, &block)
1527
+ connection.request(
1528
+ :post,
1529
+ "/images/load",
1530
+ query: { "quiet" => quiet, "platform" => platform },
1531
+ body: body,
1532
+ expects: [200],
1533
+ operation: "image_load",
1534
+ &block
1535
+ )
1536
+ end
1537
+
1538
+ # Delete unused images
1539
+ #
1540
+ # @!method image_prune
1541
+ # Engine API: POST /images/prune
1542
+ #
1543
+ # @param filters [String, nil] Filters to process on the prune list,
1544
+ # encoded as JSON (a `map[string][]string`). Available filters:
1545
+ # @yieldparam chunk [String] successive body chunks, when a block is given
1546
+ # @return [Docker::API::Response]
1547
+ # @raise [Docker::API::ServerError] 500 -- Server error
1548
+ def image_prune(filters: nil, &block)
1549
+ connection.request(
1550
+ :post,
1551
+ "/images/prune",
1552
+ query: { "filters" => filters },
1553
+ expects: [200],
1554
+ operation: "image_prune",
1555
+ &block
1556
+ )
1557
+ end
1558
+
1559
+ # Push an image
1560
+ #
1561
+ # Push an image to a registry.
1562
+ #
1563
+ # @!method image_push
1564
+ # Engine API: POST /images/{name}/push
1565
+ #
1566
+ # @param name [String] Name of the image to push. For example,
1567
+ # `registry.example.com/myimage`. The image must be present in the local
1568
+ # image store with the same name.
1569
+ # @param x_registry_auth [String] A base64url-encoded auth configuration.
1570
+ # (sent to the daemon as 'X-Registry-Auth')
1571
+ # @param tag [String, nil] Tag of the image to push. For example,
1572
+ # `latest`. If no tag is provided, all tags of the given image that are
1573
+ # present in the local image store are pushed.
1574
+ # @param platform [String, nil] JSON-encoded OCI platform to select the
1575
+ # platform-variant to push. If not provided, all available variants will
1576
+ # attempt to be pushed.
1577
+ # @yieldparam chunk [String] successive body chunks, when a block is given
1578
+ # @return [Docker::API::Response]
1579
+ # @raise [Docker::API::NotFound] 404 -- No such image
1580
+ # @raise [Docker::API::ServerError] 500 -- Server error
1581
+ def image_push(name:, x_registry_auth:, tag: nil, platform: nil, &block)
1582
+ connection.request(
1583
+ :post,
1584
+ "/images/#{Path.escape(name)}/push",
1585
+ query: { "tag" => tag, "platform" => platform },
1586
+ headers: { "X-Registry-Auth" => x_registry_auth }.compact,
1587
+ expects: [200],
1588
+ operation: "image_push",
1589
+ &block
1590
+ )
1591
+ end
1592
+
1593
+ # Search images
1594
+ #
1595
+ # Search for an image on Docker Hub.
1596
+ #
1597
+ # @!method image_search
1598
+ # Engine API: GET /images/search
1599
+ #
1600
+ # @param term [String] Term to search
1601
+ # @param limit [Integer, nil] Maximum number of results to return
1602
+ # @param filters [String, nil] A JSON encoded value of the filters (a
1603
+ # `map[string][]string`) to process on the images list. Available filters:
1604
+ # @yieldparam chunk [String] successive body chunks, when a block is given
1605
+ # @return [Docker::API::Response]
1606
+ # @raise [Docker::API::ServerError] 500 -- Server error
1607
+ def image_search(term:, limit: nil, filters: nil, &block)
1608
+ connection.request(
1609
+ :get,
1610
+ "/images/search",
1611
+ query: { "term" => term, "limit" => limit, "filters" => filters },
1612
+ expects: [200],
1613
+ operation: "image_search",
1614
+ &block
1615
+ )
1616
+ end
1617
+
1618
+ # Tag an image
1619
+ #
1620
+ # Create a tag that refers to a source image.
1621
+ #
1622
+ # @!method image_tag
1623
+ # Engine API: POST /images/{name}/tag
1624
+ #
1625
+ # @param name [String] Image name or ID to tag.
1626
+ # @param repo [String, nil] The repository to tag in. For example,
1627
+ # `someuser/someimage`.
1628
+ # @param tag [String, nil] The name of the new tag.
1629
+ # @yieldparam chunk [String] successive body chunks, when a block is given
1630
+ # @return [Docker::API::Response]
1631
+ # @raise [Docker::API::BadRequest] 400 -- Bad parameter
1632
+ # @raise [Docker::API::NotFound] 404 -- No such image
1633
+ # @raise [Docker::API::Conflict] 409 -- Conflict
1634
+ # @raise [Docker::API::ServerError] 500 -- Server error
1635
+ def image_tag(name:, repo: nil, tag: nil, &block)
1636
+ connection.request(
1637
+ :post,
1638
+ "/images/#{Path.escape(name)}/tag",
1639
+ query: { "repo" => repo, "tag" => tag },
1640
+ expects: [201],
1641
+ operation: "image_tag",
1642
+ &block
1643
+ )
1644
+ end
1645
+
1646
+ # Connect a container to a network
1647
+ #
1648
+ # The network must be either a local-scoped network or a swarm-scoped
1649
+ # network with the `attachable` option set. A network cannot be re-attached
1650
+ # to a running container
1651
+ #
1652
+ # @!method network_connect
1653
+ # Engine API: POST /networks/{id}/connect
1654
+ #
1655
+ # @param id [String] Network ID or name
1656
+ # @param body [Hash] (body parameter 'container' in the API specification)
1657
+ # @yieldparam chunk [String] successive body chunks, when a block is given
1658
+ # @return [Docker::API::Response]
1659
+ # @raise [Docker::API::BadRequest] 400 -- bad parameter
1660
+ # @raise [Docker::API::Forbidden] 403 -- Operation forbidden
1661
+ # @raise [Docker::API::NotFound] 404 -- Network or container not found
1662
+ # @raise [Docker::API::ServerError] 500 -- Server error
1663
+ def network_connect(id:, body:, &block)
1664
+ connection.request(
1665
+ :post,
1666
+ "/networks/#{Path.escape(id)}/connect",
1667
+ body: body,
1668
+ expects: [200],
1669
+ operation: "network_connect",
1670
+ &block
1671
+ )
1672
+ end
1673
+
1674
+ # Create a network
1675
+ #
1676
+ # @!method network_create
1677
+ # Engine API: POST /networks/create
1678
+ #
1679
+ # @param body [Hash] Network configuration (body parameter 'networkConfig'
1680
+ # in the API specification)
1681
+ # @yieldparam chunk [String] successive body chunks, when a block is given
1682
+ # @return [Docker::API::Response]
1683
+ # @raise [Docker::API::BadRequest] 400 -- bad parameter
1684
+ # @raise [Docker::API::Forbidden] 403 -- Forbidden operation. This happens
1685
+ # when trying to create a network named after a pre-define...
1686
+ # @raise [Docker::API::NotFound] 404 -- plugin not found
1687
+ # @raise [Docker::API::ServerError] 500 -- Server error
1688
+ def network_create(body:, &block)
1689
+ connection.request(
1690
+ :post,
1691
+ "/networks/create",
1692
+ body: body,
1693
+ expects: [201],
1694
+ operation: "network_create",
1695
+ &block
1696
+ )
1697
+ end
1698
+
1699
+ # Remove a network
1700
+ #
1701
+ # @!method network_delete
1702
+ # Engine API: DELETE /networks/{id}
1703
+ #
1704
+ # @param id [String] Network ID or name
1705
+ # @yieldparam chunk [String] successive body chunks, when a block is given
1706
+ # @return [Docker::API::Response]
1707
+ # @raise [Docker::API::Forbidden] 403 -- operation not supported for
1708
+ # pre-defined networks
1709
+ # @raise [Docker::API::NotFound] 404 -- no such network
1710
+ # @raise [Docker::API::ServerError] 500 -- Server error
1711
+ def network_delete(id:, &block)
1712
+ connection.request(
1713
+ :delete,
1714
+ "/networks/#{Path.escape(id)}",
1715
+ expects: [204],
1716
+ operation: "network_delete",
1717
+ &block
1718
+ )
1719
+ end
1720
+
1721
+ # Disconnect a container from a network
1722
+ #
1723
+ # @!method network_disconnect
1724
+ # Engine API: POST /networks/{id}/disconnect
1725
+ #
1726
+ # @param id [String] Network ID or name
1727
+ # @param body [Hash] (body parameter 'container' in the API specification)
1728
+ # @yieldparam chunk [String] successive body chunks, when a block is given
1729
+ # @return [Docker::API::Response]
1730
+ # @raise [Docker::API::Forbidden] 403 -- Operation not supported for swarm
1731
+ # scoped networks
1732
+ # @raise [Docker::API::NotFound] 404 -- Network or container not found
1733
+ # @raise [Docker::API::ServerError] 500 -- Server error
1734
+ def network_disconnect(id:, body:, &block)
1735
+ connection.request(
1736
+ :post,
1737
+ "/networks/#{Path.escape(id)}/disconnect",
1738
+ body: body,
1739
+ expects: [200],
1740
+ operation: "network_disconnect",
1741
+ &block
1742
+ )
1743
+ end
1744
+
1745
+ # Inspect a network
1746
+ #
1747
+ # @!method network_inspect
1748
+ # Engine API: GET /networks/{id}
1749
+ #
1750
+ # @param id [String] Network ID or name
1751
+ # @param verbose [Boolean, nil] Detailed inspect output for
1752
+ # troubleshooting
1753
+ # @param scope [String, nil] Filter the network by scope (swarm, global,
1754
+ # or local)
1755
+ # @yieldparam chunk [String] successive body chunks, when a block is given
1756
+ # @return [Docker::API::Response]
1757
+ # @raise [Docker::API::NotFound] 404 -- Network not found
1758
+ # @raise [Docker::API::ServerError] 500 -- Server error
1759
+ def network_inspect(id:, verbose: nil, scope: nil, &block)
1760
+ connection.request(
1761
+ :get,
1762
+ "/networks/#{Path.escape(id)}",
1763
+ query: { "verbose" => verbose, "scope" => scope },
1764
+ expects: [200],
1765
+ operation: "network_inspect",
1766
+ &block
1767
+ )
1768
+ end
1769
+
1770
+ # List networks
1771
+ #
1772
+ # Returns a list of networks. For details on the format, see the [network
1773
+ # inspect endpoint](#operation/NetworkInspect).
1774
+ #
1775
+ # @!method network_list
1776
+ # Engine API: GET /networks
1777
+ #
1778
+ # @param filters [String, nil] JSON encoded value of the filters (a
1779
+ # `map[string][]string`) to process on the networks list.
1780
+ # @yieldparam chunk [String] successive body chunks, when a block is given
1781
+ # @return [Docker::API::Response]
1782
+ # @raise [Docker::API::ServerError] 500 -- Server error
1783
+ def network_list(filters: nil, &block)
1784
+ connection.request(
1785
+ :get,
1786
+ "/networks",
1787
+ query: { "filters" => filters },
1788
+ expects: [200],
1789
+ operation: "network_list",
1790
+ &block
1791
+ )
1792
+ end
1793
+
1794
+ # Delete unused networks
1795
+ #
1796
+ # @!method network_prune
1797
+ # Engine API: POST /networks/prune
1798
+ #
1799
+ # @param filters [String, nil] Filters to process on the prune list,
1800
+ # encoded as JSON (a `map[string][]string`).
1801
+ # @yieldparam chunk [String] successive body chunks, when a block is given
1802
+ # @return [Docker::API::Response]
1803
+ # @raise [Docker::API::ServerError] 500 -- Server error
1804
+ def network_prune(filters: nil, &block)
1805
+ connection.request(
1806
+ :post,
1807
+ "/networks/prune",
1808
+ query: { "filters" => filters },
1809
+ expects: [200],
1810
+ operation: "network_prune",
1811
+ &block
1812
+ )
1813
+ end
1814
+
1815
+ # Delete a node
1816
+ #
1817
+ # @!method node_delete
1818
+ # Engine API: DELETE /nodes/{id}
1819
+ #
1820
+ # @param id [String] The ID or name of the node
1821
+ # @param force [Boolean, nil] Force remove a node from the swarm
1822
+ # @yieldparam chunk [String] successive body chunks, when a block is given
1823
+ # @return [Docker::API::Response]
1824
+ # @raise [Docker::API::NotFound] 404 -- no such node
1825
+ # @raise [Docker::API::ServerError] 500 -- server error
1826
+ # @raise [Docker::API::ServerError] 503 -- node is not part of a swarm
1827
+ def node_delete(id:, force: nil, &block)
1828
+ connection.request(
1829
+ :delete,
1830
+ "/nodes/#{Path.escape(id)}",
1831
+ query: { "force" => force },
1832
+ expects: [200],
1833
+ operation: "node_delete",
1834
+ &block
1835
+ )
1836
+ end
1837
+
1838
+ # Inspect a node
1839
+ #
1840
+ # @!method node_inspect
1841
+ # Engine API: GET /nodes/{id}
1842
+ #
1843
+ # @param id [String] The ID or name of the node
1844
+ # @yieldparam chunk [String] successive body chunks, when a block is given
1845
+ # @return [Docker::API::Response]
1846
+ # @raise [Docker::API::NotFound] 404 -- no such node
1847
+ # @raise [Docker::API::ServerError] 500 -- server error
1848
+ # @raise [Docker::API::ServerError] 503 -- node is not part of a swarm
1849
+ def node_inspect(id:, &block)
1850
+ connection.request(
1851
+ :get,
1852
+ "/nodes/#{Path.escape(id)}",
1853
+ expects: [200],
1854
+ operation: "node_inspect",
1855
+ &block
1856
+ )
1857
+ end
1858
+
1859
+ # List nodes
1860
+ #
1861
+ # @!method node_list
1862
+ # Engine API: GET /nodes
1863
+ #
1864
+ # @param filters [String, nil] Filters to process on the nodes list,
1865
+ # encoded as JSON (a `map[string][]string`).
1866
+ # @yieldparam chunk [String] successive body chunks, when a block is given
1867
+ # @return [Docker::API::Response]
1868
+ # @raise [Docker::API::ServerError] 500 -- server error
1869
+ # @raise [Docker::API::ServerError] 503 -- node is not part of a swarm
1870
+ def node_list(filters: nil, &block)
1871
+ connection.request(
1872
+ :get,
1873
+ "/nodes",
1874
+ query: { "filters" => filters },
1875
+ expects: [200],
1876
+ operation: "node_list",
1877
+ &block
1878
+ )
1879
+ end
1880
+
1881
+ # Update a node
1882
+ #
1883
+ # @!method node_update
1884
+ # Engine API: POST /nodes/{id}/update
1885
+ #
1886
+ # @param id [String] The ID of the node
1887
+ # @param version [Integer] The version number of the node object being
1888
+ # updated. This is required to avoid conflicting writes.
1889
+ # @param body [Hash, nil] (body parameter 'body' in the API specification)
1890
+ # @yieldparam chunk [String] successive body chunks, when a block is given
1891
+ # @return [Docker::API::Response]
1892
+ # @raise [Docker::API::BadRequest] 400 -- bad parameter
1893
+ # @raise [Docker::API::NotFound] 404 -- no such node
1894
+ # @raise [Docker::API::ServerError] 500 -- server error
1895
+ # @raise [Docker::API::ServerError] 503 -- node is not part of a swarm
1896
+ def node_update(id:, version:, body: nil, &block)
1897
+ connection.request(
1898
+ :post,
1899
+ "/nodes/#{Path.escape(id)}/update",
1900
+ query: { "version" => version },
1901
+ body: body,
1902
+ expects: [200],
1903
+ operation: "node_update",
1904
+ &block
1905
+ )
1906
+ end
1907
+
1908
+ # Get plugin privileges
1909
+ #
1910
+ # @!method get_plugin_privileges
1911
+ # Engine API: GET /plugins/privileges
1912
+ #
1913
+ # @param remote [String] The name of the plugin. The `:latest` tag is
1914
+ # optional, and is the default if omitted.
1915
+ # @yieldparam chunk [String] successive body chunks, when a block is given
1916
+ # @return [Docker::API::Response]
1917
+ # @raise [Docker::API::ServerError] 500 -- server error
1918
+ def get_plugin_privileges(remote:, &block)
1919
+ connection.request(
1920
+ :get,
1921
+ "/plugins/privileges",
1922
+ query: { "remote" => remote },
1923
+ expects: [200],
1924
+ operation: "get_plugin_privileges",
1925
+ &block
1926
+ )
1927
+ end
1928
+
1929
+ # Create a plugin
1930
+ #
1931
+ # @!method plugin_create
1932
+ # Engine API: POST /plugins/create
1933
+ #
1934
+ # @param name [String] The name of the plugin. The `:latest` tag is
1935
+ # optional, and is the default if omitted.
1936
+ # @param body [Hash, nil] Path to tar containing plugin rootfs and
1937
+ # manifest (body parameter 'tarContext' in the API specification)
1938
+ # @yieldparam chunk [String] successive body chunks, when a block is given
1939
+ # @return [Docker::API::Response]
1940
+ # @raise [Docker::API::ServerError] 500 -- server error
1941
+ def plugin_create(name:, body: nil, &block)
1942
+ connection.request(
1943
+ :post,
1944
+ "/plugins/create",
1945
+ query: { "name" => name },
1946
+ body: body,
1947
+ expects: [204],
1948
+ operation: "plugin_create",
1949
+ &block
1950
+ )
1951
+ end
1952
+
1953
+ # Remove a plugin
1954
+ #
1955
+ # @!method plugin_delete
1956
+ # Engine API: DELETE /plugins/{name}
1957
+ #
1958
+ # @param name [String] The name of the plugin. The `:latest` tag is
1959
+ # optional, and is the default if omitted.
1960
+ # @param force [Boolean, nil] Disable the plugin before removing. This may
1961
+ # result in issues if the plugin is in use by a container.
1962
+ # @yieldparam chunk [String] successive body chunks, when a block is given
1963
+ # @return [Docker::API::Response]
1964
+ # @raise [Docker::API::NotFound] 404 -- plugin is not installed
1965
+ # @raise [Docker::API::ServerError] 500 -- server error
1966
+ def plugin_delete(name:, force: nil, &block)
1967
+ connection.request(
1968
+ :delete,
1969
+ "/plugins/#{Path.escape(name)}",
1970
+ query: { "force" => force },
1971
+ expects: [200],
1972
+ operation: "plugin_delete",
1973
+ &block
1974
+ )
1975
+ end
1976
+
1977
+ # Disable a plugin
1978
+ #
1979
+ # @!method plugin_disable
1980
+ # Engine API: POST /plugins/{name}/disable
1981
+ #
1982
+ # @param name [String] The name of the plugin. The `:latest` tag is
1983
+ # optional, and is the default if omitted.
1984
+ # @param force [Boolean, nil] Force disable a plugin even if still in use.
1985
+ # @yieldparam chunk [String] successive body chunks, when a block is given
1986
+ # @return [Docker::API::Response]
1987
+ # @raise [Docker::API::NotFound] 404 -- plugin is not installed
1988
+ # @raise [Docker::API::ServerError] 500 -- server error
1989
+ def plugin_disable(name:, force: nil, &block)
1990
+ connection.request(
1991
+ :post,
1992
+ "/plugins/#{Path.escape(name)}/disable",
1993
+ query: { "force" => force },
1994
+ expects: [200],
1995
+ operation: "plugin_disable",
1996
+ &block
1997
+ )
1998
+ end
1999
+
2000
+ # Enable a plugin
2001
+ #
2002
+ # @!method plugin_enable
2003
+ # Engine API: POST /plugins/{name}/enable
2004
+ #
2005
+ # @param name [String] The name of the plugin. The `:latest` tag is
2006
+ # optional, and is the default if omitted.
2007
+ # @param timeout [Integer, nil] Set the HTTP client timeout (in seconds)
2008
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2009
+ # @return [Docker::API::Response]
2010
+ # @raise [Docker::API::NotFound] 404 -- plugin is not installed
2011
+ # @raise [Docker::API::ServerError] 500 -- server error
2012
+ def plugin_enable(name:, timeout: nil, &block)
2013
+ connection.request(
2014
+ :post,
2015
+ "/plugins/#{Path.escape(name)}/enable",
2016
+ query: { "timeout" => timeout },
2017
+ expects: [200],
2018
+ operation: "plugin_enable",
2019
+ &block
2020
+ )
2021
+ end
2022
+
2023
+ # Inspect a plugin
2024
+ #
2025
+ # @!method plugin_inspect
2026
+ # Engine API: GET /plugins/{name}/json
2027
+ #
2028
+ # @param name [String] The name of the plugin. The `:latest` tag is
2029
+ # optional, and is the default if omitted.
2030
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2031
+ # @return [Docker::API::Response]
2032
+ # @raise [Docker::API::NotFound] 404 -- plugin is not installed
2033
+ # @raise [Docker::API::ServerError] 500 -- server error
2034
+ def plugin_inspect(name:, &block)
2035
+ connection.request(
2036
+ :get,
2037
+ "/plugins/#{Path.escape(name)}/json",
2038
+ expects: [200],
2039
+ operation: "plugin_inspect",
2040
+ &block
2041
+ )
2042
+ end
2043
+
2044
+ # List plugins
2045
+ #
2046
+ # Returns information about installed plugins.
2047
+ #
2048
+ # @!method plugin_list
2049
+ # Engine API: GET /plugins
2050
+ #
2051
+ # @param filters [String, nil] A JSON encoded value of the filters (a
2052
+ # `map[string][]string`) to process on the plugin list.
2053
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2054
+ # @return [Docker::API::Response]
2055
+ # @raise [Docker::API::ServerError] 500 -- Server error
2056
+ def plugin_list(filters: nil, &block)
2057
+ connection.request(
2058
+ :get,
2059
+ "/plugins",
2060
+ query: { "filters" => filters },
2061
+ expects: [200],
2062
+ operation: "plugin_list",
2063
+ &block
2064
+ )
2065
+ end
2066
+
2067
+ # Install a plugin
2068
+ #
2069
+ # Pulls and installs a plugin. After the plugin is installed, it can be
2070
+ # enabled using the [`POST /plugins/{name}/enable`
2071
+ # endpoint](#operation/PostPluginsEnable).
2072
+ #
2073
+ # @!method plugin_pull
2074
+ # Engine API: POST /plugins/pull
2075
+ #
2076
+ # @param remote [String] Remote reference for plugin to install.
2077
+ # @param name [String, nil] Local name for the pulled plugin.
2078
+ # @param x_registry_auth [String, nil] A base64url-encoded auth
2079
+ # configuration to use when pulling a plugin from a registry. (sent to the
2080
+ # daemon as 'X-Registry-Auth')
2081
+ # @param body [Hash, nil] (body parameter 'body' in the API specification)
2082
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2083
+ # @return [Docker::API::Response]
2084
+ # @raise [Docker::API::ServerError] 500 -- server error
2085
+ def plugin_pull(remote:, name: nil, x_registry_auth: nil, body: nil, &block)
2086
+ connection.request(
2087
+ :post,
2088
+ "/plugins/pull",
2089
+ query: { "remote" => remote, "name" => name },
2090
+ headers: { "X-Registry-Auth" => x_registry_auth }.compact,
2091
+ body: body,
2092
+ expects: [204],
2093
+ operation: "plugin_pull",
2094
+ &block
2095
+ )
2096
+ end
2097
+
2098
+ # Push a plugin
2099
+ #
2100
+ # Push a plugin to the registry.
2101
+ #
2102
+ # @!method plugin_push
2103
+ # Engine API: POST /plugins/{name}/push
2104
+ #
2105
+ # @param name [String] The name of the plugin. The `:latest` tag is
2106
+ # optional, and is the default if omitted.
2107
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2108
+ # @return [Docker::API::Response]
2109
+ # @raise [Docker::API::NotFound] 404 -- plugin not installed
2110
+ # @raise [Docker::API::ServerError] 500 -- server error
2111
+ def plugin_push(name:, &block)
2112
+ connection.request(
2113
+ :post,
2114
+ "/plugins/#{Path.escape(name)}/push",
2115
+ expects: [200],
2116
+ operation: "plugin_push",
2117
+ &block
2118
+ )
2119
+ end
2120
+
2121
+ # Configure a plugin
2122
+ #
2123
+ # @!method plugin_set
2124
+ # Engine API: POST /plugins/{name}/set
2125
+ #
2126
+ # @param name [String] The name of the plugin. The `:latest` tag is
2127
+ # optional, and is the default if omitted.
2128
+ # @param body [Hash, nil] (body parameter 'body' in the API specification)
2129
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2130
+ # @return [Docker::API::Response]
2131
+ # @raise [Docker::API::NotFound] 404 -- Plugin not installed
2132
+ # @raise [Docker::API::ServerError] 500 -- Server error
2133
+ def plugin_set(name:, body: nil, &block)
2134
+ connection.request(
2135
+ :post,
2136
+ "/plugins/#{Path.escape(name)}/set",
2137
+ body: body,
2138
+ expects: [204],
2139
+ operation: "plugin_set",
2140
+ &block
2141
+ )
2142
+ end
2143
+
2144
+ # Upgrade a plugin
2145
+ #
2146
+ # @!method plugin_upgrade
2147
+ # Engine API: POST /plugins/{name}/upgrade
2148
+ #
2149
+ # @param name [String] The name of the plugin. The `:latest` tag is
2150
+ # optional, and is the default if omitted.
2151
+ # @param remote [String] Remote reference to upgrade to.
2152
+ # @param x_registry_auth [String, nil] A base64url-encoded auth
2153
+ # configuration to use when pulling a plugin from a registry. (sent to the
2154
+ # daemon as 'X-Registry-Auth')
2155
+ # @param body [Hash, nil] (body parameter 'body' in the API specification)
2156
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2157
+ # @return [Docker::API::Response]
2158
+ # @raise [Docker::API::NotFound] 404 -- plugin not installed
2159
+ # @raise [Docker::API::ServerError] 500 -- server error
2160
+ def plugin_upgrade(name:, remote:, x_registry_auth: nil, body: nil, &block)
2161
+ connection.request(
2162
+ :post,
2163
+ "/plugins/#{Path.escape(name)}/upgrade",
2164
+ query: { "remote" => remote },
2165
+ headers: { "X-Registry-Auth" => x_registry_auth }.compact,
2166
+ body: body,
2167
+ expects: [204],
2168
+ operation: "plugin_upgrade",
2169
+ &block
2170
+ )
2171
+ end
2172
+
2173
+ # Create a secret
2174
+ #
2175
+ # @!method secret_create
2176
+ # Engine API: POST /secrets/create
2177
+ #
2178
+ # @param body [Hash, nil] (body parameter 'body' in the API specification)
2179
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2180
+ # @return [Docker::API::Response]
2181
+ # @raise [Docker::API::Conflict] 409 -- name conflicts with an existing
2182
+ # object
2183
+ # @raise [Docker::API::ServerError] 500 -- server error
2184
+ # @raise [Docker::API::ServerError] 503 -- node is not part of a swarm
2185
+ def secret_create(body: nil, &block)
2186
+ connection.request(
2187
+ :post,
2188
+ "/secrets/create",
2189
+ body: body,
2190
+ expects: [201],
2191
+ operation: "secret_create",
2192
+ &block
2193
+ )
2194
+ end
2195
+
2196
+ # Delete a secret
2197
+ #
2198
+ # @!method secret_delete
2199
+ # Engine API: DELETE /secrets/{id}
2200
+ #
2201
+ # @param id [String] ID of the secret
2202
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2203
+ # @return [Docker::API::Response]
2204
+ # @raise [Docker::API::NotFound] 404 -- secret not found
2205
+ # @raise [Docker::API::ServerError] 500 -- server error
2206
+ # @raise [Docker::API::ServerError] 503 -- node is not part of a swarm
2207
+ def secret_delete(id:, &block)
2208
+ connection.request(
2209
+ :delete,
2210
+ "/secrets/#{Path.escape(id)}",
2211
+ expects: [204],
2212
+ operation: "secret_delete",
2213
+ &block
2214
+ )
2215
+ end
2216
+
2217
+ # Inspect a secret
2218
+ #
2219
+ # @!method secret_inspect
2220
+ # Engine API: GET /secrets/{id}
2221
+ #
2222
+ # @param id [String] ID of the secret
2223
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2224
+ # @return [Docker::API::Response]
2225
+ # @raise [Docker::API::NotFound] 404 -- secret not found
2226
+ # @raise [Docker::API::ServerError] 500 -- server error
2227
+ # @raise [Docker::API::ServerError] 503 -- node is not part of a swarm
2228
+ def secret_inspect(id:, &block)
2229
+ connection.request(
2230
+ :get,
2231
+ "/secrets/#{Path.escape(id)}",
2232
+ expects: [200],
2233
+ operation: "secret_inspect",
2234
+ &block
2235
+ )
2236
+ end
2237
+
2238
+ # List secrets
2239
+ #
2240
+ # @!method secret_list
2241
+ # Engine API: GET /secrets
2242
+ #
2243
+ # @param filters [String, nil] A JSON encoded value of the filters (a
2244
+ # `map[string][]string`) to process on the secrets list.
2245
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2246
+ # @return [Docker::API::Response]
2247
+ # @raise [Docker::API::ServerError] 500 -- server error
2248
+ # @raise [Docker::API::ServerError] 503 -- node is not part of a swarm
2249
+ def secret_list(filters: nil, &block)
2250
+ connection.request(
2251
+ :get,
2252
+ "/secrets",
2253
+ query: { "filters" => filters },
2254
+ expects: [200],
2255
+ operation: "secret_list",
2256
+ &block
2257
+ )
2258
+ end
2259
+
2260
+ # Update a Secret
2261
+ #
2262
+ # @!method secret_update
2263
+ # Engine API: POST /secrets/{id}/update
2264
+ #
2265
+ # @param id [String] The ID or name of the secret
2266
+ # @param version [Integer] The version number of the secret object being
2267
+ # updated. This is required to avoid conflicting writes.
2268
+ # @param body [Hash, nil] The spec of the secret to update. Currently,
2269
+ # only the Labels field can be updated. All other fields must remain
2270
+ # unchanged from the [SecretInspect endpoint](#ope... (body parameter
2271
+ # 'body' in the API specification)
2272
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2273
+ # @return [Docker::API::Response]
2274
+ # @raise [Docker::API::BadRequest] 400 -- bad parameter
2275
+ # @raise [Docker::API::NotFound] 404 -- no such secret
2276
+ # @raise [Docker::API::ServerError] 500 -- server error
2277
+ # @raise [Docker::API::ServerError] 503 -- node is not part of a swarm
2278
+ def secret_update(id:, version:, body: nil, &block)
2279
+ connection.request(
2280
+ :post,
2281
+ "/secrets/#{Path.escape(id)}/update",
2282
+ query: { "version" => version },
2283
+ body: body,
2284
+ expects: [200],
2285
+ operation: "secret_update",
2286
+ &block
2287
+ )
2288
+ end
2289
+
2290
+ # Create a service
2291
+ #
2292
+ # @!method service_create
2293
+ # Engine API: POST /services/create
2294
+ #
2295
+ # @param body [Hash] (body parameter 'body' in the API specification)
2296
+ # @param x_registry_auth [String, nil] A base64url-encoded auth
2297
+ # configuration for pulling from private registries. (sent to the daemon
2298
+ # as 'X-Registry-Auth')
2299
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2300
+ # @return [Docker::API::Response]
2301
+ # @raise [Docker::API::BadRequest] 400 -- bad parameter
2302
+ # @raise [Docker::API::Forbidden] 403 -- network is not eligible for
2303
+ # services
2304
+ # @raise [Docker::API::Conflict] 409 -- name conflicts with an existing
2305
+ # service
2306
+ # @raise [Docker::API::ServerError] 500 -- server error
2307
+ # @raise [Docker::API::ServerError] 503 -- node is not part of a swarm
2308
+ def service_create(body:, x_registry_auth: nil, &block)
2309
+ connection.request(
2310
+ :post,
2311
+ "/services/create",
2312
+ headers: { "X-Registry-Auth" => x_registry_auth }.compact,
2313
+ body: body,
2314
+ expects: [201],
2315
+ operation: "service_create",
2316
+ &block
2317
+ )
2318
+ end
2319
+
2320
+ # Delete a service
2321
+ #
2322
+ # @!method service_delete
2323
+ # Engine API: DELETE /services/{id}
2324
+ #
2325
+ # @param id [String] ID or name of service.
2326
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2327
+ # @return [Docker::API::Response]
2328
+ # @raise [Docker::API::NotFound] 404 -- no such service
2329
+ # @raise [Docker::API::ServerError] 500 -- server error
2330
+ # @raise [Docker::API::ServerError] 503 -- node is not part of a swarm
2331
+ def service_delete(id:, &block)
2332
+ connection.request(
2333
+ :delete,
2334
+ "/services/#{Path.escape(id)}",
2335
+ expects: [200],
2336
+ operation: "service_delete",
2337
+ &block
2338
+ )
2339
+ end
2340
+
2341
+ # Inspect a service
2342
+ #
2343
+ # @!method service_inspect
2344
+ # Engine API: GET /services/{id}
2345
+ #
2346
+ # @param id [String] ID or name of service.
2347
+ # @param insert_defaults [Boolean, nil] Fill empty fields with default
2348
+ # values. (sent to the daemon as 'insertDefaults')
2349
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2350
+ # @return [Docker::API::Response]
2351
+ # @raise [Docker::API::NotFound] 404 -- no such service
2352
+ # @raise [Docker::API::ServerError] 500 -- server error
2353
+ # @raise [Docker::API::ServerError] 503 -- node is not part of a swarm
2354
+ def service_inspect(id:, insert_defaults: nil, &block)
2355
+ connection.request(
2356
+ :get,
2357
+ "/services/#{Path.escape(id)}",
2358
+ query: { "insertDefaults" => insert_defaults },
2359
+ expects: [200],
2360
+ operation: "service_inspect",
2361
+ &block
2362
+ )
2363
+ end
2364
+
2365
+ # List services
2366
+ #
2367
+ # @!method service_list
2368
+ # Engine API: GET /services
2369
+ #
2370
+ # @param filters [String, nil] A JSON encoded value of the filters (a
2371
+ # `map[string][]string`) to process on the services list.
2372
+ # @param status [Boolean, nil] Include service status, with count of
2373
+ # running and desired tasks.
2374
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2375
+ # @return [Docker::API::Response]
2376
+ # @raise [Docker::API::ServerError] 500 -- server error
2377
+ # @raise [Docker::API::ServerError] 503 -- node is not part of a swarm
2378
+ def service_list(filters: nil, status: nil, &block)
2379
+ connection.request(
2380
+ :get,
2381
+ "/services",
2382
+ query: { "filters" => filters, "status" => status },
2383
+ expects: [200],
2384
+ operation: "service_list",
2385
+ &block
2386
+ )
2387
+ end
2388
+
2389
+ # Get service logs
2390
+ #
2391
+ # Get `stdout` and `stderr` logs from a service. See also
2392
+ # [`/containers/{id}/logs`](#operation/ContainerLogs).
2393
+ #
2394
+ # @!method service_logs
2395
+ # Engine API: GET /services/{id}/logs
2396
+ #
2397
+ # @param id [String] ID or name of the service
2398
+ # @param details [Boolean, nil] Show service context and extra details
2399
+ # provided to logs.
2400
+ # @param follow [Boolean, nil] Keep connection after returning logs.
2401
+ # @param stdout [Boolean, nil] Return logs from `stdout`
2402
+ # @param stderr [Boolean, nil] Return logs from `stderr`
2403
+ # @param since [Integer, nil] Only return logs since this time, as a UNIX
2404
+ # timestamp
2405
+ # @param timestamps [Boolean, nil] Add timestamps to every log line
2406
+ # @param tail [String, nil] Only return this number of log lines from the
2407
+ # end of the logs. Specify as an integer or `all` to output all log lines.
2408
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2409
+ # @return [Docker::API::Response]
2410
+ # @raise [Docker::API::NotFound] 404 -- no such service
2411
+ # @raise [Docker::API::ServerError] 500 -- server error
2412
+ # @raise [Docker::API::ServerError] 503 -- node is not part of a swarm
2413
+ def service_logs(
2414
+ id:,
2415
+ details: nil,
2416
+ follow: nil,
2417
+ stdout: nil,
2418
+ stderr: nil,
2419
+ since: nil,
2420
+ timestamps: nil,
2421
+ tail: nil,
2422
+ &block
2423
+ )
2424
+ connection.request(
2425
+ :get,
2426
+ "/services/#{Path.escape(id)}/logs",
2427
+ query: {
2428
+ "details" => details,
2429
+ "follow" => follow,
2430
+ "stdout" => stdout,
2431
+ "stderr" => stderr,
2432
+ "since" => since,
2433
+ "timestamps" => timestamps,
2434
+ "tail" => tail,
2435
+ },
2436
+ expects: [200],
2437
+ operation: "service_logs",
2438
+ &block
2439
+ )
2440
+ end
2441
+
2442
+ # Update a service
2443
+ #
2444
+ # @!method service_update
2445
+ # Engine API: POST /services/{id}/update
2446
+ #
2447
+ # @param id [String] ID or name of service.
2448
+ # @param body [Hash] (body parameter 'body' in the API specification)
2449
+ # @param version [Integer] The version number of the service object being
2450
+ # updated. This is required to avoid conflicting writes. This version
2451
+ # number should be the value as currently set o...
2452
+ # @param registry_auth_from [String, nil] If the `X-Registry-Auth` header
2453
+ # is not specified, this parameter indicates where to find registry
2454
+ # authorization credentials. (sent to the daemon as 'registryAuthFrom')
2455
+ # @param rollback [String, nil] Set to this parameter to `previous` to
2456
+ # cause a server-side rollback to the previous service spec. The supplied
2457
+ # spec will be ignored in this case.
2458
+ # @param x_registry_auth [String, nil] A base64url-encoded auth
2459
+ # configuration for pulling from private registries. (sent to the daemon
2460
+ # as 'X-Registry-Auth')
2461
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2462
+ # @return [Docker::API::Response]
2463
+ # @raise [Docker::API::BadRequest] 400 -- bad parameter
2464
+ # @raise [Docker::API::NotFound] 404 -- no such service
2465
+ # @raise [Docker::API::ServerError] 500 -- server error
2466
+ # @raise [Docker::API::ServerError] 503 -- node is not part of a swarm
2467
+ def service_update(id:, body:, version:, registry_auth_from: nil, rollback: nil, x_registry_auth: nil, &block)
2468
+ connection.request(
2469
+ :post,
2470
+ "/services/#{Path.escape(id)}/update",
2471
+ query: { "version" => version, "registryAuthFrom" => registry_auth_from, "rollback" => rollback },
2472
+ headers: { "X-Registry-Auth" => x_registry_auth }.compact,
2473
+ body: body,
2474
+ expects: [200],
2475
+ operation: "service_update",
2476
+ &block
2477
+ )
2478
+ end
2479
+
2480
+ # Initialize interactive session
2481
+ #
2482
+ # Start a new interactive session with a server. Session allows server to
2483
+ # call back to the client for advanced capabilities.
2484
+ #
2485
+ # @!method session
2486
+ # Engine API: POST /session
2487
+ #
2488
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2489
+ # @return [Docker::API::Response]
2490
+ # @raise [Docker::API::ClientError] 101 -- no error, hijacking successful
2491
+ # @raise [Docker::API::BadRequest] 400 -- bad parameter
2492
+ # @raise [Docker::API::ServerError] 500 -- server error
2493
+ def session(&block)
2494
+ connection.request(
2495
+ :post,
2496
+ "/session",
2497
+ expects: [200],
2498
+ operation: "session",
2499
+ &block
2500
+ )
2501
+ end
2502
+
2503
+ # Initialize a new swarm
2504
+ #
2505
+ # @!method swarm_init
2506
+ # Engine API: POST /swarm/init
2507
+ #
2508
+ # @param body [Hash] (body parameter 'body' in the API specification)
2509
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2510
+ # @return [Docker::API::Response]
2511
+ # @raise [Docker::API::BadRequest] 400 -- bad parameter
2512
+ # @raise [Docker::API::ServerError] 500 -- server error
2513
+ # @raise [Docker::API::ServerError] 503 -- node is already part of a swarm
2514
+ def swarm_init(body:, &block)
2515
+ connection.request(
2516
+ :post,
2517
+ "/swarm/init",
2518
+ body: body,
2519
+ expects: [200],
2520
+ operation: "swarm_init",
2521
+ &block
2522
+ )
2523
+ end
2524
+
2525
+ # Inspect swarm
2526
+ #
2527
+ # @!method swarm_inspect
2528
+ # Engine API: GET /swarm
2529
+ #
2530
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2531
+ # @return [Docker::API::Response]
2532
+ # @raise [Docker::API::NotFound] 404 -- no such swarm
2533
+ # @raise [Docker::API::ServerError] 500 -- server error
2534
+ # @raise [Docker::API::ServerError] 503 -- node is not part of a swarm
2535
+ def swarm_inspect(&block)
2536
+ connection.request(
2537
+ :get,
2538
+ "/swarm",
2539
+ expects: [200],
2540
+ operation: "swarm_inspect",
2541
+ &block
2542
+ )
2543
+ end
2544
+
2545
+ # Join an existing swarm
2546
+ #
2547
+ # @!method swarm_join
2548
+ # Engine API: POST /swarm/join
2549
+ #
2550
+ # @param body [Hash] (body parameter 'body' in the API specification)
2551
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2552
+ # @return [Docker::API::Response]
2553
+ # @raise [Docker::API::BadRequest] 400 -- bad parameter
2554
+ # @raise [Docker::API::ServerError] 500 -- server error
2555
+ # @raise [Docker::API::ServerError] 503 -- node is already part of a swarm
2556
+ def swarm_join(body:, &block)
2557
+ connection.request(
2558
+ :post,
2559
+ "/swarm/join",
2560
+ body: body,
2561
+ expects: [200],
2562
+ operation: "swarm_join",
2563
+ &block
2564
+ )
2565
+ end
2566
+
2567
+ # Leave a swarm
2568
+ #
2569
+ # @!method swarm_leave
2570
+ # Engine API: POST /swarm/leave
2571
+ #
2572
+ # @param force [Boolean, nil] Force leave swarm, even if this is the last
2573
+ # manager or that it will break the cluster.
2574
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2575
+ # @return [Docker::API::Response]
2576
+ # @raise [Docker::API::ServerError] 500 -- server error
2577
+ # @raise [Docker::API::ServerError] 503 -- node is not part of a swarm
2578
+ def swarm_leave(force: nil, &block)
2579
+ connection.request(
2580
+ :post,
2581
+ "/swarm/leave",
2582
+ query: { "force" => force },
2583
+ expects: [200],
2584
+ operation: "swarm_leave",
2585
+ &block
2586
+ )
2587
+ end
2588
+
2589
+ # Unlock a locked manager
2590
+ #
2591
+ # @!method swarm_unlock
2592
+ # Engine API: POST /swarm/unlock
2593
+ #
2594
+ # @param body [Hash] (body parameter 'body' in the API specification)
2595
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2596
+ # @return [Docker::API::Response]
2597
+ # @raise [Docker::API::ServerError] 500 -- server error
2598
+ # @raise [Docker::API::ServerError] 503 -- node is not part of a swarm
2599
+ def swarm_unlock(body:, &block)
2600
+ connection.request(
2601
+ :post,
2602
+ "/swarm/unlock",
2603
+ body: body,
2604
+ expects: [200],
2605
+ operation: "swarm_unlock",
2606
+ &block
2607
+ )
2608
+ end
2609
+
2610
+ # Get the unlock key
2611
+ #
2612
+ # @!method swarm_unlockkey
2613
+ # Engine API: GET /swarm/unlockkey
2614
+ #
2615
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2616
+ # @return [Docker::API::Response]
2617
+ # @raise [Docker::API::ServerError] 500 -- server error
2618
+ # @raise [Docker::API::ServerError] 503 -- node is not part of a swarm
2619
+ def swarm_unlockkey(&block)
2620
+ connection.request(
2621
+ :get,
2622
+ "/swarm/unlockkey",
2623
+ expects: [200],
2624
+ operation: "swarm_unlockkey",
2625
+ &block
2626
+ )
2627
+ end
2628
+
2629
+ # Update a swarm
2630
+ #
2631
+ # @!method swarm_update
2632
+ # Engine API: POST /swarm/update
2633
+ #
2634
+ # @param body [Hash] (body parameter 'body' in the API specification)
2635
+ # @param version [Integer] The version number of the swarm object being
2636
+ # updated. This is required to avoid conflicting writes.
2637
+ # @param rotate_worker_token [Boolean, nil] Rotate the worker join token.
2638
+ # (sent to the daemon as 'rotateWorkerToken')
2639
+ # @param rotate_manager_token [Boolean, nil] Rotate the manager join
2640
+ # token. (sent to the daemon as 'rotateManagerToken')
2641
+ # @param rotate_manager_unlock_key [Boolean, nil] Rotate the manager
2642
+ # unlock key. (sent to the daemon as 'rotateManagerUnlockKey')
2643
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2644
+ # @return [Docker::API::Response]
2645
+ # @raise [Docker::API::BadRequest] 400 -- bad parameter
2646
+ # @raise [Docker::API::ServerError] 500 -- server error
2647
+ # @raise [Docker::API::ServerError] 503 -- node is not part of a swarm
2648
+ def swarm_update(
2649
+ body:,
2650
+ version:,
2651
+ rotate_worker_token: nil,
2652
+ rotate_manager_token: nil,
2653
+ rotate_manager_unlock_key: nil,
2654
+ &block
2655
+ )
2656
+ connection.request(
2657
+ :post,
2658
+ "/swarm/update",
2659
+ query: {
2660
+ "version" => version,
2661
+ "rotateWorkerToken" => rotate_worker_token,
2662
+ "rotateManagerToken" => rotate_manager_token,
2663
+ "rotateManagerUnlockKey" => rotate_manager_unlock_key,
2664
+ },
2665
+ body: body,
2666
+ expects: [200],
2667
+ operation: "swarm_update",
2668
+ &block
2669
+ )
2670
+ end
2671
+
2672
+ # Check auth configuration
2673
+ #
2674
+ # Validate credentials for a registry and, if available, get an identity
2675
+ # token for accessing the registry without password.
2676
+ #
2677
+ # @!method system_auth
2678
+ # Engine API: POST /auth
2679
+ #
2680
+ # @param body [Hash, nil] Authentication to check (body parameter
2681
+ # 'authConfig' in the API specification)
2682
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2683
+ # @return [Docker::API::Response]
2684
+ # @raise [Docker::API::Unauthorized] 401 -- Auth error
2685
+ # @raise [Docker::API::ServerError] 500 -- Server error
2686
+ def system_auth(body: nil, &block)
2687
+ connection.request(
2688
+ :post,
2689
+ "/auth",
2690
+ body: body,
2691
+ expects: [200, 204],
2692
+ operation: "system_auth",
2693
+ &block
2694
+ )
2695
+ end
2696
+
2697
+ # Get data usage information
2698
+ #
2699
+ # @!method system_data_usage
2700
+ # Engine API: GET /system/df
2701
+ #
2702
+ # @param type [Array<String>, nil] Object types, for which to compute and
2703
+ # return data.
2704
+ # @param verbose [Boolean, nil] Show detailed information on space usage.
2705
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2706
+ # @return [Docker::API::Response]
2707
+ # @raise [Docker::API::ServerError] 500 -- server error
2708
+ def system_data_usage(type: nil, verbose: nil, &block)
2709
+ connection.request(
2710
+ :get,
2711
+ "/system/df",
2712
+ query: { "type" => type, "verbose" => verbose },
2713
+ expects: [200],
2714
+ operation: "system_data_usage",
2715
+ &block
2716
+ )
2717
+ end
2718
+
2719
+ # Monitor events
2720
+ #
2721
+ # Stream real-time events from the server.
2722
+ #
2723
+ # @!method system_events
2724
+ # Engine API: GET /events
2725
+ #
2726
+ # @param since [String, nil] Show events created since this timestamp then
2727
+ # stream new events.
2728
+ # @param until_ [String, nil] Show events created until this timestamp
2729
+ # then stop streaming. (sent to the daemon as 'until')
2730
+ # @param filters [String, nil] A JSON encoded value of filters (a
2731
+ # `map[string][]string`) to process on the event list. Available filters:
2732
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2733
+ # @return [Docker::API::Response]
2734
+ # @raise [Docker::API::BadRequest] 400 -- bad parameter
2735
+ # @raise [Docker::API::ServerError] 500 -- server error
2736
+ def system_events(since: nil, until_: nil, filters: nil, &block)
2737
+ connection.request(
2738
+ :get,
2739
+ "/events",
2740
+ query: { "since" => since, "until" => until_, "filters" => filters },
2741
+ expects: [200],
2742
+ operation: "system_events",
2743
+ &block
2744
+ )
2745
+ end
2746
+
2747
+ # Get system information
2748
+ #
2749
+ # @!method system_info
2750
+ # Engine API: GET /info
2751
+ #
2752
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2753
+ # @return [Docker::API::Response]
2754
+ # @raise [Docker::API::ServerError] 500 -- Server error
2755
+ def system_info(&block)
2756
+ connection.request(
2757
+ :get,
2758
+ "/info",
2759
+ expects: [200],
2760
+ operation: "system_info",
2761
+ &block
2762
+ )
2763
+ end
2764
+
2765
+ # Ping
2766
+ #
2767
+ # This is a dummy endpoint you can use to test if the server is accessible.
2768
+ #
2769
+ # @!method system_ping
2770
+ # Engine API: GET /_ping
2771
+ #
2772
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2773
+ # @return [Docker::API::Response]
2774
+ # @raise [Docker::API::ServerError] 500 -- server error
2775
+ def system_ping(&block)
2776
+ connection.request(
2777
+ :get,
2778
+ "/_ping",
2779
+ expects: [200],
2780
+ operation: "system_ping",
2781
+ &block
2782
+ )
2783
+ end
2784
+
2785
+ # Ping
2786
+ #
2787
+ # This is a dummy endpoint you can use to test if the server is accessible.
2788
+ #
2789
+ # @!method system_ping_head
2790
+ # Engine API: HEAD /_ping
2791
+ #
2792
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2793
+ # @return [Docker::API::Response]
2794
+ # @raise [Docker::API::ServerError] 500 -- server error
2795
+ def system_ping_head(&block)
2796
+ connection.request(
2797
+ :head,
2798
+ "/_ping",
2799
+ expects: [200],
2800
+ operation: "system_ping_head",
2801
+ &block
2802
+ )
2803
+ end
2804
+
2805
+ # Get version
2806
+ #
2807
+ # Returns the version of Docker that is running and various information
2808
+ # about the system that Docker is running on.
2809
+ #
2810
+ # @!method system_version
2811
+ # Engine API: GET /version
2812
+ #
2813
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2814
+ # @return [Docker::API::Response]
2815
+ # @raise [Docker::API::ServerError] 500 -- server error
2816
+ def system_version(&block)
2817
+ connection.request(
2818
+ :get,
2819
+ "/version",
2820
+ expects: [200],
2821
+ operation: "system_version",
2822
+ &block
2823
+ )
2824
+ end
2825
+
2826
+ # Inspect a task
2827
+ #
2828
+ # @!method task_inspect
2829
+ # Engine API: GET /tasks/{id}
2830
+ #
2831
+ # @param id [String] ID of the task
2832
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2833
+ # @return [Docker::API::Response]
2834
+ # @raise [Docker::API::NotFound] 404 -- no such task
2835
+ # @raise [Docker::API::ServerError] 500 -- server error
2836
+ # @raise [Docker::API::ServerError] 503 -- node is not part of a swarm
2837
+ def task_inspect(id:, &block)
2838
+ connection.request(
2839
+ :get,
2840
+ "/tasks/#{Path.escape(id)}",
2841
+ expects: [200],
2842
+ operation: "task_inspect",
2843
+ &block
2844
+ )
2845
+ end
2846
+
2847
+ # List tasks
2848
+ #
2849
+ # @!method task_list
2850
+ # Engine API: GET /tasks
2851
+ #
2852
+ # @param filters [String, nil] A JSON encoded value of the filters (a
2853
+ # `map[string][]string`) to process on the tasks list.
2854
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2855
+ # @return [Docker::API::Response]
2856
+ # @raise [Docker::API::ServerError] 500 -- server error
2857
+ # @raise [Docker::API::ServerError] 503 -- node is not part of a swarm
2858
+ def task_list(filters: nil, &block)
2859
+ connection.request(
2860
+ :get,
2861
+ "/tasks",
2862
+ query: { "filters" => filters },
2863
+ expects: [200],
2864
+ operation: "task_list",
2865
+ &block
2866
+ )
2867
+ end
2868
+
2869
+ # Get task logs
2870
+ #
2871
+ # Get `stdout` and `stderr` logs from a task. See also
2872
+ # [`/containers/{id}/logs`](#operation/ContainerLogs).
2873
+ #
2874
+ # @!method task_logs
2875
+ # Engine API: GET /tasks/{id}/logs
2876
+ #
2877
+ # @param id [String] ID of the task
2878
+ # @param details [Boolean, nil] Show task context and extra details
2879
+ # provided to logs.
2880
+ # @param follow [Boolean, nil] Keep connection after returning logs.
2881
+ # @param stdout [Boolean, nil] Return logs from `stdout`
2882
+ # @param stderr [Boolean, nil] Return logs from `stderr`
2883
+ # @param since [Integer, nil] Only return logs since this time, as a UNIX
2884
+ # timestamp
2885
+ # @param timestamps [Boolean, nil] Add timestamps to every log line
2886
+ # @param tail [String, nil] Only return this number of log lines from the
2887
+ # end of the logs. Specify as an integer or `all` to output all log lines.
2888
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2889
+ # @return [Docker::API::Response]
2890
+ # @raise [Docker::API::NotFound] 404 -- no such task
2891
+ # @raise [Docker::API::ServerError] 500 -- server error
2892
+ # @raise [Docker::API::ServerError] 503 -- node is not part of a swarm
2893
+ def task_logs(
2894
+ id:,
2895
+ details: nil,
2896
+ follow: nil,
2897
+ stdout: nil,
2898
+ stderr: nil,
2899
+ since: nil,
2900
+ timestamps: nil,
2901
+ tail: nil,
2902
+ &block
2903
+ )
2904
+ connection.request(
2905
+ :get,
2906
+ "/tasks/#{Path.escape(id)}/logs",
2907
+ query: {
2908
+ "details" => details,
2909
+ "follow" => follow,
2910
+ "stdout" => stdout,
2911
+ "stderr" => stderr,
2912
+ "since" => since,
2913
+ "timestamps" => timestamps,
2914
+ "tail" => tail,
2915
+ },
2916
+ expects: [200],
2917
+ operation: "task_logs",
2918
+ &block
2919
+ )
2920
+ end
2921
+
2922
+ # Create a volume
2923
+ #
2924
+ # @!method volume_create
2925
+ # Engine API: POST /volumes/create
2926
+ #
2927
+ # @param body [Hash] Volume configuration (body parameter 'volumeConfig'
2928
+ # in the API specification)
2929
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2930
+ # @return [Docker::API::Response]
2931
+ # @raise [Docker::API::ServerError] 500 -- Server error
2932
+ def volume_create(body:, &block)
2933
+ connection.request(
2934
+ :post,
2935
+ "/volumes/create",
2936
+ body: body,
2937
+ expects: [201],
2938
+ operation: "volume_create",
2939
+ &block
2940
+ )
2941
+ end
2942
+
2943
+ # Remove a volume
2944
+ #
2945
+ # Instruct the driver to remove the volume.
2946
+ #
2947
+ # @!method volume_delete
2948
+ # Engine API: DELETE /volumes/{name}
2949
+ #
2950
+ # @param name [String] Volume name or ID
2951
+ # @param force [Boolean, nil] Force the removal of the volume
2952
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2953
+ # @return [Docker::API::Response]
2954
+ # @raise [Docker::API::NotFound] 404 -- No such volume or volume driver
2955
+ # @raise [Docker::API::Conflict] 409 -- Volume is in use and cannot be
2956
+ # removed
2957
+ # @raise [Docker::API::ServerError] 500 -- Server error
2958
+ def volume_delete(name:, force: nil, &block)
2959
+ connection.request(
2960
+ :delete,
2961
+ "/volumes/#{Path.escape(name)}",
2962
+ query: { "force" => force },
2963
+ expects: [204],
2964
+ operation: "volume_delete",
2965
+ &block
2966
+ )
2967
+ end
2968
+
2969
+ # Inspect a volume
2970
+ #
2971
+ # @!method volume_inspect
2972
+ # Engine API: GET /volumes/{name}
2973
+ #
2974
+ # @param name [String] Volume name or ID
2975
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2976
+ # @return [Docker::API::Response]
2977
+ # @raise [Docker::API::NotFound] 404 -- No such volume
2978
+ # @raise [Docker::API::ServerError] 500 -- Server error
2979
+ def volume_inspect(name:, &block)
2980
+ connection.request(
2981
+ :get,
2982
+ "/volumes/#{Path.escape(name)}",
2983
+ expects: [200],
2984
+ operation: "volume_inspect",
2985
+ &block
2986
+ )
2987
+ end
2988
+
2989
+ # List volumes
2990
+ #
2991
+ # @!method volume_list
2992
+ # Engine API: GET /volumes
2993
+ #
2994
+ # @param filters [String, nil] JSON encoded value of the filters (a
2995
+ # `map[string][]string`) to process on the volumes list. Available
2996
+ # filters:
2997
+ # @yieldparam chunk [String] successive body chunks, when a block is given
2998
+ # @return [Docker::API::Response]
2999
+ # @raise [Docker::API::ServerError] 500 -- Server error
3000
+ def volume_list(filters: nil, &block)
3001
+ connection.request(
3002
+ :get,
3003
+ "/volumes",
3004
+ query: { "filters" => filters },
3005
+ expects: [200],
3006
+ operation: "volume_list",
3007
+ &block
3008
+ )
3009
+ end
3010
+
3011
+ # Delete unused volumes
3012
+ #
3013
+ # @!method volume_prune
3014
+ # Engine API: POST /volumes/prune
3015
+ #
3016
+ # @param filters [String, nil] Filters to process on the prune list,
3017
+ # encoded as JSON (a `map[string][]string`).
3018
+ # @yieldparam chunk [String] successive body chunks, when a block is given
3019
+ # @return [Docker::API::Response]
3020
+ # @raise [Docker::API::ServerError] 500 -- Server error
3021
+ def volume_prune(filters: nil, &block)
3022
+ connection.request(
3023
+ :post,
3024
+ "/volumes/prune",
3025
+ query: { "filters" => filters },
3026
+ expects: [200],
3027
+ operation: "volume_prune",
3028
+ &block
3029
+ )
3030
+ end
3031
+
3032
+ # "Update a volume. Valid only for Swarm cluster volumes"
3033
+ #
3034
+ # @!method volume_update
3035
+ # Engine API: PUT /volumes/{name}
3036
+ #
3037
+ # @param name [String] The name or ID of the volume
3038
+ # @param version [Integer] The version number of the volume being updated.
3039
+ # This is required to avoid conflicting writes. Found in the volume's
3040
+ # `ClusterVolume` field.
3041
+ # @param body [Hash, nil] The spec of the volume to update. Currently,
3042
+ # only Availability may change. All other fields must remain unchanged.
3043
+ # (body parameter 'body' in the API specification)
3044
+ # @yieldparam chunk [String] successive body chunks, when a block is given
3045
+ # @return [Docker::API::Response]
3046
+ # @raise [Docker::API::BadRequest] 400 -- bad parameter
3047
+ # @raise [Docker::API::NotFound] 404 -- no such volume
3048
+ # @raise [Docker::API::ServerError] 500 -- server error
3049
+ # @raise [Docker::API::ServerError] 503 -- node is not part of a swarm
3050
+ def volume_update(name:, version:, body: nil, &block)
3051
+ connection.request(
3052
+ :put,
3053
+ "/volumes/#{Path.escape(name)}",
3054
+ query: { "version" => version },
3055
+ body: body,
3056
+ expects: [200],
3057
+ operation: "volume_update",
3058
+ &block
3059
+ )
3060
+ end
3061
+
3062
+ end
3063
+ end
3064
+ end