{-# LANGUAGE OverloadedLists #-}

module Hasura.Metadata.DTO.MetadataV3 (MetadataV3 (..)) where

import Autodocodec
  ( Autodocodec (Autodocodec),
    HasCodec (codec),
    object,
    optionalFieldWithOmittedDefault,
    optionalFieldWithOmittedDefault',
    optionalFieldWithOmittedDefaultWith,
    requiredFieldWith,
    (.=),
  )
import Autodocodec.Extended (versionField)
import Autodocodec.OpenAPI ()
import Data.Aeson (FromJSON, ToJSON)
import Data.HashMap.Strict.InsOrd.Autodocodec (sortedElemsCodec)
import Data.OpenApi qualified as OpenApi
import Hasura.Prelude
import Hasura.RQL.Types.Action (ActionMetadata (_amName))
import Hasura.RQL.Types.Allowlist (AllowlistEntry (aeCollection), MetadataAllowlist)
import Hasura.RQL.Types.ApiLimit (ApiLimit, emptyApiLimit)
import Hasura.RQL.Types.Common (MetricsConfig, emptyMetricsConfig)
import Hasura.RQL.Types.CustomTypes (CustomTypes, emptyCustomTypes)
import Hasura.RQL.Types.Endpoint (_ceName)
import Hasura.RQL.Types.GraphqlSchemaIntrospection (SetGraphqlIntrospectionOptions)
import Hasura.RQL.Types.Metadata.Common (Actions, BackendConfigWrapper, CronTriggers, Endpoints, InheritedRoles, QueryCollections, RemoteSchemas, Sources, sourcesCodec)
import Hasura.RQL.Types.OpenTelemetry (OpenTelemetryConfig, emptyOpenTelemetryConfig)
import Hasura.RQL.Types.QueryCollection qualified as QC
import Hasura.RQL.Types.Roles (Role (_rRoleName))
import Hasura.RQL.Types.ScheduledTrigger (CronTriggerMetadata (ctName))
import Hasura.RemoteSchema.Metadata.Core (RemoteSchemaMetadataG (_rsmName))
import Hasura.SQL.BackendMap (BackendMap)
import Network.Types.Extended (Network, emptyNetwork)

-- | Revision 3 of the Metadata export format. Note that values of the types,
-- 'PlaceholderArray' and 'PlaceholderObject' will eventually be expanded to represent more detail.
data MetadataV3 = MetadataV3
  { MetadataV3 -> Sources
metaV3Sources :: Sources,
    MetadataV3 -> RemoteSchemas
metaV3RemoteSchemas :: RemoteSchemas,
    MetadataV3 -> QueryCollections
metaV3QueryCollections :: QueryCollections,
    MetadataV3 -> MetadataAllowlist
metaV3Allowlist :: MetadataAllowlist,
    MetadataV3 -> Actions
metaV3Actions :: Actions,
    MetadataV3 -> CustomTypes
metaV3CustomTypes :: CustomTypes,
    MetadataV3 -> CronTriggers
metaV3CronTriggers :: CronTriggers,
    MetadataV3 -> Endpoints
metaV3RestEndpoints :: Endpoints,
    MetadataV3 -> ApiLimit
metaV3ApiLimits :: ApiLimit,
    MetadataV3 -> MetricsConfig
metaV3MetricsConfig :: MetricsConfig,
    MetadataV3 -> InheritedRoles
metaV3InheritedRoles :: InheritedRoles,
    MetadataV3 -> SetGraphqlIntrospectionOptions
metaV3GraphqlSchemaIntrospection :: SetGraphqlIntrospectionOptions,
    MetadataV3 -> Network
metaV3Network :: Network,
    MetadataV3 -> BackendMap BackendConfigWrapper
metaV3BackendConfigs :: BackendMap BackendConfigWrapper,
    MetadataV3 -> OpenTelemetryConfig
metaV3OpenTelemetryConfig :: OpenTelemetryConfig
  }
  deriving stock (Int -> MetadataV3 -> ShowS
[MetadataV3] -> ShowS
MetadataV3 -> String
(Int -> MetadataV3 -> ShowS)
-> (MetadataV3 -> String)
-> ([MetadataV3] -> ShowS)
-> Show MetadataV3
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> MetadataV3 -> ShowS
showsPrec :: Int -> MetadataV3 -> ShowS
$cshow :: MetadataV3 -> String
show :: MetadataV3 -> String
$cshowList :: [MetadataV3] -> ShowS
showList :: [MetadataV3] -> ShowS
Show, MetadataV3 -> MetadataV3 -> Bool
(MetadataV3 -> MetadataV3 -> Bool)
-> (MetadataV3 -> MetadataV3 -> Bool) -> Eq MetadataV3
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MetadataV3 -> MetadataV3 -> Bool
== :: MetadataV3 -> MetadataV3 -> Bool
$c/= :: MetadataV3 -> MetadataV3 -> Bool
/= :: MetadataV3 -> MetadataV3 -> Bool
Eq, (forall x. MetadataV3 -> Rep MetadataV3 x)
-> (forall x. Rep MetadataV3 x -> MetadataV3) -> Generic MetadataV3
forall x. Rep MetadataV3 x -> MetadataV3
forall x. MetadataV3 -> Rep MetadataV3 x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. MetadataV3 -> Rep MetadataV3 x
from :: forall x. MetadataV3 -> Rep MetadataV3 x
$cto :: forall x. Rep MetadataV3 x -> MetadataV3
to :: forall x. Rep MetadataV3 x -> MetadataV3
Generic)
  deriving (Value -> Parser [MetadataV3]
Value -> Parser MetadataV3
(Value -> Parser MetadataV3)
-> (Value -> Parser [MetadataV3]) -> FromJSON MetadataV3
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
$cparseJSON :: Value -> Parser MetadataV3
parseJSON :: Value -> Parser MetadataV3
$cparseJSONList :: Value -> Parser [MetadataV3]
parseJSONList :: Value -> Parser [MetadataV3]
FromJSON, [MetadataV3] -> Value
[MetadataV3] -> Encoding
MetadataV3 -> Value
MetadataV3 -> Encoding
(MetadataV3 -> Value)
-> (MetadataV3 -> Encoding)
-> ([MetadataV3] -> Value)
-> ([MetadataV3] -> Encoding)
-> ToJSON MetadataV3
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
$ctoJSON :: MetadataV3 -> Value
toJSON :: MetadataV3 -> Value
$ctoEncoding :: MetadataV3 -> Encoding
toEncoding :: MetadataV3 -> Encoding
$ctoJSONList :: [MetadataV3] -> Value
toJSONList :: [MetadataV3] -> Value
$ctoEncodingList :: [MetadataV3] -> Encoding
toEncodingList :: [MetadataV3] -> Encoding
ToJSON, Typeable MetadataV3
Typeable MetadataV3
-> (Proxy MetadataV3 -> Declare (Definitions Schema) NamedSchema)
-> ToSchema MetadataV3
Proxy MetadataV3 -> Declare (Definitions Schema) NamedSchema
forall a.
Typeable a
-> (Proxy a -> Declare (Definitions Schema) NamedSchema)
-> ToSchema a
$cdeclareNamedSchema :: Proxy MetadataV3 -> Declare (Definitions Schema) NamedSchema
declareNamedSchema :: Proxy MetadataV3 -> Declare (Definitions Schema) NamedSchema
OpenApi.ToSchema) via (Autodocodec MetadataV3)

-- | Codecs simultaneously provide serialization logic for a type, and
-- documentation. A codec can be used to generate a specification in OpenAPI or
-- another format that matches the JSON serialization of the same type.
-- Documentation strings (the second argument to 'optionalField' and to
-- 'requiredField') appear in the generated specification for users' reference.
instance HasCodec MetadataV3 where
  codec :: JSONCodec MetadataV3
codec =
    Text -> ObjectCodec MetadataV3 MetadataV3 -> JSONCodec MetadataV3
forall input output.
Text -> ObjectCodec input output -> ValueCodec input output
object Text
"MetadataV3"
      (ObjectCodec MetadataV3 MetadataV3 -> JSONCodec MetadataV3)
-> ObjectCodec MetadataV3 MetadataV3 -> JSONCodec MetadataV3
forall a b. (a -> b) -> a -> b
$ Sources
-> RemoteSchemas
-> QueryCollections
-> MetadataAllowlist
-> Actions
-> CustomTypes
-> CronTriggers
-> Endpoints
-> ApiLimit
-> MetricsConfig
-> InheritedRoles
-> SetGraphqlIntrospectionOptions
-> Network
-> BackendMap BackendConfigWrapper
-> OpenTelemetryConfig
-> MetadataV3
MetadataV3
      (Sources
 -> RemoteSchemas
 -> QueryCollections
 -> MetadataAllowlist
 -> Actions
 -> CustomTypes
 -> CronTriggers
 -> Endpoints
 -> ApiLimit
 -> MetricsConfig
 -> InheritedRoles
 -> SetGraphqlIntrospectionOptions
 -> Network
 -> BackendMap BackendConfigWrapper
 -> OpenTelemetryConfig
 -> MetadataV3)
-> Codec Object MetadataV3 Scientific
-> Codec
     Object
     MetadataV3
     (Sources
      -> RemoteSchemas
      -> QueryCollections
      -> MetadataAllowlist
      -> Actions
      -> CustomTypes
      -> CronTriggers
      -> Endpoints
      -> ApiLimit
      -> MetricsConfig
      -> InheritedRoles
      -> SetGraphqlIntrospectionOptions
      -> Network
      -> BackendMap BackendConfigWrapper
      -> OpenTelemetryConfig
      -> MetadataV3)
forall a b.
a -> Codec Object MetadataV3 b -> Codec Object MetadataV3 a
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Integer -> Codec Object MetadataV3 Scientific
forall a. Integer -> ObjectCodec a Scientific
versionField Integer
3
      Codec
  Object
  MetadataV3
  (Sources
   -> RemoteSchemas
   -> QueryCollections
   -> MetadataAllowlist
   -> Actions
   -> CustomTypes
   -> CronTriggers
   -> Endpoints
   -> ApiLimit
   -> MetricsConfig
   -> InheritedRoles
   -> SetGraphqlIntrospectionOptions
   -> Network
   -> BackendMap BackendConfigWrapper
   -> OpenTelemetryConfig
   -> MetadataV3)
-> Codec Object MetadataV3 Sources
-> Codec
     Object
     MetadataV3
     (RemoteSchemas
      -> QueryCollections
      -> MetadataAllowlist
      -> Actions
      -> CustomTypes
      -> CronTriggers
      -> Endpoints
      -> ApiLimit
      -> MetricsConfig
      -> InheritedRoles
      -> SetGraphqlIntrospectionOptions
      -> Network
      -> BackendMap BackendConfigWrapper
      -> OpenTelemetryConfig
      -> MetadataV3)
forall a b.
Codec Object MetadataV3 (a -> b)
-> Codec Object MetadataV3 a -> Codec Object MetadataV3 b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Text
-> ValueCodec Sources Sources
-> Text
-> ObjectCodec Sources Sources
forall input output.
Text -> ValueCodec input output -> Text -> ObjectCodec input output
requiredFieldWith Text
"sources" ValueCodec Sources Sources
sourcesCodec Text
"configured databases"
      ObjectCodec Sources Sources
-> (MetadataV3 -> Sources) -> Codec Object MetadataV3 Sources
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
.= MetadataV3 -> Sources
metaV3Sources
        Codec
  Object
  MetadataV3
  (RemoteSchemas
   -> QueryCollections
   -> MetadataAllowlist
   -> Actions
   -> CustomTypes
   -> CronTriggers
   -> Endpoints
   -> ApiLimit
   -> MetricsConfig
   -> InheritedRoles
   -> SetGraphqlIntrospectionOptions
   -> Network
   -> BackendMap BackendConfigWrapper
   -> OpenTelemetryConfig
   -> MetadataV3)
-> Codec Object MetadataV3 RemoteSchemas
-> Codec
     Object
     MetadataV3
     (QueryCollections
      -> MetadataAllowlist
      -> Actions
      -> CustomTypes
      -> CronTriggers
      -> Endpoints
      -> ApiLimit
      -> MetricsConfig
      -> InheritedRoles
      -> SetGraphqlIntrospectionOptions
      -> Network
      -> BackendMap BackendConfigWrapper
      -> OpenTelemetryConfig
      -> MetadataV3)
forall a b.
Codec Object MetadataV3 (a -> b)
-> Codec Object MetadataV3 a -> Codec Object MetadataV3 b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Text
-> JSONCodec RemoteSchemas
-> RemoteSchemas
-> Text
-> ObjectCodec RemoteSchemas RemoteSchemas
forall output.
Eq output =>
Text
-> JSONCodec output -> output -> Text -> ObjectCodec output output
optionalFieldWithOmittedDefaultWith Text
"remote_schemas" ((RemoteSchemaMetadataG RemoteRelationshipDefinition
 -> RemoteSchemaName)
-> JSONCodec RemoteSchemas
forall a k.
(HasCodec a, Hashable k, Ord k, ToTxt k) =>
(a -> k) -> JSONCodec (InsOrdHashMap k a)
sortedElemsCodec RemoteSchemaMetadataG RemoteRelationshipDefinition
-> RemoteSchemaName
forall r. RemoteSchemaMetadataG r -> RemoteSchemaName
_rsmName) [] Text
"merge remote GraphQL schemas and provide a unified GraphQL API"
      ObjectCodec RemoteSchemas RemoteSchemas
-> (MetadataV3 -> RemoteSchemas)
-> Codec Object MetadataV3 RemoteSchemas
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
.= MetadataV3 -> RemoteSchemas
metaV3RemoteSchemas
        Codec
  Object
  MetadataV3
  (QueryCollections
   -> MetadataAllowlist
   -> Actions
   -> CustomTypes
   -> CronTriggers
   -> Endpoints
   -> ApiLimit
   -> MetricsConfig
   -> InheritedRoles
   -> SetGraphqlIntrospectionOptions
   -> Network
   -> BackendMap BackendConfigWrapper
   -> OpenTelemetryConfig
   -> MetadataV3)
-> Codec Object MetadataV3 QueryCollections
-> Codec
     Object
     MetadataV3
     (MetadataAllowlist
      -> Actions
      -> CustomTypes
      -> CronTriggers
      -> Endpoints
      -> ApiLimit
      -> MetricsConfig
      -> InheritedRoles
      -> SetGraphqlIntrospectionOptions
      -> Network
      -> BackendMap BackendConfigWrapper
      -> OpenTelemetryConfig
      -> MetadataV3)
forall a b.
Codec Object MetadataV3 (a -> b)
-> Codec Object MetadataV3 a -> Codec Object MetadataV3 b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Text
-> JSONCodec QueryCollections
-> QueryCollections
-> Text
-> ObjectCodec QueryCollections QueryCollections
forall output.
Eq output =>
Text
-> JSONCodec output -> output -> Text -> ObjectCodec output output
optionalFieldWithOmittedDefaultWith
          Text
"query_collections"
          ((CreateCollection -> CollectionName) -> JSONCodec QueryCollections
forall a k.
(HasCodec a, Hashable k, Ord k, ToTxt k) =>
(a -> k) -> JSONCodec (InsOrdHashMap k a)
sortedElemsCodec CreateCollection -> CollectionName
QC._ccName)
          QueryCollections
forall a. Monoid a => a
mempty
          Text
"group queries using query collections"
      ObjectCodec QueryCollections QueryCollections
-> (MetadataV3 -> QueryCollections)
-> Codec Object MetadataV3 QueryCollections
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
.= MetadataV3 -> QueryCollections
metaV3QueryCollections
        Codec
  Object
  MetadataV3
  (MetadataAllowlist
   -> Actions
   -> CustomTypes
   -> CronTriggers
   -> Endpoints
   -> ApiLimit
   -> MetricsConfig
   -> InheritedRoles
   -> SetGraphqlIntrospectionOptions
   -> Network
   -> BackendMap BackendConfigWrapper
   -> OpenTelemetryConfig
   -> MetadataV3)
-> Codec Object MetadataV3 MetadataAllowlist
-> Codec
     Object
     MetadataV3
     (Actions
      -> CustomTypes
      -> CronTriggers
      -> Endpoints
      -> ApiLimit
      -> MetricsConfig
      -> InheritedRoles
      -> SetGraphqlIntrospectionOptions
      -> Network
      -> BackendMap BackendConfigWrapper
      -> OpenTelemetryConfig
      -> MetadataV3)
forall a b.
Codec Object MetadataV3 (a -> b)
-> Codec Object MetadataV3 a -> Codec Object MetadataV3 b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Text
-> JSONCodec MetadataAllowlist
-> MetadataAllowlist
-> Text
-> ObjectCodec MetadataAllowlist MetadataAllowlist
forall output.
Eq output =>
Text
-> JSONCodec output -> output -> Text -> ObjectCodec output output
optionalFieldWithOmittedDefaultWith Text
"allowlist" ((AllowlistEntry -> CollectionName) -> JSONCodec MetadataAllowlist
forall a k.
(HasCodec a, Hashable k, Ord k, ToTxt k) =>
(a -> k) -> JSONCodec (InsOrdHashMap k a)
sortedElemsCodec AllowlistEntry -> CollectionName
aeCollection) [] Text
"safe GraphQL operations - when allow lists are enabled only these operations are allowed"
      ObjectCodec MetadataAllowlist MetadataAllowlist
-> (MetadataV3 -> MetadataAllowlist)
-> Codec Object MetadataV3 MetadataAllowlist
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
.= MetadataV3 -> MetadataAllowlist
metaV3Allowlist
        Codec
  Object
  MetadataV3
  (Actions
   -> CustomTypes
   -> CronTriggers
   -> Endpoints
   -> ApiLimit
   -> MetricsConfig
   -> InheritedRoles
   -> SetGraphqlIntrospectionOptions
   -> Network
   -> BackendMap BackendConfigWrapper
   -> OpenTelemetryConfig
   -> MetadataV3)
-> Codec Object MetadataV3 Actions
-> Codec
     Object
     MetadataV3
     (CustomTypes
      -> CronTriggers
      -> Endpoints
      -> ApiLimit
      -> MetricsConfig
      -> InheritedRoles
      -> SetGraphqlIntrospectionOptions
      -> Network
      -> BackendMap BackendConfigWrapper
      -> OpenTelemetryConfig
      -> MetadataV3)
forall a b.
Codec Object MetadataV3 (a -> b)
-> Codec Object MetadataV3 a -> Codec Object MetadataV3 b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Text
-> JSONCodec Actions
-> Actions
-> Text
-> ObjectCodec Actions Actions
forall output.
Eq output =>
Text
-> JSONCodec output -> output -> Text -> ObjectCodec output output
optionalFieldWithOmittedDefaultWith Text
"actions" ((ActionMetadata -> ActionName) -> JSONCodec Actions
forall a k.
(HasCodec a, Hashable k, Ord k, ToTxt k) =>
(a -> k) -> JSONCodec (InsOrdHashMap k a)
sortedElemsCodec ActionMetadata -> ActionName
_amName) Actions
forall a. Monoid a => a
mempty Text
"action definitions which extend Hasura's schema with custom business logic using custom queries and mutations"
      ObjectCodec Actions Actions
-> (MetadataV3 -> Actions) -> Codec Object MetadataV3 Actions
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
.= MetadataV3 -> Actions
metaV3Actions
        Codec
  Object
  MetadataV3
  (CustomTypes
   -> CronTriggers
   -> Endpoints
   -> ApiLimit
   -> MetricsConfig
   -> InheritedRoles
   -> SetGraphqlIntrospectionOptions
   -> Network
   -> BackendMap BackendConfigWrapper
   -> OpenTelemetryConfig
   -> MetadataV3)
-> Codec Object MetadataV3 CustomTypes
-> Codec
     Object
     MetadataV3
     (CronTriggers
      -> Endpoints
      -> ApiLimit
      -> MetricsConfig
      -> InheritedRoles
      -> SetGraphqlIntrospectionOptions
      -> Network
      -> BackendMap BackendConfigWrapper
      -> OpenTelemetryConfig
      -> MetadataV3)
forall a b.
Codec Object MetadataV3 (a -> b)
-> Codec Object MetadataV3 a -> Codec Object MetadataV3 b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Text -> CustomTypes -> Text -> ObjectCodec CustomTypes CustomTypes
forall output.
(Eq output, HasCodec output) =>
Text -> output -> Text -> ObjectCodec output output
optionalFieldWithOmittedDefault Text
"custom_types" CustomTypes
emptyCustomTypes Text
"custom type definitions"
      ObjectCodec CustomTypes CustomTypes
-> (MetadataV3 -> CustomTypes)
-> Codec Object MetadataV3 CustomTypes
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
.= MetadataV3 -> CustomTypes
metaV3CustomTypes
        Codec
  Object
  MetadataV3
  (CronTriggers
   -> Endpoints
   -> ApiLimit
   -> MetricsConfig
   -> InheritedRoles
   -> SetGraphqlIntrospectionOptions
   -> Network
   -> BackendMap BackendConfigWrapper
   -> OpenTelemetryConfig
   -> MetadataV3)
-> Codec Object MetadataV3 CronTriggers
-> Codec
     Object
     MetadataV3
     (Endpoints
      -> ApiLimit
      -> MetricsConfig
      -> InheritedRoles
      -> SetGraphqlIntrospectionOptions
      -> Network
      -> BackendMap BackendConfigWrapper
      -> OpenTelemetryConfig
      -> MetadataV3)
forall a b.
Codec Object MetadataV3 (a -> b)
-> Codec Object MetadataV3 a -> Codec Object MetadataV3 b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Text
-> JSONCodec CronTriggers
-> CronTriggers
-> Text
-> ObjectCodec CronTriggers CronTriggers
forall output.
Eq output =>
Text
-> JSONCodec output -> output -> Text -> ObjectCodec output output
optionalFieldWithOmittedDefaultWith Text
"cron_triggers" ((CronTriggerMetadata -> TriggerName) -> JSONCodec CronTriggers
forall a k.
(HasCodec a, Hashable k, Ord k, ToTxt k) =>
(a -> k) -> JSONCodec (InsOrdHashMap k a)
sortedElemsCodec CronTriggerMetadata -> TriggerName
ctName) [] Text
"reliably trigger HTTP endpoints to run custom business logic periodically based on a cron schedule"
      ObjectCodec CronTriggers CronTriggers
-> (MetadataV3 -> CronTriggers)
-> Codec Object MetadataV3 CronTriggers
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
.= MetadataV3 -> CronTriggers
metaV3CronTriggers
        Codec
  Object
  MetadataV3
  (Endpoints
   -> ApiLimit
   -> MetricsConfig
   -> InheritedRoles
   -> SetGraphqlIntrospectionOptions
   -> Network
   -> BackendMap BackendConfigWrapper
   -> OpenTelemetryConfig
   -> MetadataV3)
-> Codec Object MetadataV3 Endpoints
-> Codec
     Object
     MetadataV3
     (ApiLimit
      -> MetricsConfig
      -> InheritedRoles
      -> SetGraphqlIntrospectionOptions
      -> Network
      -> BackendMap BackendConfigWrapper
      -> OpenTelemetryConfig
      -> MetadataV3)
forall a b.
Codec Object MetadataV3 (a -> b)
-> Codec Object MetadataV3 a -> Codec Object MetadataV3 b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Text
-> JSONCodec Endpoints
-> Endpoints
-> Text
-> ObjectCodec Endpoints Endpoints
forall output.
Eq output =>
Text
-> JSONCodec output -> output -> Text -> ObjectCodec output output
optionalFieldWithOmittedDefaultWith Text
"rest_endpoints" ((EndpointMetadata QueryReference -> EndpointName)
-> JSONCodec Endpoints
forall a k.
(HasCodec a, Hashable k, Ord k, ToTxt k) =>
(a -> k) -> JSONCodec (InsOrdHashMap k a)
sortedElemsCodec EndpointMetadata QueryReference -> EndpointName
forall query. EndpointMetadata query -> EndpointName
_ceName) [] Text
"REST interfaces to saved GraphQL queries and mutations"
      ObjectCodec Endpoints Endpoints
-> (MetadataV3 -> Endpoints) -> Codec Object MetadataV3 Endpoints
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
.= MetadataV3 -> Endpoints
metaV3RestEndpoints
        Codec
  Object
  MetadataV3
  (ApiLimit
   -> MetricsConfig
   -> InheritedRoles
   -> SetGraphqlIntrospectionOptions
   -> Network
   -> BackendMap BackendConfigWrapper
   -> OpenTelemetryConfig
   -> MetadataV3)
-> Codec Object MetadataV3 ApiLimit
-> Codec
     Object
     MetadataV3
     (MetricsConfig
      -> InheritedRoles
      -> SetGraphqlIntrospectionOptions
      -> Network
      -> BackendMap BackendConfigWrapper
      -> OpenTelemetryConfig
      -> MetadataV3)
forall a b.
Codec Object MetadataV3 (a -> b)
-> Codec Object MetadataV3 a -> Codec Object MetadataV3 b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Text -> ApiLimit -> Text -> ObjectCodec ApiLimit ApiLimit
forall output.
(Eq output, HasCodec output) =>
Text -> output -> Text -> ObjectCodec output output
optionalFieldWithOmittedDefault Text
"api_limits" ApiLimit
emptyApiLimit Text
"limts to depth and/or rate of API requests"
      ObjectCodec ApiLimit ApiLimit
-> (MetadataV3 -> ApiLimit) -> Codec Object MetadataV3 ApiLimit
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
.= MetadataV3 -> ApiLimit
metaV3ApiLimits
        Codec
  Object
  MetadataV3
  (MetricsConfig
   -> InheritedRoles
   -> SetGraphqlIntrospectionOptions
   -> Network
   -> BackendMap BackendConfigWrapper
   -> OpenTelemetryConfig
   -> MetadataV3)
-> Codec Object MetadataV3 MetricsConfig
-> Codec
     Object
     MetadataV3
     (InheritedRoles
      -> SetGraphqlIntrospectionOptions
      -> Network
      -> BackendMap BackendConfigWrapper
      -> OpenTelemetryConfig
      -> MetadataV3)
forall a b.
Codec Object MetadataV3 (a -> b)
-> Codec Object MetadataV3 a -> Codec Object MetadataV3 b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Text -> MetricsConfig -> ObjectCodec MetricsConfig MetricsConfig
forall output.
(Eq output, HasCodec output) =>
Text -> output -> ObjectCodec output output
optionalFieldWithOmittedDefault' Text
"metrics_config" MetricsConfig
emptyMetricsConfig
      ObjectCodec MetricsConfig MetricsConfig
-> (MetadataV3 -> MetricsConfig)
-> Codec Object MetadataV3 MetricsConfig
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
.= MetadataV3 -> MetricsConfig
metaV3MetricsConfig
        Codec
  Object
  MetadataV3
  (InheritedRoles
   -> SetGraphqlIntrospectionOptions
   -> Network
   -> BackendMap BackendConfigWrapper
   -> OpenTelemetryConfig
   -> MetadataV3)
-> Codec Object MetadataV3 InheritedRoles
-> Codec
     Object
     MetadataV3
     (SetGraphqlIntrospectionOptions
      -> Network
      -> BackendMap BackendConfigWrapper
      -> OpenTelemetryConfig
      -> MetadataV3)
forall a b.
Codec Object MetadataV3 (a -> b)
-> Codec Object MetadataV3 a -> Codec Object MetadataV3 b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Text
-> JSONCodec InheritedRoles
-> InheritedRoles
-> Text
-> ObjectCodec InheritedRoles InheritedRoles
forall output.
Eq output =>
Text
-> JSONCodec output -> output -> Text -> ObjectCodec output output
optionalFieldWithOmittedDefaultWith Text
"inherited_roles" ((Role -> RoleName) -> JSONCodec InheritedRoles
forall a k.
(HasCodec a, Hashable k, Ord k, ToTxt k) =>
(a -> k) -> JSONCodec (InsOrdHashMap k a)
sortedElemsCodec Role -> RoleName
_rRoleName) [] Text
"an inherited role is a way to create a new role which inherits permissions from two or more roles"
      ObjectCodec InheritedRoles InheritedRoles
-> (MetadataV3 -> InheritedRoles)
-> Codec Object MetadataV3 InheritedRoles
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
.= MetadataV3 -> InheritedRoles
metaV3InheritedRoles
        Codec
  Object
  MetadataV3
  (SetGraphqlIntrospectionOptions
   -> Network
   -> BackendMap BackendConfigWrapper
   -> OpenTelemetryConfig
   -> MetadataV3)
-> Codec Object MetadataV3 SetGraphqlIntrospectionOptions
-> Codec
     Object
     MetadataV3
     (Network
      -> BackendMap BackendConfigWrapper
      -> OpenTelemetryConfig
      -> MetadataV3)
forall a b.
Codec Object MetadataV3 (a -> b)
-> Codec Object MetadataV3 a -> Codec Object MetadataV3 b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Text
-> SetGraphqlIntrospectionOptions
-> ObjectCodec
     SetGraphqlIntrospectionOptions SetGraphqlIntrospectionOptions
forall output.
(Eq output, HasCodec output) =>
Text -> output -> ObjectCodec output output
optionalFieldWithOmittedDefault' Text
"graphql_schema_introspection" SetGraphqlIntrospectionOptions
forall a. Monoid a => a
mempty
      ObjectCodec
  SetGraphqlIntrospectionOptions SetGraphqlIntrospectionOptions
-> (MetadataV3 -> SetGraphqlIntrospectionOptions)
-> Codec Object MetadataV3 SetGraphqlIntrospectionOptions
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
.= MetadataV3 -> SetGraphqlIntrospectionOptions
metaV3GraphqlSchemaIntrospection
        Codec
  Object
  MetadataV3
  (Network
   -> BackendMap BackendConfigWrapper
   -> OpenTelemetryConfig
   -> MetadataV3)
-> Codec Object MetadataV3 Network
-> Codec
     Object
     MetadataV3
     (BackendMap BackendConfigWrapper
      -> OpenTelemetryConfig -> MetadataV3)
forall a b.
Codec Object MetadataV3 (a -> b)
-> Codec Object MetadataV3 a -> Codec Object MetadataV3 b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Text -> Network -> ObjectCodec Network Network
forall output.
(Eq output, HasCodec output) =>
Text -> output -> ObjectCodec output output
optionalFieldWithOmittedDefault' Text
"network" Network
emptyNetwork
      ObjectCodec Network Network
-> (MetadataV3 -> Network) -> Codec Object MetadataV3 Network
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
.= MetadataV3 -> Network
metaV3Network
        Codec
  Object
  MetadataV3
  (BackendMap BackendConfigWrapper
   -> OpenTelemetryConfig -> MetadataV3)
-> Codec Object MetadataV3 (BackendMap BackendConfigWrapper)
-> Codec Object MetadataV3 (OpenTelemetryConfig -> MetadataV3)
forall a b.
Codec Object MetadataV3 (a -> b)
-> Codec Object MetadataV3 a -> Codec Object MetadataV3 b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Text
-> BackendMap BackendConfigWrapper
-> ObjectCodec
     (BackendMap BackendConfigWrapper) (BackendMap BackendConfigWrapper)
forall output.
(Eq output, HasCodec output) =>
Text -> output -> ObjectCodec output output
optionalFieldWithOmittedDefault' Text
"backend_configs" BackendMap BackendConfigWrapper
forall a. Monoid a => a
mempty
      ObjectCodec
  (BackendMap BackendConfigWrapper) (BackendMap BackendConfigWrapper)
-> (MetadataV3 -> BackendMap BackendConfigWrapper)
-> Codec Object MetadataV3 (BackendMap BackendConfigWrapper)
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
.= MetadataV3 -> BackendMap BackendConfigWrapper
metaV3BackendConfigs
        Codec Object MetadataV3 (OpenTelemetryConfig -> MetadataV3)
-> Codec Object MetadataV3 OpenTelemetryConfig
-> ObjectCodec MetadataV3 MetadataV3
forall a b.
Codec Object MetadataV3 (a -> b)
-> Codec Object MetadataV3 a -> Codec Object MetadataV3 b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Text
-> OpenTelemetryConfig
-> ObjectCodec OpenTelemetryConfig OpenTelemetryConfig
forall output.
(Eq output, HasCodec output) =>
Text -> output -> ObjectCodec output output
optionalFieldWithOmittedDefault' Text
"opentelemetry" OpenTelemetryConfig
emptyOpenTelemetryConfig
      ObjectCodec OpenTelemetryConfig OpenTelemetryConfig
-> (MetadataV3 -> OpenTelemetryConfig)
-> Codec Object MetadataV3 OpenTelemetryConfig
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
.= MetadataV3 -> OpenTelemetryConfig
metaV3OpenTelemetryConfig