, create
, setIdx
, setName
+ , setAlias
, setPri
, setSec
, setBoth
-- | The instance type
data Instance = Instance { name :: String -- ^ The instance name
+ , alias :: String -- ^ The shortened name
, mem :: Int -- ^ Memory of the instance
, dsk :: Int -- ^ Disk size of instance
, vcpus :: Int -- ^ Number of VCPUs
} deriving (Show)
instance T.Element Instance where
- nameOf = name
- idxOf = idx
- setName = setName
- setIdx = setIdx
+ nameOf = name
+ idxOf = idx
+ setAlias = setAlias
+ setIdx = setIdx
+ allNames n = [name n, alias n]
-- | Running instance states.
runningStates :: [String]
-> [String] -> T.Ndx -> T.Ndx -> Instance
create name_init mem_init dsk_init vcpus_init run_init tags_init pn sn =
Instance { name = name_init
+ , alias = name_init
, mem = mem_init
, dsk = dsk_init
, vcpus = vcpus_init
setName :: Instance -- ^ The original instance
-> String -- ^ New name
-> Instance -- ^ The modified instance
-setName t s = t { name = s }
+setName t s = t { name = s, alias = s }
+
+-- | Changes the alias.
+--
+-- This is used only during the building of the data structures.
+setAlias :: Instance -- ^ The original instance
+ -> String -- ^ New alias
+ -> Instance -- ^ The modified instance
+setAlias t s = t { alias = s }
-- * Update functions