Skip to content

Commit 1c4f530

Browse files
committed
Consistent operation
1 parent f9990f1 commit 1c4f530

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/Kubernetes/Webhook/Types.hs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,17 @@ newtype UID = UID Text deriving (Generic, Show, A.ToJSON, A.FromJSON)
164164

165165
-- |
166166
-- Operation is the type of resource operation being checked for admission control
167-
data Operation = CREATE | UPDATE | DELETE | CONNECT deriving (Generic, Show, A.ToJSON, A.FromJSON)
167+
data Operation = Create | Update | Delete | Connect deriving (Generic, Show)
168+
169+
instance A.ToJSON Operation where
170+
toJSON = A.genericToJSON opts
171+
where
172+
opts = A.defaultOptions {A.constructorTagModifier = fmap C.toUpper}
173+
174+
instance A.FromJSON Operation where
175+
parseJSON = A.genericParseJSON opts
176+
where
177+
opts = A.defaultOptions {A.constructorTagModifier = fmap C.toUpper}
168178

169179
-- |
170180
-- UserInfo holds the information about the user needed to implement the user.Info interface.

0 commit comments

Comments
 (0)