dockerapi 0.8.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c8cda98d22f89e4f925e266c90afbeb1b190e37034205b3b7abc22ba8c5489e2
4
- data.tar.gz: f911265e3661b021098032b1e4338373e31bd04d256ed89ef20856b40a948907
3
+ metadata.gz: 2fa69dcb4c7b79c558bc6749b51def3a8a056e39259ad8163c84fec253193c67
4
+ data.tar.gz: '0998c5433ddcd3c4bbcc43ea6c21d61220527f7864c524e83bf0b3aedec501fd'
5
5
  SHA512:
6
- metadata.gz: fefb6660133b5f424608819ae8aaa0a3bca0aae00398823f1d755e59ed3763ff147bb6bc87e284183e5de3940f5ebb159fd33fb0c84d53bbd2306227ebf333d4
7
- data.tar.gz: 1ea1391ff3a464f99d1fd61cfb8bb2c2801632adc40265f2667d7ab3c6ac8f0155365217cafca188f106cc300422c061bf0c072a66419989924e40f3ee0f6e79
6
+ metadata.gz: cafcf788d269546dd338daf50247df1ee1cf6af16372b50a2a6404b2323e0f8d6f78384789c245d122855d325e355dd9f822e4c61e5df4fb5bb9c7af79e11cac
7
+ data.tar.gz: b63d32250bfa09e067b56b19a2737ffc35e130511cd17dd31ffbb71db494406ff2b9e85e6e7226161e126b4d423a6fd570c3da6695dcb0d18407ce1c9a706190
@@ -1,3 +1,16 @@
1
+ # 0.9.0
2
+
3
+ Significant change: `#inspect` is now deprecated and replaced by `#details` in the following classes:
4
+ * `Docker::API::Container`
5
+ * `Docker::API::Image`
6
+ * `Docker::API::Network`
7
+ * `Docker::API::Volume`
8
+ * `Docker::API::Exec`
9
+ * `Docker::API::Swarm`
10
+ * `Docker::API::Node`
11
+
12
+ The method will be removed in the refactoring phase.
13
+
1
14
  # 0.8.1
2
15
 
3
16
  Restore the default `#inspect` output for `Docker::API` classes.
@@ -6,18 +19,18 @@ Most of the overriding methods take an argument, therefore calling using the exp
6
19
 
7
20
  # 0.8.0
8
21
 
9
- Add Docker::API::Swarm methods:
22
+ Add `Docker::API::Swarm` methods:
10
23
  * init
11
24
  * update
12
- * inspect
25
+ * ~~inspect~~ details
13
26
  * unlock_key
14
27
  * unlock
15
28
  * join
16
29
  * leave
17
30
 
18
- Add Docker::API::Node methods:
31
+ Add `Docker::API::Node` methods:
19
32
  * list
20
- * inspect
33
+ * ~~inspect~~ details
21
34
  * update
22
35
  * delete
23
36
 
@@ -25,7 +38,7 @@ Query parameters and request body json can now skip the validation step with `:s
25
38
 
26
39
  # 0.7.0
27
40
 
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.
41
+ 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
42
 
30
43
  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
44
 
@@ -33,15 +46,15 @@ Bug fix: Image push returns a 20X status even when the push is unsucessful. To p
33
46
 
34
47
  Add connection parameters specifications with connect_to in Docker::API::Connection.
35
48
 
36
- Add Docker::API::Exec methods:
49
+ Add `Docker::API::Exec` methods:
37
50
  * create
38
51
  * start
39
52
  * resize
40
- * inspect
53
+ * ~~inspect~~ details
41
54
 
42
55
  # 0.5.0
43
56
 
44
- Add Docker::API::System methods:
57
+ Add `Docker::API::System` methods:
45
58
  * auth
46
59
  * ping
47
60
  * info
@@ -49,7 +62,7 @@ Add Docker::API::System methods:
49
62
  * events
50
63
  * df
51
64
 
52
- Add new response class Docker::API::Response with the following methods:
65
+ Add new response class `Docker::API::Response` with the following methods:
53
66
  * json
54
67
  * path
55
68
  * success?
@@ -58,9 +71,9 @@ Error classes output better error messages.
58
71
 
59
72
  # 0.4.0
60
73
 
61
- Add Docker::API::Network methods:
74
+ Add `Docker::API::Network` methods:
62
75
  * list
63
- * inspect
76
+ * ~~inspect~~ details
64
77
  * create
65
78
  * remove
66
79
  * prune
@@ -69,9 +82,9 @@ Add Docker::API::Network methods:
69
82
 
70
83
  # 0.3.0
71
84
 
72
- Add Docker::API::Volume methods:
85
+ Add `Docker::API::Volume` methods:
73
86
  * list
74
- * inspect
87
+ * ~~inspect~~ details
75
88
  * create
76
89
  * remove
77
90
  * prune
@@ -79,8 +92,8 @@ Add Docker::API::Volume methods:
79
92
 
80
93
  # 0.2.0
81
94
 
82
- Add Docker::API::Image methods:
83
- * inspect
95
+ Add `Docker::API::Image` methods:
96
+ * ~~inspect~~ details
84
97
  * history
85
98
  * list
86
99
  * search
@@ -95,13 +108,13 @@ Add Docker::API::Image methods:
95
108
  * build
96
109
  * delete_cache
97
110
 
98
- Add Docker::API::System.auth (untested) for basic authentication
111
+ Add `Docker::API::System.auth` (untested) for basic authentication
99
112
 
100
113
  # 0.1.0
101
114
 
102
- Add Docker::API::Container methods:
115
+ Add `Docker::API::Container` methods:
103
116
  * list
104
- * inspect
117
+ * ~~inspect~~ details
105
118
  * top
106
119
  * changes
107
120
  * start
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dockerapi (0.8.1)
4
+ dockerapi (0.9.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,7 @@ 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")
48
46
 
49
47
  # History
50
48
  image.history("image")
@@ -125,7 +123,7 @@ container.list
125
123
  container.list(all: true)
126
124
 
127
125
  # Inspect container
128
- container.inspect("nginx")
126
+ container.details("nginx")
129
127
 
130
128
  # View container's processes
131
129
  container.top("nginx")
@@ -172,7 +170,7 @@ volume.create( Name:"my-volume" )
172
170
  volume.list
173
171
 
174
172
  # Inspect volume
175
- volume.inspect("my-volume")
173
+ volume.details("my-volume")
176
174
 
177
175
  # Remove volume
178
176
  volume.remove("my-volume")
@@ -191,7 +189,7 @@ network = Docker::API::Network.new
191
189
  network.list
192
190
 
193
191
  # Inspect network
194
- network.inspect("bridge")
192
+ network.details("bridge")
195
193
 
196
194
  # Create network
197
195
  network.create( Name:"my-network" )
@@ -246,7 +244,7 @@ response = exe.start(id)
246
244
  print response.data[:stream]
247
245
 
248
246
  # Inspect exec instance
249
- exe.inspect(id)
247
+ exe.details(id)
250
248
  ```
251
249
 
252
250
  ### Swarm
@@ -258,7 +256,7 @@ swarm = Docker::API::Swarm.new
258
256
  swarm.init({AdvertiseAddr: "local-ip-address:2377", ListenAddr: "0.0.0.0:4567"})
259
257
 
260
258
  # Inspect swarm
261
- swarm.inspect
259
+ swarm.details
262
260
 
263
261
  # Update swarm
264
262
  swarm.update(version, {rotateWorkerToken: true})
@@ -288,7 +286,7 @@ node = Docker::API::Node.new
288
286
  node.list
289
287
 
290
288
  # Inspect node
291
- node.inspect("node-id")
289
+ node.details("node-id")
292
290
 
293
291
  # Update node (version, Role and Availability must be present)
294
292
  node.update("node-id", {version: "version"}, {Role: "worker", Availability: "pause" })
@@ -373,17 +371,20 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
373
371
 
374
372
  | Class | Tests | Implementation | Refactoring |
