on master help sign in
small updates
commit9834323dfbaf60068b9f58f5f28598e9b66ad2e4 authorJames Parker <dev@jamesparker.me> dateMon 25 Jul 2016, 15:47 (10 years ago) parent79d00d9
1 file changed+8−7
src/Docker/Types.hs+8−7
src/Docker/Types.hs+8−7
@@ -71,6 +71,7 @@ module Docker.Types (
7171 , Value
7272 , EnvVar(..)
7373 , ContainerConfig(..)
74+ , ExposedPorts(..)
7475 ) where
7576
7677import Data.Aeson (FromJSON, ToJSON, genericParseJSON,
@@ -399,7 +400,7 @@ data NetworkSettings = NetworkSettings {
399400 , networkSettingsHairpinMode :: Bool
400401 , networkSettingsLinkLocalIPv6Address :: Text
401402 , networkSettingsLinkLocalIPv6PrefixLen :: Int
402− , networkSettingsPorts :: [Int] -- TODO: 1.24 spec is unclear
403+ , networkSettingsPorts :: [Port] -- TODO: 1.24 spec is unclear
403404 , networkSettingsSandboxKey :: Text
404405 , networkSettingsSecondaryIPAddresses :: Maybe [Text] -- TODO: 1.24 spec is unclear
405406 , networkSettingsSecondaryIPv6Addresses :: Maybe [Text] -- TODO: 1.24 spec is unclear
@@ -438,7 +439,6 @@ instance FromJSON NetworkSettings where
438439 return $ NetworkSettings bridge sandbox hairpin localIP6 localIP6Len ports sandboxKey secondaryIP secondayIP6 endpointID gateway globalIP6 globalIP6Len ip ipLen ip6Gateway mac networks
439440 parseJSON _ = fail "NetworkSettings is not an Object"
440441
441−-- TODO: Add NetworkSettings, Mounts
442442data Container = Container
443443 { containerId :: ContainerID
444444 , containerNames :: [Text]
@@ -1034,9 +1034,9 @@ instance ToJSON EnvVar where
10341034-- | ExposedPorts represent a enumeraton of all the ports (and their type)
10351035-- that a container should expose to other containers or the host system.
10361036-- `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
10381038-- 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
10401040-- inject into a container linking to our container.
10411041-- Example linking a Postgres container named db would inject the following
10421042-- environment variables automatically if we set the corresponding
@@ -1044,7 +1044,8 @@ instance ToJSON EnvVar where
10441044-- DB_PORT_5432_TCP_PORT="5432"
10451045-- DB_PORT_5432_TCP_PROTO="tcp"
10461046-- 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)]?
10481049
10491050instance FromJSON ExposedPorts where
10501051 parseJSON (JSON.Object o) = do
@@ -1056,13 +1057,13 @@ instance FromJSON ExposedPorts where
10561057 port <- parseIntegerText port'
10571058 portType <- parseJSON $ JSON.String portType'
10581059 acc <- accM
1059− return $ M.insert portType port acc
1060+ return $ M.insert port portType acc
10601061 _ ->
10611062 fail "Could not parse ExposedPorts"
10621063 parseJSON _ = fail "ExposedPorts is not an object."
10631064
10641065instance 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)]
10661067
10671068
10681069data ContainerConfig = ContainerConfig {