This moves the types for the `engine-api` repo to the existing types
package.
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
... | ... |
@@ -9,9 +9,9 @@ import ( |
9 | 9 |
|
10 | 10 |
"github.com/Sirupsen/logrus" |
11 | 11 |
"github.com/docker/docker/api/client" |
12 |
+ "github.com/docker/docker/api/types" |
|
12 | 13 |
"github.com/docker/docker/cli" |
13 | 14 |
"github.com/docker/docker/pkg/signal" |
14 |
- "github.com/docker/engine-api/types" |
|
15 | 15 |
"github.com/spf13/cobra" |
16 | 16 |
) |
17 | 17 |
|
... | ... |
@@ -6,9 +6,9 @@ import ( |
6 | 6 |
"golang.org/x/net/context" |
7 | 7 |
|
8 | 8 |
"github.com/docker/docker/api/client" |
9 |
+ "github.com/docker/docker/api/types" |
|
9 | 10 |
"github.com/docker/docker/cli" |
10 | 11 |
dockeropts "github.com/docker/docker/opts" |
11 |
- "github.com/docker/engine-api/types" |
|
12 | 12 |
"github.com/spf13/cobra" |
13 | 13 |
) |
14 | 14 |
|
... | ... |
@@ -10,10 +10,10 @@ import ( |
10 | 10 |
"golang.org/x/net/context" |
11 | 11 |
|
12 | 12 |
"github.com/docker/docker/api/client" |
13 |
+ "github.com/docker/docker/api/types" |
|
13 | 14 |
"github.com/docker/docker/cli" |
14 | 15 |
"github.com/docker/docker/pkg/archive" |
15 | 16 |
"github.com/docker/docker/pkg/system" |
16 |
- "github.com/docker/engine-api/types" |
|
17 | 17 |
"github.com/spf13/cobra" |
18 | 18 |
) |
19 | 19 |
|
... | ... |
@@ -11,13 +11,13 @@ import ( |
11 | 11 |
"github.com/docker/docker/cli" |
12 | 12 |
"github.com/docker/docker/pkg/jsonmessage" |
13 | 13 |
// FIXME migrate to docker/distribution/reference |
14 |
+ "github.com/docker/docker/api/types" |
|
15 |
+ "github.com/docker/docker/api/types/container" |
|
16 |
+ networktypes "github.com/docker/docker/api/types/network" |
|
14 | 17 |
"github.com/docker/docker/reference" |
15 | 18 |
"github.com/docker/docker/registry" |
16 | 19 |
runconfigopts "github.com/docker/docker/runconfig/opts" |
17 | 20 |
apiclient "github.com/docker/engine-api/client" |
18 |
- "github.com/docker/engine-api/types" |
|
19 |
- "github.com/docker/engine-api/types/container" |
|
20 |
- networktypes "github.com/docker/engine-api/types/network" |
|
21 | 21 |
"github.com/spf13/cobra" |
22 | 22 |
"github.com/spf13/pflag" |
23 | 23 |
) |
... | ... |
@@ -8,9 +8,9 @@ import ( |
8 | 8 |
|
9 | 9 |
"github.com/Sirupsen/logrus" |
10 | 10 |
"github.com/docker/docker/api/client" |
11 |
+ "github.com/docker/docker/api/types" |
|
11 | 12 |
"github.com/docker/docker/cli" |
12 | 13 |
"github.com/docker/docker/pkg/promise" |
13 |
- "github.com/docker/engine-api/types" |
|
14 | 14 |
"github.com/spf13/cobra" |
15 | 15 |
) |
16 | 16 |
|
... | ... |
@@ -7,9 +7,9 @@ import ( |
7 | 7 |
"golang.org/x/net/context" |
8 | 8 |
|
9 | 9 |
"github.com/docker/docker/api/client" |
10 |
+ "github.com/docker/docker/api/types" |
|
10 | 11 |
"github.com/docker/docker/cli" |
11 | 12 |
"github.com/docker/docker/pkg/stdcopy" |
12 |
- "github.com/docker/engine-api/types" |
|
13 | 13 |
"github.com/spf13/cobra" |
14 | 14 |
) |
15 | 15 |
|
... | ... |
@@ -5,9 +5,9 @@ import ( |
5 | 5 |
|
6 | 6 |
"github.com/docker/docker/api/client" |
7 | 7 |
"github.com/docker/docker/api/client/formatter" |
8 |
+ "github.com/docker/docker/api/types" |
|
9 |
+ "github.com/docker/docker/api/types/filters" |
|
8 | 10 |
"github.com/docker/docker/cli" |
9 |
- "github.com/docker/engine-api/types" |
|
10 |
- "github.com/docker/engine-api/types/filters" |
|
11 | 11 |
|
12 | 12 |
"io/ioutil" |
13 | 13 |
|
... | ... |
@@ -13,12 +13,12 @@ import ( |
13 | 13 |
|
14 | 14 |
"github.com/Sirupsen/logrus" |
15 | 15 |
"github.com/docker/docker/api/client" |
16 |
+ "github.com/docker/docker/api/types" |
|
16 | 17 |
"github.com/docker/docker/cli" |
17 | 18 |
opttypes "github.com/docker/docker/opts" |
18 | 19 |
"github.com/docker/docker/pkg/promise" |
19 | 20 |
"github.com/docker/docker/pkg/signal" |
20 | 21 |
runconfigopts "github.com/docker/docker/runconfig/opts" |
21 |
- "github.com/docker/engine-api/types" |
|
22 | 22 |
"github.com/docker/libnetwork/resolvconf/dns" |
23 | 23 |
"github.com/spf13/cobra" |
24 | 24 |
"github.com/spf13/pflag" |
... | ... |
@@ -9,10 +9,10 @@ import ( |
9 | 9 |
"golang.org/x/net/context" |
10 | 10 |
|
11 | 11 |
"github.com/docker/docker/api/client" |
12 |
+ "github.com/docker/docker/api/types" |
|
12 | 13 |
"github.com/docker/docker/cli" |
13 | 14 |
"github.com/docker/docker/pkg/promise" |
14 | 15 |
"github.com/docker/docker/pkg/signal" |
15 |
- "github.com/docker/engine-api/types" |
|
16 | 16 |
"github.com/spf13/cobra" |
17 | 17 |
) |
18 | 18 |
|
... | ... |
@@ -13,10 +13,10 @@ import ( |
13 | 13 |
"github.com/Sirupsen/logrus" |
14 | 14 |
"github.com/docker/docker/api/client" |
15 | 15 |
"github.com/docker/docker/api/client/system" |
16 |
+ "github.com/docker/docker/api/types" |
|
17 |
+ "github.com/docker/docker/api/types/events" |
|
18 |
+ "github.com/docker/docker/api/types/filters" |
|
16 | 19 |
"github.com/docker/docker/cli" |
17 |
- "github.com/docker/engine-api/types" |
|
18 |
- "github.com/docker/engine-api/types/events" |
|
19 |
- "github.com/docker/engine-api/types/filters" |
|
20 | 20 |
"github.com/spf13/cobra" |
21 | 21 |
) |
22 | 22 |
|
... | ... |
@@ -7,9 +7,9 @@ import ( |
7 | 7 |
"golang.org/x/net/context" |
8 | 8 |
|
9 | 9 |
"github.com/docker/docker/api/client" |
10 |
+ containertypes "github.com/docker/docker/api/types/container" |
|
10 | 11 |
"github.com/docker/docker/cli" |
11 | 12 |
runconfigopts "github.com/docker/docker/runconfig/opts" |
12 |
- containertypes "github.com/docker/engine-api/types/container" |
|
13 | 13 |
"github.com/docker/go-units" |
14 | 14 |
"github.com/spf13/cobra" |
15 | 15 |
) |
... | ... |
@@ -9,10 +9,10 @@ import ( |
9 | 9 |
"github.com/Sirupsen/logrus" |
10 | 10 |
"github.com/docker/docker/api/client" |
11 | 11 |
"github.com/docker/docker/api/client/system" |
12 |
+ "github.com/docker/docker/api/types" |
|
13 |
+ "github.com/docker/docker/api/types/events" |
|
14 |
+ "github.com/docker/docker/api/types/filters" |
|
12 | 15 |
clientapi "github.com/docker/engine-api/client" |
13 |
- "github.com/docker/engine-api/types" |
|
14 |
- "github.com/docker/engine-api/types/events" |
|
15 |
- "github.com/docker/engine-api/types/filters" |
|
16 | 16 |
) |
17 | 17 |
|
18 | 18 |
func waitExitOrRemoved(dockerCli *client.DockerCli, ctx context.Context, containerID string, waitRemove bool) (chan int, error) { |
... | ... |
@@ -1,9 +1,9 @@ |
1 | 1 |
package client |
2 | 2 |
|
3 | 3 |
import ( |
4 |
+ "github.com/docker/docker/api/types" |
|
4 | 5 |
"github.com/docker/docker/cliconfig/configfile" |
5 | 6 |
"github.com/docker/docker/cliconfig/credentials" |
6 |
- "github.com/docker/engine-api/types" |
|
7 | 7 |
) |
8 | 8 |
|
9 | 9 |
// GetCredentials loads the user credentials from a credentials store. |
... | ... |
@@ -8,9 +8,9 @@ import ( |
8 | 8 |
"time" |
9 | 9 |
|
10 | 10 |
"github.com/docker/docker/api" |
11 |
+ "github.com/docker/docker/api/types" |
|
11 | 12 |
"github.com/docker/docker/pkg/stringid" |
12 | 13 |
"github.com/docker/docker/pkg/stringutils" |
13 |
- "github.com/docker/engine-api/types" |
|
14 | 14 |
"github.com/docker/go-units" |
15 | 15 |
) |
16 | 16 |
|
... | ... |
@@ -7,8 +7,8 @@ import ( |
7 | 7 |
"golang.org/x/net/context" |
8 | 8 |
|
9 | 9 |
"github.com/Sirupsen/logrus" |
10 |
+ "github.com/docker/docker/api/types" |
|
10 | 11 |
"github.com/docker/docker/pkg/stdcopy" |
11 |
- "github.com/docker/engine-api/types" |
|
12 | 12 |
) |
13 | 13 |
|
14 | 14 |
// HoldHijackedConnection handles copying input to and output from streams to the |
... | ... |
@@ -15,6 +15,8 @@ import ( |
15 | 15 |
|
16 | 16 |
"github.com/docker/docker/api" |
17 | 17 |
"github.com/docker/docker/api/client" |
18 |
+ "github.com/docker/docker/api/types" |
|
19 |
+ "github.com/docker/docker/api/types/container" |
|
18 | 20 |
"github.com/docker/docker/builder" |
19 | 21 |
"github.com/docker/docker/builder/dockerignore" |
20 | 22 |
"github.com/docker/docker/cli" |
... | ... |
@@ -27,8 +29,6 @@ import ( |
27 | 27 |
"github.com/docker/docker/pkg/urlutil" |
28 | 28 |
"github.com/docker/docker/reference" |
29 | 29 |
runconfigopts "github.com/docker/docker/runconfig/opts" |
30 |
- "github.com/docker/engine-api/types" |
|
31 |
- "github.com/docker/engine-api/types/container" |
|
32 | 30 |
"github.com/docker/go-units" |
33 | 31 |
"github.com/spf13/cobra" |
34 | 32 |
) |
... | ... |
@@ -5,9 +5,9 @@ import ( |
5 | 5 |
|
6 | 6 |
"github.com/docker/docker/api/client" |
7 | 7 |
"github.com/docker/docker/api/client/formatter" |
8 |
+ "github.com/docker/docker/api/types" |
|
9 |
+ "github.com/docker/docker/api/types/filters" |
|
8 | 10 |
"github.com/docker/docker/cli" |
9 |
- "github.com/docker/engine-api/types" |
|
10 |
- "github.com/docker/engine-api/types/filters" |
|
11 | 11 |
"github.com/spf13/cobra" |
12 | 12 |
) |
13 | 13 |
|
... | ... |
@@ -7,11 +7,11 @@ import ( |
7 | 7 |
"golang.org/x/net/context" |
8 | 8 |
|
9 | 9 |
"github.com/docker/docker/api/client" |
10 |
+ "github.com/docker/docker/api/types" |
|
10 | 11 |
"github.com/docker/docker/cli" |
11 | 12 |
dockeropts "github.com/docker/docker/opts" |
12 | 13 |
"github.com/docker/docker/pkg/jsonmessage" |
13 | 14 |
"github.com/docker/docker/pkg/urlutil" |
14 |
- "github.com/docker/engine-api/types" |
|
15 | 15 |
"github.com/spf13/cobra" |
16 | 16 |
) |
17 | 17 |
|
... | ... |
@@ -9,12 +9,12 @@ import ( |
9 | 9 |
"golang.org/x/net/context" |
10 | 10 |
|
11 | 11 |
"github.com/docker/docker/api/client" |
12 |
+ "github.com/docker/docker/api/types" |
|
13 |
+ "github.com/docker/docker/api/types/filters" |
|
14 |
+ registrytypes "github.com/docker/docker/api/types/registry" |
|
12 | 15 |
"github.com/docker/docker/cli" |
13 | 16 |
"github.com/docker/docker/pkg/stringutils" |
14 | 17 |
"github.com/docker/docker/registry" |
15 |
- "github.com/docker/engine-api/types" |
|
16 |
- "github.com/docker/engine-api/types/filters" |
|
17 |
- registrytypes "github.com/docker/engine-api/types/registry" |
|
18 | 18 |
"github.com/spf13/cobra" |
19 | 19 |
) |
20 | 20 |
|
... | ... |
@@ -4,10 +4,10 @@ import ( |
4 | 4 |
"golang.org/x/net/context" |
5 | 5 |
|
6 | 6 |
"github.com/docker/docker/api/client" |
7 |
+ "github.com/docker/docker/api/types/network" |
|
7 | 8 |
"github.com/docker/docker/cli" |
8 | 9 |
"github.com/docker/docker/opts" |
9 | 10 |
runconfigopts "github.com/docker/docker/runconfig/opts" |
10 |
- "github.com/docker/engine-api/types/network" |
|
11 | 11 |
"github.com/spf13/cobra" |
12 | 12 |
) |
13 | 13 |
|
... | ... |
@@ -8,11 +8,11 @@ import ( |
8 | 8 |
"golang.org/x/net/context" |
9 | 9 |
|
10 | 10 |
"github.com/docker/docker/api/client" |
11 |
+ "github.com/docker/docker/api/types" |
|
12 |
+ "github.com/docker/docker/api/types/network" |
|
11 | 13 |
"github.com/docker/docker/cli" |
12 | 14 |
"github.com/docker/docker/opts" |
13 | 15 |
runconfigopts "github.com/docker/docker/runconfig/opts" |
14 |
- "github.com/docker/engine-api/types" |
|
15 |
- "github.com/docker/engine-api/types/network" |
|
16 | 16 |
"github.com/spf13/cobra" |
17 | 17 |
) |
18 | 18 |
|
... | ... |
@@ -7,9 +7,9 @@ import ( |
7 | 7 |
|
8 | 8 |
"github.com/docker/docker/api/client" |
9 | 9 |
"github.com/docker/docker/api/client/formatter" |
10 |
+ "github.com/docker/docker/api/types" |
|
11 |
+ "github.com/docker/docker/api/types/filters" |
|
10 | 12 |
"github.com/docker/docker/cli" |
11 |
- "github.com/docker/engine-api/types" |
|
12 |
- "github.com/docker/engine-api/types/filters" |
|
13 | 13 |
"github.com/spf13/cobra" |
14 | 14 |
) |
15 | 15 |
|
... | ... |
@@ -8,9 +8,9 @@ import ( |
8 | 8 |
|
9 | 9 |
"github.com/docker/docker/api/client" |
10 | 10 |
"github.com/docker/docker/api/client/inspect" |
11 |
+ "github.com/docker/docker/api/types/swarm" |
|
11 | 12 |
"github.com/docker/docker/cli" |
12 | 13 |
"github.com/docker/docker/pkg/ioutils" |
13 |
- "github.com/docker/engine-api/types/swarm" |
|
14 | 14 |
"github.com/docker/go-units" |
15 | 15 |
"github.com/spf13/cobra" |
16 | 16 |
"golang.org/x/net/context" |
... | ... |
@@ -8,10 +8,10 @@ import ( |
8 | 8 |
"golang.org/x/net/context" |
9 | 9 |
|
10 | 10 |
"github.com/docker/docker/api/client" |
11 |
+ "github.com/docker/docker/api/types" |
|
12 |
+ "github.com/docker/docker/api/types/swarm" |
|
11 | 13 |
"github.com/docker/docker/cli" |
12 | 14 |
"github.com/docker/docker/opts" |
13 |
- "github.com/docker/engine-api/types" |
|
14 |
- "github.com/docker/engine-api/types/swarm" |
|
15 | 15 |
"github.com/spf13/cobra" |
16 | 16 |
) |
17 | 17 |
|
... | ... |
@@ -4,9 +4,9 @@ import ( |
4 | 4 |
"github.com/docker/docker/api/client" |
5 | 5 |
"github.com/docker/docker/api/client/idresolver" |
6 | 6 |
"github.com/docker/docker/api/client/task" |
7 |
+ "github.com/docker/docker/api/types" |
|
7 | 8 |
"github.com/docker/docker/cli" |
8 | 9 |
"github.com/docker/docker/opts" |
9 |
- "github.com/docker/engine-api/types" |
|
10 | 10 |
"github.com/spf13/cobra" |
11 | 11 |
"golang.org/x/net/context" |
12 | 12 |
) |
... | ... |
@@ -5,10 +5,10 @@ import ( |
5 | 5 |
"fmt" |
6 | 6 |
|
7 | 7 |
"github.com/docker/docker/api/client" |
8 |
+ "github.com/docker/docker/api/types/swarm" |
|
8 | 9 |
"github.com/docker/docker/cli" |
9 | 10 |
"github.com/docker/docker/opts" |
10 | 11 |
runconfigopts "github.com/docker/docker/runconfig/opts" |
11 |
- "github.com/docker/engine-api/types/swarm" |
|
12 | 12 |
"github.com/spf13/cobra" |
13 | 13 |
"github.com/spf13/pflag" |
14 | 14 |
"golang.org/x/net/context" |
... | ... |
@@ -8,10 +8,10 @@ import ( |
8 | 8 |
"strings" |
9 | 9 |
|
10 | 10 |
"github.com/docker/docker/api/client" |
11 |
+ "github.com/docker/docker/api/types" |
|
11 | 12 |
"github.com/docker/docker/cli" |
12 | 13 |
"github.com/docker/docker/reference" |
13 | 14 |
"github.com/docker/docker/registry" |
14 |
- "github.com/docker/engine-api/types" |
|
15 | 15 |
"github.com/spf13/cobra" |
16 | 16 |
"golang.org/x/net/context" |
17 | 17 |
) |
... | ... |
@@ -6,9 +6,9 @@ import ( |
6 | 6 |
"fmt" |
7 | 7 |
|
8 | 8 |
"github.com/docker/docker/api/client" |
9 |
+ "github.com/docker/docker/api/types" |
|
9 | 10 |
"github.com/docker/docker/cli" |
10 | 11 |
"github.com/docker/docker/reference" |
11 |
- "github.com/docker/engine-api/types" |
|
12 | 12 |
"github.com/spf13/cobra" |
13 | 13 |
"golang.org/x/net/context" |
14 | 14 |
) |
... | ... |
@@ -12,11 +12,11 @@ import ( |
12 | 12 |
|
13 | 13 |
"golang.org/x/net/context" |
14 | 14 |
|
15 |
+ "github.com/docker/docker/api/types" |
|
16 |
+ registrytypes "github.com/docker/docker/api/types/registry" |
|
15 | 17 |
"github.com/docker/docker/pkg/term" |
16 | 18 |
"github.com/docker/docker/reference" |
17 | 19 |
"github.com/docker/docker/registry" |
18 |
- "github.com/docker/engine-api/types" |
|
19 |
- registrytypes "github.com/docker/engine-api/types/registry" |
|
20 | 20 |
) |
21 | 21 |
|
22 | 22 |
// ElectAuthServer returns the default registry to use (by asking the daemon) |
... | ... |
@@ -10,10 +10,10 @@ import ( |
10 | 10 |
|
11 | 11 |
"github.com/docker/docker/api/client" |
12 | 12 |
"github.com/docker/docker/api/client/inspect" |
13 |
+ "github.com/docker/docker/api/types/swarm" |
|
13 | 14 |
"github.com/docker/docker/cli" |
14 | 15 |
"github.com/docker/docker/pkg/ioutils" |
15 | 16 |
apiclient "github.com/docker/engine-api/client" |
16 |
- "github.com/docker/engine-api/types/swarm" |
|
17 | 17 |
"github.com/docker/go-units" |
18 | 18 |
"github.com/spf13/cobra" |
19 | 19 |
) |
... | ... |
@@ -7,12 +7,12 @@ import ( |
7 | 7 |
"text/tabwriter" |
8 | 8 |
|
9 | 9 |
"github.com/docker/docker/api/client" |
10 |
+ "github.com/docker/docker/api/types" |
|
11 |
+ "github.com/docker/docker/api/types/filters" |
|
12 |
+ "github.com/docker/docker/api/types/swarm" |
|
10 | 13 |
"github.com/docker/docker/cli" |
11 | 14 |
"github.com/docker/docker/opts" |
12 | 15 |
"github.com/docker/docker/pkg/stringid" |
13 |
- "github.com/docker/engine-api/types" |
|
14 |
- "github.com/docker/engine-api/types/filters" |
|
15 |
- "github.com/docker/engine-api/types/swarm" |
|
16 | 16 |
"github.com/spf13/cobra" |
17 | 17 |
"golang.org/x/net/context" |
18 | 18 |
) |
... | ... |
@@ -8,10 +8,10 @@ import ( |
8 | 8 |
"strings" |
9 | 9 |
"time" |
10 | 10 |
|
11 |
+ mounttypes "github.com/docker/docker/api/types/mount" |
|
12 |
+ "github.com/docker/docker/api/types/swarm" |
|
11 | 13 |
"github.com/docker/docker/opts" |
12 | 14 |
runconfigopts "github.com/docker/docker/runconfig/opts" |
13 |
- mounttypes "github.com/docker/engine-api/types/mount" |
|
14 |
- "github.com/docker/engine-api/types/swarm" |
|
15 | 15 |
"github.com/docker/go-connections/nat" |
16 | 16 |
units "github.com/docker/go-units" |
17 | 17 |
"github.com/spf13/cobra" |
... | ... |
@@ -5,9 +5,9 @@ import ( |
5 | 5 |
"github.com/docker/docker/api/client/idresolver" |
6 | 6 |
"github.com/docker/docker/api/client/node" |
7 | 7 |
"github.com/docker/docker/api/client/task" |
8 |
+ "github.com/docker/docker/api/types" |
|
8 | 9 |
"github.com/docker/docker/cli" |
9 | 10 |
"github.com/docker/docker/opts" |
10 |
- "github.com/docker/engine-api/types" |
|
11 | 11 |
"github.com/spf13/cobra" |
12 | 12 |
"golang.org/x/net/context" |
13 | 13 |
) |
... | ... |
@@ -9,12 +9,12 @@ import ( |
9 | 9 |
"golang.org/x/net/context" |
10 | 10 |
|
11 | 11 |
"github.com/docker/docker/api/client" |
12 |
+ "github.com/docker/docker/api/types" |
|
13 |
+ mounttypes "github.com/docker/docker/api/types/mount" |
|
14 |
+ "github.com/docker/docker/api/types/swarm" |
|
12 | 15 |
"github.com/docker/docker/cli" |
13 | 16 |
"github.com/docker/docker/opts" |
14 | 17 |
runconfigopts "github.com/docker/docker/runconfig/opts" |
15 |
- "github.com/docker/engine-api/types" |
|
16 |
- mounttypes "github.com/docker/engine-api/types/mount" |
|
17 |
- "github.com/docker/engine-api/types/swarm" |
|
18 | 18 |
"github.com/docker/go-connections/nat" |
19 | 19 |
shlex "github.com/flynn-archive/go-shlex" |
20 | 20 |
"github.com/spf13/cobra" |
... | ... |
@@ -4,9 +4,9 @@ import ( |
4 | 4 |
"sort" |
5 | 5 |
"testing" |
6 | 6 |
|
7 |
+ mounttypes "github.com/docker/docker/api/types/mount" |
|
8 |
+ "github.com/docker/docker/api/types/swarm" |
|
7 | 9 |
"github.com/docker/docker/pkg/testutil/assert" |
8 |
- mounttypes "github.com/docker/engine-api/types/mount" |
|
9 |
- "github.com/docker/engine-api/types/swarm" |
|
10 | 10 |
) |
11 | 11 |
|
12 | 12 |
func TestUpdateServiceArgs(t *testing.T) { |
... | ... |
@@ -5,10 +5,10 @@ package stack |
5 | 5 |
import ( |
6 | 6 |
"golang.org/x/net/context" |
7 | 7 |
|
8 |
+ "github.com/docker/docker/api/types" |
|
9 |
+ "github.com/docker/docker/api/types/filters" |
|
10 |
+ "github.com/docker/docker/api/types/swarm" |
|
8 | 11 |
"github.com/docker/engine-api/client" |
9 |
- "github.com/docker/engine-api/types" |
|
10 |
- "github.com/docker/engine-api/types/filters" |
|
11 |
- "github.com/docker/engine-api/types/swarm" |
|
12 | 12 |
) |
13 | 13 |
|
14 | 14 |
const ( |
... | ... |
@@ -10,9 +10,9 @@ import ( |
10 | 10 |
|
11 | 11 |
"github.com/docker/docker/api/client" |
12 | 12 |
"github.com/docker/docker/api/client/bundlefile" |
13 |
+ "github.com/docker/docker/api/types" |
|
14 |
+ "github.com/docker/docker/api/types/swarm" |
|
13 | 15 |
"github.com/docker/docker/cli" |
14 |
- "github.com/docker/engine-api/types" |
|
15 |
- "github.com/docker/engine-api/types/swarm" |
|
16 | 16 |
) |
17 | 17 |
|
18 | 18 |
const ( |
... | ... |
@@ -10,10 +10,10 @@ import ( |
10 | 10 |
"github.com/docker/docker/api/client" |
11 | 11 |
"github.com/docker/docker/api/client/idresolver" |
12 | 12 |
"github.com/docker/docker/api/client/task" |
13 |
+ "github.com/docker/docker/api/types" |
|
14 |
+ "github.com/docker/docker/api/types/swarm" |
|
13 | 15 |
"github.com/docker/docker/cli" |
14 | 16 |
"github.com/docker/docker/opts" |
15 |
- "github.com/docker/engine-api/types" |
|
16 |
- "github.com/docker/engine-api/types/swarm" |
|
17 | 17 |
"github.com/spf13/cobra" |
18 | 18 |
) |
19 | 19 |
|
... | ... |
@@ -9,10 +9,10 @@ import ( |
9 | 9 |
|
10 | 10 |
"github.com/docker/docker/api/client" |
11 | 11 |
"github.com/docker/docker/api/client/service" |
12 |
+ "github.com/docker/docker/api/types" |
|
13 |
+ "github.com/docker/docker/api/types/filters" |
|
12 | 14 |
"github.com/docker/docker/cli" |
13 | 15 |
"github.com/docker/docker/opts" |
14 |
- "github.com/docker/engine-api/types" |
|
15 |
- "github.com/docker/engine-api/types/filters" |
|
16 | 16 |
"github.com/spf13/cobra" |
17 | 17 |
) |
18 | 18 |
|
... | ... |
@@ -8,8 +8,8 @@ import ( |
8 | 8 |
"golang.org/x/net/context" |
9 | 9 |
|
10 | 10 |
"github.com/docker/docker/api/client" |
11 |
+ "github.com/docker/docker/api/types/swarm" |
|
11 | 12 |
"github.com/docker/docker/cli" |
12 |
- "github.com/docker/engine-api/types/swarm" |
|
13 | 13 |
"github.com/spf13/cobra" |
14 | 14 |
"github.com/spf13/pflag" |
15 | 15 |
) |
... | ... |
@@ -6,8 +6,8 @@ import ( |
6 | 6 |
"golang.org/x/net/context" |
7 | 7 |
|
8 | 8 |
"github.com/docker/docker/api/client" |
9 |
+ "github.com/docker/docker/api/types/swarm" |
|
9 | 10 |
"github.com/docker/docker/cli" |
10 |
- "github.com/docker/engine-api/types/swarm" |
|
11 | 11 |
"github.com/spf13/cobra" |
12 | 12 |
"github.com/spf13/pflag" |
13 | 13 |
) |
... | ... |
@@ -10,11 +10,11 @@ import ( |
10 | 10 |
"golang.org/x/net/context" |
11 | 11 |
|
12 | 12 |
"github.com/docker/docker/api/client" |
13 |
+ "github.com/docker/docker/api/types" |
|
14 |
+ eventtypes "github.com/docker/docker/api/types/events" |
|
15 |
+ "github.com/docker/docker/api/types/filters" |
|
13 | 16 |
"github.com/docker/docker/cli" |
14 | 17 |
"github.com/docker/docker/pkg/jsonlog" |
15 |
- "github.com/docker/engine-api/types" |
|
16 |
- eventtypes "github.com/docker/engine-api/types/events" |
|
17 |
- "github.com/docker/engine-api/types/filters" |
|
18 | 18 |
"github.com/spf13/cobra" |
19 | 19 |
) |
20 | 20 |
|
... | ... |
@@ -8,12 +8,12 @@ import ( |
8 | 8 |
"golang.org/x/net/context" |
9 | 9 |
|
10 | 10 |
"github.com/docker/docker/api/client" |
11 |
+ "github.com/docker/docker/api/types" |
|
12 |
+ "github.com/docker/docker/api/types/swarm" |
|
11 | 13 |
"github.com/docker/docker/cli" |
12 | 14 |
"github.com/docker/docker/pkg/ioutils" |
13 | 15 |
"github.com/docker/docker/utils" |
14 | 16 |
"github.com/docker/docker/utils/templates" |
15 |
- "github.com/docker/engine-api/types" |
|
16 |
- "github.com/docker/engine-api/types/swarm" |
|
17 | 17 |
"github.com/docker/go-units" |
18 | 18 |
"github.com/spf13/cobra" |
19 | 19 |
) |
... | ... |
@@ -7,11 +7,11 @@ import ( |
7 | 7 |
"golang.org/x/net/context" |
8 | 8 |
|
9 | 9 |
"github.com/docker/docker/api/client" |
10 |
+ "github.com/docker/docker/api/types" |
|
10 | 11 |
"github.com/docker/docker/cli" |
11 | 12 |
"github.com/docker/docker/dockerversion" |
12 | 13 |
"github.com/docker/docker/utils" |
13 | 14 |
"github.com/docker/docker/utils/templates" |
14 |
- "github.com/docker/engine-api/types" |
|
15 | 15 |
"github.com/spf13/cobra" |
16 | 16 |
) |
17 | 17 |
|
... | ... |
@@ -22,13 +22,13 @@ import ( |
22 | 22 |
"github.com/docker/distribution/digest" |
23 | 23 |
"github.com/docker/distribution/registry/client/auth" |
24 | 24 |
"github.com/docker/distribution/registry/client/transport" |
25 |
+ "github.com/docker/docker/api/types" |
|
26 |
+ registrytypes "github.com/docker/docker/api/types/registry" |
|
25 | 27 |
"github.com/docker/docker/cliconfig" |
26 | 28 |
"github.com/docker/docker/distribution" |
27 | 29 |
"github.com/docker/docker/pkg/jsonmessage" |
28 | 30 |
"github.com/docker/docker/reference" |
29 | 31 |
"github.com/docker/docker/registry" |
30 |
- "github.com/docker/engine-api/types" |
|
31 |
- registrytypes "github.com/docker/engine-api/types/registry" |
|
32 | 32 |
"github.com/docker/go-connections/tlsconfig" |
33 | 33 |
"github.com/docker/notary/client" |
34 | 34 |
"github.com/docker/notary/passphrase" |
... | ... |
@@ -14,10 +14,10 @@ import ( |
14 | 14 |
"golang.org/x/net/context" |
15 | 15 |
|
16 | 16 |
"github.com/Sirupsen/logrus" |
17 |
+ "github.com/docker/docker/api/types" |
|
17 | 18 |
"github.com/docker/docker/pkg/signal" |
18 | 19 |
"github.com/docker/docker/pkg/term" |
19 | 20 |
"github.com/docker/engine-api/client" |
20 |
- "github.com/docker/engine-api/types" |
|
21 | 21 |
) |
22 | 22 |
|
23 | 23 |
func (cli *DockerCli) resizeTty(ctx context.Context, id string, isExec bool) { |
... | ... |
@@ -6,10 +6,10 @@ import ( |
6 | 6 |
"golang.org/x/net/context" |
7 | 7 |
|
8 | 8 |
"github.com/docker/docker/api/client" |
9 |
+ "github.com/docker/docker/api/types" |
|
9 | 10 |
"github.com/docker/docker/cli" |
10 | 11 |
"github.com/docker/docker/opts" |
11 | 12 |
runconfigopts "github.com/docker/docker/runconfig/opts" |
12 |
- "github.com/docker/engine-api/types" |
|
13 | 13 |
"github.com/spf13/cobra" |
14 | 14 |
) |
15 | 15 |
|
... | ... |
@@ -7,9 +7,9 @@ import ( |
7 | 7 |
|
8 | 8 |
"github.com/docker/docker/api/client" |
9 | 9 |
"github.com/docker/docker/api/client/formatter" |
10 |
+ "github.com/docker/docker/api/types" |
|
11 |
+ "github.com/docker/docker/api/types/filters" |
|
10 | 12 |
"github.com/docker/docker/cli" |
11 |
- "github.com/docker/engine-api/types" |
|
12 |
- "github.com/docker/engine-api/types/filters" |
|
13 | 13 |
"github.com/spf13/cobra" |
14 | 14 |
) |
15 | 15 |
|
... | ... |
@@ -12,9 +12,9 @@ import ( |
12 | 12 |
"strings" |
13 | 13 |
|
14 | 14 |
"github.com/Sirupsen/logrus" |
15 |
+ "github.com/docker/docker/api/types" |
|
15 | 16 |
"github.com/docker/docker/pkg/ioutils" |
16 | 17 |
"github.com/docker/docker/pkg/system" |
17 |
- "github.com/docker/engine-api/types" |
|
18 | 18 |
"github.com/docker/libtrust" |
19 | 19 |
) |
20 | 20 |
|
... | ... |
@@ -3,8 +3,8 @@ package httputils |
3 | 3 |
import ( |
4 | 4 |
"io" |
5 | 5 |
|
6 |
- "github.com/docker/engine-api/types/container" |
|
7 |
- "github.com/docker/engine-api/types/network" |
|
6 |
+ "github.com/docker/docker/api/types/container" |
|
7 |
+ "github.com/docker/docker/api/types/network" |
|
8 | 8 |
) |
9 | 9 |
|
10 | 10 |
// ContainerDecoder specifies how |
... | ... |
@@ -5,8 +5,8 @@ import ( |
5 | 5 |
"strings" |
6 | 6 |
|
7 | 7 |
"github.com/Sirupsen/logrus" |
8 |
- "github.com/docker/engine-api/types" |
|
9 |
- "github.com/docker/engine-api/types/versions" |
|
8 |
+ "github.com/docker/docker/api/types" |
|
9 |
+ "github.com/docker/docker/api/types/versions" |
|
10 | 10 |
"github.com/gorilla/mux" |
11 | 11 |
"google.golang.org/grpc" |
12 | 12 |
) |
12 | 12 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,22 @@ |
0 |
+package types |
|
1 |
+ |
|
2 |
+// AuthConfig contains authorization information for connecting to a Registry |
|
3 |
+type AuthConfig struct { |
|
4 |
+ Username string `json:"username,omitempty"` |
|
5 |
+ Password string `json:"password,omitempty"` |
|
6 |
+ Auth string `json:"auth,omitempty"` |
|
7 |
+ |
|
8 |
+ // Email is an optional value associated with the username. |
|
9 |
+ // This field is deprecated and will be removed in a later |
|
10 |
+ // version of docker. |
|
11 |
+ Email string `json:"email,omitempty"` |
|
12 |
+ |
|
13 |
+ ServerAddress string `json:"serveraddress,omitempty"` |
|
14 |
+ |
|
15 |
+ // IdentityToken is used to authenticate the user and get |
|
16 |
+ // an access token for the registry. |
|
17 |
+ IdentityToken string `json:"identitytoken,omitempty"` |
|
18 |
+ |
|
19 |
+ // RegistryToken is a bearer token to be sent to a registry |
|
20 |
+ RegistryToken string `json:"registrytoken,omitempty"` |
|
21 |
+} |
... | ... |
@@ -6,8 +6,8 @@ package backend |
6 | 6 |
import ( |
7 | 7 |
"io" |
8 | 8 |
|
9 |
+ "github.com/docker/docker/api/types" |
|
9 | 10 |
"github.com/docker/docker/pkg/streamformatter" |
10 |
- "github.com/docker/engine-api/types" |
|
11 | 11 |
) |
12 | 12 |
|
13 | 13 |
// ContainerAttachConfig holds the streams to use when connecting to a container to view logs. |
14 | 14 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,23 @@ |
0 |
+package blkiodev |
|
1 |
+ |
|
2 |
+import "fmt" |
|
3 |
+ |
|
4 |
+// WeightDevice is a structure that holds device:weight pair |
|
5 |
+type WeightDevice struct { |
|
6 |
+ Path string |
|
7 |
+ Weight uint16 |
|
8 |
+} |
|
9 |
+ |
|
10 |
+func (w *WeightDevice) String() string { |
|
11 |
+ return fmt.Sprintf("%s:%d", w.Path, w.Weight) |
|
12 |
+} |
|
13 |
+ |
|
14 |
+// ThrottleDevice is a structure that holds device:rate_per_second pair |
|
15 |
+type ThrottleDevice struct { |
|
16 |
+ Path string |
|
17 |
+ Rate uint64 |
|
18 |
+} |
|
19 |
+ |
|
20 |
+func (t *ThrottleDevice) String() string { |
|
21 |
+ return fmt.Sprintf("%s:%d", t.Path, t.Rate) |
|
22 |
+} |
0 | 23 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,300 @@ |
0 |
+package types |
|
1 |
+ |
|
2 |
+import ( |
|
3 |
+ "bufio" |
|
4 |
+ "io" |
|
5 |
+ "net" |
|
6 |
+ |
|
7 |
+ "github.com/docker/docker/api/types/container" |
|
8 |
+ "github.com/docker/docker/api/types/filters" |
|
9 |
+ "github.com/docker/go-units" |
|
10 |
+) |
|
11 |
+ |
|
12 |
+// CheckpointCreateOptions holds parameters to create a checkpoint from a container |
|
13 |
+type CheckpointCreateOptions struct { |
|
14 |
+ CheckpointID string |
|
15 |
+ Exit bool |
|
16 |
+} |
|
17 |
+ |
|
18 |
+// ContainerAttachOptions holds parameters to attach to a container. |
|
19 |
+type ContainerAttachOptions struct { |
|
20 |
+ Stream bool |
|
21 |
+ Stdin bool |
|
22 |
+ Stdout bool |
|
23 |
+ Stderr bool |
|
24 |
+ DetachKeys string |
|
25 |
+} |
|
26 |
+ |
|
27 |
+// ContainerCommitOptions holds parameters to commit changes into a container. |
|
28 |
+type ContainerCommitOptions struct { |
|
29 |
+ Reference string |
|
30 |
+ Comment string |
|
31 |
+ Author string |
|
32 |
+ Changes []string |
|
33 |
+ Pause bool |
|
34 |
+ Config *container.Config |
|
35 |
+} |
|
36 |
+ |
|
37 |
+// ContainerExecInspect holds information returned by exec inspect. |
|
38 |
+type ContainerExecInspect struct { |
|
39 |
+ ExecID string |
|
40 |
+ ContainerID string |
|
41 |
+ Running bool |
|
42 |
+ ExitCode int |
|
43 |
+} |
|
44 |
+ |
|
45 |
+// ContainerListOptions holds parameters to list containers with. |
|
46 |
+type ContainerListOptions struct { |
|
47 |
+ Quiet bool |
|
48 |
+ Size bool |
|
49 |
+ All bool |
|
50 |
+ Latest bool |
|
51 |
+ Since string |
|
52 |
+ Before string |
|
53 |
+ Limit int |
|
54 |
+ Filter filters.Args |
|
55 |
+} |
|
56 |
+ |
|
57 |
+// ContainerLogsOptions holds parameters to filter logs with. |
|
58 |
+type ContainerLogsOptions struct { |
|
59 |
+ ShowStdout bool |
|
60 |
+ ShowStderr bool |
|
61 |
+ Since string |
|
62 |
+ Timestamps bool |
|
63 |
+ Follow bool |
|
64 |
+ Tail string |
|
65 |
+ Details bool |
|
66 |
+} |
|
67 |
+ |
|
68 |
+// ContainerRemoveOptions holds parameters to remove containers. |
|
69 |
+type ContainerRemoveOptions struct { |
|
70 |
+ RemoveVolumes bool |
|
71 |
+ RemoveLinks bool |
|
72 |
+ Force bool |
|
73 |
+} |
|
74 |
+ |
|
75 |
+// ContainerStartOptions holds parameters to start containers. |
|
76 |
+type ContainerStartOptions struct { |
|
77 |
+ CheckpointID string |
|
78 |
+} |
|
79 |
+ |
|
80 |
+// CopyToContainerOptions holds information |
|
81 |
+// about files to copy into a container |
|
82 |
+type CopyToContainerOptions struct { |
|
83 |
+ AllowOverwriteDirWithFile bool |
|
84 |
+} |
|
85 |
+ |
|
86 |
+// EventsOptions hold parameters to filter events with. |
|
87 |
+type EventsOptions struct { |
|
88 |
+ Since string |
|
89 |
+ Until string |
|
90 |
+ Filters filters.Args |
|
91 |
+} |
|
92 |
+ |
|
93 |
+// NetworkListOptions holds parameters to filter the list of networks with. |
|
94 |
+type NetworkListOptions struct { |
|
95 |
+ Filters filters.Args |
|
96 |
+} |
|
97 |
+ |
|
98 |
+// HijackedResponse holds connection information for a hijacked request. |
|
99 |
+type HijackedResponse struct { |
|
100 |
+ Conn net.Conn |
|
101 |
+ Reader *bufio.Reader |
|
102 |
+} |
|
103 |
+ |
|
104 |
+// Close closes the hijacked connection and reader. |
|
105 |
+func (h *HijackedResponse) Close() { |
|
106 |
+ h.Conn.Close() |
|
107 |
+} |
|
108 |
+ |
|
109 |
+// CloseWriter is an interface that implements structs |
|
110 |
+// that close input streams to prevent from writing. |
|
111 |
+type CloseWriter interface { |
|
112 |
+ CloseWrite() error |
|
113 |
+} |
|
114 |
+ |
|
115 |
+// CloseWrite closes a readWriter for writing. |
|
116 |
+func (h *HijackedResponse) CloseWrite() error { |
|
117 |
+ if conn, ok := h.Conn.(CloseWriter); ok { |
|
118 |
+ return conn.CloseWrite() |
|
119 |
+ } |
|
120 |
+ return nil |
|
121 |
+} |
|
122 |
+ |
|
123 |
+// ImageBuildOptions holds the information |
|
124 |
+// necessary to build images. |
|
125 |
+type ImageBuildOptions struct { |
|
126 |
+ Tags []string |
|
127 |
+ SuppressOutput bool |
|
128 |
+ RemoteContext string |
|
129 |
+ NoCache bool |
|
130 |
+ Remove bool |
|
131 |
+ ForceRemove bool |
|
132 |
+ PullParent bool |
|
133 |
+ Isolation container.Isolation |
|
134 |
+ CPUSetCPUs string |
|
135 |
+ CPUSetMems string |
|
136 |
+ CPUShares int64 |
|
137 |
+ CPUQuota int64 |
|
138 |
+ CPUPeriod int64 |
|
139 |
+ Memory int64 |
|
140 |
+ MemorySwap int64 |
|
141 |
+ CgroupParent string |
|
142 |
+ ShmSize int64 |
|
143 |
+ Dockerfile string |
|
144 |
+ Ulimits []*units.Ulimit |
|
145 |
+ BuildArgs map[string]string |
|
146 |
+ AuthConfigs map[string]AuthConfig |
|
147 |
+ Context io.Reader |
|
148 |
+ Labels map[string]string |
|
149 |
+ // squash the resulting image's layers to the parent |
|
150 |
+ // preserves the original image and creates a new one from the parent with all |
|
151 |
+ // the changes applied to a single layer |
|
152 |
+ Squash bool |
|
153 |
+} |
|
154 |
+ |
|
155 |
+// ImageBuildResponse holds information |
|
156 |
+// returned by a server after building |
|
157 |
+// an image. |
|
158 |
+type ImageBuildResponse struct { |
|
159 |
+ Body io.ReadCloser |
|
160 |
+ OSType string |
|
161 |
+} |
|
162 |
+ |
|
163 |
+// ImageCreateOptions holds information to create images. |
|
164 |
+type ImageCreateOptions struct { |
|
165 |
+ RegistryAuth string // RegistryAuth is the base64 encoded credentials for the registry |
|
166 |
+} |
|
167 |
+ |
|
168 |
+// ImageImportSource holds source information for ImageImport |
|
169 |
+type ImageImportSource struct { |
|
170 |
+ Source io.Reader // Source is the data to send to the server to create this image from (mutually exclusive with SourceName) |
|
171 |
+ SourceName string // SourceName is the name of the image to pull (mutually exclusive with Source) |
|
172 |
+} |
|
173 |
+ |
|
174 |
+// ImageImportOptions holds information to import images from the client host. |
|
175 |
+type ImageImportOptions struct { |
|
176 |
+ Tag string // Tag is the name to tag this image with. This attribute is deprecated. |
|
177 |
+ Message string // Message is the message to tag the image with |
|
178 |
+ Changes []string // Changes are the raw changes to apply to this image |
|
179 |
+} |
|
180 |
+ |
|
181 |
+// ImageListOptions holds parameters to filter the list of images with. |
|
182 |
+type ImageListOptions struct { |
|
183 |
+ MatchName string |
|
184 |
+ All bool |
|
185 |
+ Filters filters.Args |
|
186 |
+} |
|
187 |
+ |
|
188 |
+// ImageLoadResponse returns information to the client about a load process. |
|
189 |
+type ImageLoadResponse struct { |
|
190 |
+ // Body must be closed to avoid a resource leak |
|
191 |
+ Body io.ReadCloser |
|
192 |
+ JSON bool |
|
193 |
+} |
|
194 |
+ |
|
195 |
+// ImagePullOptions holds information to pull images. |
|
196 |
+type ImagePullOptions struct { |
|
197 |
+ All bool |
|
198 |
+ RegistryAuth string // RegistryAuth is the base64 encoded credentials for the registry |
|
199 |
+ PrivilegeFunc RequestPrivilegeFunc |
|
200 |
+} |
|
201 |
+ |
|
202 |
+// RequestPrivilegeFunc is a function interface that |
|
203 |
+// clients can supply to retry operations after |
|
204 |
+// getting an authorization error. |
|
205 |
+// This function returns the registry authentication |
|
206 |
+// header value in base 64 format, or an error |
|
207 |
+// if the privilege request fails. |
|
208 |
+type RequestPrivilegeFunc func() (string, error) |
|
209 |
+ |
|
210 |
+//ImagePushOptions holds information to push images. |
|
211 |
+type ImagePushOptions ImagePullOptions |
|
212 |
+ |
|
213 |
+// ImageRemoveOptions holds parameters to remove images. |
|
214 |
+type ImageRemoveOptions struct { |
|
215 |
+ Force bool |
|
216 |
+ PruneChildren bool |
|
217 |
+} |
|
218 |
+ |
|
219 |
+// ImageSearchOptions holds parameters to search images with. |
|
220 |
+type ImageSearchOptions struct { |
|
221 |
+ RegistryAuth string |
|
222 |
+ PrivilegeFunc RequestPrivilegeFunc |
|
223 |
+ Filters filters.Args |
|
224 |
+ Limit int |
|
225 |
+} |
|
226 |
+ |
|
227 |
+// ResizeOptions holds parameters to resize a tty. |
|
228 |
+// It can be used to resize container ttys and |
|
229 |
+// exec process ttys too. |
|
230 |
+type ResizeOptions struct { |
|
231 |
+ Height int |
|
232 |
+ Width int |
|
233 |
+} |
|
234 |
+ |
|
235 |
+// VersionResponse holds version information for the client and the server |
|
236 |
+type VersionResponse struct { |
|
237 |
+ Client *Version |
|
238 |
+ Server *Version |
|
239 |
+} |
|
240 |
+ |
|
241 |
+// ServerOK returns true when the client could connect to the docker server |
|
242 |
+// and parse the information received. It returns false otherwise. |
|
243 |
+func (v VersionResponse) ServerOK() bool { |
|
244 |
+ return v.Server != nil |
|
245 |
+} |
|
246 |
+ |
|
247 |
+// NodeListOptions holds parameters to list nodes with. |
|
248 |
+type NodeListOptions struct { |
|
249 |
+ Filter filters.Args |
|
250 |
+} |
|
251 |
+ |
|
252 |
+// NodeRemoveOptions holds parameters to remove nodes with. |
|
253 |
+type NodeRemoveOptions struct { |
|
254 |
+ Force bool |
|
255 |
+} |
|
256 |
+ |
|
257 |
+// ServiceCreateOptions contains the options to use when creating a service. |
|
258 |
+type ServiceCreateOptions struct { |
|
259 |
+ // EncodedRegistryAuth is the encoded registry authorization credentials to |
|
260 |
+ // use when updating the service. |
|
261 |
+ // |
|
262 |
+ // This field follows the format of the X-Registry-Auth header. |
|
263 |
+ EncodedRegistryAuth string |
|
264 |
+} |
|
265 |
+ |
|
266 |
+// ServiceCreateResponse contains the information returned to a client |
|
267 |
+// on the creation of a new service. |
|
268 |
+type ServiceCreateResponse struct { |
|
269 |
+ // ID is the ID of the created service. |
|
270 |
+ ID string |
|
271 |
+} |
|
272 |
+ |
|
273 |
+// ServiceUpdateOptions contains the options to be used for updating services. |
|
274 |
+type ServiceUpdateOptions struct { |
|
275 |
+ // EncodedRegistryAuth is the encoded registry authorization credentials to |
|
276 |
+ // use when updating the service. |
|
277 |
+ // |
|
278 |
+ // This field follows the format of the X-Registry-Auth header. |
|
279 |
+ EncodedRegistryAuth string |
|
280 |
+ |
|
281 |
+ // TODO(stevvooe): Consider moving the version parameter of ServiceUpdate |
|
282 |
+ // into this field. While it does open API users up to racy writes, most |
|
283 |
+ // users may not need that level of consistency in practice. |
|
284 |
+} |
|
285 |
+ |
|
286 |
+// ServiceListOptions holds parameters to list services with. |
|
287 |
+type ServiceListOptions struct { |
|
288 |
+ Filter filters.Args |
|
289 |
+} |
|
290 |
+ |
|
291 |
+// TaskListOptions holds parameters to list tasks with. |
|
292 |
+type TaskListOptions struct { |
|
293 |
+ Filter filters.Args |
|
294 |
+} |
|
295 |
+ |
|
296 |
+// PluginRemoveOptions holds parameters to remove plugins. |
|
297 |
+type PluginRemoveOptions struct { |
|
298 |
+ Force bool |
|
299 |
+} |
0 | 300 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,61 @@ |
0 |
+package types |
|
1 |
+ |
|
2 |
+import ( |
|
3 |
+ "github.com/docker/docker/api/types/container" |
|
4 |
+ "github.com/docker/docker/api/types/network" |
|
5 |
+) |
|
6 |
+ |
|
7 |
+// configs holds structs used for internal communication between the |
|
8 |
+// frontend (such as an http server) and the backend (such as the |
|
9 |
+// docker daemon). |
|
10 |
+ |
|
11 |
+// ContainerCreateConfig is the parameter set to ContainerCreate() |
|
12 |
+type ContainerCreateConfig struct { |
|
13 |
+ Name string |
|
14 |
+ Config *container.Config |
|
15 |
+ HostConfig *container.HostConfig |
|
16 |
+ NetworkingConfig *network.NetworkingConfig |
|
17 |
+ AdjustCPUShares bool |
|
18 |
+} |
|
19 |
+ |
|
20 |
+// ContainerRmConfig holds arguments for the container remove |
|
21 |
+// operation. This struct is used to tell the backend what operations |
|
22 |
+// to perform. |
|
23 |
+type ContainerRmConfig struct { |
|
24 |
+ ForceRemove, RemoveVolume, RemoveLink bool |
|
25 |
+} |
|
26 |
+ |
|
27 |
+// ContainerCommitConfig contains build configs for commit operation, |
|
28 |
+// and is used when making a commit with the current state of the container. |
|
29 |
+type ContainerCommitConfig struct { |
|
30 |
+ Pause bool |
|
31 |
+ Repo string |
|
32 |
+ Tag string |
|
33 |
+ Author string |
|
34 |
+ Comment string |
|
35 |
+ // merge container config into commit config before commit |
|
36 |
+ MergeConfigs bool |
|
37 |
+ Config *container.Config |
|
38 |
+} |
|
39 |
+ |
|
40 |
+// ExecConfig is a small subset of the Config struct that holds the configuration |
|
41 |
+// for the exec feature of docker. |
|
42 |
+type ExecConfig struct { |
|
43 |
+ User string // User that will run the command |
|
44 |
+ Privileged bool // Is the container in privileged mode |
|
45 |
+ Tty bool // Attach standard streams to a tty. |
|
46 |
+ AttachStdin bool // Attach the standard input, makes possible user interaction |
|
47 |
+ AttachStderr bool // Attach the standard error |
|
48 |
+ AttachStdout bool // Attach the standard output |
|
49 |
+ Detach bool // Execute in detach mode |
|
50 |
+ DetachKeys string // Escape keys for detach |
|
51 |
+ Env []string // Environment variables |
|
52 |
+ Cmd []string // Execution commands and args |
|
53 |
+} |
|
54 |
+ |
|
55 |
+// PluginRmConfig holds arguments for the plugin remove |
|
56 |
+// operation. This struct is used to tell the backend what operations |
|
57 |
+// to perform. |
|
58 |
+type PluginRmConfig struct { |
|
59 |
+ ForceRemove bool |
|
60 |
+} |
0 | 61 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,62 @@ |
0 |
+package container |
|
1 |
+ |
|
2 |
+import ( |
|
3 |
+ "time" |
|
4 |
+ |
|
5 |
+ "github.com/docker/docker/api/types/strslice" |
|
6 |
+ "github.com/docker/go-connections/nat" |
|
7 |
+) |
|
8 |
+ |
|
9 |
+// HealthConfig holds configuration settings for the HEALTHCHECK feature. |
|
10 |
+type HealthConfig struct { |
|
11 |
+ // Test is the test to perform to check that the container is healthy. |
|
12 |
+ // An empty slice means to inherit the default. |
|
13 |
+ // The options are: |
|
14 |
+ // {} : inherit healthcheck |
|
15 |
+ // {"NONE"} : disable healthcheck |
|
16 |
+ // {"CMD", args...} : exec arguments directly |
|
17 |
+ // {"CMD-SHELL", command} : run command with system's default shell |
|
18 |
+ Test []string `json:",omitempty"` |
|
19 |
+ |
|
20 |
+ // Zero means to inherit. Durations are expressed as integer nanoseconds. |
|
21 |
+ Interval time.Duration `json:",omitempty"` // Interval is the time to wait between checks. |
|
22 |
+ Timeout time.Duration `json:",omitempty"` // Timeout is the time to wait before considering the check to have hung. |
|
23 |
+ |
|
24 |
+ // Retries is the number of consecutive failures needed to consider a container as unhealthy. |
|
25 |
+ // Zero means inherit. |
|
26 |
+ Retries int `json:",omitempty"` |
|
27 |
+} |
|
28 |
+ |
|
29 |
+// Config contains the configuration data about a container. |
|
30 |
+// It should hold only portable information about the container. |
|
31 |
+// Here, "portable" means "independent from the host we are running on". |
|
32 |
+// Non-portable information *should* appear in HostConfig. |
|
33 |
+// All fields added to this struct must be marked `omitempty` to keep getting |
|
34 |
+// predictable hashes from the old `v1Compatibility` configuration. |
|
35 |
+type Config struct { |
|
36 |
+ Hostname string // Hostname |
|
37 |
+ Domainname string // Domainname |
|
38 |
+ User string // User that will run the command(s) inside the container, also support user:group |
|
39 |
+ AttachStdin bool // Attach the standard input, makes possible user interaction |
|
40 |
+ AttachStdout bool // Attach the standard output |
|
41 |
+ AttachStderr bool // Attach the standard error |
|
42 |
+ ExposedPorts map[nat.Port]struct{} `json:",omitempty"` // List of exposed ports |
|
43 |
+ Tty bool // Attach standard streams to a tty, including stdin if it is not closed. |
|
44 |
+ OpenStdin bool // Open stdin |
|
45 |
+ StdinOnce bool // If true, close stdin after the 1 attached client disconnects. |
|
46 |
+ Env []string // List of environment variable to set in the container |
|
47 |
+ Cmd strslice.StrSlice // Command to run when starting the container |
|
48 |
+ Healthcheck *HealthConfig `json:",omitempty"` // Healthcheck describes how to check the container is healthy |
|
49 |
+ ArgsEscaped bool `json:",omitempty"` // True if command is already escaped (Windows specific) |
|
50 |
+ Image string // Name of the image as it was passed by the operator (eg. could be symbolic) |
|
51 |
+ Volumes map[string]struct{} // List of volumes (mounts) used for the container |
|
52 |
+ WorkingDir string // Current directory (PWD) in the command will be launched |
|
53 |
+ Entrypoint strslice.StrSlice // Entrypoint to run when starting the container |
|
54 |
+ NetworkDisabled bool `json:",omitempty"` // Is network disabled |
|
55 |
+ MacAddress string `json:",omitempty"` // Mac Address of the container |
|
56 |
+ OnBuild []string // ONBUILD metadata that were defined on the image Dockerfile |
|
57 |
+ Labels map[string]string // List of labels set to this container |
|
58 |
+ StopSignal string `json:",omitempty"` // Signal to stop a container |
|
59 |
+ StopTimeout *int `json:",omitempty"` // Timeout (in seconds) to stop a container |
|
60 |
+ Shell strslice.StrSlice `json:",omitempty"` // Shell for shell-form of RUN, CMD, ENTRYPOINT |
|
61 |
+} |
0 | 62 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,324 @@ |
0 |
+package container |
|
1 |
+ |
|
2 |
+import ( |
|
3 |
+ "strings" |
|
4 |
+ |
|
5 |
+ "github.com/docker/docker/api/types/blkiodev" |
|
6 |
+ "github.com/docker/docker/api/types/mount" |
|
7 |
+ "github.com/docker/docker/api/types/strslice" |
|
8 |
+ "github.com/docker/go-connections/nat" |
|
9 |
+ "github.com/docker/go-units" |
|
10 |
+) |
|
11 |
+ |
|
12 |
+// NetworkMode represents the container network stack. |
|
13 |
+type NetworkMode string |
|
14 |
+ |
|
15 |
+// Isolation represents the isolation technology of a container. The supported |
|
16 |
+// values are platform specific |
|
17 |
+type Isolation string |
|
18 |
+ |
|
19 |
+// IsDefault indicates the default isolation technology of a container. On Linux this |
|
20 |
+// is the native driver. On Windows, this is a Windows Server Container. |
|
21 |
+func (i Isolation) IsDefault() bool { |
|
22 |
+ return strings.ToLower(string(i)) == "default" || string(i) == "" |
|
23 |
+} |
|
24 |
+ |
|
25 |
+// IpcMode represents the container ipc stack. |
|
26 |
+type IpcMode string |
|
27 |
+ |
|
28 |
+// IsPrivate indicates whether the container uses its private ipc stack. |
|
29 |
+func (n IpcMode) IsPrivate() bool { |
|
30 |
+ return !(n.IsHost() || n.IsContainer()) |
|
31 |
+} |
|
32 |
+ |
|
33 |
+// IsHost indicates whether the container uses the host's ipc stack. |
|
34 |
+func (n IpcMode) IsHost() bool { |
|
35 |
+ return n == "host" |
|
36 |
+} |
|
37 |
+ |
|
38 |
+// IsContainer indicates whether the container uses a container's ipc stack. |
|
39 |
+func (n IpcMode) IsContainer() bool { |
|
40 |
+ parts := strings.SplitN(string(n), ":", 2) |
|
41 |
+ return len(parts) > 1 && parts[0] == "container" |
|
42 |
+} |
|
43 |
+ |
|
44 |
+// Valid indicates whether the ipc stack is valid. |
|
45 |
+func (n IpcMode) Valid() bool { |
|
46 |
+ parts := strings.Split(string(n), ":") |
|
47 |
+ switch mode := parts[0]; mode { |
|
48 |
+ case "", "host": |
|
49 |
+ case "container": |
|
50 |
+ if len(parts) != 2 || parts[1] == "" { |
|
51 |
+ return false |
|
52 |
+ } |
|
53 |
+ default: |
|
54 |
+ return false |
|
55 |
+ } |
|
56 |
+ return true |
|
57 |
+} |
|
58 |
+ |
|
59 |
+// Container returns the name of the container ipc stack is going to be used. |
|
60 |
+func (n IpcMode) Container() string { |
|
61 |
+ parts := strings.SplitN(string(n), ":", 2) |
|
62 |
+ if len(parts) > 1 { |
|
63 |
+ return parts[1] |
|
64 |
+ } |
|
65 |
+ return "" |
|
66 |
+} |
|
67 |
+ |
|
68 |
+// UsernsMode represents userns mode in the container. |
|
69 |
+type UsernsMode string |
|
70 |
+ |
|
71 |
+// IsHost indicates whether the container uses the host's userns. |
|
72 |
+func (n UsernsMode) IsHost() bool { |
|
73 |
+ return n == "host" |
|
74 |
+} |
|
75 |
+ |
|
76 |
+// IsPrivate indicates whether the container uses the a private userns. |
|
77 |
+func (n UsernsMode) IsPrivate() bool { |
|
78 |
+ return !(n.IsHost()) |
|
79 |
+} |
|
80 |
+ |
|
81 |
+// Valid indicates whether the userns is valid. |
|
82 |
+func (n UsernsMode) Valid() bool { |
|
83 |
+ parts := strings.Split(string(n), ":") |
|
84 |
+ switch mode := parts[0]; mode { |
|
85 |
+ case "", "host": |
|
86 |
+ default: |
|
87 |
+ return false |
|
88 |
+ } |
|
89 |
+ return true |
|
90 |
+} |
|
91 |
+ |
|
92 |
+// CgroupSpec represents the cgroup to use for the container. |
|
93 |
+type CgroupSpec string |
|
94 |
+ |
|
95 |
+// IsContainer indicates whether the container is using another container cgroup |
|
96 |
+func (c CgroupSpec) IsContainer() bool { |
|
97 |
+ parts := strings.SplitN(string(c), ":", 2) |
|
98 |
+ return len(parts) > 1 && parts[0] == "container" |
|
99 |
+} |
|
100 |
+ |
|
101 |
+// Valid indicates whether the cgroup spec is valid. |
|
102 |
+func (c CgroupSpec) Valid() bool { |
|
103 |
+ return c.IsContainer() || c == "" |
|
104 |
+} |
|
105 |
+ |
|
106 |
+// Container returns the name of the container whose cgroup will be used. |
|
107 |
+func (c CgroupSpec) Container() string { |
|
108 |
+ parts := strings.SplitN(string(c), ":", 2) |
|
109 |
+ if len(parts) > 1 { |
|
110 |
+ return parts[1] |
|
111 |
+ } |
|
112 |
+ return "" |
|
113 |
+} |
|
114 |
+ |
|
115 |
+// UTSMode represents the UTS namespace of the container. |
|
116 |
+type UTSMode string |
|
117 |
+ |
|
118 |
+// IsPrivate indicates whether the container uses its private UTS namespace. |
|
119 |
+func (n UTSMode) IsPrivate() bool { |
|
120 |
+ return !(n.IsHost()) |
|
121 |
+} |
|
122 |
+ |
|
123 |
+// IsHost indicates whether the container uses the host's UTS namespace. |
|
124 |
+func (n UTSMode) IsHost() bool { |
|
125 |
+ return n == "host" |
|
126 |
+} |
|
127 |
+ |
|
128 |
+// Valid indicates whether the UTS namespace is valid. |
|
129 |
+func (n UTSMode) Valid() bool { |
|
130 |
+ parts := strings.Split(string(n), ":") |
|
131 |
+ switch mode := parts[0]; mode { |
|
132 |
+ case "", "host": |
|
133 |
+ default: |
|
134 |
+ return false |
|
135 |
+ } |
|
136 |
+ return true |
|
137 |
+} |
|
138 |
+ |
|
139 |
+// PidMode represents the pid namespace of the container. |
|
140 |
+type PidMode string |
|
141 |
+ |
|
142 |
+// IsPrivate indicates whether the container uses its own new pid namespace. |
|
143 |
+func (n PidMode) IsPrivate() bool { |
|
144 |
+ return !(n.IsHost() || n.IsContainer()) |
|
145 |
+} |
|
146 |
+ |
|
147 |
+// IsHost indicates whether the container uses the host's pid namespace. |
|
148 |
+func (n PidMode) IsHost() bool { |
|
149 |
+ return n == "host" |
|
150 |
+} |
|
151 |
+ |
|
152 |
+// IsContainer indicates whether the container uses a container's pid namespace. |
|
153 |
+func (n PidMode) IsContainer() bool { |
|
154 |
+ parts := strings.SplitN(string(n), ":", 2) |
|
155 |
+ return len(parts) > 1 && parts[0] == "container" |
|
156 |
+} |
|
157 |
+ |
|
158 |
+// Valid indicates whether the pid namespace is valid. |
|
159 |
+func (n PidMode) Valid() bool { |
|
160 |
+ parts := strings.Split(string(n), ":") |
|
161 |
+ switch mode := parts[0]; mode { |
|
162 |
+ case "", "host": |
|
163 |
+ case "container": |
|
164 |
+ if len(parts) != 2 || parts[1] == "" { |
|
165 |
+ return false |
|
166 |
+ } |
|
167 |
+ default: |
|
168 |
+ return false |
|
169 |
+ } |
|
170 |
+ return true |
|
171 |
+} |
|
172 |
+ |
|
173 |
+// Container returns the name of the container whose pid namespace is going to be used. |
|
174 |
+func (n PidMode) Container() string { |
|
175 |
+ parts := strings.SplitN(string(n), ":", 2) |
|
176 |
+ if len(parts) > 1 { |
|
177 |
+ return parts[1] |
|
178 |
+ } |
|
179 |
+ return "" |
|
180 |
+} |
|
181 |
+ |
|
182 |
+// DeviceMapping represents the device mapping between the host and the container. |
|
183 |
+type DeviceMapping struct { |
|
184 |
+ PathOnHost string |
|
185 |
+ PathInContainer string |
|
186 |
+ CgroupPermissions string |
|
187 |
+} |
|
188 |
+ |
|
189 |
+// RestartPolicy represents the restart policies of the container. |
|
190 |
+type RestartPolicy struct { |
|
191 |
+ Name string |
|
192 |
+ MaximumRetryCount int |
|
193 |
+} |
|
194 |
+ |
|
195 |
+// IsNone indicates whether the container has the "no" restart policy. |
|
196 |
+// This means the container will not automatically restart when exiting. |
|
197 |
+func (rp *RestartPolicy) IsNone() bool { |
|
198 |
+ return rp.Name == "no" || rp.Name == "" |
|
199 |
+} |
|
200 |
+ |
|
201 |
+// IsAlways indicates whether the container has the "always" restart policy. |
|
202 |
+// This means the container will automatically restart regardless of the exit status. |
|
203 |
+func (rp *RestartPolicy) IsAlways() bool { |
|
204 |
+ return rp.Name == "always" |
|
205 |
+} |
|
206 |
+ |
|
207 |
+// IsOnFailure indicates whether the container has the "on-failure" restart policy. |
|
208 |
+// This means the container will automatically restart of exiting with a non-zero exit status. |
|
209 |
+func (rp *RestartPolicy) IsOnFailure() bool { |
|
210 |
+ return rp.Name == "on-failure" |
|
211 |
+} |
|
212 |
+ |
|
213 |
+// IsUnlessStopped indicates whether the container has the |
|
214 |
+// "unless-stopped" restart policy. This means the container will |
|
215 |
+// automatically restart unless user has put it to stopped state. |
|
216 |
+func (rp *RestartPolicy) IsUnlessStopped() bool { |
|
217 |
+ return rp.Name == "unless-stopped" |
|
218 |
+} |
|
219 |
+ |
|
220 |
+// IsSame compares two RestartPolicy to see if they are the same |
|
221 |
+func (rp *RestartPolicy) IsSame(tp *RestartPolicy) bool { |
|
222 |
+ return rp.Name == tp.Name && rp.MaximumRetryCount == tp.MaximumRetryCount |
|
223 |
+} |
|
224 |
+ |
|
225 |
+// LogConfig represents the logging configuration of the container. |
|
226 |
+type LogConfig struct { |
|
227 |
+ Type string |
|
228 |
+ Config map[string]string |
|
229 |
+} |
|
230 |
+ |
|
231 |
+// Resources contains container's resources (cgroups config, ulimits...) |
|
232 |
+type Resources struct { |
|
233 |
+ // Applicable to all platforms |
|
234 |
+ CPUShares int64 `json:"CpuShares"` // CPU shares (relative weight vs. other containers) |
|
235 |
+ Memory int64 // Memory limit (in bytes) |
|
236 |
+ |
|
237 |
+ // Applicable to UNIX platforms |
|
238 |
+ CgroupParent string // Parent cgroup. |
|
239 |
+ BlkioWeight uint16 // Block IO weight (relative weight vs. other containers) |
|
240 |
+ BlkioWeightDevice []*blkiodev.WeightDevice |
|
241 |
+ BlkioDeviceReadBps []*blkiodev.ThrottleDevice |
|
242 |
+ BlkioDeviceWriteBps []*blkiodev.ThrottleDevice |
|
243 |
+ BlkioDeviceReadIOps []*blkiodev.ThrottleDevice |
|
244 |
+ BlkioDeviceWriteIOps []*blkiodev.ThrottleDevice |
|
245 |
+ CPUPeriod int64 `json:"CpuPeriod"` // CPU CFS (Completely Fair Scheduler) period |
|
246 |
+ CPUQuota int64 `json:"CpuQuota"` // CPU CFS (Completely Fair Scheduler) quota |
|
247 |
+ CpusetCpus string // CpusetCpus 0-2, 0,1 |
|
248 |
+ CpusetMems string // CpusetMems 0-2, 0,1 |
|
249 |
+ Devices []DeviceMapping // List of devices to map inside the container |
|
250 |
+ DiskQuota int64 // Disk limit (in bytes) |
|
251 |
+ KernelMemory int64 // Kernel memory limit (in bytes) |
|
252 |
+ MemoryReservation int64 // Memory soft limit (in bytes) |
|
253 |
+ MemorySwap int64 // Total memory usage (memory + swap); set `-1` to enable unlimited swap |
|
254 |
+ MemorySwappiness *int64 // Tuning container memory swappiness behaviour |
|
255 |
+ OomKillDisable *bool // Whether to disable OOM Killer or not |
|
256 |
+ PidsLimit int64 // Setting pids limit for a container |
|
257 |
+ Ulimits []*units.Ulimit // List of ulimits to be set in the container |
|
258 |
+ |
|
259 |
+ // Applicable to Windows |
|
260 |
+ CPUCount int64 `json:"CpuCount"` // CPU count |
|
261 |
+ CPUPercent int64 `json:"CpuPercent"` // CPU percent |
|
262 |
+ IOMaximumIOps uint64 // Maximum IOps for the container system drive |
|
263 |
+ IOMaximumBandwidth uint64 // Maximum IO in bytes per second for the container system drive |
|
264 |
+} |
|
265 |
+ |
|
266 |
+// UpdateConfig holds the mutable attributes of a Container. |
|
267 |
+// Those attributes can be updated at runtime. |
|
268 |
+type UpdateConfig struct { |
|
269 |
+ // Contains container's resources (cgroups, ulimits) |
|
270 |
+ Resources |
|
271 |
+ RestartPolicy RestartPolicy |
|
272 |
+} |
|
273 |
+ |
|
274 |
+// HostConfig the non-portable Config structure of a container. |
|
275 |
+// Here, "non-portable" means "dependent of the host we are running on". |
|
276 |
+// Portable information *should* appear in Config. |
|
277 |
+type HostConfig struct { |
|
278 |
+ // Applicable to all platforms |
|
279 |
+ Binds []string // List of volume bindings for this container |
|
280 |
+ ContainerIDFile string // File (path) where the containerId is written |
|
281 |
+ LogConfig LogConfig // Configuration of the logs for this container |
|
282 |
+ NetworkMode NetworkMode // Network mode to use for the container |
|
283 |
+ PortBindings nat.PortMap // Port mapping between the exposed port (container) and the host |
|
284 |
+ RestartPolicy RestartPolicy // Restart policy to be used for the container |
|
285 |
+ AutoRemove bool // Automatically remove container when it exits |
|
286 |
+ VolumeDriver string // Name of the volume driver used to mount volumes |
|
287 |
+ VolumesFrom []string // List of volumes to take from other container |
|
288 |
+ |
|
289 |
+ // Applicable to UNIX platforms |
|
290 |
+ CapAdd strslice.StrSlice // List of kernel capabilities to add to the container |
|
291 |
+ CapDrop strslice.StrSlice // List of kernel capabilities to remove from the container |
|
292 |
+ DNS []string `json:"Dns"` // List of DNS server to lookup |
|
293 |
+ DNSOptions []string `json:"DnsOptions"` // List of DNSOption to look for |
|
294 |
+ DNSSearch []string `json:"DnsSearch"` // List of DNSSearch to look for |
|
295 |
+ ExtraHosts []string // List of extra hosts |
|
296 |
+ GroupAdd []string // List of additional groups that the container process will run as |
|
297 |
+ IpcMode IpcMode // IPC namespace to use for the container |
|
298 |
+ Cgroup CgroupSpec // Cgroup to use for the container |
|
299 |
+ Links []string // List of links (in the name:alias form) |
|
300 |
+ OomScoreAdj int // Container preference for OOM-killing |
|
301 |
+ PidMode PidMode // PID namespace to use for the container |
|
302 |
+ Privileged bool // Is the container in privileged mode |
|
303 |
+ PublishAllPorts bool // Should docker publish all exposed port for the container |
|
304 |
+ ReadonlyRootfs bool // Is the container root filesystem in read-only |
|
305 |
+ SecurityOpt []string // List of string values to customize labels for MLS systems, such as SELinux. |
|
306 |
+ StorageOpt map[string]string `json:",omitempty"` // Storage driver options per container. |
|
307 |
+ Tmpfs map[string]string `json:",omitempty"` // List of tmpfs (mounts) used for the container |
|
308 |
+ UTSMode UTSMode // UTS namespace to use for the container |
|
309 |
+ UsernsMode UsernsMode // The user namespace to use for the container |
|
310 |
+ ShmSize int64 // Total shm memory usage |
|
311 |
+ Sysctls map[string]string `json:",omitempty"` // List of Namespaced sysctls used for the container |
|
312 |
+ Runtime string `json:",omitempty"` // Runtime to use with this container |
|
313 |
+ |
|
314 |
+ // Applicable to Windows |
|
315 |
+ ConsoleSize [2]int // Initial console size |
|
316 |
+ Isolation Isolation // Isolation technology of the container (eg default, hyperv) |
|
317 |
+ |
|
318 |
+ // Contains container's resources (cgroups, ulimits) |
|
319 |
+ Resources |
|
320 |
+ |
|
321 |
+ // Mounts specs used by the container |
|
322 |
+ Mounts []mount.Mount `json:",omitempty"` |
|
323 |
+} |
0 | 324 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,81 @@ |
0 |
+// +build !windows |
|
1 |
+ |
|
2 |
+package container |
|
3 |
+ |
|
4 |
+import "strings" |
|
5 |
+ |
|
6 |
+// IsValid indicates if an isolation technology is valid |
|
7 |
+func (i Isolation) IsValid() bool { |
|
8 |
+ return i.IsDefault() |
|
9 |
+} |
|
10 |
+ |
|
11 |
+// IsPrivate indicates whether container uses it's private network stack. |
|
12 |
+func (n NetworkMode) IsPrivate() bool { |
|
13 |
+ return !(n.IsHost() || n.IsContainer()) |
|
14 |
+} |
|
15 |
+ |
|
16 |
+// IsDefault indicates whether container uses the default network stack. |
|
17 |
+func (n NetworkMode) IsDefault() bool { |
|
18 |
+ return n == "default" |
|
19 |
+} |
|
20 |
+ |
|
21 |
+// NetworkName returns the name of the network stack. |
|
22 |
+func (n NetworkMode) NetworkName() string { |
|
23 |
+ if n.IsBridge() { |
|
24 |
+ return "bridge" |
|
25 |
+ } else if n.IsHost() { |
|
26 |
+ return "host" |
|
27 |
+ } else if n.IsContainer() { |
|
28 |
+ return "container" |
|
29 |
+ } else if n.IsNone() { |
|
30 |
+ return "none" |
|
31 |
+ } else if n.IsDefault() { |
|
32 |
+ return "default" |
|
33 |
+ } else if n.IsUserDefined() { |
|
34 |
+ return n.UserDefined() |
|
35 |
+ } |
|
36 |
+ return "" |
|
37 |
+} |
|
38 |
+ |
|
39 |
+// IsBridge indicates whether container uses the bridge network stack |
|
40 |
+func (n NetworkMode) IsBridge() bool { |
|
41 |
+ return n == "bridge" |
|
42 |
+} |
|
43 |
+ |
|
44 |
+// IsHost indicates whether container uses the host network stack. |
|
45 |
+func (n NetworkMode) IsHost() bool { |
|
46 |
+ return n == "host" |
|
47 |
+} |
|
48 |
+ |
|
49 |
+// IsContainer indicates whether container uses a container network stack. |
|
50 |
+func (n NetworkMode) IsContainer() bool { |
|
51 |
+ parts := strings.SplitN(string(n), ":", 2) |
|
52 |
+ return len(parts) > 1 && parts[0] == "container" |
|
53 |
+} |
|
54 |
+ |
|
55 |
+// IsNone indicates whether container isn't using a network stack. |
|
56 |
+func (n NetworkMode) IsNone() bool { |
|
57 |
+ return n == "none" |
|
58 |
+} |
|
59 |
+ |
|
60 |
+// ConnectedContainer is the id of the container which network this container is connected to. |
|
61 |
+func (n NetworkMode) ConnectedContainer() string { |
|
62 |
+ parts := strings.SplitN(string(n), ":", 2) |
|
63 |
+ if len(parts) > 1 { |
|
64 |
+ return parts[1] |
|
65 |
+ } |
|
66 |
+ return "" |
|
67 |
+} |
|
68 |
+ |
|
69 |
+// IsUserDefined indicates user-created network |
|
70 |
+func (n NetworkMode) IsUserDefined() bool { |
|
71 |
+ return !n.IsDefault() && !n.IsBridge() && !n.IsHost() && !n.IsNone() && !n.IsContainer() |
|
72 |
+} |
|
73 |
+ |
|
74 |
+//UserDefined indicates user-created network |
|
75 |
+func (n NetworkMode) UserDefined() string { |
|
76 |
+ if n.IsUserDefined() { |
|
77 |
+ return string(n) |
|
78 |
+ } |
|
79 |
+ return "" |
|
80 |
+} |
0 | 81 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,87 @@ |
0 |
+package container |
|
1 |
+ |
|
2 |
+import ( |
|
3 |
+ "strings" |
|
4 |
+) |
|
5 |
+ |
|
6 |
+// IsDefault indicates whether container uses the default network stack. |
|
7 |
+func (n NetworkMode) IsDefault() bool { |
|
8 |
+ return n == "default" |
|
9 |
+} |
|
10 |
+ |
|
11 |
+// IsNone indicates whether container isn't using a network stack. |
|
12 |
+func (n NetworkMode) IsNone() bool { |
|
13 |
+ return n == "none" |
|
14 |
+} |
|
15 |
+ |
|
16 |
+// IsContainer indicates whether container uses a container network stack. |
|
17 |
+// Returns false as windows doesn't support this mode |
|
18 |
+func (n NetworkMode) IsContainer() bool { |
|
19 |
+ return false |
|
20 |
+} |
|
21 |
+ |
|
22 |
+// IsBridge indicates whether container uses the bridge network stack |
|
23 |
+// in windows it is given the name NAT |
|
24 |
+func (n NetworkMode) IsBridge() bool { |
|
25 |
+ return n == "nat" |
|
26 |
+} |
|
27 |
+ |
|
28 |
+// IsHost indicates whether container uses the host network stack. |
|
29 |
+// returns false as this is not supported by windows |
|
30 |
+func (n NetworkMode) IsHost() bool { |
|
31 |
+ return false |
|
32 |
+} |
|
33 |
+ |
|
34 |
+// IsPrivate indicates whether container uses its private network stack. |
|
35 |
+func (n NetworkMode) IsPrivate() bool { |
|
36 |
+ return !(n.IsHost() || n.IsContainer()) |
|
37 |
+} |
|
38 |
+ |
|
39 |
+// ConnectedContainer is the id of the container which network this container is connected to. |
|
40 |
+// Returns blank string on windows |
|
41 |
+func (n NetworkMode) ConnectedContainer() string { |
|
42 |
+ return "" |
|
43 |
+} |
|
44 |
+ |
|
45 |
+// IsUserDefined indicates user-created network |
|
46 |
+func (n NetworkMode) IsUserDefined() bool { |
|
47 |
+ return !n.IsDefault() && !n.IsNone() && !n.IsBridge() |
|
48 |
+} |
|
49 |
+ |
|
50 |
+// IsHyperV indicates the use of a Hyper-V partition for isolation |
|
51 |
+func (i Isolation) IsHyperV() bool { |
|
52 |
+ return strings.ToLower(string(i)) == "hyperv" |
|
53 |
+} |
|
54 |
+ |
|
55 |
+// IsProcess indicates the use of process isolation |
|
56 |
+func (i Isolation) IsProcess() bool { |
|
57 |
+ return strings.ToLower(string(i)) == "process" |
|
58 |
+} |
|
59 |
+ |
|
60 |
+// IsValid indicates if an isolation technology is valid |
|
61 |
+func (i Isolation) IsValid() bool { |
|
62 |
+ return i.IsDefault() || i.IsHyperV() || i.IsProcess() |
|
63 |
+} |
|
64 |
+ |
|
65 |
+// NetworkName returns the name of the network stack. |
|
66 |
+func (n NetworkMode) NetworkName() string { |
|
67 |
+ if n.IsDefault() { |
|
68 |
+ return "default" |
|
69 |
+ } else if n.IsBridge() { |
|
70 |
+ return "nat" |
|
71 |
+ } else if n.IsNone() { |
|
72 |
+ return "none" |
|
73 |
+ } else if n.IsUserDefined() { |
|
74 |
+ return n.UserDefined() |
|
75 |
+ } |
|
76 |
+ |
|
77 |
+ return "" |
|
78 |
+} |
|
79 |
+ |
|
80 |
+//UserDefined indicates user-created network |
|
81 |
+func (n NetworkMode) UserDefined() string { |
|
82 |
+ if n.IsUserDefined() { |
|
83 |
+ return string(n) |
|
84 |
+ } |
|
85 |
+ return "" |
|
86 |
+} |
0 | 6 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,42 @@ |
0 |
+package events |
|
1 |
+ |
|
2 |
+const ( |
|
3 |
+ // ContainerEventType is the event type that containers generate |
|
4 |
+ ContainerEventType = "container" |
|
5 |
+ // DaemonEventType is the event type that daemon generate |
|
6 |
+ DaemonEventType = "daemon" |
|
7 |
+ // ImageEventType is the event type that images generate |
|
8 |
+ ImageEventType = "image" |
|
9 |
+ // NetworkEventType is the event type that networks generate |
|
10 |
+ NetworkEventType = "network" |
|
11 |
+ // PluginEventType is the event type that plugins generate |
|
12 |
+ PluginEventType = "plugin" |
|
13 |
+ // VolumeEventType is the event type that volumes generate |
|
14 |
+ VolumeEventType = "volume" |
|
15 |
+) |
|
16 |
+ |
|
17 |
+// Actor describes something that generates events, |
|
18 |
+// like a container, or a network, or a volume. |
|
19 |
+// It has a defined name and a set or attributes. |
|
20 |
+// The container attributes are its labels, other actors |
|
21 |
+// can generate these attributes from other properties. |
|
22 |
+type Actor struct { |
|
23 |
+ ID string |
|
24 |
+ Attributes map[string]string |
|
25 |
+} |
|
26 |
+ |
|
27 |
+// Message represents the information an event contains |
|
28 |
+type Message struct { |
|
29 |
+ // Deprecated information from JSONMessage. |
|
30 |
+ // With data only in container events. |
|
31 |
+ Status string `json:"status,omitempty"` |
|
32 |
+ ID string `json:"id,omitempty"` |
|
33 |
+ From string `json:"from,omitempty"` |
|
34 |
+ |
|
35 |
+ Type string |
|
36 |
+ Action string |
|
37 |
+ Actor Actor |
|
38 |
+ |
|
39 |
+ Time int64 `json:"time,omitempty"` |
|
40 |
+ TimeNano int64 `json:"timeNano,omitempty"` |
|
41 |
+} |
0 | 42 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,307 @@ |
0 |
+// Package filters provides helper function to parse and handle command line |
|
1 |
+// filter, used for example in docker ps or docker images commands. |
|
2 |
+package filters |
|
3 |
+ |
|
4 |
+import ( |
|
5 |
+ "encoding/json" |
|
6 |
+ "errors" |
|
7 |
+ "fmt" |
|
8 |
+ "regexp" |
|
9 |
+ "strings" |
|
10 |
+ |
|
11 |
+ "github.com/docker/docker/api/types/versions" |
|
12 |
+) |
|
13 |
+ |
|
14 |
+// Args stores filter arguments as map key:{map key: bool}. |
|
15 |
+// It contains an aggregation of the map of arguments (which are in the form |
|
16 |
+// of -f 'key=value') based on the key, and stores values for the same key |
|
17 |
+// in a map with string keys and boolean values. |
|
18 |
+// e.g given -f 'label=label1=1' -f 'label=label2=2' -f 'image.name=ubuntu' |
|
19 |
+// the args will be {"image.name":{"ubuntu":true},"label":{"label1=1":true,"label2=2":true}} |
|
20 |
+type Args struct { |
|
21 |
+ fields map[string]map[string]bool |
|
22 |
+} |
|
23 |
+ |
|
24 |
+// NewArgs initializes a new Args struct. |
|
25 |
+func NewArgs() Args { |
|
26 |
+ return Args{fields: map[string]map[string]bool{}} |
|
27 |
+} |
|
28 |
+ |
|
29 |
+// ParseFlag parses the argument to the filter flag. Like |
|
30 |
+// |
|
31 |
+// `docker ps -f 'created=today' -f 'image.name=ubuntu*'` |
|
32 |
+// |
|
33 |
+// If prev map is provided, then it is appended to, and returned. By default a new |
|
34 |
+// map is created. |
|
35 |
+func ParseFlag(arg string, prev Args) (Args, error) { |
|
36 |
+ filters := prev |
|
37 |
+ if len(arg) == 0 { |
|
38 |
+ return filters, nil |
|
39 |
+ } |
|
40 |
+ |
|
41 |
+ if !strings.Contains(arg, "=") { |
|
42 |
+ return filters, ErrBadFormat |
|
43 |
+ } |
|
44 |
+ |
|
45 |
+ f := strings.SplitN(arg, "=", 2) |
|
46 |
+ |
|
47 |
+ name := strings.ToLower(strings.TrimSpace(f[0])) |
|
48 |
+ value := strings.TrimSpace(f[1]) |
|
49 |
+ |
|
50 |
+ filters.Add(name, value) |
|
51 |
+ |
|
52 |
+ return filters, nil |
|
53 |
+} |
|
54 |
+ |
|
55 |
+// ErrBadFormat is an error returned in case of bad format for a filter. |
|
56 |
+var ErrBadFormat = errors.New("bad format of filter (expected name=value)") |
|
57 |
+ |
|
58 |
+// ToParam packs the Args into a string for easy transport from client to server. |
|
59 |
+func ToParam(a Args) (string, error) { |
|
60 |
+ // this way we don't URL encode {}, just empty space |
|
61 |
+ if a.Len() == 0 { |
|
62 |
+ return "", nil |
|
63 |
+ } |
|
64 |
+ |
|
65 |
+ buf, err := json.Marshal(a.fields) |
|
66 |
+ if err != nil { |
|
67 |
+ return "", err |
|
68 |
+ } |
|
69 |
+ return string(buf), nil |
|
70 |
+} |
|
71 |
+ |
|
72 |
+// ToParamWithVersion packs the Args into a string for easy transport from client to server. |
|
73 |
+// The generated string will depend on the specified version (corresponding to the API version). |
|
74 |
+func ToParamWithVersion(version string, a Args) (string, error) { |
|
75 |
+ // this way we don't URL encode {}, just empty space |
|
76 |
+ if a.Len() == 0 { |
|
77 |
+ return "", nil |
|
78 |
+ } |
|
79 |
+ |
|
80 |
+ // for daemons older than v1.10, filter must be of the form map[string][]string |
|
81 |
+ buf := []byte{} |
|
82 |
+ err := errors.New("") |
|
83 |
+ if version != "" && versions.LessThan(version, "1.22") { |
|
84 |
+ buf, err = json.Marshal(convertArgsToSlice(a.fields)) |
|
85 |
+ } else { |
|
86 |
+ buf, err = json.Marshal(a.fields) |
|
87 |
+ } |
|
88 |
+ if err != nil { |
|
89 |
+ return "", err |
|
90 |
+ } |
|
91 |
+ return string(buf), nil |
|
92 |
+} |
|
93 |
+ |
|
94 |
+// FromParam unpacks the filter Args. |
|
95 |
+func FromParam(p string) (Args, error) { |
|
96 |
+ if len(p) == 0 { |
|
97 |
+ return NewArgs(), nil |
|
98 |
+ } |
|
99 |
+ |
|
100 |
+ r := strings.NewReader(p) |
|
101 |
+ d := json.NewDecoder(r) |
|
102 |
+ |
|
103 |
+ m := map[string]map[string]bool{} |
|
104 |
+ if err := d.Decode(&m); err != nil { |
|
105 |
+ r.Seek(0, 0) |
|
106 |
+ |
|
107 |
+ // Allow parsing old arguments in slice format. |
|
108 |
+ // Because other libraries might be sending them in this format. |
|
109 |
+ deprecated := map[string][]string{} |
|
110 |
+ if deprecatedErr := d.Decode(&deprecated); deprecatedErr == nil { |
|
111 |
+ m = deprecatedArgs(deprecated) |
|
112 |
+ } else { |
|
113 |
+ return NewArgs(), err |
|
114 |
+ } |
|
115 |
+ } |
|
116 |
+ return Args{m}, nil |
|
117 |
+} |
|
118 |
+ |
|
119 |
+// Get returns the list of values associates with a field. |
|
120 |
+// It returns a slice of strings to keep backwards compatibility with old code. |
|
121 |
+func (filters Args) Get(field string) []string { |
|
122 |
+ values := filters.fields[field] |
|
123 |
+ if values == nil { |
|
124 |
+ return make([]string, 0) |
|
125 |
+ } |
|
126 |
+ slice := make([]string, 0, len(values)) |
|
127 |
+ for key := range values { |
|
128 |
+ slice = append(slice, key) |
|
129 |
+ } |
|
130 |
+ return slice |
|
131 |
+} |
|
132 |
+ |
|
133 |
+// Add adds a new value to a filter field. |
|
134 |
+func (filters Args) Add(name, value string) { |
|
135 |
+ if _, ok := filters.fields[name]; ok { |
|
136 |
+ filters.fields[name][value] = true |
|
137 |
+ } else { |
|
138 |
+ filters.fields[name] = map[string]bool{value: true} |
|
139 |
+ } |
|
140 |
+} |
|
141 |
+ |
|
142 |
+// Del removes a value from a filter field. |
|
143 |
+func (filters Args) Del(name, value string) { |
|
144 |
+ if _, ok := filters.fields[name]; ok { |
|
145 |
+ delete(filters.fields[name], value) |
|
146 |
+ } |
|
147 |
+} |
|
148 |
+ |
|
149 |
+// Len returns the number of fields in the arguments. |
|
150 |
+func (filters Args) Len() int { |
|
151 |
+ return len(filters.fields) |
|
152 |
+} |
|
153 |
+ |
|
154 |
+// MatchKVList returns true if the values for the specified field matches the ones |
|
155 |
+// from the sources. |
|
156 |
+// e.g. given Args are {'label': {'label1=1','label2=1'}, 'image.name', {'ubuntu'}}, |
|
157 |
+// field is 'label' and sources are {'label1': '1', 'label2': '2'} |
|
158 |
+// it returns true. |
|
159 |
+func (filters Args) MatchKVList(field string, sources map[string]string) bool { |
|
160 |
+ fieldValues := filters.fields[field] |
|
161 |
+ |
|
162 |
+ //do not filter if there is no filter set or cannot determine filter |
|
163 |
+ if len(fieldValues) == 0 { |
|
164 |
+ return true |
|
165 |
+ } |
|
166 |
+ |
|
167 |
+ if sources == nil || len(sources) == 0 { |
|
168 |
+ return false |
|
169 |
+ } |
|
170 |
+ |
|
171 |
+ for name2match := range fieldValues { |
|
172 |
+ testKV := strings.SplitN(name2match, "=", 2) |
|
173 |
+ |
|
174 |
+ v, ok := sources[testKV[0]] |
|
175 |
+ if !ok { |
|
176 |
+ return false |
|
177 |
+ } |
|
178 |
+ if len(testKV) == 2 && testKV[1] != v { |
|
179 |
+ return false |
|
180 |
+ } |
|
181 |
+ } |
|
182 |
+ |
|
183 |
+ return true |
|
184 |
+} |
|
185 |
+ |
|
186 |
+// Match returns true if the values for the specified field matches the source string |
|
187 |
+// e.g. given Args are {'label': {'label1=1','label2=1'}, 'image.name', {'ubuntu'}}, |
|
188 |
+// field is 'image.name' and source is 'ubuntu' |
|
189 |
+// it returns true. |
|
190 |
+func (filters Args) Match(field, source string) bool { |
|
191 |
+ if filters.ExactMatch(field, source) { |
|
192 |
+ return true |
|
193 |
+ } |
|
194 |
+ |
|
195 |
+ fieldValues := filters.fields[field] |
|
196 |
+ for name2match := range fieldValues { |
|
197 |
+ match, err := regexp.MatchString(name2match, source) |
|
198 |
+ if err != nil { |
|
199 |
+ continue |
|
200 |
+ } |
|
201 |
+ if match { |
|
202 |
+ return true |
|
203 |
+ } |
|
204 |
+ } |
|
205 |
+ return false |
|
206 |
+} |
|
207 |
+ |
|
208 |
+// ExactMatch returns true if the source matches exactly one of the filters. |
|
209 |
+func (filters Args) ExactMatch(field, source string) bool { |
|
210 |
+ fieldValues, ok := filters.fields[field] |
|
211 |
+ //do not filter if there is no filter set or cannot determine filter |
|
212 |
+ if !ok || len(fieldValues) == 0 { |
|
213 |
+ return true |
|
214 |
+ } |
|
215 |
+ |
|
216 |
+ // try to match full name value to avoid O(N) regular expression matching |
|
217 |
+ return fieldValues[source] |
|
218 |
+} |
|
219 |
+ |
|
220 |
+// UniqueExactMatch returns true if there is only one filter and the source matches exactly this one. |
|
221 |
+func (filters Args) UniqueExactMatch(field, source string) bool { |
|
222 |
+ fieldValues := filters.fields[field] |
|
223 |
+ //do not filter if there is no filter set or cannot determine filter |
|
224 |
+ if len(fieldValues) == 0 { |
|
225 |
+ return true |
|
226 |
+ } |
|
227 |
+ if len(filters.fields[field]) != 1 { |
|
228 |
+ return false |
|
229 |
+ } |
|
230 |
+ |
|
231 |
+ // try to match full name value to avoid O(N) regular expression matching |
|
232 |
+ return fieldValues[source] |
|
233 |
+} |
|
234 |
+ |
|
235 |
+// FuzzyMatch returns true if the source matches exactly one of the filters, |
|
236 |
+// or the source has one of the filters as a prefix. |
|
237 |
+func (filters Args) FuzzyMatch(field, source string) bool { |
|
238 |
+ if filters.ExactMatch(field, source) { |
|
239 |
+ return true |
|
240 |
+ } |
|
241 |
+ |
|
242 |
+ fieldValues := filters.fields[field] |
|
243 |
+ for prefix := range fieldValues { |
|
244 |
+ if strings.HasPrefix(source, prefix) { |
|
245 |
+ return true |
|
246 |
+ } |
|
247 |
+ } |
|
248 |
+ return false |
|
249 |
+} |
|
250 |
+ |
|
251 |
+// Include returns true if the name of the field to filter is in the filters. |
|
252 |
+func (filters Args) Include(field string) bool { |
|
253 |
+ _, ok := filters.fields[field] |
|
254 |
+ return ok |
|
255 |
+} |
|
256 |
+ |
|
257 |
+// Validate ensures that all the fields in the filter are valid. |
|
258 |
+// It returns an error as soon as it finds an invalid field. |
|
259 |
+func (filters Args) Validate(accepted map[string]bool) error { |
|
260 |
+ for name := range filters.fields { |
|
261 |
+ if !accepted[name] { |
|
262 |
+ return fmt.Errorf("Invalid filter '%s'", name) |
|
263 |
+ } |
|
264 |
+ } |
|
265 |
+ return nil |
|
266 |
+} |
|
267 |
+ |
|
268 |
+// WalkValues iterates over the list of filtered values for a field. |
|
269 |
+// It stops the iteration if it finds an error and it returns that error. |
|
270 |
+func (filters Args) WalkValues(field string, op func(value string) error) error { |
|
271 |
+ if _, ok := filters.fields[field]; !ok { |
|
272 |
+ return nil |
|
273 |
+ } |
|
274 |
+ for v := range filters.fields[field] { |
|
275 |
+ if err := op(v); err != nil { |
|
276 |
+ return err |
|
277 |
+ } |
|
278 |
+ } |
|
279 |
+ return nil |
|
280 |
+} |
|
281 |
+ |
|
282 |
+func deprecatedArgs(d map[string][]string) map[string]map[string]bool { |
|
283 |
+ m := map[string]map[string]bool{} |
|
284 |
+ for k, v := range d { |
|
285 |
+ values := map[string]bool{} |
|
286 |
+ for _, vv := range v { |
|
287 |
+ values[vv] = true |
|
288 |
+ } |
|
289 |
+ m[k] = values |
|
290 |
+ } |
|
291 |
+ return m |
|
292 |
+} |
|
293 |
+ |
|
294 |
+func convertArgsToSlice(f map[string]map[string]bool) map[string][]string { |
|
295 |
+ m := map[string][]string{} |
|
296 |
+ for k, v := range f { |
|
297 |
+ values := []string{} |
|
298 |
+ for kk := range v { |
|
299 |
+ if v[kk] { |
|
300 |
+ values = append(values, kk) |
|
301 |
+ } |
|
302 |
+ } |
|
303 |
+ m[k] = values |
|
304 |
+ } |
|
305 |
+ return m |
|
306 |
+} |
0 | 307 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,417 @@ |
0 |
+package filters |
|
1 |
+ |
|
2 |
+import ( |
|
3 |
+ "fmt" |
|
4 |
+ "testing" |
|
5 |
+) |
|
6 |
+ |
|
7 |
+func TestParseArgs(t *testing.T) { |
|
8 |
+ // equivalent of `docker ps -f 'created=today' -f 'image.name=ubuntu*' -f 'image.name=*untu'` |
|
9 |
+ flagArgs := []string{ |
|
10 |
+ "created=today", |
|
11 |
+ "image.name=ubuntu*", |
|
12 |
+ "image.name=*untu", |
|
13 |
+ } |
|
14 |
+ var ( |
|
15 |
+ args = NewArgs() |
|
16 |
+ err error |
|
17 |
+ ) |
|
18 |
+ for i := range flagArgs { |
|
19 |
+ args, err = ParseFlag(flagArgs[i], args) |
|
20 |
+ if err != nil { |
|
21 |
+ t.Errorf("failed to parse %s: %s", flagArgs[i], err) |
|
22 |
+ } |
|
23 |
+ } |
|
24 |
+ if len(args.Get("created")) != 1 { |
|
25 |
+ t.Errorf("failed to set this arg") |
|
26 |
+ } |
|
27 |
+ if len(args.Get("image.name")) != 2 { |
|
28 |
+ t.Errorf("the args should have collapsed") |
|
29 |
+ } |
|
30 |
+} |
|
31 |
+ |
|
32 |
+func TestParseArgsEdgeCase(t *testing.T) { |
|
33 |
+ var filters Args |
|
34 |
+ args, err := ParseFlag("", filters) |
|
35 |
+ if err != nil { |
|
36 |
+ t.Fatal(err) |
|
37 |
+ } |
|
38 |
+ if args.Len() != 0 { |
|
39 |
+ t.Fatalf("Expected an empty Args (map), got %v", args) |
|
40 |
+ } |
|
41 |
+ if args, err = ParseFlag("anything", args); err == nil || err != ErrBadFormat { |
|
42 |
+ t.Fatalf("Expected ErrBadFormat, got %v", err) |
|
43 |
+ } |
|
44 |
+} |
|
45 |
+ |
|
46 |
+func TestToParam(t *testing.T) { |
|
47 |
+ fields := map[string]map[string]bool{ |
|
48 |
+ "created": {"today": true}, |
|
49 |
+ "image.name": {"ubuntu*": true, "*untu": true}, |
|
50 |
+ } |
|
51 |
+ a := Args{fields: fields} |
|
52 |
+ |
|
53 |
+ _, err := ToParam(a) |
|
54 |
+ if err != nil { |
|
55 |
+ t.Errorf("failed to marshal the filters: %s", err) |
|
56 |
+ } |
|
57 |
+} |
|
58 |
+ |
|
59 |
+func TestToParamWithVersion(t *testing.T) { |
|
60 |
+ fields := map[string]map[string]bool{ |
|
61 |
+ "created": {"today": true}, |
|
62 |
+ "image.name": {"ubuntu*": true, "*untu": true}, |
|
63 |
+ } |
|
64 |
+ a := Args{fields: fields} |
|
65 |
+ |
|
66 |
+ str1, err := ToParamWithVersion("1.21", a) |
|
67 |
+ if err != nil { |
|
68 |
+ t.Errorf("failed to marshal the filters with version < 1.22: %s", err) |
|
69 |
+ } |
|
70 |
+ str2, err := ToParamWithVersion("1.22", a) |
|
71 |
+ if err != nil { |
|
72 |
+ t.Errorf("failed to marshal the filters with version >= 1.22: %s", err) |
|
73 |
+ } |
|
74 |
+ if str1 != `{"created":["today"],"image.name":["*untu","ubuntu*"]}` && |
|
75 |
+ str1 != `{"created":["today"],"image.name":["ubuntu*","*untu"]}` { |
|
76 |
+ t.Errorf("incorrectly marshaled the filters: %s", str1) |
|
77 |
+ } |
|
78 |
+ if str2 != `{"created":{"today":true},"image.name":{"*untu":true,"ubuntu*":true}}` && |
|
79 |
+ str2 != `{"created":{"today":true},"image.name":{"ubuntu*":true,"*untu":true}}` { |
|
80 |
+ t.Errorf("incorrectly marshaled the filters: %s", str2) |
|
81 |
+ } |
|
82 |
+} |
|
83 |
+ |
|
84 |
+func TestFromParam(t *testing.T) { |
|
85 |
+ invalids := []string{ |
|
86 |
+ "anything", |
|
87 |
+ "['a','list']", |
|
88 |
+ "{'key': 'value'}", |
|
89 |
+ `{"key": "value"}`, |
|
90 |
+ } |
|
91 |
+ valid := map[*Args][]string{ |
|
92 |
+ &Args{fields: map[string]map[string]bool{"key": {"value": true}}}: { |
|
93 |
+ `{"key": ["value"]}`, |
|
94 |
+ `{"key": {"value": true}}`, |
|
95 |
+ }, |
|
96 |
+ &Args{fields: map[string]map[string]bool{"key": {"value1": true, "value2": true}}}: { |
|
97 |
+ `{"key": ["value1", "value2"]}`, |
|
98 |
+ `{"key": {"value1": true, "value2": true}}`, |
|
99 |
+ }, |
|
100 |
+ &Args{fields: map[string]map[string]bool{"key1": {"value1": true}, "key2": {"value2": true}}}: { |
|
101 |
+ `{"key1": ["value1"], "key2": ["value2"]}`, |
|
102 |
+ `{"key1": {"value1": true}, "key2": {"value2": true}}`, |
|
103 |
+ }, |
|
104 |
+ } |
|
105 |
+ |
|
106 |
+ for _, invalid := range invalids { |
|
107 |
+ if _, err := FromParam(invalid); err == nil { |
|
108 |
+ t.Fatalf("Expected an error with %v, got nothing", invalid) |
|
109 |
+ } |
|
110 |
+ } |
|
111 |
+ |
|
112 |
+ for expectedArgs, matchers := range valid { |
|
113 |
+ for _, json := range matchers { |
|
114 |
+ args, err := FromParam(json) |
|
115 |
+ if err != nil { |
|
116 |
+ t.Fatal(err) |
|
117 |
+ } |
|
118 |
+ if args.Len() != expectedArgs.Len() { |
|
119 |
+ t.Fatalf("Expected %v, go %v", expectedArgs, args) |
|
120 |
+ } |
|
121 |
+ for key, expectedValues := range expectedArgs.fields { |
|
122 |
+ values := args.Get(key) |
|
123 |
+ |
|
124 |
+ if len(values) != len(expectedValues) { |
|
125 |
+ t.Fatalf("Expected %v, go %v", expectedArgs, args) |
|
126 |
+ } |
|
127 |
+ |
|
128 |
+ for _, v := range values { |
|
129 |
+ if !expectedValues[v] { |
|
130 |
+ t.Fatalf("Expected %v, go %v", expectedArgs, args) |
|
131 |
+ } |
|
132 |
+ } |
|
133 |
+ } |
|
134 |
+ } |
|
135 |
+ } |
|
136 |
+} |
|
137 |
+ |
|
138 |
+func TestEmpty(t *testing.T) { |
|
139 |
+ a := Args{} |
|
140 |
+ v, err := ToParam(a) |
|
141 |
+ if err != nil { |
|
142 |
+ t.Errorf("failed to marshal the filters: %s", err) |
|
143 |
+ } |
|
144 |
+ v1, err := FromParam(v) |
|
145 |
+ if err != nil { |
|
146 |
+ t.Errorf("%s", err) |
|
147 |
+ } |
|
148 |
+ if a.Len() != v1.Len() { |
|
149 |
+ t.Errorf("these should both be empty sets") |
|
150 |
+ } |
|
151 |
+} |
|
152 |
+ |
|
153 |
+func TestArgsMatchKVListEmptySources(t *testing.T) { |
|
154 |
+ args := NewArgs() |
|
155 |
+ if !args.MatchKVList("created", map[string]string{}) { |
|
156 |
+ t.Fatalf("Expected true for (%v,created), got true", args) |
|
157 |
+ } |
|
158 |
+ |
|
159 |
+ args = Args{map[string]map[string]bool{"created": {"today": true}}} |
|
160 |
+ if args.MatchKVList("created", map[string]string{}) { |
|
161 |
+ t.Fatalf("Expected false for (%v,created), got true", args) |
|
162 |
+ } |
|
163 |
+} |
|
164 |
+ |
|
165 |
+func TestArgsMatchKVList(t *testing.T) { |
|
166 |
+ // Not empty sources |
|
167 |
+ sources := map[string]string{ |
|
168 |
+ "key1": "value1", |
|
169 |
+ "key2": "value2", |
|
170 |
+ "key3": "value3", |
|
171 |
+ } |
|
172 |
+ |
|
173 |
+ matches := map[*Args]string{ |
|
174 |
+ &Args{}: "field", |
|
175 |
+ &Args{map[string]map[string]bool{ |
|
176 |
+ "created": map[string]bool{"today": true}, |
|
177 |
+ "labels": map[string]bool{"key1": true}}, |
|
178 |
+ }: "labels", |
|
179 |
+ &Args{map[string]map[string]bool{ |
|
180 |
+ "created": map[string]bool{"today": true}, |
|
181 |
+ "labels": map[string]bool{"key1=value1": true}}, |
|
182 |
+ }: "labels", |
|
183 |
+ } |
|
184 |
+ |
|
185 |
+ for args, field := range matches { |
|
186 |
+ if args.MatchKVList(field, sources) != true { |
|
187 |
+ t.Fatalf("Expected true for %v on %v, got false", sources, args) |
|
188 |
+ } |
|
189 |
+ } |
|
190 |
+ |
|
191 |
+ differs := map[*Args]string{ |
|
192 |
+ &Args{map[string]map[string]bool{ |
|
193 |
+ "created": map[string]bool{"today": true}}, |
|
194 |
+ }: "created", |
|
195 |
+ &Args{map[string]map[string]bool{ |
|
196 |
+ "created": map[string]bool{"today": true}, |
|
197 |
+ "labels": map[string]bool{"key4": true}}, |
|
198 |
+ }: "labels", |
|
199 |
+ &Args{map[string]map[string]bool{ |
|
200 |
+ "created": map[string]bool{"today": true}, |
|
201 |
+ "labels": map[string]bool{"key1=value3": true}}, |
|
202 |
+ }: "labels", |
|
203 |
+ } |
|
204 |
+ |
|
205 |
+ for args, field := range differs { |
|
206 |
+ if args.MatchKVList(field, sources) != false { |
|
207 |
+ t.Fatalf("Expected false for %v on %v, got true", sources, args) |
|
208 |
+ } |
|
209 |
+ } |
|
210 |
+} |
|
211 |
+ |
|
212 |
+func TestArgsMatch(t *testing.T) { |
|
213 |
+ source := "today" |
|
214 |
+ |
|
215 |
+ matches := map[*Args]string{ |
|
216 |
+ &Args{}: "field", |
|
217 |
+ &Args{map[string]map[string]bool{ |
|
218 |
+ "created": map[string]bool{"today": true}}, |
|
219 |
+ }: "today", |
|
220 |
+ &Args{map[string]map[string]bool{ |
|
221 |
+ "created": map[string]bool{"to*": true}}, |
|
222 |
+ }: "created", |
|
223 |
+ &Args{map[string]map[string]bool{ |
|
224 |
+ "created": map[string]bool{"to(.*)": true}}, |
|
225 |
+ }: "created", |
|
226 |
+ &Args{map[string]map[string]bool{ |
|
227 |
+ "created": map[string]bool{"tod": true}}, |
|
228 |
+ }: "created", |
|
229 |
+ &Args{map[string]map[string]bool{ |
|
230 |
+ "created": map[string]bool{"anyting": true, "to*": true}}, |
|
231 |
+ }: "created", |
|
232 |
+ } |
|
233 |
+ |
|
234 |
+ for args, field := range matches { |
|
235 |
+ if args.Match(field, source) != true { |
|
236 |
+ t.Fatalf("Expected true for %v on %v, got false", source, args) |
|
237 |
+ } |
|
238 |
+ } |
|
239 |
+ |
|
240 |
+ differs := map[*Args]string{ |
|
241 |
+ &Args{map[string]map[string]bool{ |
|
242 |
+ "created": map[string]bool{"tomorrow": true}}, |
|
243 |
+ }: "created", |
|
244 |
+ &Args{map[string]map[string]bool{ |
|
245 |
+ "created": map[string]bool{"to(day": true}}, |
|
246 |
+ }: "created", |
|
247 |
+ &Args{map[string]map[string]bool{ |
|
248 |
+ "created": map[string]bool{"tom(.*)": true}}, |
|
249 |
+ }: "created", |
|
250 |
+ &Args{map[string]map[string]bool{ |
|
251 |
+ "created": map[string]bool{"tom": true}}, |
|
252 |
+ }: "created", |
|
253 |
+ &Args{map[string]map[string]bool{ |
|
254 |
+ "created": map[string]bool{"today1": true}, |
|
255 |
+ "labels": map[string]bool{"today": true}}, |
|
256 |
+ }: "created", |
|
257 |
+ } |
|
258 |
+ |
|
259 |
+ for args, field := range differs { |
|
260 |
+ if args.Match(field, source) != false { |
|
261 |
+ t.Fatalf("Expected false for %v on %v, got true", source, args) |
|
262 |
+ } |
|
263 |
+ } |
|
264 |
+} |
|
265 |
+ |
|
266 |
+func TestAdd(t *testing.T) { |
|
267 |
+ f := NewArgs() |
|
268 |
+ f.Add("status", "running") |
|
269 |
+ v := f.fields["status"] |
|
270 |
+ if len(v) != 1 || !v["running"] { |
|
271 |
+ t.Fatalf("Expected to include a running status, got %v", v) |
|
272 |
+ } |
|
273 |
+ |
|
274 |
+ f.Add("status", "paused") |
|
275 |
+ if len(v) != 2 || !v["paused"] { |
|
276 |
+ t.Fatalf("Expected to include a paused status, got %v", v) |
|
277 |
+ } |
|
278 |
+} |
|
279 |
+ |
|
280 |
+func TestDel(t *testing.T) { |
|
281 |
+ f := NewArgs() |
|
282 |
+ f.Add("status", "running") |
|
283 |
+ f.Del("status", "running") |
|
284 |
+ v := f.fields["status"] |
|
285 |
+ if v["running"] { |
|
286 |
+ t.Fatalf("Expected to not include a running status filter, got true") |
|
287 |
+ } |
|
288 |
+} |
|
289 |
+ |
|
290 |
+func TestLen(t *testing.T) { |
|
291 |
+ f := NewArgs() |
|
292 |
+ if f.Len() != 0 { |
|
293 |
+ t.Fatalf("Expected to not include any field") |
|
294 |
+ } |
|
295 |
+ f.Add("status", "running") |
|
296 |
+ if f.Len() != 1 { |
|
297 |
+ t.Fatalf("Expected to include one field") |
|
298 |
+ } |
|
299 |
+} |
|
300 |
+ |
|
301 |
+func TestExactMatch(t *testing.T) { |
|
302 |
+ f := NewArgs() |
|
303 |
+ |
|
304 |
+ if !f.ExactMatch("status", "running") { |
|
305 |
+ t.Fatalf("Expected to match `running` when there are no filters, got false") |
|
306 |
+ } |
|
307 |
+ |
|
308 |
+ f.Add("status", "running") |
|
309 |
+ f.Add("status", "pause*") |
|
310 |
+ |
|
311 |
+ if !f.ExactMatch("status", "running") { |
|
312 |
+ t.Fatalf("Expected to match `running` with one of the filters, got false") |
|
313 |
+ } |
|
314 |
+ |
|
315 |
+ if f.ExactMatch("status", "paused") { |
|
316 |
+ t.Fatalf("Expected to not match `paused` with one of the filters, got true") |
|
317 |
+ } |
|
318 |
+} |
|
319 |
+ |
|
320 |
+func TestOnlyOneExactMatch(t *testing.T) { |
|
321 |
+ f := NewArgs() |
|
322 |
+ |
|
323 |
+ if !f.UniqueExactMatch("status", "running") { |
|
324 |
+ t.Fatalf("Expected to match `running` when there are no filters, got false") |
|
325 |
+ } |
|
326 |
+ |
|
327 |
+ f.Add("status", "running") |
|
328 |
+ |
|
329 |
+ if !f.UniqueExactMatch("status", "running") { |
|
330 |
+ t.Fatalf("Expected to match `running` with one of the filters, got false") |
|
331 |
+ } |
|
332 |
+ |
|
333 |
+ if f.UniqueExactMatch("status", "paused") { |
|
334 |
+ t.Fatalf("Expected to not match `paused` with one of the filters, got true") |
|
335 |
+ } |
|
336 |
+ |
|
337 |
+ f.Add("status", "pause") |
|
338 |
+ if f.UniqueExactMatch("status", "running") { |
|
339 |
+ t.Fatalf("Expected to not match only `running` with two filters, got true") |
|
340 |
+ } |
|
341 |
+} |
|
342 |
+ |
|
343 |
+func TestInclude(t *testing.T) { |
|
344 |
+ f := NewArgs() |
|
345 |
+ if f.Include("status") { |
|
346 |
+ t.Fatalf("Expected to not include a status key, got true") |
|
347 |
+ } |
|
348 |
+ f.Add("status", "running") |
|
349 |
+ if !f.Include("status") { |
|
350 |
+ t.Fatalf("Expected to include a status key, got false") |
|
351 |
+ } |
|
352 |
+} |
|
353 |
+ |
|
354 |
+func TestValidate(t *testing.T) { |
|
355 |
+ f := NewArgs() |
|
356 |
+ f.Add("status", "running") |
|
357 |
+ |
|
358 |
+ valid := map[string]bool{ |
|
359 |
+ "status": true, |
|
360 |
+ "dangling": true, |
|
361 |
+ } |
|
362 |
+ |
|
363 |
+ if err := f.Validate(valid); err != nil { |
|
364 |
+ t.Fatal(err) |
|
365 |
+ } |
|
366 |
+ |
|
367 |
+ f.Add("bogus", "running") |
|
368 |
+ if err := f.Validate(valid); err == nil { |
|
369 |
+ t.Fatalf("Expected to return an error, got nil") |
|
370 |
+ } |
|
371 |
+} |
|
372 |
+ |
|
373 |
+func TestWalkValues(t *testing.T) { |
|
374 |
+ f := NewArgs() |
|
375 |
+ f.Add("status", "running") |
|
376 |
+ f.Add("status", "paused") |
|
377 |
+ |
|
378 |
+ f.WalkValues("status", func(value string) error { |
|
379 |
+ if value != "running" && value != "paused" { |
|
380 |
+ t.Fatalf("Unexpected value %s", value) |
|
381 |
+ } |
|
382 |
+ return nil |
|
383 |
+ }) |
|
384 |
+ |
|
385 |
+ err := f.WalkValues("status", func(value string) error { |
|
386 |
+ return fmt.Errorf("return") |
|
387 |
+ }) |
|
388 |
+ if err == nil { |
|
389 |
+ t.Fatalf("Expected to get an error, got nil") |
|
390 |
+ } |
|
391 |
+ |
|
392 |
+ err = f.WalkValues("foo", func(value string) error { |
|
393 |
+ return fmt.Errorf("return") |
|
394 |
+ }) |
|
395 |
+ if err != nil { |
|
396 |
+ t.Fatalf("Expected to not iterate when the field doesn't exist, got %v", err) |
|
397 |
+ } |
|
398 |
+} |
|
399 |
+ |
|
400 |
+func TestFuzzyMatch(t *testing.T) { |
|
401 |
+ f := NewArgs() |
|
402 |
+ f.Add("container", "foo") |
|
403 |
+ |
|
404 |
+ cases := map[string]bool{ |
|
405 |
+ "foo": true, |
|
406 |
+ "foobar": true, |
|
407 |
+ "barfoo": false, |
|
408 |
+ "bar": false, |
|
409 |
+ } |
|
410 |
+ for source, match := range cases { |
|
411 |
+ got := f.FuzzyMatch("container", source) |
|
412 |
+ if got != match { |
|
413 |
+ t.Fatalf("Expected %v, got %v: %s", match, got, source) |
|
414 |
+ } |
|
415 |
+ } |
|
416 |
+} |
0 | 417 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,58 @@ |
0 |
+package mount |
|
1 |
+ |
|
2 |
+// Type represents the type of a mount. |
|
3 |
+type Type string |
|
4 |
+ |
|
5 |
+const ( |
|
6 |
+ // TypeBind BIND |
|
7 |
+ TypeBind Type = "bind" |
|
8 |
+ // TypeVolume VOLUME |
|
9 |
+ TypeVolume Type = "volume" |
|
10 |
+) |
|
11 |
+ |
|
12 |
+// Mount represents a mount (volume). |
|
13 |
+type Mount struct { |
|
14 |
+ Type Type `json:",omitempty"` |
|
15 |
+ Source string `json:",omitempty"` |
|
16 |
+ Target string `json:",omitempty"` |
|
17 |
+ ReadOnly bool `json:",omitempty"` |
|
18 |
+ |
|
19 |
+ BindOptions *BindOptions `json:",omitempty"` |
|
20 |
+ VolumeOptions *VolumeOptions `json:",omitempty"` |
|
21 |
+} |
|
22 |
+ |
|
23 |
+// Propagation represents the propagation of a mount. |
|
24 |
+type Propagation string |
|
25 |
+ |
|
26 |
+const ( |
|
27 |
+ // PropagationRPrivate RPRIVATE |
|
28 |
+ PropagationRPrivate Propagation = "rprivate" |
|
29 |
+ // PropagationPrivate PRIVATE |
|
30 |
+ PropagationPrivate Propagation = "private" |
|
31 |
+ // PropagationRShared RSHARED |
|
32 |
+ PropagationRShared Propagation = "rshared" |
|
33 |
+ // PropagationShared SHARED |
|
34 |
+ PropagationShared Propagation = "shared" |
|
35 |
+ // PropagationRSlave RSLAVE |
|
36 |
+ PropagationRSlave Propagation = "rslave" |
|
37 |
+ // PropagationSlave SLAVE |
|
38 |
+ PropagationSlave Propagation = "slave" |
|
39 |
+) |
|
40 |
+ |
|
41 |
+// BindOptions defines options specific to mounts of type "bind". |
|
42 |
+type BindOptions struct { |
|
43 |
+ Propagation Propagation `json:",omitempty"` |
|
44 |
+} |
|
45 |
+ |
|
46 |
+// VolumeOptions represents the options for a mount of type volume. |
|
47 |
+type VolumeOptions struct { |
|
48 |
+ NoCopy bool `json:",omitempty"` |
|
49 |
+ Labels map[string]string `json:",omitempty"` |
|
50 |
+ DriverConfig *Driver `json:",omitempty"` |
|
51 |
+} |
|
52 |
+ |
|
53 |
+// Driver represents a volume driver. |
|
54 |
+type Driver struct { |
|
55 |
+ Name string `json:",omitempty"` |
|
56 |
+ Options map[string]string `json:",omitempty"` |
|
57 |
+} |
0 | 58 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,53 @@ |
0 |
+package network |
|
1 |
+ |
|
2 |
+// Address represents an IP address |
|
3 |
+type Address struct { |
|
4 |
+ Addr string |
|
5 |
+ PrefixLen int |
|
6 |
+} |
|
7 |
+ |
|
8 |
+// IPAM represents IP Address Management |
|
9 |
+type IPAM struct { |
|
10 |
+ Driver string |
|
11 |
+ Options map[string]string //Per network IPAM driver options |
|
12 |
+ Config []IPAMConfig |
|
13 |
+} |
|
14 |
+ |
|
15 |
+// IPAMConfig represents IPAM configurations |
|
16 |
+type IPAMConfig struct { |
|
17 |
+ Subnet string `json:",omitempty"` |
|
18 |
+ IPRange string `json:",omitempty"` |
|
19 |
+ Gateway string `json:",omitempty"` |
|
20 |
+ AuxAddress map[string]string `json:"AuxiliaryAddresses,omitempty"` |
|
21 |
+} |
|
22 |
+ |
|
23 |
+// EndpointIPAMConfig represents IPAM configurations for the endpoint |
|
24 |
+type EndpointIPAMConfig struct { |
|
25 |
+ IPv4Address string `json:",omitempty"` |
|
26 |
+ IPv6Address string `json:",omitempty"` |
|
27 |
+ LinkLocalIPs []string `json:",omitempty"` |
|
28 |
+} |
|
29 |
+ |
|
30 |
+// EndpointSettings stores the network endpoint details |
|
31 |
+type EndpointSettings struct { |
|
32 |
+ // Configurations |
|
33 |
+ IPAMConfig *EndpointIPAMConfig |
|
34 |
+ Links []string |
|
35 |
+ Aliases []string |
|
36 |
+ // Operational data |
|
37 |
+ NetworkID string |
|
38 |
+ EndpointID string |
|
39 |
+ Gateway string |
|
40 |
+ IPAddress string |
|
41 |
+ IPPrefixLen int |
|
42 |
+ IPv6Gateway string |
|
43 |
+ GlobalIPv6Address string |
|
44 |
+ GlobalIPv6PrefixLen int |
|
45 |
+ MacAddress string |
|
46 |
+} |
|
47 |
+ |
|
48 |
+// NetworkingConfig represents the container's networking configuration for each of its interfaces |
|
49 |
+// Carries the networking configs specified in the `docker run` and `docker network connect` commands |
|
50 |
+type NetworkingConfig struct { |
|
51 |
+ EndpointsConfig map[string]*EndpointSettings // Endpoint configs for each connecting network |
|
52 |
+} |
0 | 53 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,170 @@ |
0 |
+// +build experimental |
|
1 |
+ |
|
2 |
+package types |
|
3 |
+ |
|
4 |
+import ( |
|
5 |
+ "encoding/json" |
|
6 |
+ "fmt" |
|
7 |
+) |
|
8 |
+ |
|
9 |
+// PluginInstallOptions holds parameters to install a plugin. |
|
10 |
+type PluginInstallOptions struct { |
|
11 |
+ Disabled bool |
|
12 |
+ AcceptAllPermissions bool |
|
13 |
+ RegistryAuth string // RegistryAuth is the base64 encoded credentials for the registry |
|
14 |
+ PrivilegeFunc RequestPrivilegeFunc |
|
15 |
+ AcceptPermissionsFunc func(PluginPrivileges) (bool, error) |
|
16 |
+} |
|
17 |
+ |
|
18 |
+// PluginConfig represents the values of settings potentially modifiable by a user |
|
19 |
+type PluginConfig struct { |
|
20 |
+ Mounts []PluginMount |
|
21 |
+ Env []string |
|
22 |
+ Args []string |
|
23 |
+ Devices []PluginDevice |
|
24 |
+} |
|
25 |
+ |
|
26 |
+// Plugin represents a Docker plugin for the remote API |
|
27 |
+type Plugin struct { |
|
28 |
+ ID string `json:"Id,omitempty"` |
|
29 |
+ Name string |
|
30 |
+ Tag string |
|
31 |
+ // Enabled is true when the plugin is running, is false when the plugin is not running, only installed. |
|
32 |
+ Enabled bool |
|
33 |
+ Config PluginConfig |
|
34 |
+ Manifest PluginManifest |
|
35 |
+} |
|
36 |
+ |
|
37 |
+// PluginsListResponse contains the response for the remote API |
|
38 |
+type PluginsListResponse []*Plugin |
|
39 |
+ |
|
40 |
+const ( |
|
41 |
+ authzDriver = "AuthzDriver" |
|
42 |
+ graphDriver = "GraphDriver" |
|
43 |
+ ipamDriver = "IpamDriver" |
|
44 |
+ networkDriver = "NetworkDriver" |
|
45 |
+ volumeDriver = "VolumeDriver" |
|
46 |
+) |
|
47 |
+ |
|
48 |
+// PluginInterfaceType represents a type that a plugin implements. |
|
49 |
+type PluginInterfaceType struct { |
|
50 |
+ Prefix string // This is always "docker" |
|
51 |
+ Capability string // Capability should be validated against the above list. |
|
52 |
+ Version string // Plugin API version. Depends on the capability |
|
53 |
+} |
|
54 |
+ |
|
55 |
+// UnmarshalJSON implements json.Unmarshaler for PluginInterfaceType |
|
56 |
+func (t *PluginInterfaceType) UnmarshalJSON(p []byte) error { |
|
57 |
+ versionIndex := len(p) |
|
58 |
+ prefixIndex := 0 |
|
59 |
+ if len(p) < 2 || p[0] != '"' || p[len(p)-1] != '"' { |
|
60 |
+ return fmt.Errorf("%q is not a plugin interface type", p) |
|
61 |
+ } |
|
62 |
+ p = p[1 : len(p)-1] |
|
63 |
+loop: |
|
64 |
+ for i, b := range p { |
|
65 |
+ switch b { |
|
66 |
+ case '.': |
|
67 |
+ prefixIndex = i |
|
68 |
+ case '/': |
|
69 |
+ versionIndex = i |
|
70 |
+ break loop |
|
71 |
+ } |
|
72 |
+ } |
|
73 |
+ t.Prefix = string(p[:prefixIndex]) |
|
74 |
+ t.Capability = string(p[prefixIndex+1 : versionIndex]) |
|
75 |
+ if versionIndex < len(p) { |
|
76 |
+ t.Version = string(p[versionIndex+1:]) |
|
77 |
+ } |
|
78 |
+ return nil |
|
79 |
+} |
|
80 |
+ |
|
81 |
+// MarshalJSON implements json.Marshaler for PluginInterfaceType |
|
82 |
+func (t *PluginInterfaceType) MarshalJSON() ([]byte, error) { |
|
83 |
+ return json.Marshal(t.String()) |
|
84 |
+} |
|
85 |
+ |
|
86 |
+// String implements fmt.Stringer for PluginInterfaceType |
|
87 |
+func (t PluginInterfaceType) String() string { |
|
88 |
+ return fmt.Sprintf("%s.%s/%s", t.Prefix, t.Capability, t.Version) |
|
89 |
+} |
|
90 |
+ |
|
91 |
+// PluginInterface describes the interface between Docker and plugin |
|
92 |
+type PluginInterface struct { |
|
93 |
+ Types []PluginInterfaceType |
|
94 |
+ Socket string |
|
95 |
+} |
|
96 |
+ |
|
97 |
+// PluginSetting is to be embedded in other structs, if they are supposed to be |
|
98 |
+// modifiable by the user. |
|
99 |
+type PluginSetting struct { |
|
100 |
+ Name string |
|
101 |
+ Description string |
|
102 |
+ Settable []string |
|
103 |
+} |
|
104 |
+ |
|
105 |
+// PluginNetwork represents the network configuration for a plugin |
|
106 |
+type PluginNetwork struct { |
|
107 |
+ Type string |
|
108 |
+} |
|
109 |
+ |
|
110 |
+// PluginMount represents the mount configuration for a plugin |
|
111 |
+type PluginMount struct { |
|
112 |
+ PluginSetting |
|
113 |
+ Source *string |
|
114 |
+ Destination string |
|
115 |
+ Type string |
|
116 |
+ Options []string |
|
117 |
+} |
|
118 |
+ |
|
119 |
+// PluginEnv represents an environment variable for a plugin |
|
120 |
+type PluginEnv struct { |
|
121 |
+ PluginSetting |
|
122 |
+ Value *string |
|
123 |
+} |
|
124 |
+ |
|
125 |
+// PluginArgs represents the command line arguments for a plugin |
|
126 |
+type PluginArgs struct { |
|
127 |
+ PluginSetting |
|
128 |
+ Value []string |
|
129 |
+} |
|
130 |
+ |
|
131 |
+// PluginDevice represents a device for a plugin |
|
132 |
+type PluginDevice struct { |
|
133 |
+ PluginSetting |
|
134 |
+ Path *string |
|
135 |
+} |
|
136 |
+ |
|
137 |
+// PluginUser represents the user for the plugin's process |
|
138 |
+type PluginUser struct { |
|
139 |
+ UID uint32 `json:"Uid,omitempty"` |
|
140 |
+ GID uint32 `json:"Gid,omitempty"` |
|
141 |
+} |
|
142 |
+ |
|
143 |
+// PluginManifest represents the manifest of a plugin |
|
144 |
+type PluginManifest struct { |
|
145 |
+ ManifestVersion string |
|
146 |
+ Description string |
|
147 |
+ Documentation string |
|
148 |
+ Interface PluginInterface |
|
149 |
+ Entrypoint []string |
|
150 |
+ Workdir string |
|
151 |
+ User PluginUser `json:",omitempty"` |
|
152 |
+ Network PluginNetwork |
|
153 |
+ Capabilities []string |
|
154 |
+ Mounts []PluginMount |
|
155 |
+ Devices []PluginDevice |
|
156 |
+ Env []PluginEnv |
|
157 |
+ Args PluginArgs |
|
158 |
+} |
|
159 |
+ |
|
160 |
+// PluginPrivilege describes a permission the user has to accept |
|
161 |
+// upon installing a plugin. |
|
162 |
+type PluginPrivilege struct { |
|
163 |
+ Name string |
|
164 |
+ Description string |
|
165 |
+ Value []string |
|
166 |
+} |
|
167 |
+ |
|
168 |
+// PluginPrivileges is a list of PluginPrivilege |
|
169 |
+type PluginPrivileges []PluginPrivilege |
0 | 170 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,34 @@ |
0 |
+package reference |
|
1 |
+ |
|
2 |
+import ( |
|
3 |
+ distreference "github.com/docker/distribution/reference" |
|
4 |
+) |
|
5 |
+ |
|
6 |
+// Parse parses the given references and returns the repository and |
|
7 |
+// tag (if present) from it. If there is an error during parsing, it will |
|
8 |
+// return an error. |
|
9 |
+func Parse(ref string) (string, string, error) { |
|
10 |
+ distributionRef, err := distreference.ParseNamed(ref) |
|
11 |
+ if err != nil { |
|
12 |
+ return "", "", err |
|
13 |
+ } |
|
14 |
+ |
|
15 |
+ tag := GetTagFromNamedRef(distributionRef) |
|
16 |
+ return distributionRef.Name(), tag, nil |
|
17 |
+} |
|
18 |
+ |
|
19 |
+// GetTagFromNamedRef returns a tag from the specified reference. |
|
20 |
+// This function is necessary as long as the docker "server" api makes the distinction between repository |
|
21 |
+// and tags. |
|
22 |
+func GetTagFromNamedRef(ref distreference.Named) string { |
|
23 |
+ var tag string |
|
24 |
+ switch x := ref.(type) { |
|
25 |
+ case distreference.Digested: |
|
26 |
+ tag = x.Digest().String() |
|
27 |
+ case distreference.NamedTagged: |
|
28 |
+ tag = x.Tag() |
|
29 |
+ default: |
|
30 |
+ tag = "latest" |
|
31 |
+ } |
|
32 |
+ return tag |
|
33 |
+} |
0 | 34 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,72 @@ |
0 |
+package reference |
|
1 |
+ |
|
2 |
+import ( |
|
3 |
+ "testing" |
|
4 |
+) |
|
5 |
+ |
|
6 |
+func TestParse(t *testing.T) { |
|
7 |
+ testCases := []struct { |
|
8 |
+ ref string |
|
9 |
+ expectedName string |
|
10 |
+ expectedTag string |
|
11 |
+ expectedError bool |
|
12 |
+ }{ |
|
13 |
+ { |
|
14 |
+ ref: "", |
|
15 |
+ expectedName: "", |
|
16 |
+ expectedTag: "", |
|
17 |
+ expectedError: true, |
|
18 |
+ }, |
|
19 |
+ { |
|
20 |
+ ref: "repository", |
|
21 |
+ expectedName: "repository", |
|
22 |
+ expectedTag: "latest", |
|
23 |
+ expectedError: false, |
|
24 |
+ }, |
|
25 |
+ { |
|
26 |
+ ref: "repository:tag", |
|
27 |
+ expectedName: "repository", |
|
28 |
+ expectedTag: "tag", |
|
29 |
+ expectedError: false, |
|
30 |
+ }, |
|
31 |
+ { |
|
32 |
+ ref: "test.com/repository", |
|
33 |
+ expectedName: "test.com/repository", |
|
34 |
+ expectedTag: "latest", |
|
35 |
+ expectedError: false, |
|
36 |
+ }, |
|
37 |
+ { |
|
38 |
+ ref: "test.com:5000/test/repository", |
|
39 |
+ expectedName: "test.com:5000/test/repository", |
|
40 |
+ expectedTag: "latest", |
|
41 |
+ expectedError: false, |
|
42 |
+ }, |
|
43 |
+ { |
|
44 |
+ ref: "test.com:5000/repo@sha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", |
|
45 |
+ expectedName: "test.com:5000/repo", |
|
46 |
+ expectedTag: "sha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", |
|
47 |
+ expectedError: false, |
|
48 |
+ }, |
|
49 |
+ { |
|
50 |
+ ref: "test.com:5000/repo:tag@sha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", |
|
51 |
+ expectedName: "test.com:5000/repo", |
|
52 |
+ expectedTag: "sha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", |
|
53 |
+ expectedError: false, |
|
54 |
+ }, |
|
55 |
+ } |
|
56 |
+ |
|
57 |
+ for _, c := range testCases { |
|
58 |
+ name, tag, err := Parse(c.ref) |
|
59 |
+ if err != nil && c.expectedError { |
|
60 |
+ continue |
|
61 |
+ } else if err != nil { |
|
62 |
+ t.Fatalf("error with %s: %s", c.ref, err.Error()) |
|
63 |
+ } |
|
64 |
+ if name != c.expectedName { |
|
65 |
+ t.Fatalf("expected name %s, got %s", c.expectedName, name) |
|
66 |
+ } |
|
67 |
+ if tag != c.expectedTag { |
|
68 |
+ t.Fatalf("expected tag %s, got %s", c.expectedTag, tag) |
|
69 |
+ } |
|
70 |
+ } |
|
71 |
+} |
0 | 72 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,104 @@ |
0 |
+package registry |
|
1 |
+ |
|
2 |
+import ( |
|
3 |
+ "encoding/json" |
|
4 |
+ "net" |
|
5 |
+) |
|
6 |
+ |
|
7 |
+// ServiceConfig stores daemon registry services configuration. |
|
8 |
+type ServiceConfig struct { |
|
9 |
+ InsecureRegistryCIDRs []*NetIPNet `json:"InsecureRegistryCIDRs"` |
|
10 |
+ IndexConfigs map[string]*IndexInfo `json:"IndexConfigs"` |
|
11 |
+ Mirrors []string |
|
12 |
+} |
|
13 |
+ |
|
14 |
+// NetIPNet is the net.IPNet type, which can be marshalled and |
|
15 |
+// unmarshalled to JSON |
|
16 |
+type NetIPNet net.IPNet |
|
17 |
+ |
|
18 |
+// String returns the CIDR notation of ipnet |
|
19 |
+func (ipnet *NetIPNet) String() string { |
|
20 |
+ return (*net.IPNet)(ipnet).String() |
|
21 |
+} |
|
22 |
+ |
|
23 |
+// MarshalJSON returns the JSON representation of the IPNet |
|
24 |
+func (ipnet *NetIPNet) MarshalJSON() ([]byte, error) { |
|
25 |
+ return json.Marshal((*net.IPNet)(ipnet).String()) |
|
26 |
+} |
|
27 |
+ |
|
28 |
+// UnmarshalJSON sets the IPNet from a byte array of JSON |
|
29 |
+func (ipnet *NetIPNet) UnmarshalJSON(b []byte) (err error) { |
|
30 |
+ var ipnetStr string |
|
31 |
+ if err = json.Unmarshal(b, &ipnetStr); err == nil { |
|
32 |
+ var cidr *net.IPNet |
|
33 |
+ if _, cidr, err = net.ParseCIDR(ipnetStr); err == nil { |
|
34 |
+ *ipnet = NetIPNet(*cidr) |
|
35 |
+ } |
|
36 |
+ } |
|
37 |
+ return |
|
38 |
+} |
|
39 |
+ |
|
40 |
+// IndexInfo contains information about a registry |
|
41 |
+// |
|
42 |
+// RepositoryInfo Examples: |
|
43 |
+// { |
|
44 |
+// "Index" : { |
|
45 |
+// "Name" : "docker.io", |
|
46 |
+// "Mirrors" : ["https://registry-2.docker.io/v1/", "https://registry-3.docker.io/v1/"], |
|
47 |
+// "Secure" : true, |
|
48 |
+// "Official" : true, |
|
49 |
+// }, |
|
50 |
+// "RemoteName" : "library/debian", |
|
51 |
+// "LocalName" : "debian", |
|
52 |
+// "CanonicalName" : "docker.io/debian" |
|
53 |
+// "Official" : true, |
|
54 |
+// } |
|
55 |
+// |
|
56 |
+// { |
|
57 |
+// "Index" : { |
|
58 |
+// "Name" : "127.0.0.1:5000", |
|
59 |
+// "Mirrors" : [], |
|
60 |
+// "Secure" : false, |
|
61 |
+// "Official" : false, |
|
62 |
+// }, |
|
63 |
+// "RemoteName" : "user/repo", |
|
64 |
+// "LocalName" : "127.0.0.1:5000/user/repo", |
|
65 |
+// "CanonicalName" : "127.0.0.1:5000/user/repo", |
|
66 |
+// "Official" : false, |
|
67 |
+// } |
|
68 |
+type IndexInfo struct { |
|
69 |
+ // Name is the name of the registry, such as "docker.io" |
|
70 |
+ Name string |
|
71 |
+ // Mirrors is a list of mirrors, expressed as URIs |
|
72 |
+ Mirrors []string |
|
73 |
+ // Secure is set to false if the registry is part of the list of |
|
74 |
+ // insecure registries. Insecure registries accept HTTP and/or accept |
|
75 |
+ // HTTPS with certificates from unknown CAs. |
|
76 |
+ Secure bool |
|
77 |
+ // Official indicates whether this is an official registry |
|
78 |
+ Official bool |
|
79 |
+} |
|
80 |
+ |
|
81 |
+// SearchResult describes a search result returned from a registry |
|
82 |
+type SearchResult struct { |
|
83 |
+ // StarCount indicates the number of stars this repository has |
|
84 |
+ StarCount int `json:"star_count"` |
|
85 |
+ // IsOfficial is true if the result is from an official repository. |
|
86 |
+ IsOfficial bool `json:"is_official"` |
|
87 |
+ // Name is the name of the repository |
|
88 |
+ Name string `json:"name"` |
|
89 |
+ // IsAutomated indicates whether the result is automated |
|
90 |
+ IsAutomated bool `json:"is_automated"` |
|
91 |
+ // Description is a textual description of the repository |
|
92 |
+ Description string `json:"description"` |
|
93 |
+} |
|
94 |
+ |
|
95 |
+// SearchResults lists a collection search results returned from a registry |
|
96 |
+type SearchResults struct { |
|
97 |
+ // Query contains the query string that generated the search results |
|
98 |
+ Query string `json:"query"` |
|
99 |
+ // NumResults indicates the number of results the query returned |
|
100 |
+ NumResults int `json:"num_results"` |
|
101 |
+ // Results is a slice containing the actual results for the search |
|
102 |
+ Results []SearchResult `json:"results"` |
|
103 |
+} |
0 | 104 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,93 @@ |
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 is kept to maintain backward compatibility with the old |
|
6 |
+ // seccomp profile. |
|
7 |
+ Architectures []Arch `json:"architectures,omitempty"` |
|
8 |
+ ArchMap []Architecture `json:"archMap,omitempty"` |
|
9 |
+ Syscalls []*Syscall `json:"syscalls"` |
|
10 |
+} |
|
11 |
+ |
|
12 |
+// Architecture is used to represent an specific architecture |
|
13 |
+// and its sub-architectures |
|
14 |
+type Architecture struct { |
|
15 |
+ Arch Arch `json:"architecture"` |
|
16 |
+ SubArches []Arch `json:"subArchitectures"` |
|
17 |
+} |
|
18 |
+ |
|
19 |
+// Arch used for architectures |
|
20 |
+type Arch string |
|
21 |
+ |
|
22 |
+// Additional architectures permitted to be used for system calls |
|
23 |
+// By default only the native architecture of the kernel is permitted |
|
24 |
+const ( |
|
25 |
+ ArchX86 Arch = "SCMP_ARCH_X86" |
|
26 |
+ ArchX86_64 Arch = "SCMP_ARCH_X86_64" |
|
27 |
+ ArchX32 Arch = "SCMP_ARCH_X32" |
|
28 |
+ ArchARM Arch = "SCMP_ARCH_ARM" |
|
29 |
+ ArchAARCH64 Arch = "SCMP_ARCH_AARCH64" |
|
30 |
+ ArchMIPS Arch = "SCMP_ARCH_MIPS" |
|
31 |
+ ArchMIPS64 Arch = "SCMP_ARCH_MIPS64" |
|
32 |
+ ArchMIPS64N32 Arch = "SCMP_ARCH_MIPS64N32" |
|
33 |
+ ArchMIPSEL Arch = "SCMP_ARCH_MIPSEL" |
|
34 |
+ ArchMIPSEL64 Arch = "SCMP_ARCH_MIPSEL64" |
|
35 |
+ ArchMIPSEL64N32 Arch = "SCMP_ARCH_MIPSEL64N32" |
|
36 |
+ ArchPPC Arch = "SCMP_ARCH_PPC" |
|
37 |
+ ArchPPC64 Arch = "SCMP_ARCH_PPC64" |
|
38 |
+ ArchPPC64LE Arch = "SCMP_ARCH_PPC64LE" |
|
39 |
+ ArchS390 Arch = "SCMP_ARCH_S390" |
|
40 |
+ ArchS390X Arch = "SCMP_ARCH_S390X" |
|
41 |
+) |
|
42 |
+ |
|
43 |
+// Action taken upon Seccomp rule match |
|
44 |
+type Action string |
|
45 |
+ |
|
46 |
+// Define actions for Seccomp rules |
|
47 |
+const ( |
|
48 |
+ ActKill Action = "SCMP_ACT_KILL" |
|
49 |
+ ActTrap Action = "SCMP_ACT_TRAP" |
|
50 |
+ ActErrno Action = "SCMP_ACT_ERRNO" |
|
51 |
+ ActTrace Action = "SCMP_ACT_TRACE" |
|
52 |
+ ActAllow Action = "SCMP_ACT_ALLOW" |
|
53 |
+) |
|
54 |
+ |
|
55 |
+// Operator used to match syscall arguments in Seccomp |
|
56 |
+type Operator string |
|
57 |
+ |
|
58 |
+// Define operators for syscall arguments in Seccomp |
|
59 |
+const ( |
|
60 |
+ OpNotEqual Operator = "SCMP_CMP_NE" |
|
61 |
+ OpLessThan Operator = "SCMP_CMP_LT" |
|
62 |
+ OpLessEqual Operator = "SCMP_CMP_LE" |
|
63 |
+ OpEqualTo Operator = "SCMP_CMP_EQ" |
|
64 |
+ OpGreaterEqual Operator = "SCMP_CMP_GE" |
|
65 |
+ OpGreaterThan Operator = "SCMP_CMP_GT" |
|
66 |
+ OpMaskedEqual Operator = "SCMP_CMP_MASKED_EQ" |
|
67 |
+) |
|
68 |
+ |
|
69 |
+// Arg used for matching specific syscall arguments in Seccomp |
|
70 |
+type Arg struct { |
|
71 |
+ Index uint `json:"index"` |
|
72 |
+ Value uint64 `json:"value"` |
|
73 |
+ ValueTwo uint64 `json:"valueTwo"` |
|
74 |
+ Op Operator `json:"op"` |
|
75 |
+} |
|
76 |
+ |
|
77 |
+// Filter is used to conditionally apply Seccomp rules |
|
78 |
+type Filter struct { |
|
79 |
+ Caps []string `json:"caps,omitempty"` |
|
80 |
+ Arches []string `json:"arches,omitempty"` |
|
81 |
+} |
|
82 |
+ |
|
83 |
+// Syscall is used to match a group of syscalls in Seccomp |
|
84 |
+type Syscall struct { |
|
85 |
+ Name string `json:"name,omitempty"` |
|
86 |
+ Names []string `json:"names,omitempty"` |
|
87 |
+ Action Action `json:"action"` |
|
88 |
+ Args []*Arg `json:"args"` |
|
89 |
+ Comment string `json:"comment"` |
|
90 |
+ Includes Filter `json:"includes"` |
|
91 |
+ Excludes Filter `json:"excludes"` |
|
92 |
+} |
0 | 93 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,115 @@ |
0 |
+// Package types is used for API stability in the types and response to the |
|
1 |
+// consumers of the API stats endpoint. |
|
2 |
+package types |
|
3 |
+ |
|
4 |
+import "time" |
|
5 |
+ |
|
6 |
+// ThrottlingData stores CPU throttling stats of one running container |
|
7 |
+type ThrottlingData struct { |
|
8 |
+ // Number of periods with throttling active |
|
9 |
+ Periods uint64 `json:"periods"` |
|
10 |
+ // Number of periods when the container hits its throttling limit. |
|
11 |
+ ThrottledPeriods uint64 `json:"throttled_periods"` |
|
12 |
+ // Aggregate time the container was throttled for in nanoseconds. |
|
13 |
+ ThrottledTime uint64 `json:"throttled_time"` |
|
14 |
+} |
|
15 |
+ |
|
16 |
+// CPUUsage stores All CPU stats aggregated since container inception. |
|
17 |
+type CPUUsage struct { |
|
18 |
+ // Total CPU time consumed. |
|
19 |
+ // Units: nanoseconds. |
|
20 |
+ TotalUsage uint64 `json:"total_usage"` |
|
21 |
+ // Total CPU time consumed per core. |
|
22 |
+ // Units: nanoseconds. |
|
23 |
+ PercpuUsage []uint64 `json:"percpu_usage"` |
|
24 |
+ // Time spent by tasks of the cgroup in kernel mode. |
|
25 |
+ // Units: nanoseconds. |
|
26 |
+ UsageInKernelmode uint64 `json:"usage_in_kernelmode"` |
|
27 |
+ // Time spent by tasks of the cgroup in user mode. |
|
28 |
+ // Units: nanoseconds. |
|
29 |
+ UsageInUsermode uint64 `json:"usage_in_usermode"` |
|
30 |
+} |
|
31 |
+ |
|
32 |
+// CPUStats aggregates and wraps all CPU related info of container |
|
33 |
+type CPUStats struct { |
|
34 |
+ CPUUsage CPUUsage `json:"cpu_usage"` |
|
35 |
+ SystemUsage uint64 `json:"system_cpu_usage"` |
|
36 |
+ ThrottlingData ThrottlingData `json:"throttling_data,omitempty"` |
|
37 |
+} |
|
38 |
+ |
|
39 |
+// MemoryStats aggregates All memory stats since container inception |
|
40 |
+type MemoryStats struct { |
|
41 |
+ // current res_counter usage for memory |
|
42 |
+ Usage uint64 `json:"usage"` |
|
43 |
+ // maximum usage ever recorded. |
|
44 |
+ MaxUsage uint64 `json:"max_usage"` |
|
45 |
+ // TODO(vishh): Export these as stronger types. |
|
46 |
+ // all the stats exported via memory.stat. |
|
47 |
+ Stats map[string]uint64 `json:"stats"` |
|
48 |
+ // number of times memory usage hits limits. |
|
49 |
+ Failcnt uint64 `json:"failcnt"` |
|
50 |
+ Limit uint64 `json:"limit"` |
|
51 |
+} |
|
52 |
+ |
|
53 |
+// BlkioStatEntry is one small entity to store a piece of Blkio stats |
|
54 |
+// TODO Windows: This can be factored out |
|
55 |
+type BlkioStatEntry struct { |
|
56 |
+ Major uint64 `json:"major"` |
|
57 |
+ Minor uint64 `json:"minor"` |
|
58 |
+ Op string `json:"op"` |
|
59 |
+ Value uint64 `json:"value"` |
|
60 |
+} |
|
61 |
+ |
|
62 |
+// BlkioStats stores All IO service stats for data read and write |
|
63 |
+// TODO Windows: This can be factored out |
|
64 |
+type BlkioStats struct { |
|
65 |
+ // number of bytes transferred to and from the block device |
|
66 |
+ IoServiceBytesRecursive []BlkioStatEntry `json:"io_service_bytes_recursive"` |
|
67 |
+ IoServicedRecursive []BlkioStatEntry `json:"io_serviced_recursive"` |
|
68 |
+ IoQueuedRecursive []BlkioStatEntry `json:"io_queue_recursive"` |
|
69 |
+ IoServiceTimeRecursive []BlkioStatEntry `json:"io_service_time_recursive"` |
|
70 |
+ IoWaitTimeRecursive []BlkioStatEntry `json:"io_wait_time_recursive"` |
|
71 |
+ IoMergedRecursive []BlkioStatEntry `json:"io_merged_recursive"` |
|
72 |
+ IoTimeRecursive []BlkioStatEntry `json:"io_time_recursive"` |
|
73 |
+ SectorsRecursive []BlkioStatEntry `json:"sectors_recursive"` |
|
74 |
+} |
|
75 |
+ |
|
76 |
+// NetworkStats aggregates All network stats of one container |
|
77 |
+// TODO Windows: This will require refactoring |
|
78 |
+type NetworkStats struct { |
|
79 |
+ RxBytes uint64 `json:"rx_bytes"` |
|
80 |
+ RxPackets uint64 `json:"rx_packets"` |
|
81 |
+ RxErrors uint64 `json:"rx_errors"` |
|
82 |
+ RxDropped uint64 `json:"rx_dropped"` |
|
83 |
+ TxBytes uint64 `json:"tx_bytes"` |
|
84 |
+ TxPackets uint64 `json:"tx_packets"` |
|
85 |
+ TxErrors uint64 `json:"tx_errors"` |
|
86 |
+ TxDropped uint64 `json:"tx_dropped"` |
|
87 |
+} |
|
88 |
+ |
|
89 |
+// PidsStats contains the stats of a container's pids |
|
90 |
+type PidsStats struct { |
|
91 |
+ // Current is the number of pids in the cgroup |
|
92 |
+ Current uint64 `json:"current,omitempty"` |
|
93 |
+ // Limit is the hard limit on the number of pids in the cgroup. |
|
94 |
+ // A "Limit" of 0 means that there is no limit. |
|
95 |
+ Limit uint64 `json:"limit,omitempty"` |
|
96 |
+} |
|
97 |
+ |
|
98 |
+// Stats is Ultimate struct aggregating all types of stats of one container |
|
99 |
+type Stats struct { |
|
100 |
+ Read time.Time `json:"read"` |
|
101 |
+ PreCPUStats CPUStats `json:"precpu_stats,omitempty"` |
|
102 |
+ CPUStats CPUStats `json:"cpu_stats,omitempty"` |
|
103 |
+ MemoryStats MemoryStats `json:"memory_stats,omitempty"` |
|
104 |
+ BlkioStats BlkioStats `json:"blkio_stats,omitempty"` |
|
105 |
+ PidsStats PidsStats `json:"pids_stats,omitempty"` |
|
106 |
+} |
|
107 |
+ |
|
108 |
+// StatsJSON is newly used Networks |
|
109 |
+type StatsJSON struct { |
|
110 |
+ Stats |
|
111 |
+ |
|
112 |
+ // Networks request version >=1.21 |
|
113 |
+ Networks map[string]NetworkStats `json:"networks,omitempty"` |
|
114 |
+} |
0 | 115 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,30 @@ |
0 |
+package strslice |
|
1 |
+ |
|
2 |
+import "encoding/json" |
|
3 |
+ |
|
4 |
+// StrSlice represents a string or an array of strings. |
|
5 |
+// We need to override the json decoder to accept both options. |
|
6 |
+type StrSlice []string |
|
7 |
+ |
|
8 |
+// UnmarshalJSON decodes the byte slice whether it's a string or an array of |
|
9 |
+// strings. This method is needed to implement json.Unmarshaler. |
|
10 |
+func (e *StrSlice) UnmarshalJSON(b []byte) error { |
|
11 |
+ if len(b) == 0 { |
|
12 |
+ // With no input, we preserve the existing value by returning nil and |
|
13 |
+ // leaving the target alone. This allows defining default values for |
|
14 |
+ // the type. |
|
15 |
+ return nil |
|
16 |
+ } |
|
17 |
+ |
|
18 |
+ p := make([]string, 0, 1) |
|
19 |
+ if err := json.Unmarshal(b, &p); err != nil { |
|
20 |
+ var s string |
|
21 |
+ if err := json.Unmarshal(b, &s); err != nil { |
|
22 |
+ return err |
|
23 |
+ } |
|
24 |
+ p = append(p, s) |
|
25 |
+ } |
|
26 |
+ |
|
27 |
+ *e = p |
|
28 |
+ return nil |
|
29 |
+} |
0 | 30 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,86 @@ |
0 |
+package strslice |
|
1 |
+ |
|
2 |
+import ( |
|
3 |
+ "encoding/json" |
|
4 |
+ "reflect" |
|
5 |
+ "testing" |
|
6 |
+) |
|
7 |
+ |
|
8 |
+func TestStrSliceMarshalJSON(t *testing.T) { |
|
9 |
+ for _, testcase := range []struct { |
|
10 |
+ input StrSlice |
|
11 |
+ expected string |
|
12 |
+ }{ |
|
13 |
+ // MADNESS(stevvooe): No clue why nil would be "" but empty would be |
|
14 |
+ // "null". Had to make a change here that may affect compatibility. |
|
15 |
+ {input: nil, expected: "null"}, |
|
16 |
+ {StrSlice{}, "[]"}, |
|
17 |
+ {StrSlice{"/bin/sh", "-c", "echo"}, `["/bin/sh","-c","echo"]`}, |
|
18 |
+ } { |
|
19 |
+ data, err := json.Marshal(testcase.input) |
|
20 |
+ if err != nil { |
|
21 |
+ t.Fatal(err) |
|
22 |
+ } |
|
23 |
+ if string(data) != testcase.expected { |
|
24 |
+ t.Fatalf("%#v: expected %v, got %v", testcase.input, testcase.expected, string(data)) |
|
25 |
+ } |
|
26 |
+ } |
|
27 |
+} |
|
28 |
+ |
|
29 |
+func TestStrSliceUnmarshalJSON(t *testing.T) { |
|
30 |
+ parts := map[string][]string{ |
|
31 |
+ "": {"default", "values"}, |
|
32 |
+ "[]": {}, |
|
33 |
+ `["/bin/sh","-c","echo"]`: {"/bin/sh", "-c", "echo"}, |
|
34 |
+ } |
|
35 |
+ for json, expectedParts := range parts { |
|
36 |
+ strs := StrSlice{"default", "values"} |
|
37 |
+ if err := strs.UnmarshalJSON([]byte(json)); err != nil { |
|
38 |
+ t.Fatal(err) |
|
39 |
+ } |
|
40 |
+ |
|
41 |
+ actualParts := []string(strs) |
|
42 |
+ if !reflect.DeepEqual(actualParts, expectedParts) { |
|
43 |
+ t.Fatalf("%#v: expected %v, got %v", json, expectedParts, actualParts) |
|
44 |
+ } |
|
45 |
+ |
|
46 |
+ } |
|
47 |
+} |
|
48 |
+ |
|
49 |
+func TestStrSliceUnmarshalString(t *testing.T) { |
|
50 |
+ var e StrSlice |
|
51 |
+ echo, err := json.Marshal("echo") |
|
52 |
+ if err != nil { |
|
53 |
+ t.Fatal(err) |
|
54 |
+ } |
|
55 |
+ if err := json.Unmarshal(echo, &e); err != nil { |
|
56 |
+ t.Fatal(err) |
|
57 |
+ } |
|
58 |
+ |
|
59 |
+ if len(e) != 1 { |
|
60 |
+ t.Fatalf("expected 1 element after unmarshal: %q", e) |
|
61 |
+ } |
|
62 |
+ |
|
63 |
+ if e[0] != "echo" { |
|
64 |
+ t.Fatalf("expected `echo`, got: %q", e[0]) |
|
65 |
+ } |
|
66 |
+} |
|
67 |
+ |
|
68 |
+func TestStrSliceUnmarshalSlice(t *testing.T) { |
|
69 |
+ var e StrSlice |
|
70 |
+ echo, err := json.Marshal([]string{"echo"}) |
|
71 |
+ if err != nil { |
|
72 |
+ t.Fatal(err) |
|
73 |
+ } |
|
74 |
+ if err := json.Unmarshal(echo, &e); err != nil { |
|
75 |
+ t.Fatal(err) |
|
76 |
+ } |
|
77 |
+ |
|
78 |
+ if len(e) != 1 { |
|
79 |
+ t.Fatalf("expected 1 element after unmarshal: %q", e) |
|
80 |
+ } |
|
81 |
+ |
|
82 |
+ if e[0] != "echo" { |
|
83 |
+ t.Fatalf("expected `echo`, got: %q", e[0]) |
|
84 |
+ } |
|
85 |
+} |
0 | 86 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,21 @@ |
0 |
+package swarm |
|
1 |
+ |
|
2 |
+import "time" |
|
3 |
+ |
|
4 |
+// Version represent the internal object version. |
|
5 |
+type Version struct { |
|
6 |
+ Index uint64 `json:",omitempty"` |
|
7 |
+} |
|
8 |
+ |
|
9 |
+// Meta is base object inherited by most of the other once. |
|
10 |
+type Meta struct { |
|
11 |
+ Version Version `json:",omitempty"` |
|
12 |
+ CreatedAt time.Time `json:",omitempty"` |
|
13 |
+ UpdatedAt time.Time `json:",omitempty"` |
|
14 |
+} |
|
15 |
+ |
|
16 |
+// Annotations represents how to describe an object. |
|
17 |
+type Annotations struct { |
|
18 |
+ Name string `json:",omitempty"` |
|
19 |
+ Labels map[string]string `json:",omitempty"` |
|
20 |
+} |
0 | 21 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,22 @@ |
0 |
+package swarm |
|
1 |
+ |
|
2 |
+import ( |
|
3 |
+ "time" |
|
4 |
+ |
|
5 |
+ "github.com/docker/docker/api/types/mount" |
|
6 |
+) |
|
7 |
+ |
|
8 |
+// ContainerSpec represents the spec of a container. |
|
9 |
+type ContainerSpec struct { |
|
10 |
+ Image string `json:",omitempty"` |
|
11 |
+ Labels map[string]string `json:",omitempty"` |
|
12 |
+ Command []string `json:",omitempty"` |
|
13 |
+ Args []string `json:",omitempty"` |
|
14 |
+ Env []string `json:",omitempty"` |
|
15 |
+ Dir string `json:",omitempty"` |
|
16 |
+ User string `json:",omitempty"` |
|
17 |
+ Groups []string `json:",omitempty"` |
|
18 |
+ TTY bool `json:",omitempty"` |
|
19 |
+ Mounts []mount.Mount `json:",omitempty"` |
|
20 |
+ StopGracePeriod *time.Duration `json:",omitempty"` |
|
21 |
+} |
0 | 22 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,100 @@ |
0 |
+package swarm |
|
1 |
+ |
|
2 |
+// Endpoint represents an endpoint. |
|
3 |
+type Endpoint struct { |
|
4 |
+ Spec EndpointSpec `json:",omitempty"` |
|
5 |
+ Ports []PortConfig `json:",omitempty"` |
|
6 |
+ VirtualIPs []EndpointVirtualIP `json:",omitempty"` |
|
7 |
+} |
|
8 |
+ |
|
9 |
+// EndpointSpec represents the spec of an endpoint. |
|
10 |
+type EndpointSpec struct { |
|
11 |
+ Mode ResolutionMode `json:",omitempty"` |
|
12 |
+ Ports []PortConfig `json:",omitempty"` |
|
13 |
+} |
|
14 |
+ |
|
15 |
+// ResolutionMode represents a resolution mode. |
|
16 |
+type ResolutionMode string |
|
17 |
+ |
|
18 |
+const ( |
|
19 |
+ // ResolutionModeVIP VIP |
|
20 |
+ ResolutionModeVIP ResolutionMode = "vip" |
|
21 |
+ // ResolutionModeDNSRR DNSRR |
|
22 |
+ ResolutionModeDNSRR ResolutionMode = "dnsrr" |
|
23 |
+) |
|
24 |
+ |
|
25 |
+// PortConfig represents the config of a port. |
|
26 |
+type PortConfig struct { |
|
27 |
+ Name string `json:",omitempty"` |
|
28 |
+ Protocol PortConfigProtocol `json:",omitempty"` |
|
29 |
+ TargetPort uint32 `json:",omitempty"` |
|
30 |
+ PublishedPort uint32 `json:",omitempty"` |
|
31 |
+} |
|
32 |
+ |
|
33 |
+// PortConfigProtocol represents the protocol of a port. |
|
34 |
+type PortConfigProtocol string |
|
35 |
+ |
|
36 |
+const ( |
|
37 |
+ // TODO(stevvooe): These should be used generally, not just for PortConfig. |
|
38 |
+ |
|
39 |
+ // PortConfigProtocolTCP TCP |
|
40 |
+ PortConfigProtocolTCP PortConfigProtocol = "tcp" |
|
41 |
+ // PortConfigProtocolUDP UDP |
|
42 |
+ PortConfigProtocolUDP PortConfigProtocol = "udp" |
|
43 |
+) |
|
44 |
+ |
|
45 |
+// EndpointVirtualIP represents the virtual ip of a port. |
|
46 |
+type EndpointVirtualIP struct { |
|
47 |
+ NetworkID string `json:",omitempty"` |
|
48 |
+ Addr string `json:",omitempty"` |
|
49 |
+} |
|
50 |
+ |
|
51 |
+// Network represents a network. |
|
52 |
+type Network struct { |
|
53 |
+ ID string |
|
54 |
+ Meta |
|
55 |
+ Spec NetworkSpec `json:",omitempty"` |
|
56 |
+ DriverState Driver `json:",omitempty"` |
|
57 |
+ IPAMOptions *IPAMOptions `json:",omitempty"` |
|
58 |
+} |
|
59 |
+ |
|
60 |
+// NetworkSpec represents the spec of a network. |
|
61 |
+type NetworkSpec struct { |
|
62 |
+ Annotations |
|
63 |
+ DriverConfiguration *Driver `json:",omitempty"` |
|
64 |
+ IPv6Enabled bool `json:",omitempty"` |
|
65 |
+ Internal bool `json:",omitempty"` |
|
66 |
+ Attachable bool `json:",omitempty"` |
|
67 |
+ IPAMOptions *IPAMOptions `json:",omitempty"` |
|
68 |
+} |
|
69 |
+ |
|
70 |
+// NetworkAttachmentConfig represents the configuration of a network attachment. |
|
71 |
+type NetworkAttachmentConfig struct { |
|
72 |
+ Target string `json:",omitempty"` |
|
73 |
+ Aliases []string `json:",omitempty"` |
|
74 |
+} |
|
75 |
+ |
|
76 |
+// NetworkAttachment represents a network attachment. |
|
77 |
+type NetworkAttachment struct { |
|
78 |
+ Network Network `json:",omitempty"` |
|
79 |
+ Addresses []string `json:",omitempty"` |
|
80 |
+} |
|
81 |
+ |
|
82 |
+// IPAMOptions represents ipam options. |
|
83 |
+type IPAMOptions struct { |
|
84 |
+ Driver Driver `json:",omitempty"` |
|
85 |
+ Configs []IPAMConfig `json:",omitempty"` |
|
86 |
+} |
|
87 |
+ |
|
88 |
+// IPAMConfig represents ipam configuration. |
|
89 |
+type IPAMConfig struct { |
|
90 |
+ Subnet string `json:",omitempty"` |
|
91 |
+ Range string `json:",omitempty"` |
|
92 |
+ Gateway string `json:",omitempty"` |
|
93 |
+} |
|
94 |
+ |
|
95 |
+// Driver represents a network driver. |
|
96 |
+type Driver struct { |
|
97 |
+ Name string `json:",omitempty"` |
|
98 |
+ Options map[string]string `json:",omitempty"` |
|
99 |
+} |
0 | 100 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,107 @@ |
0 |
+package swarm |
|
1 |
+ |
|
2 |
+// Node represents a node. |
|
3 |
+type Node struct { |
|
4 |
+ ID string |
|
5 |
+ Meta |
|
6 |
+ |
|
7 |
+ Spec NodeSpec `json:",omitempty"` |
|
8 |
+ Description NodeDescription `json:",omitempty"` |
|
9 |
+ Status NodeStatus `json:",omitempty"` |
|
10 |
+ ManagerStatus *ManagerStatus `json:",omitempty"` |
|
11 |
+} |
|
12 |
+ |
|
13 |
+// NodeSpec represents the spec of a node. |
|
14 |
+type NodeSpec struct { |
|
15 |
+ Annotations |
|
16 |
+ Role NodeRole `json:",omitempty"` |
|
17 |
+ Availability NodeAvailability `json:",omitempty"` |
|
18 |
+} |
|
19 |
+ |
|
20 |
+// NodeRole represents the role of a node. |
|
21 |
+type NodeRole string |
|
22 |
+ |
|
23 |
+const ( |
|
24 |
+ // NodeRoleWorker WORKER |
|
25 |
+ NodeRoleWorker NodeRole = "worker" |
|
26 |
+ // NodeRoleManager MANAGER |
|
27 |
+ NodeRoleManager NodeRole = "manager" |
|
28 |
+) |
|
29 |
+ |
|
30 |
+// NodeAvailability represents the availability of a node. |
|
31 |
+type NodeAvailability string |
|
32 |
+ |
|
33 |
+const ( |
|
34 |
+ // NodeAvailabilityActive ACTIVE |
|
35 |
+ NodeAvailabilityActive NodeAvailability = "active" |
|
36 |
+ // NodeAvailabilityPause PAUSE |
|
37 |
+ NodeAvailabilityPause NodeAvailability = "pause" |
|
38 |
+ // NodeAvailabilityDrain DRAIN |
|
39 |
+ NodeAvailabilityDrain NodeAvailability = "drain" |
|
40 |
+) |
|
41 |
+ |
|
42 |
+// NodeDescription represents the description of a node. |
|
43 |
+type NodeDescription struct { |
|
44 |
+ Hostname string `json:",omitempty"` |
|
45 |
+ Platform Platform `json:",omitempty"` |
|
46 |
+ Resources Resources `json:",omitempty"` |
|
47 |
+ Engine EngineDescription `json:",omitempty"` |
|
48 |
+} |
|
49 |
+ |
|
50 |
+// Platform represents the platfrom (Arch/OS). |
|
51 |
+type Platform struct { |
|
52 |
+ Architecture string `json:",omitempty"` |
|
53 |
+ OS string `json:",omitempty"` |
|
54 |
+} |
|
55 |
+ |
|
56 |
+// EngineDescription represents the description of an engine. |
|
57 |
+type EngineDescription struct { |
|
58 |
+ EngineVersion string `json:",omitempty"` |
|
59 |
+ Labels map[string]string `json:",omitempty"` |
|
60 |
+ Plugins []PluginDescription `json:",omitempty"` |
|
61 |
+} |
|
62 |
+ |
|
63 |
+// PluginDescription represents the description of an engine plugin. |
|
64 |
+type PluginDescription struct { |
|
65 |
+ Type string `json:",omitempty"` |
|
66 |
+ Name string `json:",omitempty"` |
|
67 |
+} |
|
68 |
+ |
|
69 |
+// NodeStatus represents the status of a node. |
|
70 |
+type NodeStatus struct { |
|
71 |
+ State NodeState `json:",omitempty"` |
|
72 |
+ Message string `json:",omitempty"` |
|
73 |
+} |
|
74 |
+ |
|
75 |
+// Reachability represents the reachability of a node. |
|
76 |
+type Reachability string |
|
77 |
+ |
|
78 |
+const ( |
|
79 |
+ // ReachabilityUnknown UNKNOWN |
|
80 |
+ ReachabilityUnknown Reachability = "unknown" |
|
81 |
+ // ReachabilityUnreachable UNREACHABLE |
|
82 |
+ ReachabilityUnreachable Reachability = "unreachable" |
|
83 |
+ // ReachabilityReachable REACHABLE |
|
84 |
+ ReachabilityReachable Reachability = "reachable" |
|
85 |
+) |
|
86 |
+ |
|
87 |
+// ManagerStatus represents the status of a manager. |
|
88 |
+type ManagerStatus struct { |
|
89 |
+ Leader bool `json:",omitempty"` |
|
90 |
+ Reachability Reachability `json:",omitempty"` |
|
91 |
+ Addr string `json:",omitempty"` |
|
92 |
+} |
|
93 |
+ |
|
94 |
+// NodeState represents the state of a node. |
|
95 |
+type NodeState string |
|
96 |
+ |
|
97 |
+const ( |
|
98 |
+ // NodeStateUnknown UNKNOWN |
|
99 |
+ NodeStateUnknown NodeState = "unknown" |
|
100 |
+ // NodeStateDown DOWN |
|
101 |
+ NodeStateDown NodeState = "down" |
|
102 |
+ // NodeStateReady READY |
|
103 |
+ NodeStateReady NodeState = "ready" |
|
104 |
+ // NodeStateDisconnected DISCONNECTED |
|
105 |
+ NodeStateDisconnected NodeState = "disconnected" |
|
106 |
+) |
0 | 107 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,77 @@ |
0 |
+package swarm |
|
1 |
+ |
|
2 |
+import "time" |
|
3 |
+ |
|
4 |
+// Service represents a service. |
|
5 |
+type Service struct { |
|
6 |
+ ID string |
|
7 |
+ Meta |
|
8 |
+ Spec ServiceSpec `json:",omitempty"` |
|
9 |
+ Endpoint Endpoint `json:",omitempty"` |
|
10 |
+ UpdateStatus UpdateStatus `json:",omitempty"` |
|
11 |
+} |
|
12 |
+ |
|
13 |
+// ServiceSpec represents the spec of a service. |
|
14 |
+type ServiceSpec struct { |
|
15 |
+ Annotations |
|
16 |
+ |
|
17 |
+ // TaskTemplate defines how the service should construct new tasks when |
|
18 |
+ // orchestrating this service. |
|
19 |
+ TaskTemplate TaskSpec `json:",omitempty"` |
|
20 |
+ Mode ServiceMode `json:",omitempty"` |
|
21 |
+ UpdateConfig *UpdateConfig `json:",omitempty"` |
|
22 |
+ |
|
23 |
+ // Networks field in ServiceSpec is being deprecated. Users of |
|
24 |
+ // engine-api should start using the same field in |
|
25 |
+ // TaskSpec. This field will be removed in future releases. |
|
26 |
+ Networks []NetworkAttachmentConfig `json:",omitempty"` |
|
27 |
+ EndpointSpec *EndpointSpec `json:",omitempty"` |
|
28 |
+} |
|
29 |
+ |
|
30 |
+// ServiceMode represents the mode of a service. |
|
31 |
+type ServiceMode struct { |
|
32 |
+ Replicated *ReplicatedService `json:",omitempty"` |
|
33 |
+ Global *GlobalService `json:",omitempty"` |
|
34 |
+} |
|
35 |
+ |
|
36 |
+// UpdateState is the state of a service update. |
|
37 |
+type UpdateState string |
|
38 |
+ |
|
39 |
+const ( |
|
40 |
+ // UpdateStateUpdating is the updating state. |
|
41 |
+ UpdateStateUpdating UpdateState = "updating" |
|
42 |
+ // UpdateStatePaused is the paused state. |
|
43 |
+ UpdateStatePaused UpdateState = "paused" |
|
44 |
+ // UpdateStateCompleted is the completed state. |
|
45 |
+ UpdateStateCompleted UpdateState = "completed" |
|
46 |
+) |
|
47 |
+ |
|
48 |
+// UpdateStatus reports the status of a service update. |
|
49 |
+type UpdateStatus struct { |
|
50 |
+ State UpdateState `json:",omitempty"` |
|
51 |
+ StartedAt time.Time `json:",omitempty"` |
|
52 |
+ CompletedAt time.Time `json:",omitempty"` |
|
53 |
+ Message string `json:",omitempty"` |
|
54 |
+} |
|
55 |
+ |
|
56 |
+// ReplicatedService is a kind of ServiceMode. |
|
57 |
+type ReplicatedService struct { |
|
58 |
+ Replicas *uint64 `json:",omitempty"` |
|
59 |
+} |
|
60 |
+ |
|
61 |
+// GlobalService is a kind of ServiceMode. |
|
62 |
+type GlobalService struct{} |
|
63 |
+ |
|
64 |
+const ( |
|
65 |
+ // UpdateFailureActionPause PAUSE |
|
66 |
+ UpdateFailureActionPause = "pause" |
|
67 |
+ // UpdateFailureActionContinue CONTINUE |
|
68 |
+ UpdateFailureActionContinue = "continue" |
|
69 |
+) |
|
70 |
+ |
|
71 |
+// UpdateConfig represents the update configuration. |
|
72 |
+type UpdateConfig struct { |
|
73 |
+ Parallelism uint64 `json:",omitempty"` |
|
74 |
+ Delay time.Duration `json:",omitempty"` |
|
75 |
+ FailureAction string `json:",omitempty"` |
|
76 |
+} |
0 | 77 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,155 @@ |
0 |
+package swarm |
|
1 |
+ |
|
2 |
+import "time" |
|
3 |
+ |
|
4 |
+// ClusterInfo represents info about the cluster for outputing in "info" |
|
5 |
+// it contains the same information as "Swarm", but without the JoinTokens |
|
6 |
+type ClusterInfo struct { |
|
7 |
+ ID string |
|
8 |
+ Meta |
|
9 |
+ Spec Spec |
|
10 |
+} |
|
11 |
+ |
|
12 |
+// Swarm represents a swarm. |
|
13 |
+type Swarm struct { |
|
14 |
+ ClusterInfo |
|
15 |
+ JoinTokens JoinTokens |
|
16 |
+} |
|
17 |
+ |
|
18 |
+// JoinTokens contains the tokens workers and managers need to join the swarm. |
|
19 |
+type JoinTokens struct { |
|
20 |
+ Worker string |
|
21 |
+ Manager string |
|
22 |
+} |
|
23 |
+ |
|
24 |
+// Spec represents the spec of a swarm. |
|
25 |
+type Spec struct { |
|
26 |
+ Annotations |
|
27 |
+ |
|
28 |
+ Orchestration OrchestrationConfig `json:",omitempty"` |
|
29 |
+ Raft RaftConfig `json:",omitempty"` |
|
30 |
+ Dispatcher DispatcherConfig `json:",omitempty"` |
|
31 |
+ CAConfig CAConfig `json:",omitempty"` |
|
32 |
+ TaskDefaults TaskDefaults `json:",omitempty"` |
|
33 |
+} |
|
34 |
+ |
|
35 |
+// OrchestrationConfig represents orchestration configuration. |
|
36 |
+type OrchestrationConfig struct { |
|
37 |
+ TaskHistoryRetentionLimit int64 `json:",omitempty"` |
|
38 |
+} |
|
39 |
+ |
|
40 |
+// TaskDefaults parameterizes cluster-level task creation with default values. |
|
41 |
+type TaskDefaults struct { |
|
42 |
+ // LogDriver selects the log driver to use for tasks created in the |
|
43 |
+ // orchestrator if unspecified by a service. |
|
44 |
+ // |
|
45 |
+ // Updating this value will only have an affect on new tasks. Old tasks |
|
46 |
+ // will continue use their previously configured log driver until |
|
47 |
+ // recreated. |
|
48 |
+ LogDriver *Driver `json:",omitempty"` |
|
49 |
+} |
|
50 |
+ |
|
51 |
+// RaftConfig represents raft configuration. |
|
52 |
+type RaftConfig struct { |
|
53 |
+ SnapshotInterval uint64 `json:",omitempty"` |
|
54 |
+ KeepOldSnapshots uint64 `json:",omitempty"` |
|
55 |
+ LogEntriesForSlowFollowers uint64 `json:",omitempty"` |
|
56 |
+ |
|
57 |
+ // ElectionTick is the number of ticks that a follower will wait for a message |
|
58 |
+ // from the leader before becoming a candidate and starting an election. |
|
59 |
+ // ElectionTick must be greater than HeartbeatTick. |
|
60 |
+ // |
|
61 |
+ // A tick currently defaults to one second, so these translate directly to |
|
62 |
+ // seconds currently, but this is NOT guaranteed. |
|
63 |
+ ElectionTick int |
|
64 |
+ |
|
65 |
+ // HeartbeatTick is the number of ticks between heartbeats. Every |
|
66 |
+ // HeartbeatTick ticks, the leader will send a heartbeat to the |
|
67 |
+ // followers. |
|
68 |
+ // |
|
69 |
+ // A tick currently defaults to one second, so these translate directly to |
|
70 |
+ // seconds currently, but this is NOT guaranteed. |
|
71 |
+ HeartbeatTick int |
|
72 |
+} |
|
73 |
+ |
|
74 |
+// DispatcherConfig represents dispatcher configuration. |
|
75 |
+type DispatcherConfig struct { |
|
76 |
+ HeartbeatPeriod time.Duration `json:",omitempty"` |
|
77 |
+} |
|
78 |
+ |
|
79 |
+// CAConfig represents CA configuration. |
|
80 |
+type CAConfig struct { |
|
81 |
+ NodeCertExpiry time.Duration `json:",omitempty"` |
|
82 |
+ ExternalCAs []*ExternalCA `json:",omitempty"` |
|
83 |
+} |
|
84 |
+ |
|
85 |
+// ExternalCAProtocol represents type of external CA. |
|
86 |
+type ExternalCAProtocol string |
|
87 |
+ |
|
88 |
+// ExternalCAProtocolCFSSL CFSSL |
|
89 |
+const ExternalCAProtocolCFSSL ExternalCAProtocol = "cfssl" |
|
90 |
+ |
|
91 |
+// ExternalCA defines external CA to be used by the cluster. |
|
92 |
+type ExternalCA struct { |
|
93 |
+ Protocol ExternalCAProtocol |
|
94 |
+ URL string |
|
95 |
+ Options map[string]string `json:",omitempty"` |
|
96 |
+} |
|
97 |
+ |
|
98 |
+// InitRequest is the request used to init a swarm. |
|
99 |
+type InitRequest struct { |
|
100 |
+ ListenAddr string |
|
101 |
+ AdvertiseAddr string |
|
102 |
+ ForceNewCluster bool |
|
103 |
+ Spec Spec |
|
104 |
+} |
|
105 |
+ |
|
106 |
+// JoinRequest is the request used to join a swarm. |
|
107 |
+type JoinRequest struct { |
|
108 |
+ ListenAddr string |
|
109 |
+ AdvertiseAddr string |
|
110 |
+ RemoteAddrs []string |
|
111 |
+ JoinToken string // accept by secret |
|
112 |
+} |
|
113 |
+ |
|
114 |
+// LocalNodeState represents the state of the local node. |
|
115 |
+type LocalNodeState string |
|
116 |
+ |
|
117 |
+const ( |
|
118 |
+ // LocalNodeStateInactive INACTIVE |
|
119 |
+ LocalNodeStateInactive LocalNodeState = "inactive" |
|
120 |
+ // LocalNodeStatePending PENDING |
|
121 |
+ LocalNodeStatePending LocalNodeState = "pending" |
|
122 |
+ // LocalNodeStateActive ACTIVE |
|
123 |
+ LocalNodeStateActive LocalNodeState = "active" |
|
124 |
+ // LocalNodeStateError ERROR |
|
125 |
+ LocalNodeStateError LocalNodeState = "error" |
|
126 |
+) |
|
127 |
+ |
|
128 |
+// Info represents generic information about swarm. |
|
129 |
+type Info struct { |
|
130 |
+ NodeID string |
|
131 |
+ NodeAddr string |
|
132 |
+ |
|
133 |
+ LocalNodeState LocalNodeState |
|
134 |
+ ControlAvailable bool |
|
135 |
+ Error string |
|
136 |
+ |
|
137 |
+ RemoteManagers []Peer |
|
138 |
+ Nodes int |
|
139 |
+ Managers int |
|
140 |
+ |
|
141 |
+ Cluster ClusterInfo |
|
142 |
+} |
|
143 |
+ |
|
144 |
+// Peer represents a peer. |
|
145 |
+type Peer struct { |
|
146 |
+ NodeID string |
|
147 |
+ Addr string |
|
148 |
+} |
|
149 |
+ |
|
150 |
+// UpdateFlags contains flags for SwarmUpdate. |
|
151 |
+type UpdateFlags struct { |
|
152 |
+ RotateWorkerToken bool |
|
153 |
+ RotateManagerToken bool |
|
154 |
+} |
0 | 155 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,117 @@ |
0 |
+package swarm |
|
1 |
+ |
|
2 |
+import "time" |
|
3 |
+ |
|
4 |
+// TaskState represents the state of a task. |
|
5 |
+type TaskState string |
|
6 |
+ |
|
7 |
+const ( |
|
8 |
+ // TaskStateNew NEW |
|
9 |
+ TaskStateNew TaskState = "new" |
|
10 |
+ // TaskStateAllocated ALLOCATED |
|
11 |
+ TaskStateAllocated TaskState = "allocated" |
|
12 |
+ // TaskStatePending PENDING |
|
13 |
+ TaskStatePending TaskState = "pending" |
|
14 |
+ // TaskStateAssigned ASSIGNED |
|
15 |
+ TaskStateAssigned TaskState = "assigned" |
|
16 |
+ // TaskStateAccepted ACCEPTED |
|
17 |
+ TaskStateAccepted TaskState = "accepted" |
|
18 |
+ // TaskStatePreparing PREPARING |
|
19 |
+ TaskStatePreparing TaskState = "preparing" |
|
20 |
+ // TaskStateReady READY |
|
21 |
+ TaskStateReady TaskState = "ready" |
|
22 |
+ // TaskStateStarting STARTING |
|
23 |
+ TaskStateStarting TaskState = "starting" |
|
24 |
+ // TaskStateRunning RUNNING |
|
25 |
+ TaskStateRunning TaskState = "running" |
|
26 |
+ // TaskStateComplete COMPLETE |
|
27 |
+ TaskStateComplete TaskState = "complete" |
|
28 |
+ // TaskStateShutdown SHUTDOWN |
|
29 |
+ TaskStateShutdown TaskState = "shutdown" |
|
30 |
+ // TaskStateFailed FAILED |
|
31 |
+ TaskStateFailed TaskState = "failed" |
|
32 |
+ // TaskStateRejected REJECTED |
|
33 |
+ TaskStateRejected TaskState = "rejected" |
|
34 |
+) |
|
35 |
+ |
|
36 |
+// Task represents a task. |
|
37 |
+type Task struct { |
|
38 |
+ ID string |
|
39 |
+ Meta |
|
40 |
+ Annotations |
|
41 |
+ |
|
42 |
+ Spec TaskSpec `json:",omitempty"` |
|
43 |
+ ServiceID string `json:",omitempty"` |
|
44 |
+ Slot int `json:",omitempty"` |
|
45 |
+ NodeID string `json:",omitempty"` |
|
46 |
+ Status TaskStatus `json:",omitempty"` |
|
47 |
+ DesiredState TaskState `json:",omitempty"` |
|
48 |
+ NetworksAttachments []NetworkAttachment `json:",omitempty"` |
|
49 |
+} |
|
50 |
+ |
|
51 |
+// TaskSpec represents the spec of a task. |
|
52 |
+type TaskSpec struct { |
|
53 |
+ ContainerSpec ContainerSpec `json:",omitempty"` |
|
54 |
+ Resources *ResourceRequirements `json:",omitempty"` |
|
55 |
+ RestartPolicy *RestartPolicy `json:",omitempty"` |
|
56 |
+ Placement *Placement `json:",omitempty"` |
|
57 |
+ Networks []NetworkAttachmentConfig `json:",omitempty"` |
|
58 |
+ |
|
59 |
+ // LogDriver specifies the LogDriver to use for tasks created from this |
|
60 |
+ // spec. If not present, the one on cluster default on swarm.Spec will be |
|
61 |
+ // used, finally falling back to the engine default if not specified. |
|
62 |
+ LogDriver *Driver `json:",omitempty"` |
|
63 |
+} |
|
64 |
+ |
|
65 |
+// Resources represents resources (CPU/Memory). |
|
66 |
+type Resources struct { |
|
67 |
+ NanoCPUs int64 `json:",omitempty"` |
|
68 |
+ MemoryBytes int64 `json:",omitempty"` |
|
69 |
+} |
|
70 |
+ |
|
71 |
+// ResourceRequirements represents resources requirements. |
|
72 |
+type ResourceRequirements struct { |
|
73 |
+ Limits *Resources `json:",omitempty"` |
|
74 |
+ Reservations *Resources `json:",omitempty"` |
|
75 |
+} |
|
76 |
+ |
|
77 |
+// Placement represents orchestration parameters. |
|
78 |
+type Placement struct { |
|
79 |
+ Constraints []string `json:",omitempty"` |
|
80 |
+} |
|
81 |
+ |
|
82 |
+// RestartPolicy represents the restart policy. |
|
83 |
+type RestartPolicy struct { |
|
84 |
+ Condition RestartPolicyCondition `json:",omitempty"` |
|
85 |
+ Delay *time.Duration `json:",omitempty"` |
|
86 |
+ MaxAttempts *uint64 `json:",omitempty"` |
|
87 |
+ Window *time.Duration `json:",omitempty"` |
|
88 |
+} |
|
89 |
+ |
|
90 |
+// RestartPolicyCondition represents when to restart. |
|
91 |
+type RestartPolicyCondition string |
|
92 |
+ |
|
93 |
+const ( |
|
94 |
+ // RestartPolicyConditionNone NONE |
|
95 |
+ RestartPolicyConditionNone RestartPolicyCondition = "none" |
|
96 |
+ // RestartPolicyConditionOnFailure ON_FAILURE |
|
97 |
+ RestartPolicyConditionOnFailure RestartPolicyCondition = "on-failure" |
|
98 |
+ // RestartPolicyConditionAny ANY |
|
99 |
+ RestartPolicyConditionAny RestartPolicyCondition = "any" |
|
100 |
+) |
|
101 |
+ |
|
102 |
+// TaskStatus represents the status of a task. |
|
103 |
+type TaskStatus struct { |
|
104 |
+ Timestamp time.Time `json:",omitempty"` |
|
105 |
+ State TaskState `json:",omitempty"` |
|
106 |
+ Message string `json:",omitempty"` |
|
107 |
+ Err string `json:",omitempty"` |
|
108 |
+ ContainerStatus ContainerStatus `json:",omitempty"` |
|
109 |
+} |
|
110 |
+ |
|
111 |
+// ContainerStatus represents the status of a container. |
|
112 |
+type ContainerStatus struct { |
|
113 |
+ ContainerID string `json:",omitempty"` |
|
114 |
+ PID int `json:",omitempty"` |
|
115 |
+ ExitCode int `json:",omitempty"` |
|
116 |
+} |
0 | 117 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,12 @@ |
0 |
+package time |
|
1 |
+ |
|
2 |
+import ( |
|
3 |
+ "strconv" |
|
4 |
+ "time" |
|
5 |
+) |
|
6 |
+ |
|
7 |
+// DurationToSecondsString converts the specified duration to the number |
|
8 |
+// seconds it represents, formatted as a string. |
|
9 |
+func DurationToSecondsString(duration time.Duration) string { |
|
10 |
+ return strconv.FormatFloat(duration.Seconds(), 'f', 0, 64) |
|
11 |
+} |
0 | 12 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,26 @@ |
0 |
+package time |
|
1 |
+ |
|
2 |
+import ( |
|
3 |
+ "testing" |
|
4 |
+ "time" |
|
5 |
+) |
|
6 |
+ |
|
7 |
+func TestDurationToSecondsString(t *testing.T) { |
|
8 |
+ cases := []struct { |
|
9 |
+ in time.Duration |
|
10 |
+ expected string |
|
11 |
+ }{ |
|
12 |
+ {0 * time.Second, "0"}, |
|
13 |
+ {1 * time.Second, "1"}, |
|
14 |
+ {1 * time.Minute, "60"}, |
|
15 |
+ {24 * time.Hour, "86400"}, |
|
16 |
+ } |
|
17 |
+ |
|
18 |
+ for _, c := range cases { |
|
19 |
+ s := DurationToSecondsString(c.in) |
|
20 |
+ if s != c.expected { |
|
21 |
+ t.Errorf("wrong value for input `%v`: expected `%s`, got `%s`", c.in, c.expected, s) |
|
22 |
+ t.Fail() |
|
23 |
+ } |
|
24 |
+ } |
|
25 |
+} |
0 | 26 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,124 @@ |
0 |
+package time |
|
1 |
+ |
|
2 |
+import ( |
|
3 |
+ "fmt" |
|
4 |
+ "math" |
|
5 |
+ "strconv" |
|
6 |
+ "strings" |
|
7 |
+ "time" |
|
8 |
+) |
|
9 |
+ |
|
10 |
+// These are additional predefined layouts for use in Time.Format and Time.Parse |
|
11 |
+// with --since and --until parameters for `docker logs` and `docker events` |
|
12 |
+const ( |
|
13 |
+ rFC3339Local = "2006-01-02T15:04:05" // RFC3339 with local timezone |
|
14 |
+ rFC3339NanoLocal = "2006-01-02T15:04:05.999999999" // RFC3339Nano with local timezone |
|
15 |
+ dateWithZone = "2006-01-02Z07:00" // RFC3339 with time at 00:00:00 |
|
16 |
+ dateLocal = "2006-01-02" // RFC3339 with local timezone and time at 00:00:00 |
|
17 |
+) |
|
18 |
+ |
|
19 |
+// GetTimestamp tries to parse given string as golang duration, |
|
20 |
+// then RFC3339 time and finally as a Unix timestamp. If |
|
21 |
+// any of these were successful, it returns a Unix timestamp |
|
22 |
+// as string otherwise returns the given value back. |
|
23 |
+// In case of duration input, the returned timestamp is computed |
|
24 |
+// as the given reference time minus the amount of the duration. |
|
25 |
+func GetTimestamp(value string, reference time.Time) (string, error) { |
|
26 |
+ if d, err := time.ParseDuration(value); value != "0" && err == nil { |
|
27 |
+ return strconv.FormatInt(reference.Add(-d).Unix(), 10), nil |
|
28 |
+ } |
|
29 |
+ |
|
30 |
+ var format string |
|
31 |
+ var parseInLocation bool |
|
32 |
+ |
|
33 |
+ // if the string has a Z or a + or three dashes use parse otherwise use parseinlocation |
|
34 |
+ parseInLocation = !(strings.ContainsAny(value, "zZ+") || strings.Count(value, "-") == 3) |
|
35 |
+ |
|
36 |
+ if strings.Contains(value, ".") { |
|
37 |
+ if parseInLocation { |
|
38 |
+ format = rFC3339NanoLocal |
|
39 |
+ } else { |
|
40 |
+ format = time.RFC3339Nano |
|
41 |
+ } |
|
42 |
+ } else if strings.Contains(value, "T") { |
|
43 |
+ // we want the number of colons in the T portion of the timestamp |
|
44 |
+ tcolons := strings.Count(value, ":") |
|
45 |
+ // if parseInLocation is off and we have a +/- zone offset (not Z) then |
|
46 |
+ // there will be an extra colon in the input for the tz offset subtract that |
|
47 |
+ // colon from the tcolons count |
|
48 |
+ if !parseInLocation && !strings.ContainsAny(value, "zZ") && tcolons > 0 { |
|
49 |
+ tcolons-- |
|
50 |
+ } |
|
51 |
+ if parseInLocation { |
|
52 |
+ switch tcolons { |
|
53 |
+ case 0: |
|
54 |
+ format = "2006-01-02T15" |
|
55 |
+ case 1: |
|
56 |
+ format = "2006-01-02T15:04" |
|
57 |
+ default: |
|
58 |
+ format = rFC3339Local |
|
59 |
+ } |
|
60 |
+ } else { |
|
61 |
+ switch tcolons { |
|
62 |
+ case 0: |
|
63 |
+ format = "2006-01-02T15Z07:00" |
|
64 |
+ case 1: |
|
65 |
+ format = "2006-01-02T15:04Z07:00" |
|
66 |
+ default: |
|
67 |
+ format = time.RFC3339 |
|
68 |
+ } |
|
69 |
+ } |
|
70 |
+ } else if parseInLocation { |
|
71 |
+ format = dateLocal |
|
72 |
+ } else { |
|
73 |
+ format = dateWithZone |
|
74 |
+ } |
|
75 |
+ |
|
76 |
+ var t time.Time |
|
77 |
+ var err error |
|
78 |
+ |
|
79 |
+ if parseInLocation { |
|
80 |
+ t, err = time.ParseInLocation(format, value, time.FixedZone(reference.Zone())) |
|
81 |
+ } else { |
|
82 |
+ t, err = time.Parse(format, value) |
|
83 |
+ } |
|
84 |
+ |
|
85 |
+ if err != nil { |
|
86 |
+ // if there is a `-` then its an RFC3339 like timestamp otherwise assume unixtimestamp |
|
87 |
+ if strings.Contains(value, "-") { |
|
88 |
+ return "", err // was probably an RFC3339 like timestamp but the parser failed with an error |
|
89 |
+ } |
|
90 |
+ return value, nil // unixtimestamp in and out case (meaning: the value passed at the command line is already in the right format for passing to the server) |
|
91 |
+ } |
|
92 |
+ |
|
93 |
+ return fmt.Sprintf("%d.%09d", t.Unix(), int64(t.Nanosecond())), nil |
|
94 |
+} |
|
95 |
+ |
|
96 |
+// ParseTimestamps returns seconds and nanoseconds from a timestamp that has the |
|
97 |
+// format "%d.%09d", time.Unix(), int64(time.Nanosecond())) |
|
98 |
+// if the incoming nanosecond portion is longer or shorter than 9 digits it is |
|
99 |
+// converted to nanoseconds. The expectation is that the seconds and |
|
100 |
+// seconds will be used to create a time variable. For example: |
|
101 |
+// seconds, nanoseconds, err := ParseTimestamp("1136073600.000000001",0) |
|
102 |
+// if err == nil since := time.Unix(seconds, nanoseconds) |
|
103 |
+// returns seconds as def(aultSeconds) if value == "" |
|
104 |
+func ParseTimestamps(value string, def int64) (int64, int64, error) { |
|
105 |
+ if value == "" { |
|
106 |
+ return def, 0, nil |
|
107 |
+ } |
|
108 |
+ sa := strings.SplitN(value, ".", 2) |
|
109 |
+ s, err := strconv.ParseInt(sa[0], 10, 64) |
|
110 |
+ if err != nil { |
|
111 |
+ return s, 0, err |
|
112 |
+ } |
|
113 |
+ if len(sa) != 2 { |
|
114 |
+ return s, 0, nil |
|
115 |
+ } |
|
116 |
+ n, err := strconv.ParseInt(sa[1], 10, 64) |
|
117 |
+ if err != nil { |
|
118 |
+ return s, n, err |
|
119 |
+ } |
|
120 |
+ // should already be in nanoseconds but just in case convert n to nanoseonds |
|
121 |
+ n = int64(float64(n) * math.Pow(float64(10), float64(9-len(sa[1])))) |
|
122 |
+ return s, n, nil |
|
123 |
+} |
0 | 124 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,93 @@ |
0 |
+package time |
|
1 |
+ |
|
2 |
+import ( |
|
3 |
+ "fmt" |
|
4 |
+ "testing" |
|
5 |
+ "time" |
|
6 |
+) |
|
7 |
+ |
|
8 |
+func TestGetTimestamp(t *testing.T) { |
|
9 |
+ now := time.Now().In(time.UTC) |
|
10 |
+ cases := []struct { |
|
11 |
+ in, expected string |
|
12 |
+ expectedErr bool |
|
13 |
+ }{ |
|
14 |
+ // Partial RFC3339 strings get parsed with second precision |
|
15 |
+ {"2006-01-02T15:04:05.999999999+07:00", "1136189045.999999999", false}, |
|
16 |
+ {"2006-01-02T15:04:05.999999999Z", "1136214245.999999999", false}, |
|
17 |
+ {"2006-01-02T15:04:05.999999999", "1136214245.999999999", false}, |
|
18 |
+ {"2006-01-02T15:04:05Z", "1136214245.000000000", false}, |
|
19 |
+ {"2006-01-02T15:04:05", "1136214245.000000000", false}, |
|
20 |
+ {"2006-01-02T15:04:0Z", "", true}, |
|
21 |
+ {"2006-01-02T15:04:0", "", true}, |
|
22 |
+ {"2006-01-02T15:04Z", "1136214240.000000000", false}, |
|
23 |
+ {"2006-01-02T15:04+00:00", "1136214240.000000000", false}, |
|
24 |
+ {"2006-01-02T15:04-00:00", "1136214240.000000000", false}, |
|
25 |
+ {"2006-01-02T15:04", "1136214240.000000000", false}, |
|
26 |
+ {"2006-01-02T15:0Z", "", true}, |
|
27 |
+ {"2006-01-02T15:0", "", true}, |
|
28 |
+ {"2006-01-02T15Z", "1136214000.000000000", false}, |
|
29 |
+ {"2006-01-02T15+00:00", "1136214000.000000000", false}, |
|
30 |
+ {"2006-01-02T15-00:00", "1136214000.000000000", false}, |
|
31 |
+ {"2006-01-02T15", "1136214000.000000000", false}, |
|
32 |
+ {"2006-01-02T1Z", "1136163600.000000000", false}, |
|
33 |
+ {"2006-01-02T1", "1136163600.000000000", false}, |
|
34 |
+ {"2006-01-02TZ", "", true}, |
|
35 |
+ {"2006-01-02T", "", true}, |
|
36 |
+ {"2006-01-02+00:00", "1136160000.000000000", false}, |
|
37 |
+ {"2006-01-02-00:00", "1136160000.000000000", false}, |
|
38 |
+ {"2006-01-02-00:01", "1136160060.000000000", false}, |
|
39 |
+ {"2006-01-02Z", "1136160000.000000000", false}, |
|
40 |
+ {"2006-01-02", "1136160000.000000000", false}, |
|
41 |
+ {"2015-05-13T20:39:09Z", "1431549549.000000000", false}, |
|
42 |
+ |
|
43 |
+ // unix timestamps returned as is |
|
44 |
+ {"1136073600", "1136073600", false}, |
|
45 |
+ {"1136073600.000000001", "1136073600.000000001", false}, |
|
46 |
+ // Durations |
|
47 |
+ {"1m", fmt.Sprintf("%d", now.Add(-1*time.Minute).Unix()), false}, |
|
48 |
+ {"1.5h", fmt.Sprintf("%d", now.Add(-90*time.Minute).Unix()), false}, |
|
49 |
+ {"1h30m", fmt.Sprintf("%d", now.Add(-90*time.Minute).Unix()), false}, |
|
50 |
+ |
|
51 |
+ // String fallback |
|
52 |
+ {"invalid", "invalid", false}, |
|
53 |
+ } |
|
54 |
+ |
|
55 |
+ for _, c := range cases { |
|
56 |
+ o, err := GetTimestamp(c.in, now) |
|
57 |
+ if o != c.expected || |
|
58 |
+ (err == nil && c.expectedErr) || |
|
59 |
+ (err != nil && !c.expectedErr) { |
|
60 |
+ t.Errorf("wrong value for '%s'. expected:'%s' got:'%s' with error: `%s`", c.in, c.expected, o, err) |
|
61 |
+ t.Fail() |
|
62 |
+ } |
|
63 |
+ } |
|
64 |
+} |
|
65 |
+ |
|
66 |
+func TestParseTimestamps(t *testing.T) { |
|
67 |
+ cases := []struct { |
|
68 |
+ in string |
|
69 |
+ def, expectedS, expectedN int64 |
|
70 |
+ expectedErr bool |
|
71 |
+ }{ |
|
72 |
+ // unix timestamps |
|
73 |
+ {"1136073600", 0, 1136073600, 0, false}, |
|
74 |
+ {"1136073600.000000001", 0, 1136073600, 1, false}, |
|
75 |
+ {"1136073600.0000000010", 0, 1136073600, 1, false}, |
|
76 |
+ {"1136073600.00000001", 0, 1136073600, 10, false}, |
|
77 |
+ {"foo.bar", 0, 0, 0, true}, |
|
78 |
+ {"1136073600.bar", 0, 1136073600, 0, true}, |
|
79 |
+ {"", -1, -1, 0, false}, |
|
80 |
+ } |
|
81 |
+ |
|
82 |
+ for _, c := range cases { |
|
83 |
+ s, n, err := ParseTimestamps(c.in, c.def) |
|
84 |
+ if s != c.expectedS || |
|
85 |
+ n != c.expectedN || |
|
86 |
+ (err == nil && c.expectedErr) || |
|
87 |
+ (err != nil && !c.expectedErr) { |
|
88 |
+ t.Errorf("wrong values for input `%s` with default `%d` expected:'%d'seconds and `%d`nanosecond got:'%d'seconds and `%d`nanoseconds with error: `%s`", c.in, c.def, c.expectedS, c.expectedN, s, n, err) |
|
89 |
+ t.Fail() |
|
90 |
+ } |
|
91 |
+ } |
|
92 |
+} |
0 | 93 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,519 @@ |
0 |
+package types |
|
1 |
+ |
|
2 |
+import ( |
|
3 |
+ "os" |
|
4 |
+ "time" |
|
5 |
+ |
|
6 |
+ "github.com/docker/docker/api/types/container" |
|
7 |
+ "github.com/docker/docker/api/types/mount" |
|
8 |
+ "github.com/docker/docker/api/types/network" |
|
9 |
+ "github.com/docker/docker/api/types/registry" |
|
10 |
+ "github.com/docker/docker/api/types/swarm" |
|
11 |
+ "github.com/docker/go-connections/nat" |
|
12 |
+) |
|
13 |
+ |
|
14 |
+// ContainerCreateResponse contains the information returned to a client on the |
|
15 |
+// creation of a new container. |
|
16 |
+type ContainerCreateResponse struct { |
|
17 |
+ // ID is the ID of the created container. |
|
18 |
+ ID string `json:"Id"` |
|
19 |
+ |
|
20 |
+ // Warnings are any warnings encountered during the creation of the container. |
|
21 |
+ Warnings []string `json:"Warnings"` |
|
22 |
+} |
|
23 |
+ |
|
24 |
+// ContainerExecCreateResponse contains response of Remote API: |
|
25 |
+// POST "/containers/{name:.*}/exec" |
|
26 |
+type ContainerExecCreateResponse struct { |
|
27 |
+ // ID is the exec ID. |
|
28 |
+ ID string `json:"Id"` |
|
29 |
+} |
|
30 |
+ |
|
31 |
+// ContainerUpdateResponse contains response of Remote API: |
|
32 |
+// POST "/containers/{name:.*}/update" |
|
33 |
+type ContainerUpdateResponse struct { |
|
34 |
+ // Warnings are any warnings encountered during the updating of the container. |
|
35 |
+ Warnings []string `json:"Warnings"` |
|
36 |
+} |
|
37 |
+ |
|
38 |
+// AuthResponse contains response of Remote API: |
|
39 |
+// POST "/auth" |
|
40 |
+type AuthResponse struct { |
|
41 |
+ // Status is the authentication status |
|
42 |
+ Status string `json:"Status"` |
|
43 |
+ |
|
44 |
+ // IdentityToken is an opaque token used for authenticating |
|
45 |
+ // a user after a successful login. |
|
46 |
+ IdentityToken string `json:"IdentityToken,omitempty"` |
|
47 |
+} |
|
48 |
+ |
|
49 |
+// ContainerWaitResponse contains response of Remote API: |
|
50 |
+// POST "/containers/"+containerID+"/wait" |
|
51 |
+type ContainerWaitResponse struct { |
|
52 |
+ // StatusCode is the status code of the wait job |
|
53 |
+ StatusCode int `json:"StatusCode"` |
|
54 |
+} |
|
55 |
+ |
|
56 |
+// ContainerCommitResponse contains response of Remote API: |
|
57 |
+// POST "/commit?container="+containerID |
|
58 |
+type ContainerCommitResponse struct { |
|
59 |
+ ID string `json:"Id"` |
|
60 |
+} |
|
61 |
+ |
|
62 |
+// ContainerChange contains response of Remote API: |
|
63 |
+// GET "/containers/{name:.*}/changes" |
|
64 |
+type ContainerChange struct { |
|
65 |
+ Kind int |
|
66 |
+ Path string |
|
67 |
+} |
|
68 |
+ |
|
69 |
+// ImageHistory contains response of Remote API: |
|
70 |
+// GET "/images/{name:.*}/history" |
|
71 |
+type ImageHistory struct { |
|
72 |
+ ID string `json:"Id"` |
|
73 |
+ Created int64 |
|
74 |
+ CreatedBy string |
|
75 |
+ Tags []string |
|
76 |
+ Size int64 |
|
77 |
+ Comment string |
|
78 |
+} |
|
79 |
+ |
|
80 |
+// ImageDelete contains response of Remote API: |
|
81 |
+// DELETE "/images/{name:.*}" |
|
82 |
+type ImageDelete struct { |
|
83 |
+ Untagged string `json:",omitempty"` |
|
84 |
+ Deleted string `json:",omitempty"` |
|
85 |
+} |
|
86 |
+ |
|
87 |
+// Image contains response of Remote API: |
|
88 |
+// GET "/images/json" |
|
89 |
+type Image struct { |
|
90 |
+ ID string `json:"Id"` |
|
91 |
+ ParentID string `json:"ParentId"` |
|
92 |
+ RepoTags []string |
|
93 |
+ RepoDigests []string |
|
94 |
+ Created int64 |
|
95 |
+ Size int64 |
|
96 |
+ VirtualSize int64 |
|
97 |
+ Labels map[string]string |
|
98 |
+} |
|
99 |
+ |
|
100 |
+// GraphDriverData returns Image's graph driver config info |
|
101 |
+// when calling inspect command |
|
102 |
+type GraphDriverData struct { |
|
103 |
+ Name string |
|
104 |
+ Data map[string]string |
|
105 |
+} |
|
106 |
+ |
|
107 |
+// RootFS returns Image's RootFS description including the layer IDs. |
|
108 |
+type RootFS struct { |
|
109 |
+ Type string |
|
110 |
+ Layers []string `json:",omitempty"` |
|
111 |
+ BaseLayer string `json:",omitempty"` |
|
112 |
+} |
|
113 |
+ |
|
114 |
+// ImageInspect contains response of Remote API: |
|
115 |
+// GET "/images/{name:.*}/json" |
|
116 |
+type ImageInspect struct { |
|
117 |
+ ID string `json:"Id"` |
|
118 |
+ RepoTags []string |
|
119 |
+ RepoDigests []string |
|
120 |
+ Parent string |
|
121 |
+ Comment string |
|
122 |
+ Created string |
|
123 |
+ Container string |
|
124 |
+ ContainerConfig *container.Config |
|
125 |
+ DockerVersion string |
|
126 |
+ Author string |
|
127 |
+ Config *container.Config |
|
128 |
+ Architecture string |
|
129 |
+ Os string |
|
130 |
+ Size int64 |
|
131 |
+ VirtualSize int64 |
|
132 |
+ GraphDriver GraphDriverData |
|
133 |
+ RootFS RootFS |
|
134 |
+} |
|
135 |
+ |
|
136 |
+// Port stores open ports info of container |
|
137 |
+// e.g. {"PrivatePort": 8080, "PublicPort": 80, "Type": "tcp"} |
|
138 |
+type Port struct { |
|
139 |
+ IP string `json:",omitempty"` |
|
140 |
+ PrivatePort int |
|
141 |
+ PublicPort int `json:",omitempty"` |
|
142 |
+ Type string |
|
143 |
+} |
|
144 |
+ |
|
145 |
+// Container contains response of Remote API: |
|
146 |
+// GET "/containers/json" |
|
147 |
+type Container struct { |
|
148 |
+ ID string `json:"Id"` |
|
149 |
+ Names []string |
|
150 |
+ Image string |
|
151 |
+ ImageID string |
|
152 |
+ Command string |
|
153 |
+ Created int64 |
|
154 |
+ Ports []Port |
|
155 |
+ SizeRw int64 `json:",omitempty"` |
|
156 |
+ SizeRootFs int64 `json:",omitempty"` |
|
157 |
+ Labels map[string]string |
|
158 |
+ State string |
|
159 |
+ Status string |
|
160 |
+ HostConfig struct { |
|
161 |
+ NetworkMode string `json:",omitempty"` |
|
162 |
+ } |
|
163 |
+ NetworkSettings *SummaryNetworkSettings |
|
164 |
+ Mounts []MountPoint |
|
165 |
+} |
|
166 |
+ |
|
167 |
+// CopyConfig contains request body of Remote API: |
|
168 |
+// POST "/containers/"+containerID+"/copy" |
|
169 |
+type CopyConfig struct { |
|
170 |
+ Resource string |
|
171 |
+} |
|
172 |
+ |
|
173 |
+// ContainerPathStat is used to encode the header from |
|
174 |
+// GET "/containers/{name:.*}/archive" |
|
175 |
+// "Name" is the file or directory name. |
|
176 |
+type ContainerPathStat struct { |
|
177 |
+ Name string `json:"name"` |
|
178 |
+ Size int64 `json:"size"` |
|
179 |
+ Mode os.FileMode `json:"mode"` |
|
180 |
+ Mtime time.Time `json:"mtime"` |
|
181 |
+ LinkTarget string `json:"linkTarget"` |
|
182 |
+} |
|
183 |
+ |
|
184 |
+// ContainerProcessList contains response of Remote API: |
|
185 |
+// GET "/containers/{name:.*}/top" |
|
186 |
+type ContainerProcessList struct { |
|
187 |
+ Processes [][]string |
|
188 |
+ Titles []string |
|
189 |
+} |
|
190 |
+ |
|
191 |
+// Version contains response of Remote API: |
|
192 |
+// GET "/version" |
|
193 |
+type Version struct { |
|
194 |
+ Version string |
|
195 |
+ APIVersion string `json:"ApiVersion"` |
|
196 |
+ GitCommit string |
|
197 |
+ GoVersion string |
|
198 |
+ Os string |
|
199 |
+ Arch string |
|
200 |
+ KernelVersion string `json:",omitempty"` |
|
201 |
+ Experimental bool `json:",omitempty"` |
|
202 |
+ BuildTime string `json:",omitempty"` |
|
203 |
+} |
|
204 |
+ |
|
205 |
+// Info contains response of Remote API: |
|
206 |
+// GET "/info" |
|
207 |
+type Info struct { |
|
208 |
+ ID string |
|
209 |
+ Containers int |
|
210 |
+ ContainersRunning int |
|
211 |
+ ContainersPaused int |
|
212 |
+ ContainersStopped int |
|
213 |
+ Images int |
|
214 |
+ Driver string |
|
215 |
+ DriverStatus [][2]string |
|
216 |
+ SystemStatus [][2]string |
|
217 |
+ Plugins PluginsInfo |
|
218 |
+ MemoryLimit bool |
|
219 |
+ SwapLimit bool |
|
220 |
+ KernelMemory bool |
|
221 |
+ CPUCfsPeriod bool `json:"CpuCfsPeriod"` |
|
222 |
+ CPUCfsQuota bool `json:"CpuCfsQuota"` |
|
223 |
+ CPUShares bool |
|
224 |
+ CPUSet bool |
|
225 |
+ IPv4Forwarding bool |
|
226 |
+ BridgeNfIptables bool |
|
227 |
+ BridgeNfIP6tables bool `json:"BridgeNfIp6tables"` |
|
228 |
+ Debug bool |
|
229 |
+ NFd int |
|
230 |
+ OomKillDisable bool |
|
231 |
+ NGoroutines int |
|
232 |
+ SystemTime string |
|
233 |
+ LoggingDriver string |
|
234 |
+ CgroupDriver string |
|
235 |
+ NEventsListener int |
|
236 |
+ KernelVersion string |
|
237 |
+ OperatingSystem string |
|
238 |
+ OSType string |
|
239 |
+ Architecture string |
|
240 |
+ IndexServerAddress string |
|
241 |
+ RegistryConfig *registry.ServiceConfig |
|
242 |
+ NCPU int |
|
243 |
+ MemTotal int64 |
|
244 |
+ DockerRootDir string |
|
245 |
+ HTTPProxy string `json:"HttpProxy"` |
|
246 |
+ HTTPSProxy string `json:"HttpsProxy"` |
|
247 |
+ NoProxy string |
|
248 |
+ Name string |
|
249 |
+ Labels []string |
|
250 |
+ ExperimentalBuild bool |
|
251 |
+ ServerVersion string |
|
252 |
+ ClusterStore string |
|
253 |
+ ClusterAdvertise string |
|
254 |
+ SecurityOptions []string |
|
255 |
+ Runtimes map[string]Runtime |
|
256 |
+ DefaultRuntime string |
|
257 |
+ Swarm swarm.Info |
|
258 |
+ // LiveRestoreEnabled determines whether containers should be kept |
|
259 |
+ // running when the daemon is shutdown or upon daemon start if |
|
260 |
+ // running containers are detected |
|
261 |
+ LiveRestoreEnabled bool |
|
262 |
+} |
|
263 |
+ |
|
264 |
+// PluginsInfo is a temp struct holding Plugins name |
|
265 |
+// registered with docker daemon. It is used by Info struct |
|
266 |
+type PluginsInfo struct { |
|
267 |
+ // List of Volume plugins registered |
|
268 |
+ Volume []string |
|
269 |
+ // List of Network plugins registered |
|
270 |
+ Network []string |
|
271 |
+ // List of Authorization plugins registered |
|
272 |
+ Authorization []string |
|
273 |
+} |
|
274 |
+ |
|
275 |
+// ExecStartCheck is a temp struct used by execStart |
|
276 |
+// Config fields is part of ExecConfig in runconfig package |
|
277 |
+type ExecStartCheck struct { |
|
278 |
+ // ExecStart will first check if it's detached |
|
279 |
+ Detach bool |
|
280 |
+ // Check if there's a tty |
|
281 |
+ Tty bool |
|
282 |
+} |
|
283 |
+ |
|
284 |
+// HealthcheckResult stores information about a single run of a healthcheck probe |
|
285 |
+type HealthcheckResult struct { |
|
286 |
+ Start time.Time // Start is the time this check started |
|
287 |
+ End time.Time // End is the time this check ended |
|
288 |
+ ExitCode int // ExitCode meanings: 0=healthy, 1=unhealthy, 2=reserved (considered unhealthy), else=error running probe |
|
289 |
+ Output string // Output from last check |
|
290 |
+} |
|
291 |
+ |
|
292 |
+// Health states |
|
293 |
+const ( |
|
294 |
+ Starting = "starting" // Starting indicates that the container is not yet ready |
|
295 |
+ Healthy = "healthy" // Healthy indicates that the container is running correctly |
|
296 |
+ Unhealthy = "unhealthy" // Unhealthy indicates that the container has a problem |
|
297 |
+) |
|
298 |
+ |
|
299 |
+// Health stores information about the container's healthcheck results |
|
300 |
+type Health struct { |
|
301 |
+ Status string // Status is one of Starting, Healthy or Unhealthy |
|
302 |
+ FailingStreak int // FailingStreak is the number of consecutive failures |
|
303 |
+ Log []*HealthcheckResult // Log contains the last few results (oldest first) |
|
304 |
+} |
|
305 |
+ |
|
306 |
+// ContainerState stores container's running state |
|
307 |
+// it's part of ContainerJSONBase and will return by "inspect" command |
|
308 |
+type ContainerState struct { |
|
309 |
+ Status string |
|
310 |
+ Running bool |
|
311 |
+ Paused bool |
|
312 |
+ Restarting bool |
|
313 |
+ OOMKilled bool |
|
314 |
+ Dead bool |
|
315 |
+ Pid int |
|
316 |
+ ExitCode int |
|
317 |
+ Error string |
|
318 |
+ StartedAt string |
|
319 |
+ FinishedAt string |
|
320 |
+ Health *Health `json:",omitempty"` |
|
321 |
+} |
|
322 |
+ |
|
323 |
+// ContainerNode stores information about the node that a container |
|
324 |
+// is running on. It's only available in Docker Swarm |
|
325 |
+type ContainerNode struct { |
|
326 |
+ ID string |
|
327 |
+ IPAddress string `json:"IP"` |
|
328 |
+ Addr string |
|
329 |
+ Name string |
|
330 |
+ Cpus int |
|
331 |
+ Memory int64 |
|
332 |
+ Labels map[string]string |
|
333 |
+} |
|
334 |
+ |
|
335 |
+// ContainerJSONBase contains response of Remote API: |
|
336 |
+// GET "/containers/{name:.*}/json" |
|
337 |
+type ContainerJSONBase struct { |
|
338 |
+ ID string `json:"Id"` |
|
339 |
+ Created string |
|
340 |
+ Path string |
|
341 |
+ Args []string |
|
342 |
+ State *ContainerState |
|
343 |
+ Image string |
|
344 |
+ ResolvConfPath string |
|
345 |
+ HostnamePath string |
|
346 |
+ HostsPath string |
|
347 |
+ LogPath string |
|
348 |
+ Node *ContainerNode `json:",omitempty"` |
|
349 |
+ Name string |
|
350 |
+ RestartCount int |
|
351 |
+ Driver string |
|
352 |
+ MountLabel string |
|
353 |
+ ProcessLabel string |
|
354 |
+ AppArmorProfile string |
|
355 |
+ ExecIDs []string |
|
356 |
+ HostConfig *container.HostConfig |
|
357 |
+ GraphDriver GraphDriverData |
|
358 |
+ SizeRw *int64 `json:",omitempty"` |
|
359 |
+ SizeRootFs *int64 `json:",omitempty"` |
|
360 |
+} |
|
361 |
+ |
|
362 |
+// ContainerJSON is newly used struct along with MountPoint |
|
363 |
+type ContainerJSON struct { |
|
364 |
+ *ContainerJSONBase |
|
365 |
+ Mounts []MountPoint |
|
366 |
+ Config *container.Config |
|
367 |
+ NetworkSettings *NetworkSettings |
|
368 |
+} |
|
369 |
+ |
|
370 |
+// NetworkSettings exposes the network settings in the api |
|
371 |
+type NetworkSettings struct { |
|
372 |
+ NetworkSettingsBase |
|
373 |
+ DefaultNetworkSettings |
|
374 |
+ Networks map[string]*network.EndpointSettings |
|
375 |
+} |
|
376 |
+ |
|
377 |
+// SummaryNetworkSettings provides a summary of container's networks |
|
378 |
+// in /containers/json |
|
379 |
+type SummaryNetworkSettings struct { |
|
380 |
+ Networks map[string]*network.EndpointSettings |
|
381 |
+} |
|
382 |
+ |
|
383 |
+// NetworkSettingsBase holds basic information about networks |
|
384 |
+type NetworkSettingsBase struct { |
|
385 |
+ Bridge string // Bridge is the Bridge name the network uses(e.g. `docker0`) |
|
386 |
+ SandboxID string // SandboxID uniquely represents a container's network stack |
|
387 |
+ HairpinMode bool // HairpinMode specifies if hairpin NAT should be enabled on the virtual interface |
|
388 |
+ LinkLocalIPv6Address string // LinkLocalIPv6Address is an IPv6 unicast address using the link-local prefix |
|
389 |
+ LinkLocalIPv6PrefixLen int // LinkLocalIPv6PrefixLen is the prefix length of an IPv6 unicast address |
|
390 |
+ Ports nat.PortMap // Ports is a collection of PortBinding indexed by Port |
|
391 |
+ SandboxKey string // SandboxKey identifies the sandbox |
|
392 |
+ SecondaryIPAddresses []network.Address |
|
393 |
+ SecondaryIPv6Addresses []network.Address |
|
394 |
+} |
|
395 |
+ |
|
396 |
+// DefaultNetworkSettings holds network information |
|
397 |
+// during the 2 release deprecation period. |
|
398 |
+// It will be removed in Docker 1.11. |
|
399 |
+type DefaultNetworkSettings struct { |
|
400 |
+ EndpointID string // EndpointID uniquely represents a service endpoint in a Sandbox |
|
401 |
+ Gateway string // Gateway holds the gateway address for the network |
|
402 |
+ GlobalIPv6Address string // GlobalIPv6Address holds network's global IPv6 address |
|
403 |
+ GlobalIPv6PrefixLen int // GlobalIPv6PrefixLen represents mask length of network's global IPv6 address |
|
404 |
+ IPAddress string // IPAddress holds the IPv4 address for the network |
|
405 |
+ IPPrefixLen int // IPPrefixLen represents mask length of network's IPv4 address |
|
406 |
+ IPv6Gateway string // IPv6Gateway holds gateway address specific for IPv6 |
|
407 |
+ MacAddress string // MacAddress holds the MAC address for the network |
|
408 |
+} |
|
409 |
+ |
|
410 |
+// MountPoint represents a mount point configuration inside the container. |
|
411 |
+// This is used for reporting the mountpoints in use by a container. |
|
412 |
+type MountPoint struct { |
|
413 |
+ Type mount.Type `json:",omitempty"` |
|
414 |
+ Name string `json:",omitempty"` |
|
415 |
+ Source string |
|
416 |
+ Destination string |
|
417 |
+ Driver string `json:",omitempty"` |
|
418 |
+ Mode string |
|
419 |
+ RW bool |
|
420 |
+ Propagation mount.Propagation |
|
421 |
+} |
|
422 |
+ |
|
423 |
+// Volume represents the configuration of a volume for the remote API |
|
424 |
+type Volume struct { |
|
425 |
+ Name string // Name is the name of the volume |
|
426 |
+ Driver string // Driver is the Driver name used to create the volume |
|
427 |
+ Mountpoint string // Mountpoint is the location on disk of the volume |
|
428 |
+ Status map[string]interface{} `json:",omitempty"` // Status provides low-level status information about the volume |
|
429 |
+ Labels map[string]string // Labels is metadata specific to the volume |
|
430 |
+ Scope string // Scope describes the level at which the volume exists (e.g. `global` for cluster-wide or `local` for machine level) |
|
431 |
+} |
|
432 |
+ |
|
433 |
+// VolumesListResponse contains the response for the remote API: |
|
434 |
+// GET "/volumes" |
|
435 |
+type VolumesListResponse struct { |
|
436 |
+ Volumes []*Volume // Volumes is the list of volumes being returned |
|
437 |
+ Warnings []string // Warnings is a list of warnings that occurred when getting the list from the volume drivers |
|
438 |
+} |
|
439 |
+ |
|
440 |
+// VolumeCreateRequest contains the response for the remote API: |
|
441 |
+// POST "/volumes/create" |
|
442 |
+type VolumeCreateRequest struct { |
|
443 |
+ Name string // Name is the requested name of the volume |
|
444 |
+ Driver string // Driver is the name of the driver that should be used to create the volume |
|
445 |
+ DriverOpts map[string]string // DriverOpts holds the driver specific options to use for when creating the volume. |
|
446 |
+ Labels map[string]string // Labels holds metadata specific to the volume being created. |
|
447 |
+} |
|
448 |
+ |
|
449 |
+// NetworkResource is the body of the "get network" http response message |
|
450 |
+type NetworkResource struct { |
|
451 |
+ Name string // Name is the requested name of the network |
|
452 |
+ ID string `json:"Id"` // ID uniquely identifies a network on a single machine |
|
453 |
+ Scope string // Scope describes the level at which the network exists (e.g. `global` for cluster-wide or `local` for machine level) |
|
454 |
+ Driver string // Driver is the Driver name used to create the network (e.g. `bridge`, `overlay`) |
|
455 |
+ EnableIPv6 bool // EnableIPv6 represents whether to enable IPv6 |
|
456 |
+ IPAM network.IPAM // IPAM is the network's IP Address Management |
|
457 |
+ Internal bool // Internal represents if the network is used internal only |
|
458 |
+ Attachable bool // Attachable represents if the global scope is manually attachable by regular containers from workers in swarm mode. |
|
459 |
+ Containers map[string]EndpointResource // Containers contains endpoints belonging to the network |
|
460 |
+ Options map[string]string // Options holds the network specific options to use for when creating the network |
|
461 |
+ Labels map[string]string // Labels holds metadata specific to the network being created |
|
462 |
+} |
|
463 |
+ |
|
464 |
+// EndpointResource contains network resources allocated and used for a container in a network |
|
465 |
+type EndpointResource struct { |
|
466 |
+ Name string |
|
467 |
+ EndpointID string |
|
468 |
+ MacAddress string |
|
469 |
+ IPv4Address string |
|
470 |
+ IPv6Address string |
|
471 |
+} |
|
472 |
+ |
|
473 |
+// NetworkCreate is the expected body of the "create network" http request message |
|
474 |
+type NetworkCreate struct { |
|
475 |
+ CheckDuplicate bool |
|
476 |
+ Driver string |
|
477 |
+ EnableIPv6 bool |
|
478 |
+ IPAM *network.IPAM |
|
479 |
+ Internal bool |
|
480 |
+ Attachable bool |
|
481 |
+ Options map[string]string |
|
482 |
+ Labels map[string]string |
|
483 |
+} |
|
484 |
+ |
|
485 |
+// NetworkCreateRequest is the request message sent to the server for network create call. |
|
486 |
+type NetworkCreateRequest struct { |
|
487 |
+ NetworkCreate |
|
488 |
+ Name string |
|
489 |
+} |
|
490 |
+ |
|
491 |
+// NetworkCreateResponse is the response message sent by the server for network create call |
|
492 |
+type NetworkCreateResponse struct { |
|
493 |
+ ID string `json:"Id"` |
|
494 |
+ Warning string |
|
495 |
+} |
|
496 |
+ |
|
497 |
+// NetworkConnect represents the data to be used to connect a container to the network |
|
498 |
+type NetworkConnect struct { |
|
499 |
+ Container string |
|
500 |
+ EndpointConfig *network.EndpointSettings `json:",omitempty"` |
|
501 |
+} |
|
502 |
+ |
|
503 |
+// NetworkDisconnect represents the data to be used to disconnect a container from the network |
|
504 |
+type NetworkDisconnect struct { |
|
505 |
+ Container string |
|
506 |
+ Force bool |
|
507 |
+} |
|
508 |
+ |
|
509 |
+// Checkpoint represents the details of a checkpoint |
|
510 |
+type Checkpoint struct { |
|
511 |
+ Name string // Name is the name of the checkpoint |
|
512 |
+} |
|
513 |
+ |
|
514 |
+// Runtime describes an OCI runtime |
|
515 |
+type Runtime struct { |
|
516 |
+ Path string `json:"path"` |
|
517 |
+ Args []string `json:"runtimeArgs,omitempty"` |
|
518 |
+} |
0 | 519 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,14 @@ |
0 |
+## Legacy API type versions |
|
1 |
+ |
|
2 |
+This package includes types for legacy API versions. The stable version of the API types live in `api/types/*.go`. |
|
3 |
+ |
|
4 |
+Consider moving a type here when you need to keep backwards compatibility in the API. This legacy types are organized by the latest API version they appear in. For instance, types in the `v1p19` package are valid for API versions below or equal `1.19`. Types in the `v1p20` package are valid for the API version `1.20`, since the versions below that will use the legacy types in `v1p19`. |
|
5 |
+ |
|
6 |
+### Package name conventions |
|
7 |
+ |
|
8 |
+The package name convention is to use `v` as a prefix for the version number and `p`(patch) as a separator. We use this nomenclature due to a few restrictions in the Go package name convention: |
|
9 |
+ |
|
10 |
+1. We cannot use `.` because it's interpreted by the language, think of `v1.20.CallFunction`. |
|
11 |
+2. We cannot use `_` because golint complains about it. The code is actually valid, but it looks probably more weird: `v1_20.CallFunction`. |
|
12 |
+ |
|
13 |
+For instance, if you want to modify a type that was available in the version `1.21` of the API but it will have different fields in the version `1.22`, you want to create a new package under `api/types/versions/v1p21`. |
0 | 14 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,62 @@ |
0 |
+package versions |
|
1 |
+ |
|
2 |
+import ( |
|
3 |
+ "strconv" |
|
4 |
+ "strings" |
|
5 |
+) |
|
6 |
+ |
|
7 |
+// compare compares two version strings |
|
8 |
+// returns -1 if v1 < v2, 1 if v1 > v2, 0 otherwise. |
|
9 |
+func compare(v1, v2 string) int { |
|
10 |
+ var ( |
|
11 |
+ currTab = strings.Split(v1, ".") |
|
12 |
+ otherTab = strings.Split(v2, ".") |
|
13 |
+ ) |
|
14 |
+ |
|
15 |
+ max := len(currTab) |
|
16 |
+ if len(otherTab) > max { |
|
17 |
+ max = len(otherTab) |
|
18 |
+ } |
|
19 |
+ for i := 0; i < max; i++ { |
|
20 |
+ var currInt, otherInt int |
|
21 |
+ |
|
22 |
+ if len(currTab) > i { |
|
23 |
+ currInt, _ = strconv.Atoi(currTab[i]) |
|
24 |
+ } |
|
25 |
+ if len(otherTab) > i { |
|
26 |
+ otherInt, _ = strconv.Atoi(otherTab[i]) |
|
27 |
+ } |
|
28 |
+ if currInt > otherInt { |
|
29 |
+ return 1 |
|
30 |
+ } |
|
31 |
+ if otherInt > currInt { |
|
32 |
+ return -1 |
|
33 |
+ } |
|
34 |
+ } |
|
35 |
+ return 0 |
|
36 |
+} |
|
37 |
+ |
|
38 |
+// LessThan checks if a version is less than another |
|
39 |
+func LessThan(v, other string) bool { |
|
40 |
+ return compare(v, other) == -1 |
|
41 |
+} |
|
42 |
+ |
|
43 |
+// LessThanOrEqualTo checks if a version is less than or equal to another |
|
44 |
+func LessThanOrEqualTo(v, other string) bool { |
|
45 |
+ return compare(v, other) <= 0 |
|
46 |
+} |
|
47 |
+ |
|
48 |
+// GreaterThan checks if a version is greater than another |
|
49 |
+func GreaterThan(v, other string) bool { |
|
50 |
+ return compare(v, other) == 1 |
|
51 |
+} |
|
52 |
+ |
|
53 |
+// GreaterThanOrEqualTo checks if a version is greater than or equal to another |
|
54 |
+func GreaterThanOrEqualTo(v, other string) bool { |
|
55 |
+ return compare(v, other) >= 0 |
|
56 |
+} |
|
57 |
+ |
|
58 |
+// Equal checks if a version is equal to another |
|
59 |
+func Equal(v, other string) bool { |
|
60 |
+ return compare(v, other) == 0 |
|
61 |
+} |
0 | 62 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,26 @@ |
0 |
+package versions |
|
1 |
+ |
|
2 |
+import ( |
|
3 |
+ "testing" |
|
4 |
+) |
|
5 |
+ |
|
6 |
+func assertVersion(t *testing.T, a, b string, result int) { |
|
7 |
+ if r := compare(a, b); r != result { |
|
8 |
+ t.Fatalf("Unexpected version comparison result. Found %d, expected %d", r, result) |
|
9 |
+ } |
|
10 |
+} |
|
11 |
+ |
|
12 |
+func TestCompareVersion(t *testing.T) { |
|
13 |
+ assertVersion(t, "1.12", "1.12", 0) |
|
14 |
+ assertVersion(t, "1.0.0", "1", 0) |
|
15 |
+ assertVersion(t, "1", "1.0.0", 0) |
|
16 |
+ assertVersion(t, "1.05.00.0156", "1.0.221.9289", 1) |
|
17 |
+ assertVersion(t, "1", "1.0.1", -1) |
|
18 |
+ assertVersion(t, "1.0.1", "1", 1) |
|
19 |
+ assertVersion(t, "1.0.1", "1.0.2", -1) |
|
20 |
+ assertVersion(t, "1.0.2", "1.0.3", -1) |
|
21 |
+ assertVersion(t, "1.0.3", "1.1", -1) |
|
22 |
+ assertVersion(t, "1.1", "1.1.1", -1) |
|
23 |
+ assertVersion(t, "1.1.1", "1.1.2", -1) |
|
24 |
+ assertVersion(t, "1.1.2", "1.2", -1) |
|
25 |
+} |
0 | 26 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,35 @@ |
0 |
+// Package v1p19 provides specific API types for the API version 1, patch 19. |
|
1 |
+package v1p19 |
|
2 |
+ |
|
3 |
+import ( |
|
4 |
+ "github.com/docker/engine-api/types" |
|
5 |
+ "github.com/docker/engine-api/types/container" |
|
6 |
+ "github.com/docker/engine-api/types/versions/v1p20" |
|
7 |
+ "github.com/docker/go-connections/nat" |
|
8 |
+) |
|
9 |
+ |
|
10 |
+// ContainerJSON is a backcompatibility struct for APIs prior to 1.20. |
|
11 |
+// Note this is not used by the Windows daemon. |
|
12 |
+type ContainerJSON struct { |
|
13 |
+ *types.ContainerJSONBase |
|
14 |
+ Volumes map[string]string |
|
15 |
+ VolumesRW map[string]bool |
|
16 |
+ Config *ContainerConfig |
|
17 |
+ NetworkSettings *v1p20.NetworkSettings |
|
18 |
+} |
|
19 |
+ |
|
20 |
+// ContainerConfig is a backcompatibility struct for APIs prior to 1.20. |
|
21 |
+type ContainerConfig struct { |
|
22 |
+ *container.Config |
|
23 |
+ |
|
24 |
+ MacAddress string |
|
25 |
+ NetworkDisabled bool |
|
26 |
+ ExposedPorts map[nat.Port]struct{} |
|
27 |
+ |
|
28 |
+ // backward compatibility, they now live in HostConfig |
|
29 |
+ VolumeDriver string |
|
30 |
+ Memory int64 |
|
31 |
+ MemorySwap int64 |
|
32 |
+ CPUShares int64 `json:"CpuShares"` |
|
33 |
+ CPUSet string `json:"Cpuset"` |
|
34 |
+} |
0 | 35 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,40 @@ |
0 |
+// Package v1p20 provides specific API types for the API version 1, patch 20. |
|
1 |
+package v1p20 |
|
2 |
+ |
|
3 |
+import ( |
|
4 |
+ "github.com/docker/engine-api/types" |
|
5 |
+ "github.com/docker/engine-api/types/container" |
|
6 |
+ "github.com/docker/go-connections/nat" |
|
7 |
+) |
|
8 |
+ |
|
9 |
+// ContainerJSON is a backcompatibility struct for the API 1.20 |
|
10 |
+type ContainerJSON struct { |
|
11 |
+ *types.ContainerJSONBase |
|
12 |
+ Mounts []types.MountPoint |
|
13 |
+ Config *ContainerConfig |
|
14 |
+ NetworkSettings *NetworkSettings |
|
15 |
+} |
|
16 |
+ |
|
17 |
+// ContainerConfig is a backcompatibility struct used in ContainerJSON for the API 1.20 |
|
18 |
+type ContainerConfig struct { |
|
19 |
+ *container.Config |
|
20 |
+ |
|
21 |
+ MacAddress string |
|
22 |
+ NetworkDisabled bool |
|
23 |
+ ExposedPorts map[nat.Port]struct{} |
|
24 |
+ |
|
25 |
+ // backward compatibility, they now live in HostConfig |
|
26 |
+ VolumeDriver string |
|
27 |
+} |
|
28 |
+ |
|
29 |
+// StatsJSON is a backcompatibility struct used in Stats for APIs prior to 1.21 |
|
30 |
+type StatsJSON struct { |
|
31 |
+ types.Stats |
|
32 |
+ Network types.NetworkStats `json:"network,omitempty"` |
|
33 |
+} |
|
34 |
+ |
|
35 |
+// NetworkSettings is a backward compatible struct for APIs prior to 1.21 |
|
36 |
+type NetworkSettings struct { |
|
37 |
+ types.NetworkSettingsBase |
|
38 |
+ types.DefaultNetworkSettings |
|
39 |
+} |
... | ... |
@@ -9,11 +9,11 @@ import ( |
9 | 9 |
"os" |
10 | 10 |
"time" |
11 | 11 |
|
12 |
+ "github.com/docker/docker/api/types" |
|
12 | 13 |
"github.com/docker/docker/api/types/backend" |
14 |
+ "github.com/docker/docker/api/types/container" |
|
13 | 15 |
"github.com/docker/docker/image" |
14 | 16 |
"github.com/docker/docker/reference" |
15 |
- "github.com/docker/engine-api/types" |
|
16 |
- "github.com/docker/engine-api/types/container" |
|
17 | 17 |
"golang.org/x/net/context" |
18 | 18 |
) |
19 | 19 |
|
... | ... |
@@ -10,14 +10,14 @@ import ( |
10 | 10 |
"strings" |
11 | 11 |
|
12 | 12 |
"github.com/Sirupsen/logrus" |
13 |
+ "github.com/docker/docker/api/types" |
|
13 | 14 |
"github.com/docker/docker/api/types/backend" |
15 |
+ "github.com/docker/docker/api/types/container" |
|
14 | 16 |
"github.com/docker/docker/builder" |
15 | 17 |
"github.com/docker/docker/builder/dockerfile/parser" |
16 | 18 |
"github.com/docker/docker/image" |
17 | 19 |
"github.com/docker/docker/pkg/stringid" |
18 | 20 |
"github.com/docker/docker/reference" |
19 |
- "github.com/docker/engine-api/types" |
|
20 |
- "github.com/docker/engine-api/types/container" |
|
21 | 21 |
"golang.org/x/net/context" |
22 | 22 |
) |
23 | 23 |
|
... | ... |
@@ -18,11 +18,11 @@ import ( |
18 | 18 |
|
19 | 19 |
"github.com/Sirupsen/logrus" |
20 | 20 |
"github.com/docker/docker/api" |
21 |
+ "github.com/docker/docker/api/types/container" |
|
22 |
+ "github.com/docker/docker/api/types/strslice" |
|
21 | 23 |
"github.com/docker/docker/builder" |
22 | 24 |
"github.com/docker/docker/pkg/signal" |
23 | 25 |
runconfigopts "github.com/docker/docker/runconfig/opts" |
24 |
- "github.com/docker/engine-api/types/container" |
|
25 |
- "github.com/docker/engine-api/types/strslice" |
|
26 | 26 |
"github.com/docker/go-connections/nat" |
27 | 27 |
) |
28 | 28 |
|
... | ... |
@@ -6,9 +6,9 @@ import ( |
6 | 6 |
"strings" |
7 | 7 |
"testing" |
8 | 8 |
|
9 |
- "github.com/docker/engine-api/types" |
|
10 |
- "github.com/docker/engine-api/types/container" |
|
11 |
- "github.com/docker/engine-api/types/strslice" |
|
9 |
+ "github.com/docker/docker/api/types" |
|
10 |
+ "github.com/docker/docker/api/types/container" |
|
11 |
+ "github.com/docker/docker/api/types/strslice" |
|
12 | 12 |
"github.com/docker/go-connections/nat" |
13 | 13 |
) |
14 | 14 |
|
... | ... |
@@ -5,12 +5,12 @@ import ( |
5 | 5 |
"strings" |
6 | 6 |
"testing" |
7 | 7 |
|
8 |
+ "github.com/docker/docker/api/types" |
|
9 |
+ "github.com/docker/docker/api/types/container" |
|
8 | 10 |
"github.com/docker/docker/builder" |
9 | 11 |
"github.com/docker/docker/builder/dockerfile/parser" |
10 | 12 |
"github.com/docker/docker/pkg/archive" |
11 | 13 |
"github.com/docker/docker/pkg/reexec" |
12 |
- "github.com/docker/engine-api/types" |
|
13 |
- "github.com/docker/engine-api/types/container" |
|
14 | 14 |
) |
15 | 15 |
|
16 | 16 |
type dispatchTestCase struct { |
... | ... |
@@ -20,7 +20,10 @@ import ( |
20 | 20 |
"time" |
21 | 21 |
|
22 | 22 |
"github.com/Sirupsen/logrus" |
23 |
+ "github.com/docker/docker/api/types" |
|
23 | 24 |
"github.com/docker/docker/api/types/backend" |
25 |
+ "github.com/docker/docker/api/types/container" |
|
26 |
+ "github.com/docker/docker/api/types/strslice" |
|
24 | 27 |
"github.com/docker/docker/builder" |
25 | 28 |
"github.com/docker/docker/builder/dockerfile/parser" |
26 | 29 |
"github.com/docker/docker/pkg/archive" |
... | ... |
@@ -34,9 +37,6 @@ import ( |
34 | 34 |
"github.com/docker/docker/pkg/tarsum" |
35 | 35 |
"github.com/docker/docker/pkg/urlutil" |
36 | 36 |
"github.com/docker/docker/runconfig/opts" |
37 |
- "github.com/docker/engine-api/types" |
|
38 |
- "github.com/docker/engine-api/types/container" |
|
39 |
- "github.com/docker/engine-api/types/strslice" |
|
40 | 37 |
) |
41 | 38 |
|
42 | 39 |
func (b *Builder) commit(id string, autoCmd strslice.StrSlice, comment string) error { |
... | ... |
@@ -3,7 +3,9 @@ package credentials |
3 | 3 |
import ( |
4 | 4 |
"github.com/docker/docker/cliconfig/configfile" |
5 | 5 |
"github.com/docker/docker/registry" |
6 |
- "github.com/docker/engine-api/types" |
|
6 |
+ |
|
7 |
+ "github.com/docker/docker/api/types" |
|
8 |
+ "github.com/docker/docker/cliconfig/configfile" |
|
7 | 9 |
) |
8 | 10 |
|
9 | 11 |
// fileStore implements a credentials store using |
... | ... |
@@ -4,9 +4,9 @@ import ( |
4 | 4 |
"io/ioutil" |
5 | 5 |
"testing" |
6 | 6 |
|
7 |
+ "github.com/docker/docker/api/types" |
|
7 | 8 |
"github.com/docker/docker/cliconfig" |
8 | 9 |
"github.com/docker/docker/cliconfig/configfile" |
9 |
- "github.com/docker/engine-api/types" |
|
10 | 10 |
) |
11 | 11 |
|
12 | 12 |
func newConfigFile(auths map[string]types.AuthConfig) *configfile.ConfigFile { |
... | ... |
@@ -3,8 +3,8 @@ package credentials |
3 | 3 |
import ( |
4 | 4 |
"github.com/docker/docker-credential-helpers/client" |
5 | 5 |
"github.com/docker/docker-credential-helpers/credentials" |
6 |
+ "github.com/docker/docker/api/types" |
|
6 | 7 |
"github.com/docker/docker/cliconfig/configfile" |
7 |
- "github.com/docker/engine-api/types" |
|
8 | 8 |
) |
9 | 9 |
|
10 | 10 |
const ( |
... | ... |
@@ -4,9 +4,9 @@ import ( |
4 | 4 |
"os" |
5 | 5 |
"path/filepath" |
6 | 6 |
|
7 |
+ "github.com/docker/docker/api/types" |
|
7 | 8 |
"github.com/docker/docker/pkg/archive" |
8 | 9 |
"github.com/docker/docker/pkg/system" |
9 |
- "github.com/docker/engine-api/types" |
|
10 | 10 |
) |
11 | 11 |
|
12 | 12 |
// ResolvePath resolves the given path in the container to a resource on the |
... | ... |
@@ -16,6 +16,8 @@ import ( |
16 | 16 |
"golang.org/x/net/context" |
17 | 17 |
|
18 | 18 |
"github.com/Sirupsen/logrus" |
19 |
+ containertypes "github.com/docker/docker/api/types/container" |
|
20 |
+ networktypes "github.com/docker/docker/api/types/network" |
|
19 | 21 |
"github.com/docker/docker/daemon/exec" |
20 | 22 |
"github.com/docker/docker/daemon/logger" |
21 | 23 |
"github.com/docker/docker/daemon/logger/jsonfilelog" |
... | ... |
@@ -31,8 +33,6 @@ import ( |
31 | 31 |
"github.com/docker/docker/runconfig" |
32 | 32 |
runconfigopts "github.com/docker/docker/runconfig/opts" |
33 | 33 |
"github.com/docker/docker/volume" |
34 |
- containertypes "github.com/docker/engine-api/types/container" |
|
35 |
- networktypes "github.com/docker/engine-api/types/network" |
|
36 | 34 |
"github.com/docker/go-connections/nat" |
37 | 35 |
"github.com/docker/libnetwork" |
38 | 36 |
"github.com/docker/libnetwork/netlabel" |
... | ... |
@@ -11,13 +11,13 @@ import ( |
11 | 11 |
"syscall" |
12 | 12 |
|
13 | 13 |
"github.com/Sirupsen/logrus" |
14 |
+ containertypes "github.com/docker/docker/api/types/container" |
|
14 | 15 |
"github.com/docker/docker/pkg/chrootarchive" |
15 | 16 |
"github.com/docker/docker/pkg/stringid" |
16 | 17 |
"github.com/docker/docker/pkg/symlink" |
17 | 18 |
"github.com/docker/docker/pkg/system" |
18 | 19 |
"github.com/docker/docker/utils" |
19 | 20 |
"github.com/docker/docker/volume" |
20 |
- containertypes "github.com/docker/engine-api/types/container" |
|
21 | 21 |
"github.com/opencontainers/runc/libcontainer/label" |
22 | 22 |
) |
23 | 23 |
|
... | ... |
@@ -7,9 +7,9 @@ import ( |
7 | 7 |
"os" |
8 | 8 |
"path/filepath" |
9 | 9 |
|
10 |
+ containertypes "github.com/docker/docker/api/types/container" |
|
10 | 11 |
"github.com/docker/docker/utils" |
11 | 12 |
"github.com/docker/docker/volume" |
12 |
- containertypes "github.com/docker/engine-api/types/container" |
|
13 | 13 |
) |
14 | 14 |
|
15 | 15 |
// Container holds fields specific to the Windows implementation. See |
... | ... |
@@ -7,6 +7,7 @@ import ( |
7 | 7 |
"path/filepath" |
8 | 8 |
"strings" |
9 | 9 |
|
10 |
+ "github.com/docker/docker/api/types" |
|
10 | 11 |
"github.com/docker/docker/builder" |
11 | 12 |
"github.com/docker/docker/container" |
12 | 13 |
"github.com/docker/docker/pkg/archive" |
... | ... |
@@ -14,7 +15,6 @@ import ( |
14 | 14 |
"github.com/docker/docker/pkg/idtools" |
15 | 15 |
"github.com/docker/docker/pkg/ioutils" |
16 | 16 |
"github.com/docker/docker/pkg/system" |
17 |
- "github.com/docker/engine-api/types" |
|
18 | 17 |
) |
19 | 18 |
|
20 | 19 |
// ErrExtractPointNotDirectory is used to convey that the operation to extract |
... | ... |
@@ -3,8 +3,8 @@ package daemon |
3 | 3 |
import ( |
4 | 4 |
"golang.org/x/net/context" |
5 | 5 |
|
6 |
+ "github.com/docker/docker/api/types" |
|
6 | 7 |
"github.com/docker/docker/dockerversion" |
7 |
- "github.com/docker/engine-api/types" |
|
8 | 8 |
) |
9 | 9 |
|
10 | 10 |
// AuthenticateToRegistry checks the validity of credentials in authConfig |
... | ... |
@@ -14,6 +14,9 @@ import ( |
14 | 14 |
"google.golang.org/grpc" |
15 | 15 |
|
16 | 16 |
"github.com/Sirupsen/logrus" |
17 |
+ apitypes "github.com/docker/docker/api/types" |
|
18 |
+ "github.com/docker/docker/api/types/filters" |
|
19 |
+ types "github.com/docker/docker/api/types/swarm" |
|
17 | 20 |
"github.com/docker/docker/daemon/cluster/convert" |
18 | 21 |
executorpkg "github.com/docker/docker/daemon/cluster/executor" |
19 | 22 |
"github.com/docker/docker/daemon/cluster/executor/container" |
... | ... |
@@ -22,9 +25,6 @@ import ( |
22 | 22 |
"github.com/docker/docker/pkg/ioutils" |
23 | 23 |
"github.com/docker/docker/pkg/signal" |
24 | 24 |
"github.com/docker/docker/runconfig" |
25 |
- apitypes "github.com/docker/engine-api/types" |
|
26 |
- "github.com/docker/engine-api/types/filters" |
|
27 |
- types "github.com/docker/engine-api/types/swarm" |
|
28 | 25 |
swarmagent "github.com/docker/swarmkit/agent" |
29 | 26 |
swarmapi "github.com/docker/swarmkit/api" |
30 | 27 |
"golang.org/x/net/context" |
... | ... |
@@ -4,8 +4,8 @@ import ( |
4 | 4 |
"fmt" |
5 | 5 |
"strings" |
6 | 6 |
|
7 |
- mounttypes "github.com/docker/engine-api/types/mount" |
|
8 |
- types "github.com/docker/engine-api/types/swarm" |
|
7 |
+ mounttypes "github.com/docker/docker/api/types/mount" |
|
8 |
+ types "github.com/docker/docker/api/types/swarm" |
|
9 | 9 |
swarmapi "github.com/docker/swarmkit/api" |
10 | 10 |
"github.com/docker/swarmkit/protobuf/ptypes" |
11 | 11 |
) |
... | ... |
@@ -3,9 +3,9 @@ package convert |
3 | 3 |
import ( |
4 | 4 |
"strings" |
5 | 5 |
|
6 |
- basictypes "github.com/docker/engine-api/types" |
|
7 |
- networktypes "github.com/docker/engine-api/types/network" |
|
8 |
- types "github.com/docker/engine-api/types/swarm" |
|
6 |
+ basictypes "github.com/docker/docker/api/types" |
|
7 |
+ networktypes "github.com/docker/docker/api/types/network" |
|
8 |
+ types "github.com/docker/docker/api/types/swarm" |
|
9 | 9 |
swarmapi "github.com/docker/swarmkit/api" |
10 | 10 |
"github.com/docker/swarmkit/protobuf/ptypes" |
11 | 11 |
) |
... | ... |
@@ -4,8 +4,8 @@ import ( |
4 | 4 |
"fmt" |
5 | 5 |
"strings" |
6 | 6 |
|
7 |
+ types "github.com/docker/docker/api/types/swarm" |
|
7 | 8 |
"github.com/docker/docker/pkg/namesgenerator" |
8 |
- types "github.com/docker/engine-api/types/swarm" |
|
9 | 9 |
swarmapi "github.com/docker/swarmkit/api" |
10 | 10 |
"github.com/docker/swarmkit/protobuf/ptypes" |
11 | 11 |
) |
... | ... |
@@ -4,12 +4,12 @@ import ( |
4 | 4 |
"io" |
5 | 5 |
"time" |
6 | 6 |
|
7 |
+ "github.com/docker/docker/api/types" |
|
8 |
+ "github.com/docker/docker/api/types/container" |
|
9 |
+ "github.com/docker/docker/api/types/events" |
|
10 |
+ "github.com/docker/docker/api/types/filters" |
|
11 |
+ "github.com/docker/docker/api/types/network" |
|
7 | 12 |
clustertypes "github.com/docker/docker/daemon/cluster/provider" |
8 |
- "github.com/docker/engine-api/types" |
|
9 |
- "github.com/docker/engine-api/types/container" |
|
10 |
- "github.com/docker/engine-api/types/events" |
|
11 |
- "github.com/docker/engine-api/types/filters" |
|
12 |
- "github.com/docker/engine-api/types/network" |
|
13 | 13 |
"github.com/docker/libnetwork" |
14 | 14 |
"github.com/docker/libnetwork/cluster" |
15 | 15 |
networktypes "github.com/docker/libnetwork/types" |
... | ... |
@@ -8,6 +8,7 @@ import ( |
8 | 8 |
"time" |
9 | 9 |
|
10 | 10 |
"github.com/docker/docker/api/types/backend" |
11 |
+ containertypes "github.com/docker/docker/api/types/container" |
|
11 | 12 |
"github.com/docker/docker/builder/dockerfile" |
12 | 13 |
"github.com/docker/docker/container" |
13 | 14 |
"github.com/docker/docker/dockerversion" |
... | ... |
@@ -16,7 +17,6 @@ import ( |
16 | 16 |
"github.com/docker/docker/pkg/archive" |
17 | 17 |
"github.com/docker/docker/pkg/ioutils" |
18 | 18 |
"github.com/docker/docker/reference" |
19 |
- containertypes "github.com/docker/engine-api/types/container" |
|
20 | 19 |
"github.com/docker/go-connections/nat" |
21 | 20 |
) |
22 | 21 |
|
... | ... |
@@ -6,9 +6,9 @@ import ( |
6 | 6 |
"fmt" |
7 | 7 |
"net" |
8 | 8 |
|
9 |
+ "github.com/docker/docker/api/types" |
|
9 | 10 |
"github.com/docker/docker/opts" |
10 | 11 |
runconfigopts "github.com/docker/docker/runconfig/opts" |
11 |
- "github.com/docker/engine-api/types" |
|
12 | 12 |
units "github.com/docker/go-units" |
13 | 13 |
"github.com/spf13/pflag" |
14 | 14 |
) |
... | ... |
@@ -6,6 +6,8 @@ import ( |
6 | 6 |
"regexp" |
7 | 7 |
"time" |
8 | 8 |
|
9 |
+ containertypes "github.com/docker/docker/api/types/container" |
|
10 |
+ "github.com/docker/docker/api/types/strslice" |
|
9 | 11 |
"github.com/docker/docker/container" |
10 | 12 |
"github.com/docker/docker/daemon/network" |
11 | 13 |
"github.com/docker/docker/errors" |
... | ... |
@@ -13,8 +15,6 @@ import ( |
13 | 13 |
"github.com/docker/docker/pkg/signal" |
14 | 14 |
"github.com/docker/docker/pkg/system" |
15 | 15 |
"github.com/docker/docker/pkg/truncindex" |
16 |
- containertypes "github.com/docker/engine-api/types/container" |
|
17 |
- "github.com/docker/engine-api/types/strslice" |
|
18 | 16 |
"github.com/docker/go-connections/nat" |
19 | 17 |
) |
20 | 18 |
|
... | ... |
@@ -9,13 +9,13 @@ import ( |
9 | 9 |
"strings" |
10 | 10 |
|
11 | 11 |
"github.com/Sirupsen/logrus" |
12 |
+ containertypes "github.com/docker/docker/api/types/container" |
|
13 |
+ networktypes "github.com/docker/docker/api/types/network" |
|
12 | 14 |
"github.com/docker/docker/container" |
13 | 15 |
"github.com/docker/docker/daemon/network" |
14 | 16 |
derr "github.com/docker/docker/errors" |
15 | 17 |
"github.com/docker/docker/pkg/stringid" |
16 | 18 |
"github.com/docker/docker/runconfig" |
17 |
- containertypes "github.com/docker/engine-api/types/container" |
|
18 |
- networktypes "github.com/docker/engine-api/types/network" |
|
19 | 19 |
"github.com/docker/go-connections/nat" |
20 | 20 |
"github.com/docker/libnetwork" |
21 | 21 |
"github.com/docker/libnetwork/netlabel" |
... | ... |
@@ -5,8 +5,8 @@ package daemon |
5 | 5 |
import ( |
6 | 6 |
"fmt" |
7 | 7 |
|
8 |
+ networktypes "github.com/docker/docker/api/types/network" |
|
8 | 9 |
"github.com/docker/docker/container" |
9 |
- networktypes "github.com/docker/engine-api/types/network" |
|
10 | 10 |
) |
11 | 11 |
|
12 | 12 |
func (daemon *Daemon) setupLinkedContainers(container *container.Container) ([]string, error) { |
... | ... |
@@ -12,6 +12,8 @@ import ( |
12 | 12 |
"time" |
13 | 13 |
|
14 | 14 |
"github.com/Sirupsen/logrus" |
15 |
+ containertypes "github.com/docker/docker/api/types/container" |
|
16 |
+ networktypes "github.com/docker/docker/api/types/network" |
|
15 | 17 |
"github.com/docker/docker/container" |
16 | 18 |
"github.com/docker/docker/daemon/links" |
17 | 19 |
"github.com/docker/docker/pkg/fileutils" |
... | ... |
@@ -19,8 +21,6 @@ import ( |
19 | 19 |
"github.com/docker/docker/pkg/mount" |
20 | 20 |
"github.com/docker/docker/pkg/stringid" |
21 | 21 |
"github.com/docker/docker/runconfig" |
22 |
- containertypes "github.com/docker/engine-api/types/container" |
|
23 |
- networktypes "github.com/docker/engine-api/types/network" |
|
24 | 22 |
"github.com/opencontainers/runc/libcontainer/configs" |
25 | 23 |
"github.com/opencontainers/runc/libcontainer/devices" |
26 | 24 |
"github.com/opencontainers/runc/libcontainer/label" |
... | ... |
@@ -5,8 +5,8 @@ package daemon |
5 | 5 |
import ( |
6 | 6 |
"fmt" |
7 | 7 |
|
8 |
+ networktypes "github.com/docker/docker/api/types/network" |
|
8 | 9 |
"github.com/docker/docker/container" |
9 |
- networktypes "github.com/docker/engine-api/types/network" |
|
10 | 10 |
) |
11 | 11 |
|
12 | 12 |
func (daemon *Daemon) setupLinkedContainers(container *container.Container) ([]string, error) { |
... | ... |
@@ -6,6 +6,9 @@ import ( |
6 | 6 |
"strings" |
7 | 7 |
|
8 | 8 |
"github.com/Sirupsen/logrus" |
9 |
+ "github.com/docker/docker/api/types" |
|
10 |
+ containertypes "github.com/docker/docker/api/types/container" |
|
11 |
+ networktypes "github.com/docker/docker/api/types/network" |
|
9 | 12 |
"github.com/docker/docker/container" |
10 | 13 |
"github.com/docker/docker/errors" |
11 | 14 |
"github.com/docker/docker/image" |
... | ... |
@@ -14,9 +17,6 @@ import ( |
14 | 14 |
"github.com/docker/docker/pkg/stringid" |
15 | 15 |
"github.com/docker/docker/runconfig" |
16 | 16 |
volumestore "github.com/docker/docker/volume/store" |
17 |
- "github.com/docker/engine-api/types" |
|
18 |
- containertypes "github.com/docker/engine-api/types/container" |
|
19 |
- networktypes "github.com/docker/engine-api/types/network" |
|
20 | 17 |
"github.com/opencontainers/runc/libcontainer/label" |
21 | 18 |
) |
22 | 19 |
|
... | ... |
@@ -8,9 +8,9 @@ import ( |
8 | 8 |
"path/filepath" |
9 | 9 |
|
10 | 10 |
"github.com/Sirupsen/logrus" |
11 |
+ containertypes "github.com/docker/docker/api/types/container" |
|
11 | 12 |
"github.com/docker/docker/container" |
12 | 13 |
"github.com/docker/docker/pkg/stringid" |
13 |
- containertypes "github.com/docker/engine-api/types/container" |
|
14 | 14 |
"github.com/opencontainers/runc/libcontainer/label" |
15 | 15 |
) |
16 | 16 |
|
... | ... |
@@ -3,10 +3,10 @@ package daemon |
3 | 3 |
import ( |
4 | 4 |
"fmt" |
5 | 5 |
|
6 |
+ containertypes "github.com/docker/docker/api/types/container" |
|
6 | 7 |
"github.com/docker/docker/container" |
7 | 8 |
"github.com/docker/docker/pkg/stringid" |
8 | 9 |
"github.com/docker/docker/volume" |
9 |
- containertypes "github.com/docker/engine-api/types/container" |
|
10 | 10 |
) |
11 | 11 |
|
12 | 12 |
// createContainerPlatformSpecificSettings performs platform specific container create functionality |
... | ... |
@@ -23,11 +23,11 @@ import ( |
23 | 23 |
"github.com/Sirupsen/logrus" |
24 | 24 |
containerd "github.com/docker/containerd/api/grpc/types" |
25 | 25 |
"github.com/docker/docker/api" |
26 |
+ "github.com/docker/docker/api/types" |
|
27 |
+ containertypes "github.com/docker/docker/api/types/container" |
|
26 | 28 |
"github.com/docker/docker/container" |
27 | 29 |
"github.com/docker/docker/daemon/events" |
28 | 30 |
"github.com/docker/docker/daemon/exec" |
29 |
- "github.com/docker/engine-api/types" |
|
30 |
- containertypes "github.com/docker/engine-api/types/container" |
|
31 | 31 |
"github.com/docker/libnetwork/cluster" |
32 | 32 |
// register graph drivers |
33 | 33 |
_ "github.com/docker/docker/daemon/graphdriver/register" |
... | ... |
@@ -3,9 +3,9 @@ |
3 | 3 |
package daemon |
4 | 4 |
|
5 | 5 |
import ( |
6 |
+ "github.com/docker/docker/api/types/container" |
|
6 | 7 |
"github.com/docker/docker/libcontainerd" |
7 | 8 |
"github.com/docker/docker/plugin" |
8 |
- "github.com/docker/engine-api/types/container" |
|
9 | 9 |
) |
10 | 10 |
|
11 | 11 |
func (daemon *Daemon) verifyExperimentalContainerSettings(hostConfig *container.HostConfig, config *container.Config) ([]string, error) { |
... | ... |
@@ -5,14 +5,14 @@ package daemon |
5 | 5 |
import ( |
6 | 6 |
"fmt" |
7 | 7 |
|
8 |
+ "github.com/docker/docker/api/types" |
|
9 |
+ containertypes "github.com/docker/docker/api/types/container" |
|
8 | 10 |
"github.com/docker/docker/container" |
9 | 11 |
"github.com/docker/docker/image" |
10 | 12 |
"github.com/docker/docker/layer" |
11 | 13 |
"github.com/docker/docker/pkg/idtools" |
12 | 14 |
"github.com/docker/docker/pkg/parsers/kernel" |
13 | 15 |
"github.com/docker/docker/reference" |
14 |
- "github.com/docker/engine-api/types" |
|
15 |
- containertypes "github.com/docker/engine-api/types/container" |
|
16 | 16 |
"github.com/docker/libnetwork" |
17 | 17 |
nwconfig "github.com/docker/libnetwork/config" |
18 | 18 |
) |
... | ... |
@@ -3,8 +3,8 @@ |
3 | 3 |
package daemon |
4 | 4 |
|
5 | 5 |
import ( |
6 |
+ "github.com/docker/docker/api/types/container" |
|
6 | 7 |
"github.com/docker/docker/libcontainerd" |
7 |
- "github.com/docker/engine-api/types/container" |
|
8 | 8 |
) |
9 | 9 |
|
10 | 10 |
func (daemon *Daemon) verifyExperimentalContainerSettings(hostConfig *container.HostConfig, config *container.Config) ([]string, error) { |
... | ... |
@@ -8,6 +8,7 @@ import ( |
8 | 8 |
"testing" |
9 | 9 |
"time" |
10 | 10 |
|
11 |
+ containertypes "github.com/docker/docker/api/types/container" |
|
11 | 12 |
"github.com/docker/docker/container" |
12 | 13 |
"github.com/docker/docker/pkg/discovery" |
13 | 14 |
_ "github.com/docker/docker/pkg/discovery/memory" |
... | ... |
@@ -17,7 +18,6 @@ import ( |
17 | 17 |
volumedrivers "github.com/docker/docker/volume/drivers" |
18 | 18 |
"github.com/docker/docker/volume/local" |
19 | 19 |
"github.com/docker/docker/volume/store" |
20 |
- containertypes "github.com/docker/engine-api/types/container" |
|
21 | 20 |
"github.com/docker/go-connections/nat" |
22 | 21 |
) |
23 | 22 |
|
... | ... |
@@ -16,6 +16,10 @@ import ( |
16 | 16 |
"syscall" |
17 | 17 |
|
18 | 18 |
"github.com/Sirupsen/logrus" |
19 |
+ "github.com/docker/docker/api/types" |
|
20 |
+ "github.com/docker/docker/api/types/blkiodev" |
|
21 |
+ pblkiodev "github.com/docker/docker/api/types/blkiodev" |
|
22 |
+ containertypes "github.com/docker/docker/api/types/container" |
|
19 | 23 |
"github.com/docker/docker/container" |
20 | 24 |
"github.com/docker/docker/image" |
21 | 25 |
"github.com/docker/docker/pkg/idtools" |
... | ... |
@@ -24,10 +28,6 @@ import ( |
24 | 24 |
"github.com/docker/docker/pkg/sysinfo" |
25 | 25 |
"github.com/docker/docker/runconfig" |
26 | 26 |
runconfigopts "github.com/docker/docker/runconfig/opts" |
27 |
- "github.com/docker/engine-api/types" |
|
28 |
- "github.com/docker/engine-api/types/blkiodev" |
|
29 |
- pblkiodev "github.com/docker/engine-api/types/blkiodev" |
|
30 |
- containertypes "github.com/docker/engine-api/types/container" |
|
31 | 27 |
"github.com/docker/libnetwork" |
32 | 28 |
nwconfig "github.com/docker/libnetwork/config" |
33 | 29 |
"github.com/docker/libnetwork/drivers/bridge" |
... | ... |
@@ -8,12 +8,12 @@ import ( |
8 | 8 |
"path/filepath" |
9 | 9 |
"testing" |
10 | 10 |
|
11 |
+ containertypes "github.com/docker/docker/api/types/container" |
|
11 | 12 |
"github.com/docker/docker/container" |
12 | 13 |
"github.com/docker/docker/volume" |
13 | 14 |
"github.com/docker/docker/volume/drivers" |
14 | 15 |
"github.com/docker/docker/volume/local" |
15 | 16 |
"github.com/docker/docker/volume/store" |
16 |
- containertypes "github.com/docker/engine-api/types/container" |
|
17 | 17 |
) |
18 | 18 |
|
19 | 19 |
// Unix test as uses settings which are not available on Windows |
... | ... |
@@ -7,6 +7,9 @@ import ( |
7 | 7 |
|
8 | 8 |
"github.com/Microsoft/hcsshim" |
9 | 9 |
"github.com/Sirupsen/logrus" |
10 |
+ "github.com/docker/docker/api/types" |
|
11 |
+ pblkiodev "github.com/docker/docker/api/types/blkiodev" |
|
12 |
+ containertypes "github.com/docker/docker/api/types/container" |
|
10 | 13 |
"github.com/docker/docker/container" |
11 | 14 |
"github.com/docker/docker/image" |
12 | 15 |
"github.com/docker/docker/pkg/idtools" |
... | ... |
@@ -14,9 +17,6 @@ import ( |
14 | 14 |
"github.com/docker/docker/pkg/sysinfo" |
15 | 15 |
"github.com/docker/docker/pkg/system" |
16 | 16 |
"github.com/docker/docker/runconfig" |
17 |
- "github.com/docker/engine-api/types" |
|
18 |
- pblkiodev "github.com/docker/engine-api/types/blkiodev" |
|
19 |
- containertypes "github.com/docker/engine-api/types/container" |
|
20 | 17 |
"github.com/docker/libnetwork" |
21 | 18 |
nwconfig "github.com/docker/libnetwork/config" |
22 | 19 |
winlibnetwork "github.com/docker/libnetwork/drivers/windows" |
... | ... |
@@ -7,11 +7,11 @@ import ( |
7 | 7 |
"strings" |
8 | 8 |
|
9 | 9 |
"github.com/Sirupsen/logrus" |
10 |
+ "github.com/docker/docker/api/types" |
|
10 | 11 |
"github.com/docker/docker/container" |
11 | 12 |
"github.com/docker/docker/errors" |
12 | 13 |
"github.com/docker/docker/layer" |
13 | 14 |
volumestore "github.com/docker/docker/volume/store" |
14 |
- "github.com/docker/engine-api/types" |
|
15 | 15 |
) |
16 | 16 |
|
17 | 17 |
// ContainerRm removes the container id from the filesystem. An error |
... | ... |
@@ -5,9 +5,9 @@ import ( |
5 | 5 |
"os" |
6 | 6 |
"testing" |
7 | 7 |
|
8 |
+ "github.com/docker/docker/api/types" |
|
9 |
+ containertypes "github.com/docker/docker/api/types/container" |
|
8 | 10 |
"github.com/docker/docker/container" |
9 |
- "github.com/docker/engine-api/types" |
|
10 |
- containertypes "github.com/docker/engine-api/types/container" |
|
11 | 11 |
) |
12 | 12 |
|
13 | 13 |
func TestContainerDoubleDelete(t *testing.T) { |
... | ... |
@@ -4,10 +4,10 @@ import ( |
4 | 4 |
"strings" |
5 | 5 |
"time" |
6 | 6 |
|
7 |
+ "github.com/docker/docker/api/types/events" |
|
8 |
+ "github.com/docker/docker/api/types/filters" |
|
7 | 9 |
"github.com/docker/docker/container" |
8 | 10 |
daemonevents "github.com/docker/docker/daemon/events" |
9 |
- "github.com/docker/engine-api/types/events" |
|
10 |
- "github.com/docker/engine-api/types/filters" |
|
11 | 11 |
"github.com/docker/libnetwork" |
12 | 12 |
) |
13 | 13 |
|
... | ... |
@@ -5,9 +5,9 @@ import ( |
5 | 5 |
"testing" |
6 | 6 |
"time" |
7 | 7 |
|
8 |
+ "github.com/docker/docker/api/types/events" |
|
9 |
+ timetypes "github.com/docker/docker/api/types/time" |
|
8 | 10 |
"github.com/docker/docker/daemon/events/testutils" |
9 |
- "github.com/docker/engine-api/types/events" |
|
10 |
- timetypes "github.com/docker/engine-api/types/time" |
|
11 | 11 |
) |
12 | 12 |
|
13 | 13 |
func TestEventsLog(t *testing.T) { |
... | ... |
@@ -1,9 +1,9 @@ |
1 | 1 |
package events |
2 | 2 |
|
3 | 3 |
import ( |
4 |
+ "github.com/docker/docker/api/types/events" |
|
5 |
+ "github.com/docker/docker/api/types/filters" |
|
4 | 6 |
"github.com/docker/docker/reference" |
5 |
- "github.com/docker/engine-api/types/events" |
|
6 |
- "github.com/docker/engine-api/types/filters" |
|
7 | 7 |
) |
8 | 8 |
|
9 | 9 |
// Filter can filter out docker events from a stream |
... | ... |
@@ -4,10 +4,10 @@ import ( |
4 | 4 |
"testing" |
5 | 5 |
"time" |
6 | 6 |
|
7 |
+ containertypes "github.com/docker/docker/api/types/container" |
|
8 |
+ eventtypes "github.com/docker/docker/api/types/events" |
|
7 | 9 |
"github.com/docker/docker/container" |
8 | 10 |
"github.com/docker/docker/daemon/events" |
9 |
- containertypes "github.com/docker/engine-api/types/container" |
|
10 |
- eventtypes "github.com/docker/engine-api/types/events" |
|
11 | 11 |
) |
12 | 12 |
|
13 | 13 |
func TestLogContainerEventCopyLabels(t *testing.T) { |
... | ... |
@@ -9,6 +9,8 @@ import ( |
9 | 9 |
"golang.org/x/net/context" |
10 | 10 |
|
11 | 11 |
"github.com/Sirupsen/logrus" |
12 |
+ "github.com/docker/docker/api/types" |
|
13 |
+ "github.com/docker/docker/api/types/strslice" |
|
12 | 14 |
"github.com/docker/docker/container" |
13 | 15 |
"github.com/docker/docker/daemon/exec" |
14 | 16 |
"github.com/docker/docker/errors" |
... | ... |
@@ -16,8 +18,6 @@ import ( |
16 | 16 |
"github.com/docker/docker/pkg/pools" |
17 | 17 |
"github.com/docker/docker/pkg/signal" |
18 | 18 |
"github.com/docker/docker/pkg/term" |
19 |
- "github.com/docker/engine-api/types" |
|
20 |
- "github.com/docker/engine-api/types/strslice" |
|
21 | 19 |
) |
22 | 20 |
|
23 | 21 |
// Seconds to wait after sending TERM before trying KILL |
... | ... |
@@ -10,10 +10,10 @@ import ( |
10 | 10 |
"golang.org/x/net/context" |
11 | 11 |
|
12 | 12 |
"github.com/Sirupsen/logrus" |
13 |
+ "github.com/docker/docker/api/types" |
|
14 |
+ "github.com/docker/docker/api/types/strslice" |
|
13 | 15 |
"github.com/docker/docker/container" |
14 | 16 |
"github.com/docker/docker/daemon/exec" |
15 |
- "github.com/docker/engine-api/types" |
|
16 |
- "github.com/docker/engine-api/types/strslice" |
|
17 | 17 |
) |
18 | 18 |
|
19 | 19 |
const ( |
... | ... |
@@ -4,11 +4,11 @@ import ( |
4 | 4 |
"testing" |
5 | 5 |
"time" |
6 | 6 |
|
7 |
+ "github.com/docker/docker/api/types" |
|
8 |
+ containertypes "github.com/docker/docker/api/types/container" |
|
9 |
+ eventtypes "github.com/docker/docker/api/types/events" |
|
7 | 10 |
"github.com/docker/docker/container" |
8 | 11 |
"github.com/docker/docker/daemon/events" |
9 |
- "github.com/docker/engine-api/types" |
|
10 |
- containertypes "github.com/docker/engine-api/types/container" |
|
11 |
- eventtypes "github.com/docker/engine-api/types/events" |
|
12 | 12 |
) |
13 | 13 |
|
14 | 14 |
func reset(c *container.Container) { |
... | ... |
@@ -3,11 +3,11 @@ package daemon |
3 | 3 |
import ( |
4 | 4 |
"fmt" |
5 | 5 |
|
6 |
+ containertypes "github.com/docker/docker/api/types/container" |
|
6 | 7 |
"github.com/docker/docker/builder" |
7 | 8 |
"github.com/docker/docker/image" |
8 | 9 |
"github.com/docker/docker/reference" |
9 | 10 |
"github.com/docker/docker/runconfig" |
10 |
- containertypes "github.com/docker/engine-api/types/container" |
|
11 | 11 |
) |
12 | 12 |
|
13 | 13 |
// ErrImageDoesNotExist is error returned when no image can be found for a reference. |
... | ... |
@@ -4,12 +4,12 @@ import ( |
4 | 4 |
"fmt" |
5 | 5 |
"strings" |
6 | 6 |
|
7 |
+ "github.com/docker/docker/api/types" |
|
7 | 8 |
"github.com/docker/docker/container" |
8 | 9 |
"github.com/docker/docker/errors" |
9 | 10 |
"github.com/docker/docker/image" |
10 | 11 |
"github.com/docker/docker/pkg/stringid" |
11 | 12 |
"github.com/docker/docker/reference" |
12 |
- "github.com/docker/engine-api/types" |
|
13 | 13 |
) |
14 | 14 |
|
15 | 15 |
type conflictType int |
... | ... |
@@ -3,9 +3,9 @@ package daemon |
3 | 3 |
import ( |
4 | 4 |
"fmt" |
5 | 5 |
|
6 |
+ "github.com/docker/docker/api/types" |
|
6 | 7 |
"github.com/docker/docker/layer" |
7 | 8 |
"github.com/docker/docker/reference" |
8 |
- "github.com/docker/engine-api/types" |
|
9 | 9 |
) |
10 | 10 |
|
11 | 11 |
// ImageHistory returns a slice of ImageHistory structures for the specified image |
... | ... |
@@ -4,9 +4,9 @@ import ( |
4 | 4 |
"fmt" |
5 | 5 |
"time" |
6 | 6 |
|
7 |
+ "github.com/docker/docker/api/types" |
|
7 | 8 |
"github.com/docker/docker/layer" |
8 | 9 |
"github.com/docker/docker/reference" |
9 |
- "github.com/docker/engine-api/types" |
|
10 | 10 |
) |
11 | 11 |
|
12 | 12 |
// LookupImage looks up an image by name and returns it as an ImageInspect |
... | ... |
@@ -5,12 +5,12 @@ import ( |
5 | 5 |
"strings" |
6 | 6 |
|
7 | 7 |
"github.com/docker/distribution/digest" |
8 |
+ "github.com/docker/docker/api/types" |
|
8 | 9 |
"github.com/docker/docker/builder" |
9 | 10 |
"github.com/docker/docker/distribution" |
10 | 11 |
"github.com/docker/docker/pkg/progress" |
11 | 12 |
"github.com/docker/docker/reference" |
12 | 13 |
"github.com/docker/docker/registry" |
13 |
- "github.com/docker/engine-api/types" |
|
14 | 14 |
"golang.org/x/net/context" |
15 | 15 |
) |
16 | 16 |
|
... | ... |
@@ -3,10 +3,10 @@ package daemon |
3 | 3 |
import ( |
4 | 4 |
"io" |
5 | 5 |
|
6 |
+ "github.com/docker/docker/api/types" |
|
6 | 7 |
"github.com/docker/docker/distribution" |
7 | 8 |
"github.com/docker/docker/pkg/progress" |
8 | 9 |
"github.com/docker/docker/reference" |
9 |
- "github.com/docker/engine-api/types" |
|
10 | 10 |
"golang.org/x/net/context" |
11 | 11 |
) |
12 | 12 |
|
... | ... |
@@ -5,11 +5,11 @@ import ( |
5 | 5 |
"path" |
6 | 6 |
"sort" |
7 | 7 |
|
8 |
+ "github.com/docker/docker/api/types" |
|
9 |
+ "github.com/docker/docker/api/types/filters" |
|
8 | 10 |
"github.com/docker/docker/image" |
9 | 11 |
"github.com/docker/docker/layer" |
10 | 12 |
"github.com/docker/docker/reference" |
11 |
- "github.com/docker/engine-api/types" |
|
12 |
- "github.com/docker/engine-api/types/filters" |
|
13 | 13 |
) |
14 | 14 |
|
15 | 15 |
var acceptedImageFilterTags = map[string]bool{ |
... | ... |
@@ -9,6 +9,7 @@ import ( |
9 | 9 |
"runtime" |
10 | 10 |
"time" |
11 | 11 |
|
12 |
+ "github.com/docker/docker/api/types/container" |
|
12 | 13 |
"github.com/docker/docker/builder/dockerfile" |
13 | 14 |
"github.com/docker/docker/dockerversion" |
14 | 15 |
"github.com/docker/docker/image" |
... | ... |
@@ -18,7 +19,6 @@ import ( |
18 | 18 |
"github.com/docker/docker/pkg/progress" |
19 | 19 |
"github.com/docker/docker/pkg/streamformatter" |
20 | 20 |
"github.com/docker/docker/reference" |
21 |
- "github.com/docker/engine-api/types/container" |
|
22 | 21 |
) |
23 | 22 |
|
24 | 23 |
// ImportImage imports an image, getting the archived layer data either from |
... | ... |
@@ -7,6 +7,7 @@ import ( |
7 | 7 |
"time" |
8 | 8 |
|
9 | 9 |
"github.com/Sirupsen/logrus" |
10 |
+ "github.com/docker/docker/api/types" |
|
10 | 11 |
"github.com/docker/docker/container" |
11 | 12 |
"github.com/docker/docker/dockerversion" |
12 | 13 |
"github.com/docker/docker/pkg/fileutils" |
... | ... |
@@ -18,7 +19,6 @@ import ( |
18 | 18 |
"github.com/docker/docker/registry" |
19 | 19 |
"github.com/docker/docker/utils" |
20 | 20 |
"github.com/docker/docker/volume/drivers" |
21 |
- "github.com/docker/engine-api/types" |
|
22 | 21 |
"github.com/docker/go-connections/sockets" |
23 | 22 |
) |
24 | 23 |
|
... | ... |
@@ -4,13 +4,13 @@ import ( |
4 | 4 |
"fmt" |
5 | 5 |
"time" |
6 | 6 |
|
7 |
+ "github.com/docker/docker/api/types" |
|
7 | 8 |
"github.com/docker/docker/api/types/backend" |
9 |
+ networktypes "github.com/docker/docker/api/types/network" |
|
10 |
+ "github.com/docker/docker/api/types/versions" |
|
11 |
+ "github.com/docker/docker/api/types/versions/v1p20" |
|
8 | 12 |
"github.com/docker/docker/container" |
9 | 13 |
"github.com/docker/docker/daemon/network" |
10 |
- "github.com/docker/engine-api/types" |
|
11 |
- networktypes "github.com/docker/engine-api/types/network" |
|
12 |
- "github.com/docker/engine-api/types/versions" |
|
13 |
- "github.com/docker/engine-api/types/versions/v1p20" |
|
14 | 14 |
) |
15 | 15 |
|
16 | 16 |
// ContainerInspect returns low-level information about a |
... | ... |
@@ -1,10 +1,10 @@ |
1 | 1 |
package daemon |
2 | 2 |
|
3 | 3 |
import ( |
4 |
+ "github.com/docker/docker/api/types" |
|
4 | 5 |
"github.com/docker/docker/api/types/backend" |
5 | 6 |
"github.com/docker/docker/container" |
6 | 7 |
"github.com/docker/docker/daemon/exec" |
7 |
- "github.com/docker/engine-api/types" |
|
8 | 8 |
) |
9 | 9 |
|
10 | 10 |
// This sets platform-specific fields |
... | ... |
@@ -3,11 +3,11 @@ |
3 | 3 |
package daemon |
4 | 4 |
|
5 | 5 |
import ( |
6 |
+ "github.com/docker/docker/api/types" |
|
6 | 7 |
"github.com/docker/docker/api/types/backend" |
8 |
+ "github.com/docker/docker/api/types/versions/v1p19" |
|
7 | 9 |
"github.com/docker/docker/container" |
8 | 10 |
"github.com/docker/docker/daemon/exec" |
9 |
- "github.com/docker/engine-api/types" |
|
10 |
- "github.com/docker/engine-api/types/versions/v1p19" |
|
11 | 11 |
) |
12 | 12 |
|
13 | 13 |
// This sets platform-specific fields |
... | ... |
@@ -1,10 +1,10 @@ |
1 | 1 |
package daemon |
2 | 2 |
|
3 | 3 |
import ( |
4 |
+ "github.com/docker/docker/api/types" |
|
4 | 5 |
"github.com/docker/docker/api/types/backend" |
5 | 6 |
"github.com/docker/docker/container" |
6 | 7 |
"github.com/docker/docker/daemon/exec" |
7 |
- "github.com/docker/engine-api/types" |
|
8 | 8 |
) |
9 | 9 |
|
10 | 10 |
// This sets platform-specific fields |
... | ... |
@@ -8,10 +8,10 @@ import ( |
8 | 8 |
"path/filepath" |
9 | 9 |
"testing" |
10 | 10 |
|
11 |
+ containertypes "github.com/docker/docker/api/types/container" |
|
11 | 12 |
"github.com/docker/docker/container" |
12 | 13 |
"github.com/docker/docker/pkg/graphdb" |
13 | 14 |
"github.com/docker/docker/pkg/stringid" |
14 |
- containertypes "github.com/docker/engine-api/types/container" |
|
15 | 15 |
) |
16 | 16 |
|
17 | 17 |
func TestMigrateLegacySqliteLinks(t *testing.T) { |
... | ... |
@@ -8,12 +8,12 @@ import ( |
8 | 8 |
"strings" |
9 | 9 |
|
10 | 10 |
"github.com/Sirupsen/logrus" |
11 |
+ "github.com/docker/docker/api/types" |
|
12 |
+ "github.com/docker/docker/api/types/filters" |
|
13 |
+ networktypes "github.com/docker/docker/api/types/network" |
|
11 | 14 |
"github.com/docker/docker/container" |
12 | 15 |
"github.com/docker/docker/image" |
13 | 16 |
"github.com/docker/docker/volume" |
14 |
- "github.com/docker/engine-api/types" |
|
15 |
- "github.com/docker/engine-api/types/filters" |
|
16 |
- networktypes "github.com/docker/engine-api/types/network" |
|
17 | 17 |
"github.com/docker/go-connections/nat" |
18 | 18 |
) |
19 | 19 |
|
... | ... |
@@ -10,13 +10,13 @@ import ( |
10 | 10 |
|
11 | 11 |
"github.com/Sirupsen/logrus" |
12 | 12 |
"github.com/docker/docker/api/types/backend" |
13 |
+ containertypes "github.com/docker/docker/api/types/container" |
|
14 |
+ timetypes "github.com/docker/docker/api/types/time" |
|
13 | 15 |
"github.com/docker/docker/container" |
14 | 16 |
"github.com/docker/docker/daemon/logger" |
15 | 17 |
"github.com/docker/docker/daemon/logger/jsonfilelog" |
16 | 18 |
"github.com/docker/docker/pkg/ioutils" |
17 | 19 |
"github.com/docker/docker/pkg/stdcopy" |
18 |
- containertypes "github.com/docker/engine-api/types/container" |
|
19 |
- timetypes "github.com/docker/engine-api/types/time" |
|
20 | 20 |
) |
21 | 21 |
|
22 | 22 |
// ContainerLogs hooks up a container's stdout and stderr streams |
... | ... |
@@ -8,10 +8,10 @@ import ( |
8 | 8 |
"strconv" |
9 | 9 |
|
10 | 10 |
"github.com/Sirupsen/logrus" |
11 |
+ "github.com/docker/docker/api/types" |
|
11 | 12 |
"github.com/docker/docker/daemon/exec" |
12 | 13 |
"github.com/docker/docker/libcontainerd" |
13 | 14 |
"github.com/docker/docker/runconfig" |
14 |
- "github.com/docker/engine-api/types" |
|
15 | 15 |
) |
16 | 16 |
|
17 | 17 |
// StateChanged updates daemon state changes from containerd |
... | ... |
@@ -7,11 +7,11 @@ import ( |
7 | 7 |
"strings" |
8 | 8 |
|
9 | 9 |
"github.com/Sirupsen/logrus" |
10 |
+ "github.com/docker/docker/api/types" |
|
11 |
+ "github.com/docker/docker/api/types/network" |
|
10 | 12 |
clustertypes "github.com/docker/docker/daemon/cluster/provider" |
11 | 13 |
"github.com/docker/docker/errors" |
12 | 14 |
"github.com/docker/docker/runconfig" |
13 |
- "github.com/docker/engine-api/types" |
|
14 |
- "github.com/docker/engine-api/types/network" |
|
15 | 15 |
"github.com/docker/libnetwork" |
16 | 16 |
networktypes "github.com/docker/libnetwork/types" |
17 | 17 |
) |
... | ... |
@@ -1,8 +1,8 @@ |
1 | 1 |
package network |
2 | 2 |
|
3 | 3 |
import ( |
4 |
+ networktypes "github.com/docker/docker/api/types/network" |
|
4 | 5 |
clustertypes "github.com/docker/docker/daemon/cluster/provider" |
5 |
- networktypes "github.com/docker/engine-api/types/network" |
|
6 | 6 |
"github.com/docker/go-connections/nat" |
7 | 7 |
) |
8 | 8 |
|
... | ... |
@@ -10,6 +10,7 @@ import ( |
10 | 10 |
"strings" |
11 | 11 |
|
12 | 12 |
"github.com/Sirupsen/logrus" |
13 |
+ containertypes "github.com/docker/docker/api/types/container" |
|
13 | 14 |
"github.com/docker/docker/container" |
14 | 15 |
"github.com/docker/docker/daemon/caps" |
15 | 16 |
"github.com/docker/docker/libcontainerd" |
... | ... |
@@ -19,7 +20,6 @@ import ( |
19 | 19 |
"github.com/docker/docker/pkg/stringutils" |
20 | 20 |
"github.com/docker/docker/pkg/symlink" |
21 | 21 |
"github.com/docker/docker/volume" |
22 |
- containertypes "github.com/docker/engine-api/types/container" |
|
23 | 22 |
"github.com/opencontainers/runc/libcontainer/apparmor" |
24 | 23 |
"github.com/opencontainers/runc/libcontainer/devices" |
25 | 24 |
"github.com/opencontainers/runc/libcontainer/user" |
... | ... |
@@ -6,10 +6,10 @@ import ( |
6 | 6 |
|
7 | 7 |
"golang.org/x/net/context" |
8 | 8 |
|
9 |
+ "github.com/docker/docker/api/types" |
|
10 |
+ "github.com/docker/docker/api/types/filters" |
|
11 |
+ registrytypes "github.com/docker/docker/api/types/registry" |
|
9 | 12 |
"github.com/docker/docker/dockerversion" |
10 |
- "github.com/docker/engine-api/types" |
|
11 |
- "github.com/docker/engine-api/types/filters" |
|
12 |
- registrytypes "github.com/docker/engine-api/types/registry" |
|
13 | 13 |
) |
14 | 14 |
|
15 | 15 |
var acceptedSearchFilterTags = map[string]bool{ |
... | ... |
@@ -7,9 +7,9 @@ import ( |
7 | 7 |
|
8 | 8 |
"golang.org/x/net/context" |
9 | 9 |
|
10 |
+ "github.com/docker/docker/api/types" |
|
11 |
+ registrytypes "github.com/docker/docker/api/types/registry" |
|
10 | 12 |
"github.com/docker/docker/registry" |
11 |
- "github.com/docker/engine-api/types" |
|
12 |
- registrytypes "github.com/docker/engine-api/types/registry" |
|
13 | 13 |
) |
14 | 14 |
|
15 | 15 |
type FakeService struct { |
... | ... |
@@ -10,12 +10,12 @@ import ( |
10 | 10 |
"google.golang.org/grpc" |
11 | 11 |
|
12 | 12 |
"github.com/Sirupsen/logrus" |
13 |
+ "github.com/docker/docker/api/types" |
|
14 |
+ containertypes "github.com/docker/docker/api/types/container" |
|
13 | 15 |
"github.com/docker/docker/container" |
14 | 16 |
"github.com/docker/docker/errors" |
15 | 17 |
"github.com/docker/docker/libcontainerd" |
16 | 18 |
"github.com/docker/docker/runconfig" |
17 |
- "github.com/docker/engine-api/types" |
|
18 |
- containertypes "github.com/docker/engine-api/types/container" |
|
19 | 19 |
) |
20 | 20 |
|
21 | 21 |
// ContainerStart starts a container. |
... | ... |
@@ -8,12 +8,12 @@ import ( |
8 | 8 |
|
9 | 9 |
"golang.org/x/net/context" |
10 | 10 |
|
11 |
+ "github.com/docker/docker/api/types" |
|
11 | 12 |
"github.com/docker/docker/api/types/backend" |
13 |
+ "github.com/docker/docker/api/types/versions" |
|
14 |
+ "github.com/docker/docker/api/types/versions/v1p20" |
|
12 | 15 |
"github.com/docker/docker/container" |
13 | 16 |
"github.com/docker/docker/pkg/ioutils" |
14 |
- "github.com/docker/engine-api/types" |
|
15 |
- "github.com/docker/engine-api/types/versions" |
|
16 |
- "github.com/docker/engine-api/types/versions/v1p20" |
|
17 | 17 |
) |
18 | 18 |
|
19 | 19 |
// ContainerStats writes information about the container to the stream |
... | ... |
@@ -12,10 +12,10 @@ import ( |
12 | 12 |
"time" |
13 | 13 |
|
14 | 14 |
"github.com/Sirupsen/logrus" |
15 |
+ "github.com/docker/docker/api/types" |
|
15 | 16 |
"github.com/docker/docker/container" |
16 | 17 |
"github.com/docker/docker/pkg/pubsub" |
17 | 18 |
sysinfo "github.com/docker/docker/pkg/system" |
18 |
- "github.com/docker/engine-api/types" |
|
19 | 19 |
"github.com/opencontainers/runc/libcontainer/system" |
20 | 20 |
) |
21 | 21 |
|
... | ... |
@@ -3,8 +3,8 @@ package daemon |
3 | 3 |
import ( |
4 | 4 |
"fmt" |
5 | 5 |
|
6 |
- "github.com/docker/engine-api/types" |
|
7 |
- "github.com/docker/engine-api/types/container" |
|
6 |
+ "github.com/docker/docker/api/types" |
|
7 |
+ "github.com/docker/docker/api/types/container" |
|
8 | 8 |
) |
9 | 9 |
|
10 | 10 |
// ContainerUpdate updates configuration of the container |
... | ... |
@@ -3,8 +3,8 @@ |
3 | 3 |
package daemon |
4 | 4 |
|
5 | 5 |
import ( |
6 |
+ "github.com/docker/docker/api/types/container" |
|
6 | 7 |
"github.com/docker/docker/libcontainerd" |
7 |
- "github.com/docker/engine-api/types/container" |
|
8 | 8 |
) |
9 | 9 |
|
10 | 10 |
func toContainerdResources(resources container.Resources) libcontainerd.Resources { |
... | ... |
@@ -1,8 +1,8 @@ |
1 | 1 |
package daemon |
2 | 2 |
|
3 | 3 |
import ( |
4 |
+ "github.com/docker/docker/api/types/container" |
|
4 | 5 |
"github.com/docker/docker/libcontainerd" |
5 |
- "github.com/docker/engine-api/types/container" |
|
6 | 6 |
) |
7 | 7 |
|
8 | 8 |
func toContainerdResources(resources container.Resources) libcontainerd.Resources { |
... | ... |
@@ -3,8 +3,8 @@ |
3 | 3 |
package daemon |
4 | 4 |
|
5 | 5 |
import ( |
6 |
+ "github.com/docker/docker/api/types/container" |
|
6 | 7 |
"github.com/docker/docker/libcontainerd" |
7 |
- "github.com/docker/engine-api/types/container" |
|
8 | 8 |
) |
9 | 9 |
|
10 | 10 |
func toContainerdResources(resources container.Resources) libcontainerd.Resources { |
... | ... |
@@ -7,10 +7,10 @@ import ( |
7 | 7 |
"path/filepath" |
8 | 8 |
"strings" |
9 | 9 |
|
10 |
+ "github.com/docker/docker/api/types" |
|
11 |
+ containertypes "github.com/docker/docker/api/types/container" |
|
10 | 12 |
"github.com/docker/docker/container" |
11 | 13 |
"github.com/docker/docker/volume" |
12 |
- "github.com/docker/engine-api/types" |
|
13 |
- containertypes "github.com/docker/engine-api/types/container" |
|
14 | 14 |
) |
15 | 15 |
|
16 | 16 |
var ( |
... | ... |
@@ -6,13 +6,13 @@ import ( |
6 | 6 |
"github.com/Sirupsen/logrus" |
7 | 7 |
"github.com/docker/distribution/digest" |
8 | 8 |
"github.com/docker/docker/api" |
9 |
+ "github.com/docker/docker/api/types" |
|
9 | 10 |
"github.com/docker/docker/distribution/metadata" |
10 | 11 |
"github.com/docker/docker/distribution/xfer" |
11 | 12 |
"github.com/docker/docker/image" |
12 | 13 |
"github.com/docker/docker/pkg/progress" |
13 | 14 |
"github.com/docker/docker/reference" |
14 | 15 |
"github.com/docker/docker/registry" |
15 |
- "github.com/docker/engine-api/types" |
|
16 | 16 |
"golang.org/x/net/context" |
17 | 17 |
) |
18 | 18 |
|
... | ... |
@@ -7,6 +7,7 @@ import ( |
7 | 7 |
"io" |
8 | 8 |
|
9 | 9 |
"github.com/Sirupsen/logrus" |
10 |
+ "github.com/docker/docker/api/types" |
|
10 | 11 |
"github.com/docker/docker/distribution/metadata" |
11 | 12 |
"github.com/docker/docker/distribution/xfer" |
12 | 13 |
"github.com/docker/docker/image" |
... | ... |
@@ -14,7 +15,6 @@ import ( |
14 | 14 |
"github.com/docker/docker/pkg/progress" |
15 | 15 |
"github.com/docker/docker/reference" |
16 | 16 |
"github.com/docker/docker/registry" |
17 |
- "github.com/docker/engine-api/types" |
|
18 | 17 |
"github.com/docker/libtrust" |
19 | 18 |
"golang.org/x/net/context" |
20 | 19 |
) |
... | ... |
@@ -11,9 +11,9 @@ import ( |
11 | 11 |
"github.com/docker/distribution/registry/client" |
12 | 12 |
"github.com/docker/distribution/registry/client/auth" |
13 | 13 |
"github.com/docker/distribution/registry/client/transport" |
14 |
+ "github.com/docker/docker/api/types" |
|
14 | 15 |
"github.com/docker/docker/dockerversion" |
15 | 16 |
"github.com/docker/docker/registry" |
16 |
- "github.com/docker/engine-api/types" |
|
17 | 17 |
"github.com/docker/go-connections/sockets" |
18 | 18 |
"golang.org/x/net/context" |
19 | 19 |
) |
... | ... |
@@ -9,11 +9,11 @@ import ( |
9 | 9 |
"testing" |
10 | 10 |
|
11 | 11 |
"github.com/Sirupsen/logrus" |
12 |
+ "github.com/docker/docker/api/types" |
|
13 |
+ registrytypes "github.com/docker/docker/api/types/registry" |
|
12 | 14 |
"github.com/docker/docker/reference" |
13 | 15 |
"github.com/docker/docker/registry" |
14 | 16 |
"github.com/docker/docker/utils" |
15 |
- "github.com/docker/engine-api/types" |
|
16 |
- registrytypes "github.com/docker/engine-api/types/registry" |
|
17 | 17 |
"golang.org/x/net/context" |
18 | 18 |
) |
19 | 19 |
|
... | ... |
@@ -9,9 +9,9 @@ import ( |
9 | 9 |
|
10 | 10 |
"github.com/Sirupsen/logrus" |
11 | 11 |
"github.com/docker/distribution/digest" |
12 |
+ "github.com/docker/docker/api/types/versions" |
|
12 | 13 |
"github.com/docker/docker/image" |
13 | 14 |
"github.com/docker/docker/layer" |
14 |
- "github.com/docker/engine-api/types/versions" |
|
15 | 15 |
) |
16 | 16 |
|
17 | 17 |
var validHex = regexp.MustCompile(`^([a-f0-9]{64})$`) |
... | ... |
@@ -14,11 +14,11 @@ import ( |
14 | 14 |
"strings" |
15 | 15 |
"time" |
16 | 16 |
|
17 |
+ "github.com/docker/docker/api/types/events" |
|
17 | 18 |
"github.com/docker/docker/opts" |
18 | 19 |
"github.com/docker/docker/pkg/integration/checker" |
19 | 20 |
"github.com/docker/docker/pkg/ioutils" |
20 | 21 |
"github.com/docker/docker/pkg/stringid" |
21 |
- "github.com/docker/engine-api/types/events" |
|
22 | 22 |
"github.com/docker/go-connections/sockets" |
23 | 23 |
"github.com/docker/go-connections/tlsconfig" |
24 | 24 |
"github.com/go-check/check" |
... | ... |
@@ -7,10 +7,10 @@ import ( |
7 | 7 |
"strings" |
8 | 8 |
"time" |
9 | 9 |
|
10 |
+ "github.com/docker/docker/api/types" |
|
11 |
+ "github.com/docker/docker/api/types/filters" |
|
12 |
+ "github.com/docker/docker/api/types/swarm" |
|
10 | 13 |
"github.com/docker/docker/pkg/integration/checker" |
11 |
- "github.com/docker/engine-api/types" |
|
12 |
- "github.com/docker/engine-api/types/filters" |
|
13 |
- "github.com/docker/engine-api/types/swarm" |
|
14 | 14 |
"github.com/go-check/check" |
15 | 15 |
) |
16 | 16 |
|
... | ... |
@@ -15,12 +15,12 @@ import ( |
15 | 15 |
"strings" |
16 | 16 |
"time" |
17 | 17 |
|
18 |
+ "github.com/docker/docker/api/types" |
|
19 |
+ containertypes "github.com/docker/docker/api/types/container" |
|
20 |
+ networktypes "github.com/docker/docker/api/types/network" |
|
18 | 21 |
"github.com/docker/docker/pkg/integration" |
19 | 22 |
"github.com/docker/docker/pkg/integration/checker" |
20 | 23 |
"github.com/docker/docker/pkg/stringid" |
21 |
- "github.com/docker/engine-api/types" |
|
22 |
- containertypes "github.com/docker/engine-api/types/container" |
|
23 |
- networktypes "github.com/docker/engine-api/types/network" |
|
24 | 24 |
"github.com/go-check/check" |
25 | 25 |
) |
26 | 26 |
|
... | ... |
@@ -5,10 +5,10 @@ import ( |
5 | 5 |
"net/http" |
6 | 6 |
"strings" |
7 | 7 |
|
8 |
+ "github.com/docker/docker/api/types" |
|
9 |
+ "github.com/docker/docker/api/types/versions/v1p20" |
|
8 | 10 |
"github.com/docker/docker/pkg/integration/checker" |
9 | 11 |
"github.com/docker/docker/pkg/stringutils" |
10 |
- "github.com/docker/engine-api/types" |
|
11 |
- "github.com/docker/engine-api/types/versions/v1p20" |
|
12 | 12 |
"github.com/go-check/check" |
13 | 13 |
) |
14 | 14 |
|
... | ... |
@@ -8,10 +8,10 @@ import ( |
8 | 8 |
"net/url" |
9 | 9 |
"strings" |
10 | 10 |
|
11 |
+ "github.com/docker/docker/api/types" |
|
12 |
+ "github.com/docker/docker/api/types/filters" |
|
13 |
+ "github.com/docker/docker/api/types/network" |
|
11 | 14 |
"github.com/docker/docker/pkg/integration/checker" |
12 |
- "github.com/docker/engine-api/types" |
|
13 |
- "github.com/docker/engine-api/types/filters" |
|
14 |
- "github.com/docker/engine-api/types/network" |
|
15 | 15 |
"github.com/go-check/check" |
16 | 16 |
) |
17 | 17 |
|
... | ... |
@@ -11,9 +11,9 @@ import ( |
11 | 11 |
"sync" |
12 | 12 |
"time" |
13 | 13 |
|
14 |
+ "github.com/docker/docker/api/types" |
|
15 |
+ "github.com/docker/docker/api/types/versions" |
|
14 | 16 |
"github.com/docker/docker/pkg/integration/checker" |
15 |
- "github.com/docker/engine-api/types" |
|
16 |
- "github.com/docker/engine-api/types/versions" |
|
17 | 17 |
"github.com/go-check/check" |
18 | 18 |
) |
19 | 19 |
|
... | ... |
@@ -4,9 +4,9 @@ import ( |
4 | 4 |
"encoding/json" |
5 | 5 |
"net/http" |
6 | 6 |
|
7 |
+ "github.com/docker/docker/api/types" |
|
7 | 8 |
"github.com/docker/docker/dockerversion" |
8 | 9 |
"github.com/docker/docker/pkg/integration/checker" |
9 |
- "github.com/docker/engine-api/types" |
|
10 | 10 |
"github.com/go-check/check" |
11 | 11 |
) |
12 | 12 |
|
... | ... |
@@ -11,9 +11,9 @@ import ( |
11 | 11 |
"github.com/docker/distribution/digest" |
12 | 12 |
"github.com/docker/distribution/manifest/schema1" |
13 | 13 |
"github.com/docker/distribution/manifest/schema2" |
14 |
+ "github.com/docker/docker/api/types" |
|
14 | 15 |
"github.com/docker/docker/pkg/integration/checker" |
15 | 16 |
"github.com/docker/docker/pkg/stringutils" |
16 |
- "github.com/docker/engine-api/types" |
|
17 | 17 |
"github.com/go-check/check" |
18 | 18 |
) |
19 | 19 |
|
... | ... |
@@ -9,9 +9,9 @@ import ( |
9 | 9 |
"strings" |
10 | 10 |
"time" |
11 | 11 |
|
12 |
+ "github.com/docker/docker/api/types" |
|
13 |
+ "github.com/docker/docker/api/types/container" |
|
12 | 14 |
"github.com/docker/docker/pkg/integration/checker" |
13 |
- "github.com/docker/engine-api/types" |
|
14 |
- "github.com/docker/engine-api/types/container" |
|
15 | 15 |
"github.com/go-check/check" |
16 | 16 |
) |
17 | 17 |
|
... | ... |
@@ -14,12 +14,12 @@ import ( |
14 | 14 |
"strings" |
15 | 15 |
"time" |
16 | 16 |
|
17 |
+ "github.com/docker/docker/api/types" |
|
18 |
+ "github.com/docker/docker/api/types/versions/v1p20" |
|
17 | 19 |
"github.com/docker/docker/pkg/integration/checker" |
18 | 20 |
icmd "github.com/docker/docker/pkg/integration/cmd" |
19 | 21 |
"github.com/docker/docker/pkg/stringid" |
20 | 22 |
"github.com/docker/docker/runconfig" |
21 |
- "github.com/docker/engine-api/types" |
|
22 |
- "github.com/docker/engine-api/types/versions/v1p20" |
|
23 | 23 |
"github.com/docker/libnetwork/driverapi" |
24 | 24 |
remoteapi "github.com/docker/libnetwork/drivers/remote/api" |
25 | 25 |
"github.com/docker/libnetwork/ipamapi" |
... | ... |
@@ -6,9 +6,9 @@ import ( |
6 | 6 |
"encoding/json" |
7 | 7 |
"strings" |
8 | 8 |
|
9 |
+ "github.com/docker/docker/api/types" |
|
10 |
+ "github.com/docker/docker/api/types/swarm" |
|
9 | 11 |
"github.com/docker/docker/pkg/integration/checker" |
10 |
- "github.com/docker/engine-api/types" |
|
11 |
- "github.com/docker/engine-api/types/swarm" |
|
12 | 12 |
"github.com/go-check/check" |
13 | 13 |
) |
14 | 14 |
|
... | ... |
@@ -6,9 +6,9 @@ import ( |
6 | 6 |
"strconv" |
7 | 7 |
"strings" |
8 | 8 |
|
9 |
+ "github.com/docker/docker/api/types/swarm" |
|
9 | 10 |
"github.com/docker/docker/daemon/cluster/executor/container" |
10 | 11 |
"github.com/docker/docker/pkg/integration/checker" |
11 |
- "github.com/docker/engine-api/types/swarm" |
|
12 | 12 |
"github.com/go-check/check" |
13 | 13 |
) |
14 | 14 |
|
... | ... |
@@ -7,9 +7,9 @@ import ( |
7 | 7 |
"fmt" |
8 | 8 |
"strings" |
9 | 9 |
|
10 |
+ "github.com/docker/docker/api/types" |
|
10 | 11 |
"github.com/docker/docker/pkg/integration/checker" |
11 | 12 |
"github.com/docker/docker/pkg/parsers/kernel" |
12 |
- "github.com/docker/engine-api/types" |
|
13 | 13 |
"github.com/go-check/check" |
14 | 14 |
) |
15 | 15 |
|
... | ... |
@@ -22,12 +22,12 @@ import ( |
22 | 22 |
"strings" |
23 | 23 |
"time" |
24 | 24 |
|
25 |
+ "github.com/docker/docker/api/types" |
|
25 | 26 |
"github.com/docker/docker/opts" |
26 | 27 |
"github.com/docker/docker/pkg/httputils" |
27 | 28 |
icmd "github.com/docker/docker/pkg/integration/cmd" |
28 | 29 |
"github.com/docker/docker/pkg/ioutils" |
29 | 30 |
"github.com/docker/docker/pkg/stringutils" |
30 |
- "github.com/docker/engine-api/types" |
|
31 | 31 |
"github.com/docker/go-connections/tlsconfig" |
32 | 32 |
"github.com/docker/go-units" |
33 | 33 |
"github.com/go-check/check" |
... | ... |
@@ -12,12 +12,12 @@ import ( |
12 | 12 |
"path/filepath" |
13 | 13 |
|
14 | 14 |
"github.com/Sirupsen/logrus" |
15 |
+ "github.com/docker/docker/api/types" |
|
15 | 16 |
"github.com/docker/docker/pkg/archive" |
16 | 17 |
"github.com/docker/docker/pkg/stringid" |
17 | 18 |
"github.com/docker/docker/plugin/distribution" |
18 | 19 |
"github.com/docker/docker/plugin/v2" |
19 | 20 |
"github.com/docker/docker/reference" |
20 |
- "github.com/docker/engine-api/types" |
|
21 | 21 |
) |
22 | 22 |
|
23 | 23 |
// Disable deactivates a plugin, which implies that they cannot be used by containers. |
... | ... |
@@ -14,11 +14,11 @@ import ( |
14 | 14 |
"github.com/Sirupsen/logrus" |
15 | 15 |
"github.com/docker/distribution" |
16 | 16 |
"github.com/docker/distribution/manifest/schema2" |
17 |
+ "github.com/docker/docker/api/types" |
|
17 | 18 |
dockerdist "github.com/docker/docker/distribution" |
18 | 19 |
archive "github.com/docker/docker/pkg/chrootarchive" |
19 | 20 |
"github.com/docker/docker/reference" |
20 | 21 |
"github.com/docker/docker/registry" |
21 |
- "github.com/docker/engine-api/types" |
|
22 | 22 |
"golang.org/x/net/context" |
23 | 23 |
) |
24 | 24 |
|
... | ... |
@@ -11,10 +11,10 @@ import ( |
11 | 11 |
"github.com/docker/distribution" |
12 | 12 |
"github.com/docker/distribution/digest" |
13 | 13 |
"github.com/docker/distribution/manifest/schema2" |
14 |
+ "github.com/docker/docker/api/types" |
|
14 | 15 |
dockerdist "github.com/docker/docker/distribution" |
15 | 16 |
"github.com/docker/docker/reference" |
16 | 17 |
"github.com/docker/docker/registry" |
17 |
- "github.com/docker/engine-api/types" |
|
18 | 18 |
"golang.org/x/net/context" |
19 | 19 |
) |
20 | 20 |
|
... | ... |
@@ -9,12 +9,12 @@ import ( |
9 | 9 |
"time" |
10 | 10 |
|
11 | 11 |
"github.com/Sirupsen/logrus" |
12 |
+ "github.com/docker/docker/api/types/container" |
|
12 | 13 |
"github.com/docker/docker/libcontainerd" |
13 | 14 |
"github.com/docker/docker/oci" |
14 | 15 |
"github.com/docker/docker/pkg/plugins" |
15 | 16 |
"github.com/docker/docker/plugin/v2" |
16 | 17 |
"github.com/docker/docker/restartmanager" |
17 |
- "github.com/docker/engine-api/types/container" |
|
18 | 18 |
) |
19 | 19 |
|
20 | 20 |
func (pm *Manager) enable(p *v2.Plugin, force bool) error { |
... | ... |
@@ -11,10 +11,10 @@ import ( |
11 | 11 |
"strings" |
12 | 12 |
"sync" |
13 | 13 |
|
14 |
+ "github.com/docker/docker/api/types" |
|
14 | 15 |
"github.com/docker/docker/pkg/plugins" |
15 | 16 |
"github.com/docker/docker/pkg/system" |
16 | 17 |
"github.com/docker/docker/restartmanager" |
17 |
- "github.com/docker/engine-api/types" |
|
18 | 18 |
"github.com/opencontainers/runtime-spec/specs-go" |
19 | 19 |
) |
20 | 20 |
|
... | ... |
@@ -7,8 +7,8 @@ import ( |
7 | 7 |
"errors" |
8 | 8 |
"fmt" |
9 | 9 |
|
10 |
+ "github.com/docker/docker/api/types" |
|
10 | 11 |
"github.com/docker/docker/pkg/stringutils" |
11 |
- "github.com/docker/engine-api/types" |
|
12 | 12 |
"github.com/opencontainers/runtime-spec/specs-go" |
13 | 13 |
libseccomp "github.com/seccomp/libseccomp-golang" |
14 | 14 |
) |
... | ... |
@@ -11,8 +11,8 @@ import ( |
11 | 11 |
"github.com/Sirupsen/logrus" |
12 | 12 |
"github.com/docker/distribution/registry/client/auth" |
13 | 13 |
"github.com/docker/distribution/registry/client/transport" |
14 |
- "github.com/docker/engine-api/types" |
|
15 |
- registrytypes "github.com/docker/engine-api/types/registry" |
|
14 |
+ "github.com/docker/docker/api/types" |
|
15 |
+ registrytypes "github.com/docker/docker/api/types/registry" |
|
16 | 16 |
) |
17 | 17 |
|
18 | 18 |
const ( |
... | ... |
@@ -3,8 +3,8 @@ package registry |
3 | 3 |
import ( |
4 | 4 |
"testing" |
5 | 5 |
|
6 |
- "github.com/docker/engine-api/types" |
|
7 |
- registrytypes "github.com/docker/engine-api/types/registry" |
|
6 |
+ "github.com/docker/docker/api/types" |
|
7 |
+ registrytypes "github.com/docker/docker/api/types/registry" |
|
8 | 8 |
) |
9 | 9 |
|
10 | 10 |
func buildAuthConfigs() map[string]types.AuthConfig { |
... | ... |
@@ -7,9 +7,9 @@ import ( |
7 | 7 |
"net/url" |
8 | 8 |
"strings" |
9 | 9 |
|
10 |
+ registrytypes "github.com/docker/docker/api/types/registry" |
|
10 | 11 |
"github.com/docker/docker/opts" |
11 | 12 |
"github.com/docker/docker/reference" |
12 |
- registrytypes "github.com/docker/engine-api/types/registry" |
|
13 | 13 |
"github.com/spf13/pflag" |
14 | 14 |
) |
15 | 15 |
|
... | ... |
@@ -11,7 +11,7 @@ import ( |
11 | 11 |
|
12 | 12 |
"github.com/Sirupsen/logrus" |
13 | 13 |
"github.com/docker/distribution/registry/client/transport" |
14 |
- registrytypes "github.com/docker/engine-api/types/registry" |
|
14 |
+ registrytypes "github.com/docker/docker/api/types/registry" |
|
15 | 15 |
) |
16 | 16 |
|
17 | 17 |
// V1Endpoint stores basic information about a V1 registry endpoint. |
... | ... |
@@ -15,8 +15,8 @@ import ( |
15 | 15 |
"testing" |
16 | 16 |
"time" |
17 | 17 |
|
18 |
+ registrytypes "github.com/docker/docker/api/types/registry" |
|
18 | 19 |
"github.com/docker/docker/reference" |
19 |
- registrytypes "github.com/docker/engine-api/types/registry" |
|
20 | 20 |
"github.com/gorilla/mux" |
21 | 21 |
|
22 | 22 |
"github.com/Sirupsen/logrus" |
... | ... |
@@ -9,9 +9,9 @@ import ( |
9 | 9 |
"testing" |
10 | 10 |
|
11 | 11 |
"github.com/docker/distribution/registry/client/transport" |
12 |
+ "github.com/docker/docker/api/types" |
|
13 |
+ registrytypes "github.com/docker/docker/api/types/registry" |
|
12 | 14 |
"github.com/docker/docker/reference" |
13 |
- "github.com/docker/engine-api/types" |
|
14 |
- registrytypes "github.com/docker/engine-api/types/registry" |
|
15 | 15 |
) |
16 | 16 |
|
17 | 17 |
var ( |
... | ... |
@@ -11,9 +11,9 @@ import ( |
11 | 11 |
|
12 | 12 |
"github.com/Sirupsen/logrus" |
13 | 13 |
"github.com/docker/distribution/registry/client/auth" |
14 |
+ "github.com/docker/docker/api/types" |
|
15 |
+ registrytypes "github.com/docker/docker/api/types/registry" |
|
14 | 16 |
"github.com/docker/docker/reference" |
15 |
- "github.com/docker/engine-api/types" |
|
16 |
- registrytypes "github.com/docker/engine-api/types/registry" |
|
17 | 17 |
) |
18 | 18 |
|
19 | 19 |
const ( |
... | ... |
@@ -20,13 +20,13 @@ import ( |
20 | 20 |
|
21 | 21 |
"github.com/Sirupsen/logrus" |
22 | 22 |
"github.com/docker/distribution/registry/api/errcode" |
23 |
+ "github.com/docker/docker/api/types" |
|
24 |
+ registrytypes "github.com/docker/docker/api/types/registry" |
|
23 | 25 |
"github.com/docker/docker/pkg/httputils" |
24 | 26 |
"github.com/docker/docker/pkg/ioutils" |
25 | 27 |
"github.com/docker/docker/pkg/stringid" |
26 | 28 |
"github.com/docker/docker/pkg/tarsum" |
27 | 29 |
"github.com/docker/docker/reference" |
28 |
- "github.com/docker/engine-api/types" |
|
29 |
- registrytypes "github.com/docker/engine-api/types/registry" |
|
30 | 30 |
) |
31 | 31 |
|
32 | 32 |
var ( |
... | ... |
@@ -1,8 +1,8 @@ |
1 | 1 |
package registry |
2 | 2 |
|
3 | 3 |
import ( |
4 |
+ registrytypes "github.com/docker/docker/api/types/registry" |
|
4 | 5 |
"github.com/docker/docker/reference" |
5 |
- registrytypes "github.com/docker/engine-api/types/registry" |
|
6 | 6 |
) |
7 | 7 |
|
8 | 8 |
// RepositoryData tracks the image list, list of endpoints, and list of tokens |
... | ... |
@@ -3,8 +3,8 @@ package runconfig |
3 | 3 |
import ( |
4 | 4 |
"testing" |
5 | 5 |
|
6 |
- "github.com/docker/engine-api/types/container" |
|
7 |
- "github.com/docker/engine-api/types/strslice" |
|
6 |
+ "github.com/docker/docker/api/types/container" |
|
7 |
+ "github.com/docker/docker/api/types/strslice" |
|
8 | 8 |
"github.com/docker/go-connections/nat" |
9 | 9 |
) |
10 | 10 |
|
... | ... |
@@ -5,9 +5,9 @@ import ( |
5 | 5 |
"fmt" |
6 | 6 |
"io" |
7 | 7 |
|
8 |
+ "github.com/docker/docker/api/types/container" |
|
9 |
+ networktypes "github.com/docker/docker/api/types/network" |
|
8 | 10 |
"github.com/docker/docker/volume" |
9 |
- "github.com/docker/engine-api/types/container" |
|
10 |
- networktypes "github.com/docker/engine-api/types/network" |
|
11 | 11 |
) |
12 | 12 |
|
13 | 13 |
// ContainerDecoder implements httputils.ContainerDecoder |
... | ... |
@@ -9,9 +9,9 @@ import ( |
9 | 9 |
"strings" |
10 | 10 |
"testing" |
11 | 11 |
|
12 |
- "github.com/docker/engine-api/types/container" |
|
13 |
- networktypes "github.com/docker/engine-api/types/network" |
|
14 |
- "github.com/docker/engine-api/types/strslice" |
|
12 |
+ "github.com/docker/docker/api/types/container" |
|
13 |
+ networktypes "github.com/docker/docker/api/types/network" |
|
14 |
+ "github.com/docker/docker/api/types/strslice" |
|
15 | 15 |
) |
16 | 16 |
|
17 | 17 |
type f struct { |
... | ... |
@@ -3,8 +3,8 @@ |
3 | 3 |
package runconfig |
4 | 4 |
|
5 | 5 |
import ( |
6 |
- "github.com/docker/engine-api/types/container" |
|
7 |
- networktypes "github.com/docker/engine-api/types/network" |
|
6 |
+ "github.com/docker/docker/api/types/container" |
|
7 |
+ networktypes "github.com/docker/docker/api/types/network" |
|
8 | 8 |
) |
9 | 9 |
|
10 | 10 |
// ContainerConfigWrapper is a Config wrapper that holds the container Config (portable) |
... | ... |
@@ -1,8 +1,8 @@ |
1 | 1 |
package runconfig |
2 | 2 |
|
3 | 3 |
import ( |
4 |
- "github.com/docker/engine-api/types/container" |
|
5 |
- networktypes "github.com/docker/engine-api/types/network" |
|
4 |
+ "github.com/docker/docker/api/types/container" |
|
5 |
+ networktypes "github.com/docker/docker/api/types/network" |
|
6 | 6 |
) |
7 | 7 |
|
8 | 8 |
// ContainerConfigWrapper is a Config wrapper that holds the container Config (portable) |
... | ... |
@@ -10,12 +10,12 @@ import ( |
10 | 10 |
"strings" |
11 | 11 |
"time" |
12 | 12 |
|
13 |
+ "github.com/docker/docker/api/types/container" |
|
14 |
+ networktypes "github.com/docker/docker/api/types/network" |
|
15 |
+ "github.com/docker/docker/api/types/strslice" |
|
13 | 16 |
"github.com/docker/docker/opts" |
14 | 17 |
"github.com/docker/docker/pkg/mount" |
15 | 18 |
"github.com/docker/docker/pkg/signal" |
16 |
- "github.com/docker/engine-api/types/container" |
|
17 |
- networktypes "github.com/docker/engine-api/types/network" |
|
18 |
- "github.com/docker/engine-api/types/strslice" |
|
19 | 19 |
"github.com/docker/go-connections/nat" |
20 | 20 |
units "github.com/docker/go-units" |
21 | 21 |
"github.com/spf13/pflag" |
... | ... |
@@ -11,9 +11,9 @@ import ( |
11 | 11 |
"testing" |
12 | 12 |
"time" |
13 | 13 |
|
14 |
+ "github.com/docker/docker/api/types/container" |
|
15 |
+ networktypes "github.com/docker/docker/api/types/network" |
|
14 | 16 |
"github.com/docker/docker/runconfig" |
15 |
- "github.com/docker/engine-api/types/container" |
|
16 |
- networktypes "github.com/docker/engine-api/types/network" |
|
17 | 17 |
"github.com/docker/go-connections/nat" |
18 | 18 |
"github.com/spf13/pflag" |
19 | 19 |
) |
... | ... |
@@ -6,9 +6,9 @@ import ( |
6 | 6 |
"strings" |
7 | 7 |
"syscall" |
8 | 8 |
|
9 |
+ mounttypes "github.com/docker/docker/api/types/mount" |
|
9 | 10 |
"github.com/docker/docker/pkg/idtools" |
10 | 11 |
"github.com/docker/docker/pkg/stringid" |
11 |
- mounttypes "github.com/docker/engine-api/types/mount" |
|
12 | 12 |
"github.com/opencontainers/runc/libcontainer/label" |
13 | 13 |
) |
14 | 14 |
|