375
373
  |---|---|---|---|
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 |
374
+ | Image | Ok | Ok | 8/7 |
375
+ | Container | Ok | Ok | 8/14 |
376
+ | Volume | Ok | Ok | 8/21 |
377
+ | Network | Ok | Ok | 8/21 |
378
+ | System | Ok | Ok | 8/21 |
379
+ | Exec | Ok | Ok | 8/21 |
380
+ | Swarm | Ok | Ok | 8/28 |
381
+ | Node | Ok | Ok | 8/28 |
382
+ | Service | 7/17 | 7/17 | 8/28 |
383
+ | Task | 7/17 | 7/17 | 9/4 |
384
+ | Secret | 7/17 | 7/17 | 9/4 |
385
+ | Config | 7/17 | 7/17 | 9/4 |
386
+ | Distribution | 7/17 | 7/17 | 9/4 |
387
+ | Plugin | 7/24 | 7/24 | 9/4 |
387
388
 
388
389
  ## Contributing
389
390
 
@@ -5,22 +5,16 @@ module Docker
5
5
 
6
6
  class Container < Docker::API::Base
7
7
 
8
- def base_path
9
- "/containers"
8
+ def list params = {}
9
+ validate Docker::API::InvalidParameter, [:all, :limit, :size, :filters], params
10
+ @connection.get(build_path(["json"], params))
10
11
  end
11
12
 
12
- def inspect *args
13
- return super.inspect if args.size == 0
14
- name, params = args[0], args[1] || {}
13
+ def details name, params = {}
15
14
  validate Docker::API::InvalidParameter, [:size], params
16
15
  @connection.get(build_path([name, "json"], params))
17
16
  end
18
17
 
19
- def list params = {}
20
- validate Docker::API::InvalidParameter, [:all, :limit, :size, :filters], params
21
- @connection.get(build_path(["json"], params))
22
- end
23
-
24
18
  def top name, params = {}
25
19
  validate Docker::API::InvalidParameter, [:ps_args], params
26
20
  @connection.get(build_path([name, "top"], params))
@@ -126,7 +120,7 @@ module Docker
126
120
  end
127
121
 
128
122
  def export name, path = "exported_container"
129
- response = self.inspect(name)
123
+ response = self.details(name)
130
124
  if response.status == 200
131
125
  file = File.open(File.expand_path(path), "wb")
132
126
  streamer = lambda do |chunk, remaining_bytes, total_bytes|
@@ -156,6 +150,21 @@ module Docker
156
150
  response
157
151
  end
158
152
 
153
+ #################################################
154
+ # Items in this area to be removed before 1.0.0 #
155
+ #################################################
156
+ def base_path
157
+ "/containers"
158
+ end
159
+
160
+ def inspect *args
161
+ return super.inspect if args.size == 0
162
+ warn "WARNING: #inspect is deprecated and will be removed in the future, please use #details instead."
163
+ name, params = args[0], args[1] || {}
164
+ details(name, params)
165
+ end
166
+ #################################################
167
+
159
168
  end
160
169
  end
161
170
  end
@@ -2,12 +2,6 @@ module Docker
2
2
  module API
3
3
  class Exec < Docker::API::Base
4
4
 
5
- def inspect *args
6
- return super.inspect if args.size == 0
7
- name = args[0]
8
- @connection.get("/exec/#{name}/json")
9
- end
10
-
11
5
  def create name, body = {}
12
6
  validate Docker::API::InvalidRequestBody, [:AttachStdin, :AttachStdout, :AttachStderr, :DetachKeys, :Tty, :Env, :Cmd, :Privileged, :User, :WorkingDir], body
13
7
  @connection.request(method: :post, path: "/containers/#{name}/exec", headers: {"Content-Type": "application/json"}, body: body.to_json )
@@ -32,6 +26,21 @@ module Docker
32
26
  @connection.post(build_path("/exec/#{name}/resize", params))
33
27
  end
34
28
 
29
+ def details name
30
+ @connection.get("/exec/#{name}/json")
31
+ end
32
+
33
+ #################################################
34
+ # Items in this area to be removed before 1.0.0 #
35
+ #################################################
36
+ def inspect *args
37
+ return super.inspect if args.size == 0
38
+ warn "WARNING: #inspect is deprecated and will be removed in the future, please use #details instead."
39
+ name = args[0]
40
+ details(name)
41
+ end
42
+ #################################################
43
+
35
44
  end
36
45
  end
