packages feed

appc 0.0.4 → 0.0.5

raw patch · 2 files changed

+66/−4 lines, 2 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Data.AppContainer.Types: volKind :: Volume -> !Text
+ Data.AppContainer.Types: EmptyVolumeSource :: VolumeSource
+ Data.AppContainer.Types: HostVolume :: !Text -> !Bool -> HostVolume
+ Data.AppContainer.Types: HostVolumeSource :: HostVolume -> VolumeSource
+ Data.AppContainer.Types: data HostVolume
+ Data.AppContainer.Types: data VolumeSource
+ Data.AppContainer.Types: hvReadOnly :: HostVolume -> !Bool
+ Data.AppContainer.Types: hvSource :: HostVolume -> !Text
+ Data.AppContainer.Types: instance Eq HostVolume
+ Data.AppContainer.Types: instance Eq VolumeSource
+ Data.AppContainer.Types: instance FromJSON HostVolume
+ Data.AppContainer.Types: instance FromJSON VolumeSource
+ Data.AppContainer.Types: instance Show HostVolume
+ Data.AppContainer.Types: instance Show VolumeSource
+ Data.AppContainer.Types: volFulfills :: Volume -> ![Text]
+ Data.AppContainer.Types: volSource :: Volume -> !VolumeSource
- Data.AppContainer.Types: Volume :: !Text -> Volume
+ Data.AppContainer.Types: Volume :: ![Text] -> !VolumeSource -> Volume

Files

appc.cabal view
@@ -1,5 +1,5 @@ name:                appc-version:             0.0.4+version:             0.0.5 license:             MIT license-file:        LICENSE author:              Tomas Carnecky
src/Data/AppContainer/Types.hs view
@@ -16,6 +16,8 @@    , MountPoint(..)    , Port(..)    , Volume(..)+   , VolumeSource(..)+   , HostVolume(..)     ) where @@ -30,6 +32,7 @@  import           Data.SemVer import           Data.UUID+import           Data.Monoid  import           Data.Aeson import           Data.Aeson.Types@@ -165,10 +168,70 @@     , mpReadOnly :: !Bool     } deriving (Show, Eq) +instance FromJSON MountPoint where+    parseJSON (Object o) = MountPoint+        <$> o .: "name"+        <*> o .: "path"+        <*> o .:? "readOnly" .!= False++    parseJSON _ = fail "MountPoint"+ data Volume = Volume-    { volKind :: !Text+    { volFulfills :: ![Text]+    , volSource :: !VolumeSource     } deriving (Show, Eq) +instance FromJSON Volume where+    parseJSON v@(Object o) = Volume+        <$> o .: "fulfills"+        <*> parseJSON v++    parseJSON _ = fail "Volume"++instance ToJSON Volume where+    toJSON Volume{..} = case volSource of+        EmptyVolumeSource -> object+            [ "kind"     .= ("empty" :: Text)+            , "fulfills" .= volFulfills+            ]++        HostVolumeSource HostVolume{..} -> object+            [ "kind"     .= ("host" :: Text)+            , "fulfills" .= volFulfills+            , "source"   .= hvSource+            , "readOnly" .= hvReadOnly+            ]+++data VolumeSource+    = EmptyVolumeSource+    | HostVolumeSource HostVolume+    deriving (Show, Eq)++instance FromJSON VolumeSource where+    parseJSON v@(Object o) = do+        kind <- o .: "kind"+        case kind :: String of+            "empty" -> return EmptyVolumeSource+            "host"  -> HostVolumeSource <$> parseJSON v+            _       -> fail $ "Unknown volume kind: " <> kind++    parseJSON _ = fail "VolumeSource"+++data HostVolume = HostVolume+    { hvSource :: !Text+    , hvReadOnly :: !Bool+    } deriving (Show, Eq)++instance FromJSON HostVolume where+    parseJSON (Object o) = HostVolume+        <$> o .: "source"+        <*> o .:? "readOnly" .!= False++    parseJSON _ = fail "HostVolume"++ data Port = Port     { portName :: !Text     , portProtocol :: !Text@@ -212,7 +275,6 @@ $(deriveJSON (deriveJSONOptions "dep") ''Dependency) $(deriveJSON (deriveJSONOptions "eh") ''EventHandler) $(deriveJSON (deriveJSONOptions "label") ''Label)-$(deriveJSON (deriveJSONOptions "mp") ''MountPoint)-$(deriveJSON (deriveJSONOptions "vol") ''Volume)+$(deriveToJSON (deriveJSONOptions "mp") ''MountPoint) $(deriveToJSON (deriveJSONOptions "port") ''Port) $(deriveJSON (deriveJSONOptions "image") ''Image)