2015-12-03 14:18:35 -05:00
|
|
|
package lib
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"net/url"
|
|
|
|
|
|
|
|
"github.com/docker/docker/api/types"
|
|
|
|
)
|
|
|
|
|
|
|
|
// ContainerDiff shows differences in a container filesystem since it was started.
|
|
|
|
func (cli *Client) ContainerDiff(containerID string) ([]types.ContainerChange, error) {
|
|
|
|
var changes []types.ContainerChange
|
|
|
|
|
2015-12-05 20:28:36 -05:00
|
|
|
serverResp, err := cli.get("/containers/"+containerID+"/changes", url.Values{}, nil)
|
2015-12-03 14:18:35 -05:00
|
|
|
if err != nil {
|
|
|
|
return changes, err
|
|
|
|
}
|
2015-12-04 14:57:22 -05:00
|
|
|
defer ensureReaderClosed(serverResp)
|
2015-12-03 14:18:35 -05:00
|
|
|
|
|
|
|
if err := json.NewDecoder(serverResp.body).Decode(&changes); err != nil {
|
|
|
|
return changes, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return changes, nil
|
|
|
|
}
|