on master help sign in
Adds Devices to HostConfig

Fixes the wrong notion that they were somehow the same as volumes.

commitc8c192aea3b74c700cfe0b176617e22b444c7739 authorDeni Bertovic <deni@denibertovic.com> dateThu 10 Mar 2016, 15:29 (11 years ago) parent87d3b5a
1 file changed+15−1
src/Docker/Types.hs+15−1
src/Docker/Types.hs+15−1
@@ -142,6 +142,20 @@ data Volume = Volume { hostSrc :: Text
142142 , volumePermission :: Maybe VolumePermission
143143 } deriving (Eq, Show)
144144
145+data Device = Device {
146+ pathOnHost :: FilePath
147+ , pathInContainer :: FilePath
148+ , cgroupPermissions :: Text
149+ } deriving (Eq, Show, Generic)
150+
151+instance ToJSON Device where
152+ toJSON = genericToJSON defaultOptions {
153+ fieldLabelModifier = (\(x:xs) -> toUpper x : xs)}
154+
155+instance FromJSON Device where
156+ parseJSON = genericParseJSON defaultOptions {
157+ fieldLabelModifier = (\(x:xs) -> toUpper x : xs)}
158+
145159type ContainerName = Text
146160
147161data VolumeFrom = VolumeFrom ContainerName VolumePermission deriving (Eq, Show)
@@ -244,7 +258,7 @@ data ContainerResources = ContainerResources {
244258 , cpuQuota :: Integer
245259 , cpusetCpus :: Integer
246260 , cpusetMems :: Text
247− , devices :: [Volume]
261+ , devices :: [Device]
248262 , diskQuota :: Integer
249263 , kernelMemory :: Integer
250264 , memory :: Integer