Browse code

Vendor engine-api 0.2.1.

Signed-off-by: David Calavera <david.calavera@gmail.com>

David Calavera authored on 2016/01/12 05:00:03
Showing 9 changed files
... ...
@@ -22,7 +22,7 @@ clone git github.com/vdemeester/shakers 3c10293ce22b900c27acad7b28656196fcc2f73b
22 22
 clone git golang.org/x/net 47990a1ba55743e6ef1affd3a14e5bac8553615d https://github.com/golang/net.git
23 23
 clone git github.com/docker/go-units 651fc226e7441360384da338d0fd37f2440ffbe3
24 24
 clone git github.com/docker/go-connections v0.1.2
25
-clone git github.com/docker/engine-api v0.1.3
25
+clone git github.com/docker/engine-api v0.2.1
26 26
 clone git github.com/RackSec/srslog 6eb773f331e46fbba8eecb8e794e635e75fc04de
27 27
 
28 28
 #get libnetwork packages
... ...
@@ -33,13 +33,13 @@ func (cli *Client) ContainerCreate(config *container.Config, hostConfig *contain
33 33
 
34 34
 	serverResp, err := cli.post("/containers/create", query, body, nil)
35 35
 	if err != nil {
36
-		if serverResp != nil && serverResp.statusCode == 404 && strings.Contains(err.Error(), config.Image) {
36
+		if serverResp != nil && serverResp.statusCode == 404 && strings.Contains(err.Error(), "No such image") {
37 37
 			return response, imageNotFoundError{config.Image}
38 38
 		}
39 39
 		return response, err
40 40
 	}
41 41
 
42
-	if serverResp.statusCode == 404 && strings.Contains(err.Error(), config.Image) {
42
+	if serverResp.statusCode == 404 && strings.Contains(err.Error(), "No such image") {
43 43
 		return response, imageNotFoundError{config.Image}
44 44
 	}
45 45
 
... ...
@@ -60,7 +60,7 @@ type APIClient interface {
60 60
 	Info() (types.Info, error)
61 61
 	NetworkConnect(networkID, containerID string, config *network.EndpointSettings) error
62 62
 	NetworkCreate(options types.NetworkCreate) (types.NetworkCreateResponse, error)
63
-	NetworkDisconnect(networkID, containerID string) error
63
+	NetworkDisconnect(networkID, containerID string, force bool) error
64 64
 	NetworkInspect(networkID string) (types.NetworkResource, error)
65 65
 	NetworkList(options types.NetworkListOptions) ([]types.NetworkResource, error)
66 66
 	NetworkRemove(networkID string) error
... ...
@@ -42,9 +42,9 @@ func (cli *Client) NetworkConnect(networkID, containerID string, config *network
42 42
 }
43 43
 
44 44
 // NetworkDisconnect disconnects a container from an existent network in the docker host.
45
-func (cli *Client) NetworkDisconnect(networkID, containerID string) error {
46
-	nc := types.NetworkConnect{Container: containerID}
47
-	resp, err := cli.post("/networks/"+networkID+"/disconnect", nil, nc, nil)
45
+func (cli *Client) NetworkDisconnect(networkID, containerID string, force bool) error {
46
+	nd := types.NetworkDisconnect{Container: containerID, Force: force}
47
+	resp, err := cli.post("/networks/"+networkID+"/disconnect", nil, nd, nil)
48 48
 	ensureReaderClosed(resp)
49 49
 	return err
50 50
 }
... ...
@@ -154,28 +154,19 @@ type ImageBuildResponse struct {
154 154
 
155 155
 // ImageCreateOptions holds information to create images.
156 156
 type ImageCreateOptions struct {
157
-	// Parent is the image to create this image from
158
-	Parent string
159
-	// Tag is the name to tag this image
160
-	Tag string
161
-	// RegistryAuth is the base64 encoded credentials for this server
162
-	RegistryAuth string
157
+	Parent       string // Parent is the name of the image to pull
158
+	Tag          string // Tag is the name to tag this image with
159
+	RegistryAuth string // RegistryAuth is the base64 encoded credentials for the registry
163 160
 }
164 161
 
165 162
 // ImageImportOptions holds information to import images from the client host.
166 163
 type ImageImportOptions struct {
167
-	// Source is the data to send to the server to create this image from
168
-	Source io.Reader
169
-	// Source is the name of the source to import this image from
170
-	SourceName string
171
-	// RepositoryName is the name of the repository to import this image
172
-	RepositoryName string
173
-	// Message is the message to tag the image with
174
-	Message string
175
-	// Tag is the name to tag this image
176
-	Tag string
177
-	// Changes are the raw changes to apply to the image
178
-	Changes []string
164
+	Source         io.Reader // Source is the data to send to the server to create this image from (mutually exclusive with SourceName)
165
+	SourceName     string    // SourceName is the name of the image to pull (mutually exclusive with Source)
166
+	RepositoryName string    // RepositoryName is the name of the repository to import this image into
167
+	Message        string    // Message is the message to tag the image with
168
+	Tag            string    // Tag is the name to tag this image with
169
+	Changes        []string  // Changes are the raw changes to apply to this image
179 170
 }
180 171
 
181 172
 // ImageListOptions holds parameters to filter the list of images with.
... ...
@@ -193,10 +184,9 @@ type ImageLoadResponse struct {
193 193
 
194 194
 // ImagePullOptions holds information to pull images.
195 195
 type ImagePullOptions struct {
196
-	ImageID string
197
-	Tag     string
198
-	// RegistryAuth is the base64 encoded credentials for this server
199
-	RegistryAuth string
196
+	ImageID      string // ImageID is the name of the image to pull
197
+	Tag          string // Tag is the name of the tag to be pulled
198
+	RegistryAuth string // RegistryAuth is the base64 encoded credentials for the registry
200 199
 }
201 200
 
202 201
 //ImagePushOptions holds information to push images.
... ...
@@ -180,7 +180,7 @@ type Resources struct {
180 180
 	MemoryReservation    int64           // Memory soft limit (in bytes)
181 181
 	MemorySwap           int64           // Total memory usage (memory + swap); set `-1` to disable swap
182 182
 	MemorySwappiness     *int64          // Tuning container memory swappiness behaviour
183
-	OomKillDisable       bool            // Whether to disable OOM Killer or not
183
+	OomKillDisable       *bool           // Whether to disable OOM Killer or not
184 184
 	PidsLimit            int64           // Setting pids limit for a container
185 185
 	Ulimits              []*units.Ulimit // List of ulimits to be set in the container
186 186
 }
... ...
@@ -222,7 +222,6 @@ type HostConfig struct {
222 222
 	PublishAllPorts bool               // Should docker publish all exposed port for the container
223 223
 	ReadonlyRootfs  bool               // Is the container root filesystem in read-only
224 224
 	SecurityOpt     []string           // List of string values to customize labels for MLS systems, such as SELinux.
225
-	StorageOpt      []string           // Graph storage options per container
226 225
 	Tmpfs           map[string]string  `json:",omitempty"` // List of tmpfs (mounts) used for the container
227 226
 	UTSMode         UTSMode            // UTS namespace to use for the container
228 227
 	ShmSize         int64              // Total shm memory usage
... ...
@@ -8,8 +8,9 @@ type Address struct {
8 8
 
9 9
 // IPAM represents IP Address Management
10 10
 type IPAM struct {
11
-	Driver string
12
-	Config []IPAMConfig
11
+	Driver  string
12
+	Options map[string]string //Per network IPAM driver options
13
+	Config  []IPAMConfig
13 14
 }
14 15
 
15 16
 // IPAMConfig represents IPAM configurations
... ...
@@ -30,7 +31,10 @@ type EndpointIPAMConfig struct {
30 30
 type EndpointSettings struct {
31 31
 	// Configurations
32 32
 	IPAMConfig *EndpointIPAMConfig
33
+	Links      []string
34
+	Aliases    []string
33 35
 	// Operational data
36
+	NetworkID           string
34 37
 	EndpointID          string
35 38
 	Gateway             string
36 39
 	IPAddress           string
37 40
new file mode 100644
... ...
@@ -0,0 +1,68 @@
0
+package types
1
+
2
+// Seccomp represents the config for a seccomp profile for syscall restriction.
3
+type Seccomp struct {
4
+	DefaultAction Action     `json:"defaultAction"`
5
+	Architectures []Arch     `json:"architectures"`
6
+	Syscalls      []*Syscall `json:"syscalls"`
7
+}
8
+
9
+// Arch used for additional architectures
10
+type Arch string
11
+
12
+// Additional architectures permitted to be used for system calls
13
+// By default only the native architecture of the kernel is permitted
14
+const (
15
+	ArchX86         Arch = "SCMP_ARCH_X86"
16
+	ArchX86_64      Arch = "SCMP_ARCH_X86_64"
17
+	ArchX32         Arch = "SCMP_ARCH_X32"
18
+	ArchARM         Arch = "SCMP_ARCH_ARM"
19
+	ArchAARCH64     Arch = "SCMP_ARCH_AARCH64"
20
+	ArchMIPS        Arch = "SCMP_ARCH_MIPS"
21
+	ArchMIPS64      Arch = "SCMP_ARCH_MIPS64"
22
+	ArchMIPS64N32   Arch = "SCMP_ARCH_MIPS64N32"
23
+	ArchMIPSEL      Arch = "SCMP_ARCH_MIPSEL"
24
+	ArchMIPSEL64    Arch = "SCMP_ARCH_MIPSEL64"
25
+	ArchMIPSEL64N32 Arch = "SCMP_ARCH_MIPSEL64N32"
26
+)
27
+
28
+// Action taken upon Seccomp rule match
29
+type Action string
30
+
31
+// Define actions for Seccomp rules
32
+const (
33
+	ActKill  Action = "SCMP_ACT_KILL"
34
+	ActTrap  Action = "SCMP_ACT_TRAP"
35
+	ActErrno Action = "SCMP_ACT_ERRNO"
36
+	ActTrace Action = "SCMP_ACT_TRACE"
37
+	ActAllow Action = "SCMP_ACT_ALLOW"
38
+)
39
+
40
+// Operator used to match syscall arguments in Seccomp
41
+type Operator string
42
+
43
+// Define operators for syscall arguments in Seccomp
44
+const (
45
+	OpNotEqual     Operator = "SCMP_CMP_NE"
46
+	OpLessThan     Operator = "SCMP_CMP_LT"
47
+	OpLessEqual    Operator = "SCMP_CMP_LE"
48
+	OpEqualTo      Operator = "SCMP_CMP_EQ"
49
+	OpGreaterEqual Operator = "SCMP_CMP_GE"
50
+	OpGreaterThan  Operator = "SCMP_CMP_GT"
51
+	OpMaskedEqual  Operator = "SCMP_CMP_MASKED_EQ"
52
+)
53
+
54
+// Arg used for matching specific syscall arguments in Seccomp
55
+type Arg struct {
56
+	Index    uint     `json:"index"`
57
+	Value    uint64   `json:"value"`
58
+	ValueTwo uint64   `json:"valueTwo"`
59
+	Op       Operator `json:"op"`
60
+}
61
+
62
+// Syscall is used to match a syscall in Seccomp
63
+type Syscall struct {
64
+	Name   string `json:"name"`
65
+	Action Action `json:"action"`
66
+	Args   []*Arg `json:"args"`
67
+}
... ...
@@ -192,6 +192,9 @@ type Version struct {
192 192
 type Info struct {
193 193
 	ID                 string
194 194
 	Containers         int
195
+	ContainersRunning  int
196
+	ContainersPaused   int
197
+	ContainersStopped  int
195 198
 	Images             int
196 199
 	Driver             string
197 200
 	DriverStatus       [][2]string
... ...
@@ -404,6 +407,7 @@ type NetworkCreate struct {
404 404
 	CheckDuplicate bool
405 405
 	Driver         string
406 406
 	IPAM           network.IPAM
407
+	Internal       bool
407 408
 	Options        map[string]string
408 409
 }
409 410
 
... ...
@@ -416,10 +420,11 @@ type NetworkCreateResponse struct {
416 416
 // NetworkConnect represents the data to be used to connect a container to the network
417 417
 type NetworkConnect struct {
418 418
 	Container      string
419
-	EndpointConfig *network.EndpointSettings `json:"endpoint_config"`
419
+	EndpointConfig *network.EndpointSettings `json:",omitempty"`
420 420
 }
421 421
 
422 422
 // NetworkDisconnect represents the data to be used to disconnect a container from the network
423 423
 type NetworkDisconnect struct {
424 424
 	Container string
425
+	Force     bool
425 426
 }