dockerapi 0.3.0 → 0.4.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: 75cce9b4918cafd3470d083b64922e43885c6e6e438ef8fd4eb4058944986781
4
- data.tar.gz: 76bff03e4603b101af6b968271778d9c0dbec86c512373fd45f1e538efdae3a4
3
+ metadata.gz: 1fce5f833c28f2144c012a8aa5c667bdb520b4bc0423a6407263da6597f7bc1e
4
+ data.tar.gz: 0f7cb0476f93e1fea20f06567e9fd72f168c987d91dd5eb5bf8a0430c976bc92
5
5
  SHA512:
6
- metadata.gz: c5966f40e08494459b9d727d21f2b9600cc1945d31b1229a9b7d4305d98edf332092a238b5b649d9cfedf6cf56e9e3664ebeb3c7674145fea826c9758b5eb61f
7
- data.tar.gz: a6800709a10f44eac1e2cdb4001b11b7b6f5630b7af75cccd47db57ba33b48af45509593b2eaa340b06c4f35423581c47d4e646eee4503ef6b6d70bee1e847e0
6
+ metadata.gz: d8e21c6f481339361c91f74a4134c1a989007e04c88e1192618275f908be0c2436324b5939571ec4fbfbfe462b6872c13e575cef5026fd78b92250809a21582c
7
+ data.tar.gz: 3167dad7f68cf3395b26de3baf6a595ba42403f52bacc0ec455394aa9e19dd76cb461517c5b9d4a389e6019508a2438ddef12f5ad78cdf4d632c879369de22b1
@@ -1,6 +1,17 @@
1
+ # 0.4.0
2
+
3
+ Add Docker::API::Network methods:
4
+ * list
5
+ * inspect
6
+ * create
7
+ * remove
8
+ * prune
9
+ * connect
10
+ * disconnect
11
+
1
12
  # 0.3.0
2
13
 
3
- Add Docker::API::Image methods:
14
+ Add Docker::API::Volume methods:
4
15
  * list
5
16
  * inspect
6
17
  * create
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dockerapi (0.3.0)
4
+ dockerapi (0.4.0)
5
5
  excon (~> 0.74.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -156,20 +156,44 @@ Docker::API::Container.prune
156
156
 
157
157
  ```ruby
158
158
  # Create volume
159
- Docker::API::Volume.create Name:"my-volume"
159
+ Docker::API::Volume.create( Name:"my-volume" )
160
160
 
161
161
  # List volumes
162
162
  Docker::API::Volume.list
163
163
 
164
164
  # Inspect volume
165
- Docker::API::Volume.inspect "my-volume"
165
+ Docker::API::Volume.inspect("my-volume")
166
166
 
167
167
  # Remove volume
168
- Docker::API::Volume.remove "my-volume"
168
+ Docker::API::Volume.remove("my-volume")
169
169
 
170
170
  # Remove unused volumes (prune)
171
171
  Docker::API::Volume.prune
172
+ ```
173
+
174
+ ### Network
175
+
176
+ ```ruby
177
+ # List networks
178
+ Docker::API::Network.list
179
+
180
+ # Inspect network
181
+ Docker::API::Network.inspect("bridge")
182
+
183
+ # Create network
184
+ Docker::API::Network.create( Name:"my-network" )
185
+
186
+ # Remove network
187
+ Docker::API::Network.remove("my-network")
188
+
189
+ # Remove unused network (prune)
190
+ Docker::API::Network.prune
191
+
192
+ # Connect container to a network
193
+ Docker::API::Network.connect( "my-network", Container: "my-container" )
172
194
 
195
+ # Disconnect container to a network
196
+ Docker::API::Network.disconnect( "my-network", Container: "my-container" )
173
197
  ```
174
198
 
175
199
  ### Requests
@@ -198,7 +222,7 @@ WIP: Work In Progress
198
222
  | Container | Ok | Ok | NS |
199
223
  | Image | Ok | Ok | NS |
200
224
  | Volume | Ok | Ok | NS |
201
- | Network | NS | NS | NS |
225
+ | Network | Ok | Ok | NS |
202
226
  | System | NS | NS | NS |
203
227
  | Exec | NS | NS | NS |
204
228
  | Swarm | NS | NS | NS |
@@ -0,0 +1,45 @@
1
+ module Docker
2
+ module API
3
+ class Network < Docker::API::Base
4
+
5
+ def self.base_path
6
+ "/networks"
7
+ end
8
+
9
+ def self.list params = {}
10
+ validate Docker::API::InvalidParameter, [:filters], params
11
+ connection.get(build_path("/networks", params))
12
+ end
13
+
14
+ def self.inspect name, params = {}
15
+ validate Docker::API::InvalidParameter, [:verbose, :scope], params
16
+ connection.get(build_path([name], params))
17
+ end
18
+
19
+ def self.create body = {}
20
+ validate Docker::API::InvalidRequestBody, [:Name, :CheckDuplicate, :Driver, :Internal, :Attachable, :Ingress, :IPAM, :EnableIPv6, :Options, :Labels], body
21
+ connection.request(method: :post, path: build_path(["create"]), headers: {"Content-Type": "application/json"}, body: body.to_json)
22
+ end
23
+
24
+ def self.remove name
25
+ connection.delete(build_path([name]))
26
+ end
27
+
28
+ def self.prune params = {}
29
+ validate Docker::API::InvalidParameter, [:filters], params
30
+ connection.post(build_path(["prune"], params))
31
+ end
32
+
33
+ def self.connect name, body = {}
34
+ validate Docker::API::InvalidRequestBody, [:Container, :EndpointConfig], body
35
+ connection.request(method: :post, path: build_path([name, "connect"]), headers: {"Content-Type": "application/json"}, body: body.to_json)
36
+ end
37
+
38
+ def self.disconnect name, body = {}
39
+ validate Docker::API::InvalidRequestBody, [:Container, :Force], body
40
+ connection.request(method: :post, path: build_path([name, "disconnect"]), headers: {"Content-Type": "application/json"}, body: body.to_json)
41
+ end
42
+
43
+ end
44
+ end
45
+ end
@@ -1,6 +1,6 @@
1
1
  module Docker
2
2
  module API
3
- GEM_VERSION = "0.3.0"
3
+ GEM_VERSION = "0.4.0"
4
4
 
5
5
  API_VERSION = "1.40"
6
6
 
@@ -6,6 +6,7 @@ require "docker/api/base"
6
6
  require "docker/api/container"
7
7
  require "docker/api/image"
8
8
  require "docker/api/volume"
9
+ require "docker/api/network"
9
10
  require "docker/api/system"
10
11
 
11
12
  module Docker
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.3.0
4
+ version: 0.4.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-06-26 00:00:00.000000000 Z
11
+ date: 2020-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: excon
@@ -48,6 +48,7 @@ files:
48
48
  - lib/docker/api/container.rb
49
49
  - lib/docker/api/error.rb
50
50
  - lib/docker/api/image.rb
51
+ - lib/docker/api/network.rb
51
52
  - lib/docker/api/system.rb
52
53
  - lib/docker/api/version.rb
53
54
  - lib/docker/api/volume.rb