dockerapi 0.14.0 → 0.15.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 +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +1 -1
- data/README.md +12 -12
- data/lib/docker/api/exec.rb +49 -36
- data/lib/docker/api/network.rb +84 -48
- data/lib/docker/api/system.rb +57 -24
- data/lib/docker/api/version.rb +1 -1
- data/lib/docker/api/volume.rb +56 -37
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a07cc3ef52a91afb13ab99c130cb6cbed118055aba264df3e0fb0a1ec701ef6d
|
|
4
|
+
data.tar.gz: d9e6e03672a7a47de2cb0fb840569c45582075be679d21995192247633d58d70
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 46bbd5e8c6cbb41e13b3830aab5ca8825d37a1c85401dedc33aeba3352657f8410e99c8c321bc5e5d10e9eeac6435769f9b7d7570a8910b7f0d0779a3308381a
|
|
7
|
+
data.tar.gz: 672a71377c73a0c0a09796d84afebf2cfe03f3a6182626119c3370ab41112249d881152f1dadbe24ba31775475b4463df5d8c42ca2e9f7d6915c080149fab7ab
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
# 0.15.0
|
|
2
|
+
|
|
3
|
+
`Docker::API::System#events` and `Docker::API::Exec#start` methods that can now receive a block to replace standard output to stdout behavior.
|
|
4
|
+
|
|
5
|
+
General refactoring and API documentation.
|
|
6
|
+
|
|
1
7
|
# 0.14.0
|
|
2
8
|
|
|
3
9
|
Method `Docker::API::Container#archive` is splitted in `#get_archive` and `#put_archive` as per Docker API documentation.
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -543,18 +543,18 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
|
543
543
|
|---|---|---|---|
|
|
544
544
|
| Image | Ok | Ok | Ok |
|
|
545
545
|
| Container | Ok | Ok | Ok |
|
|
546
|
-
| Volume | Ok | Ok |
|
|
547
|
-
| Network | Ok | Ok |
|
|
548
|
-
| System | Ok | Ok |
|
|
549
|
-
| Exec | Ok | Ok |
|
|
550
|
-
| Swarm | Ok | Ok | 8/
|
|
551
|
-
| Node | Ok | Ok | 8/
|
|
552
|
-
| Service | Ok | Ok | 8/
|
|
553
|
-
| Task | Ok | Ok | 8/
|
|
554
|
-
| Secret | Ok | Ok | 8/
|
|
555
|
-
| Config | Ok | Ok | 8/
|
|
556
|
-
| Distribution | Ok | Ok | 8/
|
|
557
|
-
| Plugin | Ok | Ok | 8/
|
|
546
|
+
| Volume | Ok | Ok | Ok |
|
|
547
|
+
| Network | Ok | Ok | Ok |
|
|
548
|
+
| System | Ok | Ok | Ok |
|
|
549
|
+
| Exec | Ok | Ok | Ok |
|
|
550
|
+
| Swarm | Ok | Ok | 8/11 |
|
|
551
|
+
| Node | Ok | Ok | 8/11 |
|
|
552
|
+
| Service | Ok | Ok | 8/11 |
|
|
553
|
+
| Task | Ok | Ok | 8/11 |
|
|
554
|
+
| Secret | Ok | Ok | 8/11 |
|
|
555
|
+
| Config | Ok | Ok | 8/14 |
|
|
556
|
+
| Distribution | Ok | Ok | 8/14 |
|
|
557
|
+
| Plugin | Ok | Ok | 8/14 |
|
|
558
558
|
|
|
559
559
|
Add doc in these files: `base`, `connection`, `error`, `response`, `dockerapi`
|
|
560
560
|
|
data/lib/docker/api/exec.rb
CHANGED
|
@@ -1,42 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
##
|
|
2
|
+
# This class represents the Docker API exec related endpoints.
|
|
3
|
+
# @see https://docs.docker.com/engine/api/v1.40/#tag/Exec
|
|
4
|
+
class Docker::API::Exec < Docker::API::Base
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
)
|
|
17
|
-
response.data.merge!({stream: stream})
|
|
18
|
-
response
|
|
19
|
-
end
|
|
6
|
+
##
|
|
7
|
+
# Run a command inside a running container.
|
|
8
|
+
#
|
|
9
|
+
# Docker API: POST /containers/{id}/exec
|
|
10
|
+
# @see https://docs.docker.com/engine/api/v1.40/#operation/ContainerExec
|
|
11
|
+
#
|
|
12
|
+
# @param name [String]: The ID or name of the container.
|
|
13
|
+
# @param body [Hash]: Request body to be sent as json.
|
|
14
|
+
def create name, body = {}
|
|
15
|
+
@connection.request(method: :post, path: "/containers/#{name}/exec", headers: {"Content-Type": "application/json"}, body: body.to_json )
|
|
16
|
+
end
|
|
20
17
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
##
|
|
19
|
+
# Starts a previously set up exec instance.
|
|
20
|
+
#
|
|
21
|
+
# Docker API: POST /exec/{id}/start
|
|
22
|
+
# @see https://docs.docker.com/engine/api/v1.40/#operation/ExecStart
|
|
23
|
+
#
|
|
24
|
+
# @param name [String]: Exec instance ID.
|
|
25
|
+
# @param body [Hash]: Request body to be sent as json.
|
|
26
|
+
# @param &block: Replace the default output to stdout behavior.
|
|
27
|
+
def start name, body = {}, &block
|
|
28
|
+
@connection.request(method: :post, path: "/exec/#{name}/start", headers: {"Content-Type": "application/json"}, body: body.to_json,
|
|
29
|
+
response_block: block_given? ? block.call : default_streamer )
|
|
30
|
+
end
|
|
24
31
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
details(name)
|
|
37
|
-
end
|
|
38
|
-
#################################################
|
|
32
|
+
##
|
|
33
|
+
# Resize the TTY session used by an exec instance.
|
|
34
|
+
#
|
|
35
|
+
# Docker API: POST /exec/{id}/resize
|
|
36
|
+
# @see https://docs.docker.com/engine/api/v1.40/#operation/ExecResize
|
|
37
|
+
#
|
|
38
|
+
# @param name [String]: Exec instance ID.
|
|
39
|
+
# @param body [Hash]: Request body to be sent as json.
|
|
40
|
+
def resize name, params = {}
|
|
41
|
+
@connection.post(build_path("/exec/#{name}/resize", params))
|
|
42
|
+
end
|
|
39
43
|
|
|
40
|
-
|
|
44
|
+
##
|
|
45
|
+
# Return low-level information about an exec instance.
|
|
46
|
+
#
|
|
47
|
+
# Docker API: GET /exec/{id}/json
|
|
48
|
+
# @see https://docs.docker.com/engine/api/v1.40/#operation/ExecInspect
|
|
49
|
+
#
|
|
50
|
+
# @param name [String]: Exec instance ID.
|
|
51
|
+
def details name
|
|
52
|
+
@connection.get("/exec/#{name}/json")
|
|
41
53
|
end
|
|
54
|
+
|
|
42
55
|
end
|
data/lib/docker/api/network.rb
CHANGED
|
@@ -1,50 +1,86 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
1
|
+
##
|
|
2
|
+
# This class represents the Docker API endpoints regarding networks.
|
|
3
|
+
# @see https://docs.docker.com/engine/api/v1.40/#tag/Network
|
|
4
|
+
class Docker::API::Network < Docker::API::Base
|
|
5
|
+
|
|
6
|
+
##
|
|
7
|
+
# List networks.
|
|
8
|
+
#
|
|
9
|
+
# Docker API: GET /networks
|
|
10
|
+
# @see https://docs.docker.com/engine/api/v1.40/#operation/NetworkList
|
|
11
|
+
#
|
|
12
|
+
# @param params [Hash]: Parameters that are appended to the URL.
|
|
13
|
+
def list params = {}
|
|
14
|
+
@connection.get(build_path("/networks", params))
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
##
|
|
18
|
+
# Inspect a network.
|
|
19
|
+
#
|
|
20
|
+
# Docker API: GET /networks/{id}
|
|
21
|
+
# @see https://docs.docker.com/engine/api/v1.40/#operation/NetworkInspect
|
|
22
|
+
#
|
|
23
|
+
# @param name [String]: The ID or name of the network.
|
|
24
|
+
# @param params [Hash]: Parameters that are appended to the URL.
|
|
25
|
+
def details name, params = {}
|
|
26
|
+
@connection.get(build_path("/networks/#{name}", params))
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
##
|
|
30
|
+
# Create a network.
|
|
31
|
+
#
|
|
32
|
+
# Docker API: POST /networks/create
|
|
33
|
+
# @see https://docs.docker.com/engine/api/v1.40/#operation/NetworkCreate
|
|
34
|
+
#
|
|
35
|
+
# @param body [Hash]: Request body to be sent as json.
|
|
36
|
+
def create body = {}
|
|
37
|
+
@connection.request(method: :post, path: "/networks/create", headers: {"Content-Type": "application/json"}, body: body.to_json)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
##
|
|
41
|
+
# Remove a network.
|
|
42
|
+
#
|
|
43
|
+
# Docker API: DELETE /networks/{id}
|
|
44
|
+
# @see https://docs.docker.com/engine/api/v1.40/#operation/NetworkDelete
|
|
45
|
+
#
|
|
46
|
+
# @param name [String]: The ID or name of the network.
|
|
47
|
+
def remove name
|
|
48
|
+
@connection.delete("/networks/#{name}")
|
|
49
49
|
end
|
|
50
|
+
|
|
51
|
+
##
|
|
52
|
+
# Delete unused networks.
|
|
53
|
+
#
|
|
54
|
+
# Docker API: POST /networks/prune
|
|
55
|
+
# @see https://docs.docker.com/engine/api/v1.40/#operation/NetworkPrune
|
|
56
|
+
#
|
|
57
|
+
# @param params [Hash]: Parameters that are appended to the URL.
|
|
58
|
+
def prune params = {}
|
|
59
|
+
@connection.post(build_path("/networks/prune", params))
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
##
|
|
63
|
+
# Connect a container to a network.
|
|
64
|
+
#
|
|
65
|
+
# Docker API: POST /networks/{id}/connect
|
|
66
|
+
# @see https://docs.docker.com/engine/api/v1.40/#operation/NetworkConnect
|
|
67
|
+
#
|
|
68
|
+
# @param name [String]: The ID or name of the network.
|
|
69
|
+
# @param body [Hash]: Request body to be sent as json.
|
|
70
|
+
def connect name, body = {}
|
|
71
|
+
@connection.request(method: :post, path: "/networks/#{name}/connect", headers: {"Content-Type": "application/json"}, body: body.to_json)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
##
|
|
75
|
+
# Disconnect a container from a network.
|
|
76
|
+
#
|
|
77
|
+
# Docker API: POST /networks/{id}/disconnect
|
|
78
|
+
# @see https://docs.docker.com/engine/api/v1.40/#operation/NetworkDisconnect
|
|
79
|
+
#
|
|
80
|
+
# @param name [String]: The ID or name of the network.
|
|
81
|
+
# @param body [Hash]: Request body to be sent as json.
|
|
82
|
+
def disconnect name, body = {}
|
|
83
|
+
@connection.request(method: :post, path: "/networks/#{name}/disconnect", headers: {"Content-Type": "application/json"}, body: body.to_json)
|
|
84
|
+
end
|
|
85
|
+
|
|
50
86
|
end
|
data/lib/docker/api/system.rb
CHANGED
|
@@ -1,32 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
##
|
|
2
|
+
# This class represents the Docker API system related endpoints.
|
|
3
|
+
# @see https://docs.docker.com/engine/api/v1.40/#tag/System
|
|
4
|
+
class Docker::API::System < Docker::API::Base
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
##
|
|
7
|
+
# Validate credentials for a registry and, if available, get an identity token for accessing the registry without password.
|
|
8
|
+
#
|
|
9
|
+
# Docker API: POST /auth
|
|
10
|
+
# @see https://docs.docker.com/engine/api/v1.40/#operation/SystemAuth
|
|
11
|
+
#
|
|
12
|
+
# @param body [Hash]: Request body to be sent as json.
|
|
13
|
+
def auth body = {}
|
|
14
|
+
@connection.request(method: :post, path: "/auth", headers: { "Content-Type" => "application/json" }, body: body.to_json)
|
|
15
|
+
end
|
|
9
16
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
17
|
+
##
|
|
18
|
+
# Stream real-time events from the server.
|
|
19
|
+
#
|
|
20
|
+
# Docker API: GET /events
|
|
21
|
+
# @see https://docs.docker.com/engine/api/v1.40/#operation/SystemEvents
|
|
22
|
+
#
|
|
23
|
+
# @param params [Hash]: Parameters that are appended to the URL.
|
|
24
|
+
# @param &block: Replace the default output to stdout behavior.
|
|
25
|
+
def events params = {}, &block
|
|
26
|
+
@connection.request(method: :get, path: build_path("/events", params), response_block: block_given? ? block.call : default_streamer )
|
|
27
|
+
end
|
|
13
28
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
29
|
+
##
|
|
30
|
+
# This is a dummy endpoint you can use to test if the server is accessible.
|
|
31
|
+
#
|
|
32
|
+
# Docker API: GET /_ping
|
|
33
|
+
# @see https://docs.docker.com/engine/api/v1.40/#operation/SystemPing
|
|
34
|
+
def ping
|
|
35
|
+
@connection.get("/_ping")
|
|
36
|
+
end
|
|
17
37
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
38
|
+
##
|
|
39
|
+
# Get system information.
|
|
40
|
+
#
|
|
41
|
+
# Docker API: GET /info
|
|
42
|
+
# @see https://docs.docker.com/engine/api/v1.40/#operation/SystemInfo
|
|
43
|
+
def info
|
|
44
|
+
@connection.get("/info")
|
|
45
|
+
end
|
|
21
46
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
47
|
+
##
|
|
48
|
+
# Returns the version of Docker that is running and various information about the system that Docker is running on.
|
|
49
|
+
#
|
|
50
|
+
# Docker API: GET /version
|
|
51
|
+
# @see https://docs.docker.com/engine/api/v1.40/#operation/SystemVersion
|
|
52
|
+
def version
|
|
53
|
+
@connection.get("/version")
|
|
54
|
+
end
|
|
25
55
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
56
|
+
##
|
|
57
|
+
# Get data usage information.
|
|
58
|
+
#
|
|
59
|
+
# Docker API: GET /system/df
|
|
60
|
+
# @see https://docs.docker.com/engine/api/v1.40/#operation/SystemDataUsage
|
|
61
|
+
def df
|
|
62
|
+
@connection.get("/system/df")
|
|
31
63
|
end
|
|
64
|
+
|
|
32
65
|
end
|
data/lib/docker/api/version.rb
CHANGED
data/lib/docker/api/volume.rb
CHANGED
|
@@ -1,42 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def remove name, params = {}
|
|
18
|
-
@connection.delete(build_path([name]))
|
|
19
|
-
end
|
|
1
|
+
##
|
|
2
|
+
# This class represents the Docker API endpoints regarding volumes.
|
|
3
|
+
# @see https://docs.docker.com/engine/api/v1.40/#tag/Volume
|
|
4
|
+
class Docker::API::Volume < Docker::API::Base
|
|
5
|
+
|
|
6
|
+
##
|
|
7
|
+
# List volumes.
|
|
8
|
+
#
|
|
9
|
+
# Docker API: GET
|
|
10
|
+
# @see https://docs.docker.com/engine/api/v1.40/#operation/VolumeList
|
|
11
|
+
#
|
|
12
|
+
# @param params [Hash]: Parameters that are appended to the URL.
|
|
13
|
+
def list params = {}
|
|
14
|
+
@connection.get(build_path("/volumes", params))
|
|
15
|
+
end
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
##
|
|
18
|
+
# Inspect a volume.
|
|
19
|
+
#
|
|
20
|
+
# Docker API: GET /volumes/{name}
|
|
21
|
+
# @see https://docs.docker.com/engine/api/v1.40/#operation/VolumeInspect
|
|
22
|
+
#
|
|
23
|
+
# @param name [String]: The ID or name of the volume.
|
|
24
|
+
def details name
|
|
25
|
+
@connection.get("/volumes/#{name}")
|
|
26
|
+
end
|
|
24
27
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
##
|
|
29
|
+
# Create a volume.
|
|
30
|
+
#
|
|
31
|
+
# Docker API: POST /volumes/create
|
|
32
|
+
# @see https://docs.docker.com/engine/api/v1.40/#operation/VolumeCreate
|
|
33
|
+
#
|
|
34
|
+
# @param body [Hash]: Request body to be sent as json.
|
|
35
|
+
def create body = {}
|
|
36
|
+
@connection.request(method: :post, path: "/volumes/create", headers: {"Content-Type": "application/json"}, body: body.to_json)
|
|
37
|
+
end
|
|
31
38
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
##
|
|
40
|
+
# Remove a volume.
|
|
41
|
+
#
|
|
42
|
+
# Docker API: DELETE /volumes/{name}
|
|
43
|
+
# @see https://docs.docker.com/engine/api/v1.40/#operation/VolumeDelete
|
|
44
|
+
#
|
|
45
|
+
# @param name [String]: The ID or name of the volume.
|
|
46
|
+
# @param params [Hash]: Parameters that are appended to the URL.
|
|
47
|
+
def remove name, params = {}
|
|
48
|
+
@connection.delete(build_path("/volumes/#{name}",params))
|
|
49
|
+
end
|
|
39
50
|
|
|
40
|
-
|
|
51
|
+
##
|
|
52
|
+
# Delete unused volumes.
|
|
53
|
+
#
|
|
54
|
+
# Docker API: POST /volumes/prune
|
|
55
|
+
# @see https://docs.docker.com/engine/api/v1.40/#operation/VolumePrune
|
|
56
|
+
#
|
|
57
|
+
# @param params [Hash]: Parameters that are appended to the URL.
|
|
58
|
+
def prune params = {}
|
|
59
|
+
@connection.post(build_path("/volumes/prune", params))
|
|
41
60
|
end
|
|
42
|
-
end
|
|
61
|
+
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.
|
|
4
|
+
version: 0.15.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-08-
|
|
11
|
+
date: 2020-08-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: excon
|