module Ganeti.Objects.Lens where
import qualified Data.Set as Set
import System.Time (ClockTime(..))
import Ganeti.Lens (makeCustomLenses, Lens')
import Ganeti.Objects
class TimeStampObject a => TimeStampObjectL a where
mTimeL :: Lens' a ClockTime
class UuidObject a => UuidObjectL a where
uuidL :: Lens' a String
class SerialNoObject a => SerialNoObjectL a where
serialL :: Lens' a Int
class TagsObject a => TagsObjectL a where
tagsL :: Lens' a (Set.Set String)
$(makeCustomLenses ''AddressPool)
$(makeCustomLenses ''Network)
instance SerialNoObjectL Network where
serialL = networkSerialL
instance TagsObjectL Network where
tagsL = networkTagsL
instance UuidObjectL Network where
uuidL = networkUuidL
instance TimeStampObjectL Network where
mTimeL = networkMtimeL
$(makeCustomLenses ''PartialNic)
$(makeCustomLenses ''Disk)
$(makeCustomLenses ''Instance)
instance TimeStampObjectL Instance where
mTimeL = instMtimeL
instance UuidObjectL Instance where
uuidL = instUuidL
instance SerialNoObjectL Instance where
serialL = instSerialL
instance TagsObjectL Instance where
tagsL = instTagsL
$(makeCustomLenses ''MinMaxISpecs)
$(makeCustomLenses ''PartialIPolicy)
$(makeCustomLenses ''FilledIPolicy)
$(makeCustomLenses ''Node)
instance TimeStampObjectL Node where
mTimeL = nodeMtimeL
instance UuidObjectL Node where
uuidL = nodeUuidL
instance SerialNoObjectL Node where
serialL = nodeSerialL
instance TagsObjectL Node where
tagsL = nodeTagsL
$(makeCustomLenses ''NodeGroup)
instance TimeStampObjectL NodeGroup where
mTimeL = groupMtimeL
instance UuidObjectL NodeGroup where
uuidL = groupUuidL
instance SerialNoObjectL NodeGroup where
serialL = groupSerialL
instance TagsObjectL NodeGroup where
tagsL = groupTagsL
$(makeCustomLenses ''Cluster)
instance TimeStampObjectL Cluster where
mTimeL = clusterMtimeL
instance UuidObjectL Cluster where
uuidL = clusterUuidL
instance SerialNoObjectL Cluster where
serialL = clusterSerialL
instance TagsObjectL Cluster where
tagsL = clusterTagsL
$(makeCustomLenses ''ConfigData)
instance SerialNoObjectL ConfigData where
serialL = configSerialL
instance TimeStampObjectL ConfigData where
mTimeL = configMtimeL