{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
module Docker.API.Client.Internal.Types where
import Control.Monad.Except
import qualified Data.Text as T
import Docker.API.Client.Images (tagImageIfMissing)
import GHC.Generics (Generic)
newtype OS = OS String
data DockerClientError
=
ContainerCreationFailedError String
|
UnrecognizedJSONResponseError String
|
GetContainerArchiveError String
|
NonZeroExitCode String
|
GetContainerLogsError String
|
ImagePullError String
deriving (Int -> DockerClientError -> ShowS
[DockerClientError] -> ShowS
DockerClientError -> String
(Int -> DockerClientError -> ShowS)
-> (DockerClientError -> String)
-> ([DockerClientError] -> ShowS)
-> Show DockerClientError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DockerClientError] -> ShowS
$cshowList :: [DockerClientError] -> ShowS
show :: DockerClientError -> String
$cshow :: DockerClientError -> String
showsPrec :: Int -> DockerClientError -> ShowS
$cshowsPrec :: Int -> DockerClientError -> ShowS
Show, (forall x. DockerClientError -> Rep DockerClientError x)
-> (forall x. Rep DockerClientError x -> DockerClientError)
-> Generic DockerClientError
forall x. Rep DockerClientError x -> DockerClientError
forall x. DockerClientError -> Rep DockerClientError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DockerClientError x -> DockerClientError
$cfrom :: forall x. DockerClientError -> Rep DockerClientError x
Generic)
type ClientErrorMonad a = ExceptT DockerClientError IO a
data ContainerSpec = ContainerSpec
{
ContainerSpec -> Text
image :: T.Text,
ContainerSpec -> [Text]
cmd :: [T.Text],
ContainerSpec -> Text
user :: T.Text,
ContainerSpec -> Text
workingDir :: T.Text,
ContainerSpec -> [Text]
envVars :: [T.Text],
ContainerSpec -> [Text]
hostVolumes :: [T.Text]
}
deriving (Int -> ContainerSpec -> ShowS
[ContainerSpec] -> ShowS
ContainerSpec -> String
(Int -> ContainerSpec -> ShowS)
-> (ContainerSpec -> String)
-> ([ContainerSpec] -> ShowS)
-> Show ContainerSpec
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ContainerSpec] -> ShowS
$cshowList :: [ContainerSpec] -> ShowS
show :: ContainerSpec -> String
$cshow :: ContainerSpec -> String
showsPrec :: Int -> ContainerSpec -> ShowS
$cshowsPrec :: Int -> ContainerSpec -> ShowS
Show, (forall x. ContainerSpec -> Rep ContainerSpec x)
-> (forall x. Rep ContainerSpec x -> ContainerSpec)
-> Generic ContainerSpec
forall x. Rep ContainerSpec x -> ContainerSpec
forall x. ContainerSpec -> Rep ContainerSpec x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ContainerSpec x -> ContainerSpec
$cfrom :: forall x. ContainerSpec -> Rep ContainerSpec x
Generic)
defaultContainerSpec ::
T.Text ->
ContainerSpec
defaultContainerSpec :: Text -> ContainerSpec
defaultContainerSpec Text
img =
ContainerSpec :: Text -> [Text] -> Text -> Text -> [Text] -> [Text] -> ContainerSpec
ContainerSpec
{ image :: Text
image = Text -> Text
tagImageIfMissing Text
img,
cmd :: [Text]
cmd = [],
user :: Text
user = Text
"",
workingDir :: Text
workingDir = Text
"",
envVars :: [Text]
envVars = [],
hostVolumes :: [Text]
hostVolumes = []
}
data ContainerLogType = Stdout | StdErr | Both
data DockerStreamType = DockerStreamStdIn | DockerStreamStdOut | DockerStreamStdErr