dockerapi 0.8.1 → 0.13.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c8cda98d22f89e4f925e266c90afbeb1b190e37034205b3b7abc22ba8c5489e2
4
- data.tar.gz: f911265e3661b021098032b1e4338373e31bd04d256ed89ef20856b40a948907
3
+ metadata.gz: 0dac991f7f237b1df6314bae40e54a5f44175186bbbb6756184c65862bb9f652
4
+ data.tar.gz: 604ea213a309219a91b6923e89e8003eb030fff51d22104e8c689872264ebd59
5
5
  SHA512:
6
- metadata.gz: fefb6660133b5f424608819ae8aaa0a3bca0aae00398823f1d755e59ed3763ff147bb6bc87e284183e5de3940f5ebb159fd33fb0c84d53bbd2306227ebf333d4
7
- data.tar.gz: 1ea1391ff3a464f99d1fd61cfb8bb2c2801632adc40265f2667d7ab3c6ac8f0155365217cafca188f106cc300422c061bf0c072a66419989924e40f3ee0f6e79
6
+ metadata.gz: d5f2eb58e059da1f60de416b07902e538ad707ec1a95a4efb665073d3b54a3ab74ea101144f9cea51effd50610ece9e0011061c653d848855885399bcb6b1cdd
7
+ data.tar.gz: 98e253a61bd7c2ff36df30f9e3557d4c502e10e206c7b5a32d2969e9ec996151741a5bda5a46ef32426905236228caaba57485250a7f7561fb98cd2181052b86
@@ -1,3 +1,78 @@
1
+ # 0.13.0
2
+
3
+ Add default behavior for file read, write and output to stdout. Whenever a method can receive a block, this default behavior can be replaced.
4
+
5
+ The following `Docker::API::Image` methods that can now receive a block:
6
+ * export (write file)
7
+ * create (output to stdout)
8
+ * build (output to stdout)
9
+
10
+ Default output to stdout can be supressed by setting `Docker::API::PRINT_TO_STDOUT` to `false`
11
+
12
+ Method parameters `params` and `body` will be automatically evaluated whenever they are present in the method's signature.
13
+
14
+ # 0.12.0
15
+
16
+ Add `Docker::API::Plugin` methods:
17
+ * list
18
+ * privileges
19
+ * install
20
+ * details
21
+ * remove
22
+ * enable
23
+ * disable
24
+ * upgrade
25
+ * create
26
+ * push
27
+ * configure
28
+
29
+ # 0.11.0
30
+
31
+ Add `Docker::API::Task` methods:
32
+ * list
33
+ * details
34
+ * logs
35
+
36
+ Add `Docker::API::Secret` methods:
37
+ * create
38
+ * update
39
+ * list
40
+ * details
41
+ * delete
42
+
43
+ Add `Docker::API::Config` methods:
44
+ * create
45
+ * update
46
+ * list
47
+ * details
48
+ * delete
49
+
50
+ Add `Docker::API::Image` methods:
51
+ * distribution
52
+
53
+ # 0.10.0
54
+
55
+ Add `Docker::API::Service` methods:
56
+ * create
57
+ * update
58
+ * list
59
+ * details
60
+ * logs
61
+ * delete
62
+
63
+ # 0.9.0
64
+
65
+ Significant change: `#inspect` is now deprecated and replaced by `#details` in the following classes:
66
+ * `Docker::API::Container`
67
+ * `Docker::API::Image`
68
+ * `Docker::API::Network`
69
+ * `Docker::API::Volume`
70
+ * `Docker::API::Exec`
71
+ * `Docker::API::Swarm`
72
+ * `Docker::API::Node`
73
+
74
+ The method will be removed in the refactoring phase.
75
+
1
76
  # 0.8.1
2
77
 
3
78
  Restore the default `#inspect` output for `Docker::API` classes.
@@ -6,18 +81,18 @@ Most of the overriding methods take an argument, therefore calling using the exp
6
81
 
7
82
  # 0.8.0
8
83
 
9
- Add Docker::API::Swarm methods:
84
+ Add `Docker::API::Swarm` methods:
10
85
  * init
11
86
  * update
12
- * inspect
87
+ * ~~inspect~~ details
13
88
  * unlock_key
14
89
  * unlock
15
90
  * join
16
91
  * leave
17
92
 
18
- Add Docker::API::Node methods:
93
+ Add `Docker::API::Node` methods:
19
94
  * list
20
- * inspect
95
+ * ~~inspect~~ details
21
96
  * update
22
97
  * delete
23
98
 
@@ -25,7 +100,7 @@ Query parameters and request body json can now skip the validation step with `:s
25
100
 
26
101
  # 0.7.0
27
102
 
28
- Significant changes: Docker::API::Connection is now a regular class intead of a Singleton, allowing multiple connections to be stablished within the same program (replacing the connect_to implementation). To leverage this feature, API-related classes must be initialized and may or may not receive a Docker::API::Connection as parameter, or it'll connect to /var/run/docker.sock by default. For this reason, class methods were replaced with instance methods. Documentation will reflect this changes of implementation.
103
+ Significant changes: `Docker::API::Connection` is now a regular class intead of a Singleton, allowing multiple connections to be stablished within the same program (replacing the connect_to implementation). To leverage this feature, API-related classes must be initialized and may or may not receive a `Docker::API::Connection` as parameter, or it'll connect to `/var/run/docker.sock` by default. For this reason, class methods were replaced with instance methods. Documentation will reflect this changes of implementation.
29
104
 
30
105
  Bug fix: Image push returns a 20X status even when the push is unsucessful. To prevent false positives, it now requires the authentication parameters to be provided, generating a 403 status for invalid credentials or an error if they are absent.
31
106
 
@@ -33,15 +108,15 @@ Bug fix: Image push returns a 20X status even when the push is unsucessful. To p
33
108
 
34
109
  Add connection parameters specifications with connect_to in Docker::API::Connection.
35
110
 
36
- Add Docker::API::Exec methods:
111
+ Add `Docker::API::Exec` methods:
37
112
  * create
38
113
  * start
39
114
  * resize
40
- * inspect
115
+ * ~~inspect~~ details
41
116
 
42
117
  # 0.5.0
43
118
 
44
- Add Docker::API::System methods:
119
+ Add `Docker::API::System` methods:
45
120
  * auth
46
121
  * ping
47
122
  * info
@@ -49,7 +124,7 @@ Add Docker::API::System methods:
49
124
  * events
50
125
  * df
51
126
 
52
- Add new response class Docker::API::Response with the following methods:
127
+ Add new response class `Docker::API::Response` with the following methods:
53
128
  * json
54
129
  * path
55
130
  * success?
@@ -58,9 +133,9 @@ Error classes output better error messages.
58
133
 
59
134
  # 0.4.0
60
135
 
61
- Add Docker::API::Network methods:
136
+ Add `Docker::API::Network` methods:
62
137
  * list
63
- * inspect
138
+ * ~~inspect~~ details
64
139
  * create
65
140
  * remove
66
141
  * prune
@@ -69,9 +144,9 @@ Add Docker::API::Network methods:
69
144
 
70
145
  # 0.3.0
71
146
 
72
- Add Docker::API::Volume methods:
147
+ Add `Docker::API::Volume` methods:
73
148
  * list
74
- * inspect
149
+ * ~~inspect~~ details
75
150
  * create
76
151
  * remove
77
152
  * prune
@@ -79,8 +154,8 @@ Add Docker::API::Volume methods:
79
154
 
80
155
  # 0.2.0
81
156
 
82
- Add Docker::API::Image methods:
83
- * inspect
157
+ Add `Docker::API::Image` methods:
158
+ * ~~inspect~~ details
84
159
  * history
85
160
  * list
86
161
  * search
@@ -95,13 +170,13 @@ Add Docker::API::Image methods:
95
170
  * build
96
171
  * delete_cache
97
172
 
98
- Add Docker::API::System.auth (untested) for basic authentication
173
+ Add `Docker::API::System.auth` (untested) for basic authentication
99
174
 
100
175
  # 0.1.0
101
176
 
102
- Add Docker::API::Container methods:
177
+ Add `Docker::API::Container` methods:
103
178
  * list
104
- * inspect
179
+ * ~~inspect~~ details
105
180
  * top
106
181
  * changes
107
182
  * start
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dockerapi (0.8.1)
4
+ dockerapi (0.13.0)
5
5
  excon (~> 0.74.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -20,8 +20,6 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
- New implementation details as of v0.7.0.
24
-
25
23
  ### Images
26
24
 
27
25
  ```ruby
@@ -44,7 +42,10 @@ image.create( fromSrc: "https://url.to/file.tar", repo: "repo:tag" )
44
42
  image.list
45
43
 
46
44
  # Inspect image
47
- image.inspect("image")
45
+ image.details("image")
46
+
47
+ # Return image digest and platform information by contacting the registry.
48
+ image.distribution("image")
48
49
 
49
50
  # History
50
51
  image.history("image")
@@ -74,13 +75,16 @@ image.prune(filters: {dangling: {"false": true}})
74
75
  image.commit(container: container, repo: "my/image", tag: "latest", comment: "Comment from commit", author: "dockerapi", pause: false )
75
76
 
76
77
  # Build image from a local tar file
77
- image.build("/path/to/file.tar")
78
+ image.build("/path/to/file.tar", {t: "tag"})
79
+
80
+ # Build image using private repository
81
+ image.build("/path/to/file.tar", {t: "tag"}, {"https://index.docker.io/v1/" => {username: "janedoe", password: "janedoe"}})
78
82
 
79
83
  # Build image from a remote tar file
80
- image.build(nil, remote: "https://url.to/file.tar")
84
+ image.build(nil, {remote: "https://url.to/file.tar", t: "tag"})
81
85
 
82
86
  # Build image from a remote Dockerfile
83
- image.build(nil, remote: "https://url.to/Dockerfile")
87
+ image.build(nil, {remote: "https://url.to/Dockerfile", t: "tag"})
84
88
 
85
89
  # Delete builder cache
86
90
  image.delete_cache
@@ -125,7 +129,7 @@ container.list
125
129
  container.list(all: true)
126
130
 
127
131
  # Inspect container
128
- container.inspect("nginx")
132
+ container.details("nginx")
129
133
 
130
134
  # View container's processes
131
135
  container.top("nginx")
@@ -136,7 +140,7 @@ container.top("nginx").json
136
140
  # View filesystem changes
137
141
  container.changes("nginx")
138
142
 
139
- # View filesystem logs
143
+ # View container logs
140
144
  container.logs("nginx", stdout: true)
141
145
  container.logs("nginx", stdout: true, follow: true)
142
146
 
@@ -172,7 +176,7 @@ volume.create( Name:"my-volume" )
172
176
  volume.list
173
177
 
174
178
  # Inspect volume
175
- volume.inspect("my-volume")
179
+ volume.details("my-volume")
176
180
 
177
181
  # Remove volume
178
182
  volume.remove("my-volume")
@@ -191,7 +195,7 @@ network = Docker::API::Network.new
191
195
  network.list
192
196
 
193
197
  # Inspect network
194
- network.inspect("bridge")
198
+ network.details("bridge")
195
199
 
196
200
  # Create network
197
201
  network.create( Name:"my-network" )
@@ -246,7 +250,7 @@ response = exe.start(id)
246
250
  print response.data[:stream]
247
251
 
248
252
  # Inspect exec instance
249
- exe.inspect(id)
253
+ exe.details(id)
250
254
  ```
251
255
 
252
256
  ### Swarm
@@ -258,7 +262,7 @@ swarm = Docker::API::Swarm.new
258
262
  swarm.init({AdvertiseAddr: "local-ip-address:2377", ListenAddr: "0.0.0.0:4567"})
259
263
 
260
264
  # Inspect swarm
261
- swarm.inspect
265
+ swarm.details
262
266
 
263
267
  # Update swarm
264
268
  swarm.update(version, {rotateWorkerToken: true})
@@ -288,7 +292,7 @@ node = Docker::API::Node.new
288
292
  node.list
289
293
 
290
294
  # Inspect node
291
- node.inspect("node-id")
295
+ node.details("node-id")
292
296
 
293
297
  # Update node (version, Role and Availability must be present)
294
298
  node.update("node-id", {version: "version"}, {Role: "worker", Availability: "pause" })
@@ -299,9 +303,141 @@ node.update("node-id", {version: "version"}, {Role: "manager", Availability: "ac
299
303
  node.delete("node-id")
300
304
  ```
301
305
 
306
+ ### Service
307
+ ```ruby
308
+ # Connect to local service endpoints
309
+ service = Docker::API::Service.new
310
+
311
+ # List services
312
+ service.list
313
+
314
+ # Create a service
315
+ service.create({Name: "nginx-service",
316
+ TaskTemplate: {ContainerSpec: { Image: "nginx:alpine" }},
317
+ Mode: { Replicated: { Replicas: 2 } },
318
+ EndpointSpec: { Ports: [ {Protocol: "tcp", PublishedPort: 80, TargetPort: 80} ] }
319
+ })
320
+
321
+ # Update a service (needs version and current Spec)
322
+ version = service.details( service ).json["Version"]["Index"]
323
+ spec = service.details(service).json["Spec"]
324
+ service.update("nginx-service", {version: version}, spec.merge!({ Mode: { Replicated: { Replicas: 1 } } }))
325
+
326
+ # View service logs
327
+ service.logs("nginx-service", stdout: true)
328
+
329
+ # Inspect service
330
+ service.details("nginx-service")
331
+
332
+ # Delete service
333
+ service.delete("nginx-service")
334
+ ```
335
+
336
+ ### Task
337
+ ```ruby
338
+ # Connect to local task endpoints
339
+ task = Docker::API::Task.new
340
+
341
+ # List tasks
342
+ task.list
343
+
344
+ # View task logs
345
+ task.logs("task-id", stdout: true)
346
+
347
+ # Inspect service
348
+ task.details("task-id")
349
+ ```
350
+
351
+ ### Secret
352
+ ```ruby
353
+ # Connect to local secret endpoints
354
+ secret = Docker::API::Secret.new
355
+
356
+ # List secrets
357
+ secret.list
358
+
359
+ # Create a secret
360
+ secret.create({Name: "secret-name", Data: "VEhJUyBJUyBOT1QgQSBSRUFMIENFUlRJRklDQVRFCg=="})
361
+
362
+ # Inspect secrets
363
+ secret.details("secret-name")
364
+
365
+ # Update a secret (needs version and current Spec)
366
+ version = secret.details( "secret-name" ).json["Version"]["Index"]
367
+ spec = secret.details("secret-name").json["Spec"]
368
+ secret.update("secret-name", {version: version}, spec.merge!({ Data: "VEhJUyBJUyBOT1QgQSBSRUFMIENFUlRJRklDQVRFCg==" }))
369
+
370
+ # Delete secret
371
+ secret.delete("secret-name")
372
+ ```
373
+
374
+ ### Config
375
+ ```ruby
376
+ # Connect to local config endpoints
377
+ config = Docker::API::Config.new
378
+
379
+ # List configs
380
+ config.list
381
+
382
+ # Create a config
383
+ config.create({Name: "config-name", Data: "VEhJUyBJUyBOT1QgQSBSRUFMIENFUlRJRklDQVRFCg=="})
384
+
385
+ # Inspect configs
386
+ config.details("config-name")
387
+
388
+ # Update a configs (needs version and current Spec)
389
+ version = config.details( "config-name" ).json["Version"]["Index"]
390
+ spec = config.details("config-name").json["Spec"]
391
+ config.update("config-name", {version: version}, spec.merge!({ Data: "VEhJUyBJUyBOT1QgQSBSRUFMIENFUlRJRklDQVRFCg==" }))
392
+
393
+ # Delete config
394
+ config.delete("config-name")
395
+ ```
396
+
397
+ ### Plugin
398
+ ```ruby
399
+ # Connect to local plugin endpoints
400
+ plugin = Docker::API::Plugin.new
401
+
402
+ # List plugins
403
+ plugin.list
404
+
405
+ # List plugin's privileges
406
+ plugin.privileges(remote: "plugin-name")
407
+
408
+ # Install plugin (using defined privileges)
409
+ privileges = plugin.privileges(remote: "plugin-name")
410
+ plugin.install({remote: "plugin-name"}, privileges)
411
+
412
+ # Upgrade plugin (using defined privileges)
413
+ privileges = plugin.privileges(remote: "plugin-name2")
414
+ plugin.upgrade("plugin-name", {remote: "plugin-name2"}, privileges)
415
+
416
+ # Enable plugin
417
+ plugin.enable("plugin-name", timeout: 0)
418
+
419
+ # Disable plugin
420
+ plugin.disable("plugin-name")
421
+
422
+ # Configure plugin
423
+ plugin.configure("plugin-name", ["DEBUG=1"])
424
+
425
+ # Inspect plugin
426
+ plugin.details("plugin-name")
427
+
428
+ # Remove plugin
429
+ plugin.remove("plugin-name")
430
+
431
+ # Create plugin (tar file must contain rootfs folder and config.json file)
432
+ plugin.create("name", "/path/to/file.tar")
433
+
434
+ # Push plugin
435
+ plugin.push("name")
436
+ ```
437
+
302
438
  ### Connection
