@@ -71,6 +71,7 @@ module Docker.Types (
72 , EnvVar(..)
72 , EnvVar(..)
73 , ContainerConfig(..)
73 , ContainerConfig(..)
76import Data.Aeson (FromJSON, ToJSON, genericParseJSON,
77import Data.Aeson (FromJSON, ToJSON, genericParseJSON,
@@ -399,7 +400,7 @@ data NetworkSettings = NetworkSettings {
399 , networkSettingsHairpinMode :: Bool
400 , networkSettingsHairpinMode :: Bool
400 , networkSettingsLinkLocalIPv6Address :: Text
401 , networkSettingsLinkLocalIPv6Address :: Text
401 , networkSettingsLinkLocalIPv6PrefixLen :: Int
402 , networkSettingsLinkLocalIPv6PrefixLen :: Int
402− , networkSettingsPorts :: [Int] -- TODO: 1.24 spec is unclear
403+ , networkSettingsPorts :: [Port] -- TODO: 1.24 spec is unclear
403 , networkSettingsSandboxKey :: Text
404 , networkSettingsSandboxKey :: Text
404 , networkSettingsSecondaryIPAddresses :: Maybe [Text] -- TODO: 1.24 spec is unclear
405 , networkSettingsSecondaryIPAddresses :: Maybe [Text] -- TODO: 1.24 spec is unclear
405 , networkSettingsSecondaryIPv6Addresses :: Maybe [Text] -- TODO: 1.24 spec is unclear
406 , networkSettingsSecondaryIPv6Addresses :: Maybe [Text] -- TODO: 1.24 spec is unclear
@@ -438,7 +439,6 @@ instance FromJSON NetworkSettings where
438 return $ NetworkSettings bridge sandbox hairpin localIP6 localIP6Len ports sandboxKey secondaryIP secondayIP6 endpointID gateway globalIP6 globalIP6Len ip ipLen ip6Gateway mac networks
439 return $ NetworkSettings bridge sandbox hairpin localIP6 localIP6Len ports sandboxKey secondaryIP secondayIP6 endpointID gateway globalIP6 globalIP6Len ip ipLen ip6Gateway mac networks
439 parseJSON _ = fail "NetworkSettings is not an Object"
440 parseJSON _ = fail "NetworkSettings is not an Object"
441−-- TODO: Add NetworkSettings, Mounts
442data Container = Container
442data Container = Container
443 { containerId :: ContainerID
443 { containerId :: ContainerID
444 , containerNames :: [Text]
444 , containerNames :: [Text]
@@ -1034,9 +1034,9 @@ instance ToJSON EnvVar where
1034-- | ExposedPorts represent a enumeraton of all the ports (and their type)
1034-- | ExposedPorts represent a enumeraton of all the ports (and their type)
1035-- that a container should expose to other containers or the host system.
1035-- that a container should expose to other containers or the host system.
1036-- `NOTE`: This does not automatically expose the ports onto the host
1036-- `NOTE`: This does not automatically expose the ports onto the host
1037−-- system but rathet it just tags them. It's best to be used with with
1037+-- system but rather it just tags them. It's best to be used with
1038-- the PublishAllPorts flag. It is also useful for
1038-- the PublishAllPorts flag. It is also useful for
1039−-- the deamon to know wich Environment variables to
1039+-- the daemon to know which Environment variables to
1040-- inject into a container linking to our container.
1040-- inject into a container linking to our container.
1041-- Example linking a Postgres container named db would inject the following
1041-- Example linking a Postgres container named db would inject the following
1042-- environment variables automatically if we set the corresponding
1042-- environment variables automatically if we set the corresponding
@@ -1044,7 +1044,8 @@ instance ToJSON EnvVar where
1044-- DB_PORT_5432_TCP_PORT="5432"
1044-- DB_PORT_5432_TCP_PORT="5432"
1045-- DB_PORT_5432_TCP_PROTO="tcp"
1045-- DB_PORT_5432_TCP_PROTO="tcp"
1046-- DB_PORT_5432_TCP="tcp://172.17.0.1:5432"
1046-- DB_PORT_5432_TCP="tcp://172.17.0.1:5432"
1047−newtype ExposedPorts = ExposedPorts (M.Map PortType Port) deriving (Eq, Show)
1047+newtype ExposedPorts = ExposedPorts (M.Map Port PortType) deriving (Eq, Show)
1048+-- JP: Should this be ExposedPorts [(Port, PortType)]?
1049instance FromJSON ExposedPorts where
1050instance FromJSON ExposedPorts where
1050 parseJSON (JSON.Object o) = do
1051 parseJSON (JSON.Object o) = do
@@ -1056,13 +1057,13 @@ instance FromJSON ExposedPorts where
1056 port <- parseIntegerText port'
1057 port <- parseIntegerText port'
1057 portType <- parseJSON $ JSON.String portType'
1058 portType <- parseJSON $ JSON.String portType'
1058 acc <- accM
1059 acc <- accM
1059− return $ M.insert portType port acc
1060+ return $ M.insert port portType acc
1061 fail "Could not parse ExposedPorts"
1062 fail "Could not parse ExposedPorts"
1062 parseJSON _ = fail "ExposedPorts is not an object."
1063 parseJSON _ = fail "ExposedPorts is not an object."
1064instance ToJSON ExposedPorts where
1065instance ToJSON ExposedPorts where
1065− toJSON (ExposedPorts kvs) = object [((T.pack $ show p) <> "/" <> (T.pack $ show t)) .= JSON.Object HM.empty | (t,p) <- (M.toList kvs)]
1066+ toJSON (ExposedPorts kvs) = object [((T.pack $ show p) <> "/" <> (T.pack $ show t)) .= JSON.Object HM.empty | (p,t) <- (M.toList kvs)]
1068data ContainerConfig = ContainerConfig {
1069data ContainerConfig = ContainerConfig {