Last active
May 20, 2021 09:16
-
-
Save GrafBlutwurst/88b291cf84319df5ee5fe00dcb8df9ad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let Environment = < Staging | Preprod | Prod > | |
let TenantsPerEnvironment = | |
{ Staging = < Tenant1 > | |
, Preprod = < Tenant1 | Tenant2 > | |
, Prod = < Tenant2 > | |
} | |
let tenantOf | |
: Environment -> Type | |
= \(environment : Environment) -> merge TenantsPerEnvironment environment | |
let TenantClusterAuth = { account : Text, token : Text } | |
let Handler = | |
{ Tenant1 : Optional TenantClusterAuth | |
, Tenant2 : Optional TenantClusterAuth | |
} | |
let tenantClusterAuthPerEnvironmentSome = | |
{ Staging = | |
{ Tenant1 = Some { account = "a", token = "b" } | |
, Tenant2 = None TenantClusterAuth | |
} | |
, Preprod = | |
{ Tenant1 = Some { account = "c", token = "d" } | |
, Tenant2 = Some { account = "e", token = "f" } | |
} | |
, Prod = | |
{ Tenant1 = None TenantClusterAuth | |
, Tenant2 = Some { account = "g", token = "h" } | |
} | |
} | |
let tenantClusterAuthPerEnvironment = | |
{ Staging.Tenant1 = { account = "a", token = "b" } | |
, Preprod = | |
{ Tenant1 = { account = "c", token = "d" } | |
, Tenant2 = { account = "e", token = "f" } | |
} | |
, Prod.Tenant2 = Some { account = "g", token = "h" } | |
} | |
let tenantClusterAuthOf = | |
\(environment : Environment) -> | |
let TenantUnion | |
: Type | |
= tenantOf environment | |
in \(admissableTenant : TenantUnion) -> | |
let perEnv = merge tenantClusterAuthPerEnvironment environment | |
in merge perEnv admissableTenant | |
let tenantClusterAuthSomeOf = | |
\(environment : Environment) -> | |
let TenantUnion | |
: Type | |
= tenantOf environment | |
in \(admissableTenant : TenantUnion) -> | |
let perEnv | |
: Handler | |
= merge tenantClusterAuthPerEnvironmentSome environment | |
in merge perEnv admissableTenant | |
in tenantClusterAuthOf Environment.Preprod Tenants.Preprod.Tenant2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment