]>
Commit | Line | Data |
---|---|---|
1 | // Copyright 2014 go-dockerclient authors. All rights reserved. | |
2 | // Use of this source code is governed by a BSD-style | |
3 | // license that can be found in the LICENSE file. | |
4 | ||
5 | package docker | |
6 | ||
7 | import "fmt" | |
8 | ||
9 | // ChangeType is a type for constants indicating the type of change | |
10 | // in a container | |
11 | type ChangeType int | |
12 | ||
13 | const ( | |
14 | // ChangeModify is the ChangeType for container modifications | |
15 | ChangeModify ChangeType = iota | |
16 | ||
17 | // ChangeAdd is the ChangeType for additions to a container | |
18 | ChangeAdd | |
19 | ||
20 | // ChangeDelete is the ChangeType for deletions from a container | |
21 | ChangeDelete | |
22 | ) | |
23 | ||
24 | // Change represents a change in a container. | |
25 | // | |
26 | // See https://goo.gl/9GsTIF for more details. | |
27 | type Change struct { | |
28 | Path string | |
29 | Kind ChangeType | |
30 | } | |
31 | ||
32 | func (change *Change) String() string { | |
33 | var kind string | |
34 | switch change.Kind { | |
35 | case ChangeModify: | |
36 | kind = "C" | |
37 | case ChangeAdd: | |
38 | kind = "A" | |
39 | case ChangeDelete: | |
40 | kind = "D" | |
41 | } | |
42 | return fmt.Sprintf("%s %s", kind, change.Path) | |
43 | } |