on master help sign in
Adds some more types for log endpoint
b0cb71eDeni Bertovic
src/Docker/Internal.hs+1−1
@@ -92,7 +92,7 @@ getEndpoint (RestartContainerEndpoint t cid) = encodeURLWithQuery ["containers",
92 DefaultTimeout -> []
92 DefaultTimeout -> []
93getEndpoint (PauseContainerEndpoint cid) = encodeURL ["containers", cid, "pause"]
93getEndpoint (PauseContainerEndpoint cid) = encodeURL ["containers", cid, "pause"]
94getEndpoint (UnpauseContainerEndpoint cid) = encodeURL ["containers", cid, "unpause"]
94getEndpoint (UnpauseContainerEndpoint cid) = encodeURL ["containers", cid, "unpause"]
95−getEndpoint (ContainerLogsEndpoint cid (LogOpts follow stdout stderr since timestamps tail)) =
95+getEndpoint (ContainerLogsEndpoint (LogOpts follow stdout stderr since timestamps tail) cid) =
96 encodeURLWithQuery ["containers", cid, "logs"] query
96 encodeURLWithQuery ["containers", cid, "logs"] query
97 where query = [("stdout", Just (encodeQ $ show stdout)), ("stderr", Just (encodeQ $ show stderr)), ("follow", Just (encodeQ $ show follow))]
97 where query = [("stdout", Just (encodeQ $ show stdout)), ("stderr", Just (encodeQ $ show stderr)), ("follow", Just (encodeQ $ show follow))]
98getEndpoint (DeleteContainerEndpoint (DeleteOpts removeVolumes force) cid) =
98getEndpoint (DeleteContainerEndpoint (DeleteOpts removeVolumes force) cid) =
src/Docker/Types.hs+11−3
@@ -17,7 +17,7 @@ import qualified Data.Text as T
17import GHC.Generics (Generic)
17import GHC.Generics (Generic)
18import qualified Network.HTTP.Client as HTTP
18import qualified Network.HTTP.Client as HTTP
19import Network.HTTP.Types (StdMethod)
19import Network.HTTP.Types (StdMethod)
20−import Prelude hiding (all)
20+import Prelude hiding (all, tail)
21
21
22type HttpVerb = StdMethod
22type HttpVerb = StdMethod
23
23
@@ -32,7 +32,7 @@ data Endpoint =
32 | RestartContainerEndpoint Timeout ContainerID
32 | RestartContainerEndpoint Timeout ContainerID
33 | PauseContainerEndpoint ContainerID
33 | PauseContainerEndpoint ContainerID
34 | UnpauseContainerEndpoint ContainerID
34 | UnpauseContainerEndpoint ContainerID
35− | ContainerLogsEndpoint ContainerID LogOpts
35+ | ContainerLogsEndpoint LogOpts ContainerID
36 | DeleteContainerEndpoint DeleteOpts ContainerID
36 | DeleteContainerEndpoint DeleteOpts ContainerID
37
37
38type URL = Text
38type URL = Text
@@ -240,11 +240,19 @@ data LogOpts = LogOpts {
240 follow :: Bool
240 follow :: Bool
241 , stdout :: Bool
241 , stdout :: Bool
242 , stderr :: Bool
242 , stderr :: Bool
243− , since :: Timestamp
243+ , since :: Maybe Timestamp
244 , timestamps :: Bool
244 , timestamps :: Bool
245 , tail :: TailLogOpt
245 , tail :: TailLogOpt
246 } deriving (Eq, Show)
246 } deriving (Eq, Show)
247
247
248+defaultLogOpts = LogOpts { follow = False
249+ , stdout = True
250+ , stderr = True
251+ , since = Nothing
252+ , timestamps = True
253+ , tail = All
254+ }
255+
248data VolumePermission = Rw | Ro deriving (Eq, Show, Generic)
256data VolumePermission = Rw | Ro deriving (Eq, Show, Generic)
249
257
250instance ToJSON VolumePermission
258instance ToJSON VolumePermission