{-# 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.Kendra.Types.ProxyConfiguration where
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 ProxyConfiguration = ProxyConfiguration'
{
ProxyConfiguration -> Maybe Text
credentials :: Prelude.Maybe Prelude.Text,
ProxyConfiguration -> Text
host :: Prelude.Text,
ProxyConfiguration -> Natural
port :: Prelude.Natural
}
deriving (ProxyConfiguration -> ProxyConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProxyConfiguration -> ProxyConfiguration -> Bool
$c/= :: ProxyConfiguration -> ProxyConfiguration -> Bool
== :: ProxyConfiguration -> ProxyConfiguration -> Bool
$c== :: ProxyConfiguration -> ProxyConfiguration -> Bool
Prelude.Eq, ReadPrec [ProxyConfiguration]
ReadPrec ProxyConfiguration
Int -> ReadS ProxyConfiguration
ReadS [ProxyConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProxyConfiguration]
$creadListPrec :: ReadPrec [ProxyConfiguration]
readPrec :: ReadPrec ProxyConfiguration
$creadPrec :: ReadPrec ProxyConfiguration
readList :: ReadS [ProxyConfiguration]
$creadList :: ReadS [ProxyConfiguration]
readsPrec :: Int -> ReadS ProxyConfiguration
$creadsPrec :: Int -> ReadS ProxyConfiguration
Prelude.Read, Int -> ProxyConfiguration -> ShowS
[ProxyConfiguration] -> ShowS
ProxyConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProxyConfiguration] -> ShowS
$cshowList :: [ProxyConfiguration] -> ShowS
show :: ProxyConfiguration -> String
$cshow :: ProxyConfiguration -> String
showsPrec :: Int -> ProxyConfiguration -> ShowS
$cshowsPrec :: Int -> ProxyConfiguration -> ShowS
Prelude.Show, forall x. Rep ProxyConfiguration x -> ProxyConfiguration
forall x. ProxyConfiguration -> Rep ProxyConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProxyConfiguration x -> ProxyConfiguration
$cfrom :: forall x. ProxyConfiguration -> Rep ProxyConfiguration x
Prelude.Generic)
newProxyConfiguration ::
Prelude.Text ->
Prelude.Natural ->
ProxyConfiguration
newProxyConfiguration :: Text -> Natural -> ProxyConfiguration
newProxyConfiguration Text
pHost_ Natural
pPort_ =
ProxyConfiguration'
{ $sel:credentials:ProxyConfiguration' :: Maybe Text
credentials = forall a. Maybe a
Prelude.Nothing,
$sel:host:ProxyConfiguration' :: Text
host = Text
pHost_,
$sel:port:ProxyConfiguration' :: Natural
port = Natural
pPort_
}
proxyConfiguration_credentials :: Lens.Lens' ProxyConfiguration (Prelude.Maybe Prelude.Text)
proxyConfiguration_credentials :: Lens' ProxyConfiguration (Maybe Text)
proxyConfiguration_credentials = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProxyConfiguration' {Maybe Text
credentials :: Maybe Text
$sel:credentials:ProxyConfiguration' :: ProxyConfiguration -> Maybe Text
credentials} -> Maybe Text
credentials) (\s :: ProxyConfiguration
s@ProxyConfiguration' {} Maybe Text
a -> ProxyConfiguration
s {$sel:credentials:ProxyConfiguration' :: Maybe Text
credentials = Maybe Text
a} :: ProxyConfiguration)
proxyConfiguration_host :: Lens.Lens' ProxyConfiguration Prelude.Text
proxyConfiguration_host :: Lens' ProxyConfiguration Text
proxyConfiguration_host = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProxyConfiguration' {Text
host :: Text
$sel:host:ProxyConfiguration' :: ProxyConfiguration -> Text
host} -> Text
host) (\s :: ProxyConfiguration
s@ProxyConfiguration' {} Text
a -> ProxyConfiguration
s {$sel:host:ProxyConfiguration' :: Text
host = Text
a} :: ProxyConfiguration)
proxyConfiguration_port :: Lens.Lens' ProxyConfiguration Prelude.Natural
proxyConfiguration_port :: Lens' ProxyConfiguration Natural
proxyConfiguration_port = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProxyConfiguration' {Natural
port :: Natural
$sel:port:ProxyConfiguration' :: ProxyConfiguration -> Natural
port} -> Natural
port) (\s :: ProxyConfiguration
s@ProxyConfiguration' {} Natural
a -> ProxyConfiguration
s {$sel:port:ProxyConfiguration' :: Natural
port = Natural
a} :: ProxyConfiguration)
instance Data.FromJSON ProxyConfiguration where
parseJSON :: Value -> Parser ProxyConfiguration
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"ProxyConfiguration"
( \Object
x ->
Maybe Text -> Text -> Natural -> ProxyConfiguration
ProxyConfiguration'
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
"Credentials")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Host")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Port")
)
instance Prelude.Hashable ProxyConfiguration where
hashWithSalt :: Int -> ProxyConfiguration -> Int
hashWithSalt Int
_salt ProxyConfiguration' {Natural
Maybe Text
Text
port :: Natural
host :: Text
credentials :: Maybe Text
$sel:port:ProxyConfiguration' :: ProxyConfiguration -> Natural
$sel:host:ProxyConfiguration' :: ProxyConfiguration -> Text
$sel:credentials:ProxyConfiguration' :: ProxyConfiguration -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
credentials
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
host
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
port
instance Prelude.NFData ProxyConfiguration where
rnf :: ProxyConfiguration -> ()
rnf ProxyConfiguration' {Natural
Maybe Text
Text
port :: Natural
host :: Text
credentials :: Maybe Text
$sel:port:ProxyConfiguration' :: ProxyConfiguration -> Natural
$sel:host:ProxyConfiguration' :: ProxyConfiguration -> Text
$sel:credentials:ProxyConfiguration' :: ProxyConfiguration -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
credentials
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
host
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
port
instance Data.ToJSON ProxyConfiguration where
toJSON :: ProxyConfiguration -> Value
toJSON ProxyConfiguration' {Natural
Maybe Text
Text
port :: Natural
host :: Text
credentials :: Maybe Text
$sel:port:ProxyConfiguration' :: ProxyConfiguration -> Natural
$sel:host:ProxyConfiguration' :: ProxyConfiguration -> Text
$sel:credentials:ProxyConfiguration' :: ProxyConfiguration -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Credentials" 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
credentials,
forall a. a -> Maybe a
Prelude.Just (Key
"Host" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
host),
forall a. a -> Maybe a
Prelude.Just (Key
"Port" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
port)
]
)