303
439
 
304
- By default Docker::API::Connection will connect to local Docker socket at `/var/run/docker.sock`. See examples below to use a different path or connect to a remote address.
440
+ By default `Docker::API::Connection` will connect to local Docker socket at `/var/run/docker.sock`. See examples below to use a different path or connect to a remote address.
305
441
 
306
442
  ```ruby
307
443
  # Setting different connections
@@ -373,17 +509,22 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
373
509
 
374
510
  | Class | Tests | Implementation | Refactoring |
375
511
  |---|---|---|---|
376
- | Container | Ok | Ok | 7/24 |
377
- | Image | Ok | Ok | 7/31 |
378
- | Volume | Ok | Ok | 8/7 |
379
- | Network | Ok | Ok | 8/7 |
380
- | System | Ok | Ok | 8/7 |
381
- | Exec | Ok | Ok | 8/7 |
382
- | Swarm | Ok | Ok | 8/14 |
383
- | Node | Ok | Ok | 8/14 |
384
- | Service | 7/17 | 7/17 | 8/14 |
385
- | Task | 7/17 | 7/17 | 8/14 |
386
- | Secret | 7/17 | 7/17 | 8/14 |
512
+ | Image | Ok | Ok | Ok |
513
+ | Container | Ok | Ok | 8/14 |
514
+ | Volume | Ok | Ok | 8/21 |
515
+ | Network | Ok | Ok | 8/21 |
516
+ | System | Ok | Ok | 8/21 |
517
+ | Exec | Ok | Ok | 8/21 |
518
+ | Swarm | Ok | Ok | 8/28 |
519
+ | Node | Ok | Ok | 8/28 |
520
+ | Service | Ok | Ok | 8/28 |
521
+ | Task | Ok | Ok | 9/4 |
522
+ | Secret | Ok | Ok | 9/4 |
523
+ | Config | Ok | Ok | 9/4 |
524
+ | Distribution | Ok | Ok | 9/4 |
525
+ | Plugin | Ok | Ok | 9/4 |
526
+
527
+ Add doc in these files: `base`, `connection`, `error`, `response`, `dockerapi`
387
528
 
388
529
  ## Contributing
389
530