{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.AppSync.Types.HttpDataSourceConfig where
import Amazonka.AppSync.Types.AuthorizationConfig
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data HttpDataSourceConfig = HttpDataSourceConfig'
{
HttpDataSourceConfig -> Maybe AuthorizationConfig
authorizationConfig :: Prelude.Maybe AuthorizationConfig,
HttpDataSourceConfig -> Maybe Text
endpoint :: Prelude.Maybe Prelude.Text
}
deriving (HttpDataSourceConfig -> HttpDataSourceConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HttpDataSourceConfig -> HttpDataSourceConfig -> Bool
$c/= :: HttpDataSourceConfig -> HttpDataSourceConfig -> Bool
== :: HttpDataSourceConfig -> HttpDataSourceConfig -> Bool
$c== :: HttpDataSourceConfig -> HttpDataSourceConfig -> Bool
Prelude.Eq, ReadPrec [HttpDataSourceConfig]
ReadPrec HttpDataSourceConfig
Int -> ReadS HttpDataSourceConfig
ReadS [HttpDataSourceConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HttpDataSourceConfig]
$creadListPrec :: ReadPrec [HttpDataSourceConfig]
readPrec :: ReadPrec HttpDataSourceConfig
$creadPrec :: ReadPrec HttpDataSourceConfig
readList :: ReadS [HttpDataSourceConfig]
$creadList :: ReadS [HttpDataSourceConfig]
readsPrec :: Int -> ReadS HttpDataSourceConfig
$creadsPrec :: Int -> ReadS HttpDataSourceConfig
Prelude.Read, Int -> HttpDataSourceConfig -> ShowS
[HttpDataSourceConfig] -> ShowS
HttpDataSourceConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HttpDataSourceConfig] -> ShowS
$cshowList :: [HttpDataSourceConfig] -> ShowS
show :: HttpDataSourceConfig -> String
$cshow :: HttpDataSourceConfig -> String
showsPrec :: Int -> HttpDataSourceConfig -> ShowS
$cshowsPrec :: Int -> HttpDataSourceConfig -> ShowS
Prelude.Show, forall x. Rep HttpDataSourceConfig x -> HttpDataSourceConfig
forall x. HttpDataSourceConfig -> Rep HttpDataSourceConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HttpDataSourceConfig x -> HttpDataSourceConfig
$cfrom :: forall x. HttpDataSourceConfig -> Rep HttpDataSourceConfig x
Prelude.Generic)
newHttpDataSourceConfig ::
HttpDataSourceConfig
newHttpDataSourceConfig :: HttpDataSourceConfig
newHttpDataSourceConfig =
HttpDataSourceConfig'
{ $sel:authorizationConfig:HttpDataSourceConfig' :: Maybe AuthorizationConfig
authorizationConfig =
forall a. Maybe a
Prelude.Nothing,
$sel:endpoint:HttpDataSourceConfig' :: Maybe Text
endpoint = forall a. Maybe a
Prelude.Nothing
}
httpDataSourceConfig_authorizationConfig :: Lens.Lens' HttpDataSourceConfig (Prelude.Maybe AuthorizationConfig)
httpDataSourceConfig_authorizationConfig :: Lens' HttpDataSourceConfig (Maybe AuthorizationConfig)
httpDataSourceConfig_authorizationConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HttpDataSourceConfig' {Maybe AuthorizationConfig
authorizationConfig :: Maybe AuthorizationConfig
$sel:authorizationConfig:HttpDataSourceConfig' :: HttpDataSourceConfig -> Maybe AuthorizationConfig
authorizationConfig} -> Maybe AuthorizationConfig
authorizationConfig) (\s :: HttpDataSourceConfig
s@HttpDataSourceConfig' {} Maybe AuthorizationConfig
a -> HttpDataSourceConfig
s {$sel:authorizationConfig:HttpDataSourceConfig' :: Maybe AuthorizationConfig
authorizationConfig = Maybe AuthorizationConfig
a} :: HttpDataSourceConfig)
httpDataSourceConfig_endpoint :: Lens.Lens' HttpDataSourceConfig (Prelude.Maybe Prelude.Text)
httpDataSourceConfig_endpoint :: Lens' HttpDataSourceConfig (Maybe Text)
httpDataSourceConfig_endpoint = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HttpDataSourceConfig' {Maybe Text
endpoint :: Maybe Text
$sel:endpoint:HttpDataSourceConfig' :: HttpDataSourceConfig -> Maybe Text
endpoint} -> Maybe Text
endpoint) (\s :: HttpDataSourceConfig
s@HttpDataSourceConfig' {} Maybe Text
a -> HttpDataSourceConfig
s {$sel:endpoint:HttpDataSourceConfig' :: Maybe Text
endpoint = Maybe Text
a} :: HttpDataSourceConfig)
instance Data.FromJSON HttpDataSourceConfig where
parseJSON :: Value -> Parser HttpDataSourceConfig
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"HttpDataSourceConfig"
( \Object
x ->
Maybe AuthorizationConfig -> Maybe Text -> HttpDataSourceConfig
HttpDataSourceConfig'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"authorizationConfig")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"endpoint")
)
instance Prelude.Hashable HttpDataSourceConfig where
hashWithSalt :: Int -> HttpDataSourceConfig -> Int
hashWithSalt Int
_salt HttpDataSourceConfig' {Maybe Text
Maybe AuthorizationConfig
endpoint :: Maybe Text
authorizationConfig :: Maybe AuthorizationConfig
$sel:endpoint:HttpDataSourceConfig' :: HttpDataSourceConfig -> Maybe Text
$sel:authorizationConfig:HttpDataSourceConfig' :: HttpDataSourceConfig -> Maybe AuthorizationConfig
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AuthorizationConfig
authorizationConfig
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
endpoint
instance Prelude.NFData HttpDataSourceConfig where
rnf :: HttpDataSourceConfig -> ()
rnf HttpDataSourceConfig' {Maybe Text
Maybe AuthorizationConfig
endpoint :: Maybe Text
authorizationConfig :: Maybe AuthorizationConfig
$sel:endpoint:HttpDataSourceConfig' :: HttpDataSourceConfig -> Maybe Text
$sel:authorizationConfig:HttpDataSourceConfig' :: HttpDataSourceConfig -> Maybe AuthorizationConfig
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe AuthorizationConfig
authorizationConfig
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
endpoint
instance Data.ToJSON HttpDataSourceConfig where
toJSON :: HttpDataSourceConfig -> Value
toJSON HttpDataSourceConfig' {Maybe Text
Maybe AuthorizationConfig
endpoint :: Maybe Text
authorizationConfig :: Maybe AuthorizationConfig
$sel:endpoint:HttpDataSourceConfig' :: HttpDataSourceConfig -> Maybe Text
$sel:authorizationConfig:HttpDataSourceConfig' :: HttpDataSourceConfig -> Maybe AuthorizationConfig
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"authorizationConfig" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AuthorizationConfig
authorizationConfig,
(Key
"endpoint" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
endpoint
]
)