This repository has been archived by the owner on Sep 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Types.hs
66 lines (55 loc) · 2.07 KB
/
Types.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
module Types where
import RIO
import RIO.Process
import Control.Monad.Trans.AWS
import Kubernetes.OpenAPI.Core
import Network.HTTP.Client
-- | Command line arguments
data Options = Options
{ optionsVerbose :: !Bool,
optionsDiscoveryTagKey :: !Text,
optionsDiscoveryTagValue :: !(Maybe Text),
optionsMasterURI :: !Text,
optionsDryRun :: !Bool
}
data App = App
{ appLogFunc :: !LogFunc
, appProcessContext :: !ProcessContext
, appOptions :: !Options
, awsEnv :: !Env
, k8sClientConfig :: !KubernetesClientConfig
, k8sClientManager :: !Manager
}
instance HasLogFunc App where
logFuncL = lens appLogFunc (\x y -> x { appLogFunc = y })
instance HasProcessContext App where
processContextL = lens appProcessContext (\x y -> x { appProcessContext = y })
instance HasEnv App where
environment = lens awsEnv (\x y -> x { awsEnv = y })
class HasK8S env where
k8sClientConfigL :: Lens' env KubernetesClientConfig
k8sClientManagerL :: Lens' env Manager
instance HasK8S App where
k8sClientConfigL = lens k8sClientConfig (\x y -> x { k8sClientConfig = y})
k8sClientManagerL = lens k8sClientManager (\x y -> x { k8sClientManager = y})
class HasOptions env where
optionsL :: Lens' env Options
dryRunL :: Lens' env Bool
discoveryTagKeyL :: Lens' env Text
discoveryTagValueL :: Lens' env (Maybe Text)
instance HasOptions App where
optionsL = lens appOptions (\x y -> x { appOptions = y})
dryRunL = optionsL . lens optionsDryRun (\x y -> x { optionsDryRun = y})
discoveryTagKeyL = optionsL . lens optionsDiscoveryTagKey (\x y -> x { optionsDiscoveryTagKey = y})
discoveryTagValueL = optionsL . lens optionsDiscoveryTagValue (\x y -> x { optionsDiscoveryTagValue = y})
data Volume = Volume {
ebsVolumeId :: !Text
, persistentVolumeName :: !Text
, persistentVolumeClaimName :: !Text
, persistentVolumeClaimNamespace :: !Text
, storageClassName :: !(Maybe Text)
, availabilityZone :: !Text
, capacity :: !Text
} deriving (Show, Eq)
newtype TagMissing = TagMissing Text
data VolumeNotParsedReason = MissingRequiredTags Text [Text] deriving (Show, Eq)