37
46
  end
@@ -7,13 +7,7 @@ module Docker
7
7
  BuildParams = [:dockerfile, :t, :extrahosts, :remote, :q, :nocache, :cachefrom, :pull, :rm, :forcerm, :memory, :memswap, :cpushares, :cpusetcpus, :cpuperiod, :cpuquota, :buildargs, :shmsize, :squash, :labels, :networkmode, :platform, :target, :outputs]
8
8
  class Image < Docker::API::Base
9
9
 
10
- def base_path
11
- "/images"
12
- end
13
-
14
- def inspect *args
15
- return super.inspect if args.size == 0
16
- name = args[0]
10
+ def details name
17
11
  @connection.get(build_path([name, "json"]))
18
12
  end
19
13
 
@@ -78,7 +72,7 @@ module Docker
78
72
  def commit params = {}, body = {}
79
73
  validate Docker::API::InvalidParameter, [:container, :repo, :tag, :comment, :author, :pause, :changes], params
80
74
  validate Docker::API::InvalidRequestBody, Docker::API::CommitBody, body
81
- container = Docker::API::Container.new.inspect(params[:container])
75
+ container = Docker::API::Container.new.details(params[:container])
82
76
  return container if [404, 301].include? container.status
83
77
  body = JSON.parse(container.body)["Config"].merge(body)
84
78
  @connection.request(method: :post, path: build_path("/commit", params), headers: {"Content-Type": "application/json"}, body: body.to_json)
@@ -134,7 +128,21 @@ module Docker
134
128
  @connection.post(build_path("/build/prune", params))
135
129
  end
136
130
 
137
- end
131
+ #################################################
132
+ # Items in this area to be removed before 1.0.0 #
133
+ #################################################
134
+ def base_path
135
+ "/images"
136
+ end
137
+
138
+ def inspect *args
139
+ return super.inspect if args.size == 0
140
+ warn "WARNING: #inspect is deprecated and will be removed in the future, please use #details instead."
141
+ name = args[0]
142
+ details(name)
143
+ end
144
+ #################################################
138
145
 
146
+ end
139
147
  end
140
148
  end
@@ -2,22 +2,16 @@ module Docker
2
2
  module API
3
3
  class Network < Docker::API::Base
4
4
 
5
- def base_path
6
- "/networks"
5
+ def list params = {}
6
+ validate Docker::API::InvalidParameter, [:filters], params
7
+ @connection.get(build_path("/networks", params))
7
8
  end
8
9
 
9
- def inspect *args
10
- return super.inspect if args.size == 0
11
- name, params = args[0], args[1] || {}
10
+ def details name, params = {}
12
11
  validate Docker::API::InvalidParameter, [:verbose, :scope], params
13
12
  @connection.get(build_path([name], params))
14
13
  end
15
14
 
16
- def list params = {}
17
- validate Docker::API::InvalidParameter, [:filters], params
18
- @connection.get(build_path("/networks", params))
19
- end
20
-
21
15
  def create body = {}
22
16
  validate Docker::API::InvalidRequestBody, [:Name, :CheckDuplicate, :Driver, :Internal, :Attachable, :Ingress, :IPAM, :EnableIPv6, :Options, :Labels], body
23
17
  @connection.request(method: :post, path: build_path(["create"]), headers: {"Content-Type": "application/json"}, body: body.to_json)
@@ -42,6 +36,21 @@ module Docker
42
36
  @connection.request(method: :post, path: build_path([name, "disconnect"]), headers: {"Content-Type": "application/json"}, body: body.to_json)
43
37
  end
44
38
 
39
+ #################################################
40
+ # Items in this area to be removed before 1.0.0 #
41
+ #################################################
42
+ def base_path
43
+ "/networks"
44
+ end
45
+
46
+ def inspect *args
47
+ return super.inspect if args.size == 0
48
+ warn "WARNING: #inspect is deprecated and will be removed in the future, please use #details instead."
49
+ name, params = args[0], args[1] || {}
50
+ details(name, params)
51
+ end
52
+ #################################################
53
+
45
54
  end
46
55
  end
47
56
  end
@@ -2,12 +2,6 @@ module Docker
2
2
  module API
