{-# 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.Lens as Lens
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
(HttpDataSourceConfig -> HttpDataSourceConfig -> Bool)
-> (HttpDataSourceConfig -> HttpDataSourceConfig -> Bool)
-> Eq HttpDataSourceConfig
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]
(Int -> ReadS HttpDataSourceConfig)
-> ReadS [HttpDataSourceConfig]
-> ReadPrec HttpDataSourceConfig
-> ReadPrec [HttpDataSourceConfig]
-> Read 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
(Int -> HttpDataSourceConfig -> ShowS)
-> (HttpDataSourceConfig -> String)
-> ([HttpDataSourceConfig] -> ShowS)
-> Show HttpDataSourceConfig
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. HttpDataSourceConfig -> Rep HttpDataSourceConfig x)
-> (forall x. Rep HttpDataSourceConfig x -> HttpDataSourceConfig)
-> Generic HttpDataSourceConfig
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' :: Maybe AuthorizationConfig -> Maybe Text -> HttpDataSourceConfig
HttpDataSourceConfig'
{ $sel:authorizationConfig:HttpDataSourceConfig' :: Maybe AuthorizationConfig
authorizationConfig =
Maybe AuthorizationConfig
forall a. Maybe a
Prelude.Nothing,
$sel:endpoint:HttpDataSourceConfig' :: Maybe Text
endpoint = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
httpDataSourceConfig_authorizationConfig :: Lens.Lens' HttpDataSourceConfig (Prelude.Maybe AuthorizationConfig)
httpDataSourceConfig_authorizationConfig :: (Maybe AuthorizationConfig -> f (Maybe AuthorizationConfig))
-> HttpDataSourceConfig -> f HttpDataSourceConfig
httpDataSourceConfig_authorizationConfig = (HttpDataSourceConfig -> Maybe AuthorizationConfig)
-> (HttpDataSourceConfig
-> Maybe AuthorizationConfig -> HttpDataSourceConfig)
-> Lens
HttpDataSourceConfig
HttpDataSourceConfig
(Maybe AuthorizationConfig)
(Maybe 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 :: (Maybe Text -> f (Maybe Text))
-> HttpDataSourceConfig -> f HttpDataSourceConfig
httpDataSourceConfig_endpoint = (HttpDataSourceConfig -> Maybe Text)
-> (HttpDataSourceConfig -> Maybe Text -> HttpDataSourceConfig)
-> Lens
HttpDataSourceConfig HttpDataSourceConfig (Maybe Text) (Maybe Text)
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 Core.FromJSON HttpDataSourceConfig where
parseJSON :: Value -> Parser HttpDataSourceConfig
parseJSON =
String
-> (Object -> Parser HttpDataSourceConfig)
-> Value
-> Parser HttpDataSourceConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"HttpDataSourceConfig"
( \Object
x ->
Maybe AuthorizationConfig -> Maybe Text -> HttpDataSourceConfig
HttpDataSourceConfig'
(Maybe AuthorizationConfig -> Maybe Text -> HttpDataSourceConfig)
-> Parser (Maybe AuthorizationConfig)
-> Parser (Maybe Text -> HttpDataSourceConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe AuthorizationConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"authorizationConfig")
Parser (Maybe Text -> HttpDataSourceConfig)
-> Parser (Maybe Text) -> Parser HttpDataSourceConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"endpoint")
)
instance Prelude.Hashable HttpDataSourceConfig
instance Prelude.NFData HttpDataSourceConfig
instance Core.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
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"authorizationConfig" Text -> AuthorizationConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(AuthorizationConfig -> Pair)
-> Maybe AuthorizationConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AuthorizationConfig
authorizationConfig,
(Text
"endpoint" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
endpoint
]
)