@@ -49,7 +49,7 @@ module Docker.Types (
49 , LogDriverConfig(..)
49 , LogDriverConfig(..)
50 , NetworkMode(..)
50 , NetworkMode(..)
51 , PortType(..)
51 , PortType(..)
52− , NetworkInterface(..)
52+-- , NetworkInterface(..)
53 , Networks(..)
53 , Networks(..)
54 , NetworkSettings(..)
54 , NetworkSettings(..)
55 , NetworkOptions(..)
55 , NetworkOptions(..)
@@ -73,6 +73,8 @@ module Docker.Types (
73 , ContainerConfig(..)
73 , ContainerConfig(..)
74 , defaultContainerConfig
74 , defaultContainerConfig
75 , ExposedPorts(..)
75 , ExposedPorts(..)
78import Data.Aeson (FromJSON, ToJSON, genericParseJSON,
80import Data.Aeson (FromJSON, ToJSON, genericParseJSON,
@@ -801,14 +803,14 @@ instance FromJSON PortType where
801 "udp" -> return UDP
803 "udp" -> return UDP
802 _ -> fail "PortType: Invalid port type."
804 _ -> fail "PortType: Invalid port type."
804−newtype NetworkInterface = NetworkInterface Text deriving (Eq, Show)
806+-- newtype NetworkInterface = NetworkInterface Text deriving (Eq, Show)
806−instance FromJSON NetworkInterface where
808+-- instance FromJSON NetworkInterface where
807− parseJSON (JSON.String v) = return $ NetworkInterface v
809+-- parseJSON (JSON.String v) = return $ NetworkInterface v
808− parseJSON _ = fail "Network interface is not a string."
810+-- parseJSON _ = fail "Network interface is not a string."
810−instance ToJSON NetworkInterface where
812+-- instance ToJSON NetworkInterface where
811− toJSON (NetworkInterface i) = JSON.String i
813+-- toJSON (NetworkInterface i) = JSON.String i
813-- | This datastructure models mapping a Port from the container onto the
815-- | This datastructure models mapping a Port from the container onto the
814-- host system s that the service running in the container can be accessed from
816-- host system s that the service running in the container can be accessed from
@@ -851,11 +853,14 @@ instance ToJSON PortBindings where
851 toJSON (PortBindings []) = JSON.Object HM.empty
853 toJSON (PortBindings []) = JSON.Object HM.empty
852 toJSON (PortBindings (p:ps)) = toJSON (p:ps)
854 toJSON (PortBindings (p:ps)) = toJSON (p:ps)
854−data HostPort = HostPort NetworkInterface Port
856+data HostPort = HostPort {
855 deriving (Eq, Show)
860 deriving (Eq, Show)
857instance ToJSON HostPort where
862instance ToJSON HostPort where
858− toJSON (HostPort i p) = object ["HostPort" .= p, "HostIP" .= i]
863+ toJSON (HostPort i p) = object ["HostPort" .= show p, "HostIp" .= i]
860instance FromJSON HostPort where
865instance FromJSON HostPort where
861 parseJSON (JSON.Object o) = do
866 parseJSON (JSON.Object o) = do
@@ -1040,15 +1045,51 @@ instance ToJSON Ulimit where
1040 toJSON = genericToJSON defaultOptions {
1045 toJSON = genericToJSON defaultOptions {
1041 fieldLabelModifier = drop 5}
1046 fieldLabelModifier = drop 5}
1048+data DeviceWeight = DeviceWeight {
1049+ deviceWeightPath :: FilePath
1050+ , deviceWeightWeight :: Text
1052+ deriving (Show, Eq)
1054+instance FromJSON DeviceWeight where
1055+ parseJSON (JSON.Object o) = DeviceWeight
1058+ parseJSON _ = fail "DeviceWeight is not an object."
1060+instance ToJSON DeviceWeight where
1061+ toJSON (DeviceWeight p w) = object [
1066+data DeviceRate = DeviceRate {
1067+ deviceRatePath :: FilePath
1068+ , deviceRateRate :: Text
1070+ deriving (Show, Eq)
1072+instance FromJSON DeviceRate where
1073+ parseJSON (JSON.Object o) = DeviceRate
1076+ parseJSON _ = fail "DeviceRate is not an object."
1078+instance ToJSON DeviceRate where
1079+ toJSON (DeviceRate p r) = object [
1043data ContainerResources = ContainerResources {
1084data ContainerResources = ContainerResources {
1044 cpuShares :: Maybe Integer
1085 cpuShares :: Maybe Integer
1045 -- , cgroupParent :: Text -- 1.24: Missing from inspecting container details... Going to omit for now.
1086 -- , cgroupParent :: Text -- 1.24: Missing from inspecting container details... Going to omit for now.
1046 , blkioWeight :: Maybe Integer
1087 , blkioWeight :: Maybe Integer
1047− , blkioWeightDevice :: Maybe Text -- TODO: Not Text
1088+ , blkioWeightDevice :: Maybe [DeviceWeight]
1048− , blkioDeviceReadBps :: Maybe Text -- TODO: Not Text
1089+ , blkioDeviceReadBps :: Maybe [DeviceRate] -- TODO: Not Text
1049− , blkioDeviceWriteBps :: Maybe Text -- TODO: Not Text
1090+ , blkioDeviceWriteBps :: Maybe [DeviceRate] -- TODO: Not Text
1050− , blkioDeviceReadIOps :: Maybe Text -- TODO: Not Text
1091+ , blkioDeviceReadIOps :: Maybe [DeviceRate] -- TODO: Not Text
1051− , blkioDeviceWriteIOps :: Maybe Text -- TODO: Not Text
1092+ , blkioDeviceWriteIOps :: Maybe [DeviceRate] -- TODO: Not Text
1052 , cpuPeriod :: Maybe Integer
1093 , cpuPeriod :: Maybe Integer
1053 -- , cpuQuota :: Integer -- 1.24: Missing from inspecting container details... Going to omit for now.
1094 -- , cpuQuota :: Integer -- 1.24: Missing from inspecting container details... Going to omit for now.
1054 , cpusetCpus :: Maybe Text
1095 , cpusetCpus :: Maybe Text