3
3
  class Node < Docker::API::Base
4
4
 
5
- def inspect *args
6
- return super.inspect if args.size == 0
7
- name = args[0]
8
- @connection.get("/nodes/#{name}")
9
- end
10
-
11
5
  def list params = {}
12
6
  validate Docker::API::InvalidParameter, [:filters], params
13
7
  @connection.get(build_path("/nodes", params))
@@ -23,6 +17,22 @@ module Docker
23
17
  validate Docker::API::InvalidParameter, [:force], params
24
18
  @connection.delete(build_path("/nodes/#{name}", params))
25
19
  end
20
+
21
+ def details name
22
+ @connection.get("/nodes/#{name}")
23
+ end
24
+
25
+ #################################################
26
+ # Items in this area to be removed before 1.0.0 #
27
+ #################################################
28
+ def inspect *args
29
+ return super.inspect if args.size == 0
30
+ warn "WARNING: #inspect is deprecated and will be removed in the future, please use #details instead."
31
+ name = args[0]
32
+ details(name)
33
+ end
34
+ #################################################
35
+
26
36
  end
27
37
  end
28
38
  end
@@ -13,8 +13,7 @@ module Docker
13
13
  @connection.request(method: :post, path: build_path("/swarm/update", params), headers: {"Content-Type": "application/json"}, body: body.to_json)
14
14
  end
15
15
 
16
- def inspect
17
- caller.each { | el | return super.inspect if el.match(/inspector/) }
16
+ def details
18
17
  @connection.get("/swarm")
19
18
  end
20
19
 
@@ -36,6 +35,17 @@ module Docker
36
35
  validate Docker::API::InvalidParameter, [:force], params
37
36
  @connection.post(build_path("/swarm/leave", params))
38
37
  end
38
+
39
+ #################################################
40
+ # Items in this area to be removed before 1.0.0 #
41
+ #################################################
42
+ def inspect
43
+ caller.each { | el | return super.inspect if el.match(/inspector/) }
44
+ warn "WARNING: #inspect is deprecated and will be removed in the future, please use #details instead."
45
+ details
46
+ end
47
+ #################################################
48
+
39
49
  end
40
50
  end
41
51
  end
@@ -1,6 +1,6 @@
1
1
  module Docker
2
2
  module API
3
- GEM_VERSION = "0.8.1"
3
+ GEM_VERSION = "0.9.0"
4
4
 
5
5
  API_VERSION = "1.40"
6
6
 
@@ -1,21 +1,16 @@
1
1
  module Docker
2
2
  module API
3
3
  class Volume < Docker::API::Base
4
- def base_path
5
- "/volumes"
6
- end
7
-
8
- def inspect *args
9
- return super.inspect if args.size == 0
10
- name = args[0]
11
- @connection.get(build_path([name]))
12
- end
13
4
 
14
5
  def list params = {}
15
6
  validate Docker::API::InvalidParameter, [:filters], params
16
7
  @connection.get(build_path("/volumes", params))
17
8
  end
18
9
 
10
+ def details name
11
+ @connection.get(build_path([name]))
12
+ end
13
+
19
14
  def create body = {}
20
15
  validate Docker::API::InvalidRequestBody, [:Name, :Driver, :DriverOpts, :Labels], body
21
16
  @connection.request(method: :post, path: build_path(["create"]), headers: {"Content-Type": "application/json"}, body: body.to_json)
@@ -31,6 +26,21 @@ module Docker
31
26
  @connection.post(build_path(["prune"], params))
32
27
  end
33
28
 
29
+ #################################################
30
+ # Items in this area to be removed before 1.0.0 #
31
+ #################################################
32
+ def base_path
33
+ "/volumes"
34
+ end
35
+
36
+ def inspect *args
37
+ return super.inspect if args.size == 0
38
+ warn "WARNING: #inspect is deprecated and will be removed in the future, please use #details instead."
39
+ name = args[0]
40
+ @connection.get(build_path([name]))
41
+ end
42
+ #################################################
43
+
34
44
  end
35
45
  end
36
46
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dockerapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alysson A. Costa
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-10 00:00:00.000000000 Z
11
+ date: 2020-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: excon