Commit 02cccecd authored by Iustin Pop's avatar Iustin Pop
Browse files

Expand TH with tags field



Also add this new field and the other generic fields to the cluster
object.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarAgata Murawska <agatamurawska@google.com>
parent 988da36e
...@@ -372,7 +372,10 @@ $(buildObject "Cluster" "cluster" $ ...@@ -372,7 +372,10 @@ $(buildObject "Cluster" "cluster" $
, simpleField "primary_ip_family" [t| Int |] , simpleField "primary_ip_family" [t| Int |]
, simpleField "prealloc_wipe_disks" [t| Bool |] , simpleField "prealloc_wipe_disks" [t| Bool |]
] ]
++ serialFields) ++ serialFields
++ timeStampFields
++ uuidFields
++ tagsFields)
-- * ConfigData definitions -- * ConfigData definitions
......
...@@ -47,6 +47,7 @@ module Ganeti.THH ( declareSADT ...@@ -47,6 +47,7 @@ module Ganeti.THH ( declareSADT
, timeStampFields , timeStampFields
, uuidFields , uuidFields
, serialFields , serialFields
, tagsFields
, buildObject , buildObject
, buildObjectSerialisation , buildObjectSerialisation
, buildParam , buildParam
...@@ -58,6 +59,7 @@ import Control.Monad (liftM, liftM2) ...@@ -58,6 +59,7 @@ import Control.Monad (liftM, liftM2)
import Data.Char import Data.Char
import Data.List import Data.List
import qualified Data.Map as M import qualified Data.Map as M
import qualified Data.Set as Set
import Language.Haskell.TH import Language.Haskell.TH
import qualified Text.JSON as JSON import qualified Text.JSON as JSON
...@@ -172,6 +174,11 @@ serialFields = ...@@ -172,6 +174,11 @@ serialFields =
uuidFields :: [Field] uuidFields :: [Field]
uuidFields = [ simpleField "uuid" [t| String |] ] uuidFields = [ simpleField "uuid" [t| String |] ]
-- | Tag field description.
tagsFields :: [Field]
tagsFields = [ defaultField [| Set.empty |] $
simpleField "tags" [t| Set.Set String |] ]
-- * Helper functions -- * Helper functions
-- | Ensure first letter is lowercase. -- | Ensure first letter is lowercase.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment