{-# 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.ConnectionConfiguration 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 ConnectionConfiguration = ConnectionConfiguration'
{
ConnectionConfiguration -> Text
databaseHost :: Prelude.Text,
ConnectionConfiguration -> Natural
databasePort :: Prelude.Natural,
ConnectionConfiguration -> Text
databaseName :: Prelude.Text,
ConnectionConfiguration -> Text
tableName :: Prelude.Text,
ConnectionConfiguration -> Text
secretArn :: Prelude.Text
}
deriving (ConnectionConfiguration -> ConnectionConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConnectionConfiguration -> ConnectionConfiguration -> Bool
$c/= :: ConnectionConfiguration -> ConnectionConfiguration -> Bool
== :: ConnectionConfiguration -> ConnectionConfiguration -> Bool
$c== :: ConnectionConfiguration -> ConnectionConfiguration -> Bool
Prelude.Eq, ReadPrec [ConnectionConfiguration]
ReadPrec ConnectionConfiguration
Int -> ReadS ConnectionConfiguration
ReadS [ConnectionConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConnectionConfiguration]
$creadListPrec :: ReadPrec [ConnectionConfiguration]
readPrec :: ReadPrec ConnectionConfiguration
$creadPrec :: ReadPrec ConnectionConfiguration
readList :: ReadS [ConnectionConfiguration]
$creadList :: ReadS [ConnectionConfiguration]
readsPrec :: Int -> ReadS ConnectionConfiguration
$creadsPrec :: Int -> ReadS ConnectionConfiguration
Prelude.Read, Int -> ConnectionConfiguration -> ShowS
[ConnectionConfiguration] -> ShowS
ConnectionConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConnectionConfiguration] -> ShowS
$cshowList :: [ConnectionConfiguration] -> ShowS
show :: ConnectionConfiguration -> String
$cshow :: ConnectionConfiguration -> String
showsPrec :: Int -> ConnectionConfiguration -> ShowS
$cshowsPrec :: Int -> ConnectionConfiguration -> ShowS
Prelude.Show, forall x. Rep ConnectionConfiguration x -> ConnectionConfiguration
forall x. ConnectionConfiguration -> Rep ConnectionConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConnectionConfiguration x -> ConnectionConfiguration
$cfrom :: forall x. ConnectionConfiguration -> Rep ConnectionConfiguration x
Prelude.Generic)
newConnectionConfiguration ::
Prelude.Text ->
Prelude.Natural ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
ConnectionConfiguration
newConnectionConfiguration :: Text -> Natural -> Text -> Text -> Text -> ConnectionConfiguration
newConnectionConfiguration
Text
pDatabaseHost_
Natural
pDatabasePort_
Text
pDatabaseName_
Text
pTableName_
Text
pSecretArn_ =
ConnectionConfiguration'
{ $sel:databaseHost:ConnectionConfiguration' :: Text
databaseHost =
Text
pDatabaseHost_,
$sel:databasePort:ConnectionConfiguration' :: Natural
databasePort = Natural
pDatabasePort_,
$sel:databaseName:ConnectionConfiguration' :: Text
databaseName = Text
pDatabaseName_,
$sel:tableName:ConnectionConfiguration' :: Text
tableName = Text
pTableName_,
$sel:secretArn:ConnectionConfiguration' :: Text
secretArn = Text
pSecretArn_
}
connectionConfiguration_databaseHost :: Lens.Lens' ConnectionConfiguration Prelude.Text
connectionConfiguration_databaseHost :: Lens' ConnectionConfiguration Text
connectionConfiguration_databaseHost = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectionConfiguration' {Text
databaseHost :: Text
$sel:databaseHost:ConnectionConfiguration' :: ConnectionConfiguration -> Text
databaseHost} -> Text
databaseHost) (\s :: ConnectionConfiguration
s@ConnectionConfiguration' {} Text
a -> ConnectionConfiguration
s {$sel:databaseHost:ConnectionConfiguration' :: Text
databaseHost = Text
a} :: ConnectionConfiguration)
connectionConfiguration_databasePort :: Lens.Lens' ConnectionConfiguration Prelude.Natural
connectionConfiguration_databasePort :: Lens' ConnectionConfiguration Natural
connectionConfiguration_databasePort = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectionConfiguration' {Natural
databasePort :: Natural
$sel:databasePort:ConnectionConfiguration' :: ConnectionConfiguration -> Natural
databasePort} -> Natural
databasePort) (\s :: ConnectionConfiguration
s@ConnectionConfiguration' {} Natural
a -> ConnectionConfiguration
s {$sel:databasePort:ConnectionConfiguration' :: Natural
databasePort = Natural
a} :: ConnectionConfiguration)
connectionConfiguration_databaseName :: Lens.Lens' ConnectionConfiguration Prelude.Text
connectionConfiguration_databaseName :: Lens' ConnectionConfiguration Text
connectionConfiguration_databaseName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectionConfiguration' {Text
databaseName :: Text
$sel:databaseName:ConnectionConfiguration' :: ConnectionConfiguration -> Text
databaseName} -> Text
databaseName) (\s :: ConnectionConfiguration
s@ConnectionConfiguration' {} Text
a -> ConnectionConfiguration
s {$sel:databaseName:ConnectionConfiguration' :: Text
databaseName = Text
a} :: ConnectionConfiguration)
connectionConfiguration_tableName :: Lens.Lens' ConnectionConfiguration Prelude.Text
connectionConfiguration_tableName :: Lens' ConnectionConfiguration Text
connectionConfiguration_tableName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectionConfiguration' {Text
tableName :: Text
$sel:tableName:ConnectionConfiguration' :: ConnectionConfiguration -> Text
tableName} -> Text
tableName) (\s :: ConnectionConfiguration
s@ConnectionConfiguration' {} Text
a -> ConnectionConfiguration
s {$sel:tableName:ConnectionConfiguration' :: Text
tableName = Text
a} :: ConnectionConfiguration)
connectionConfiguration_secretArn :: Lens.Lens' ConnectionConfiguration Prelude.Text
connectionConfiguration_secretArn :: Lens' ConnectionConfiguration Text
connectionConfiguration_secretArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectionConfiguration' {Text
secretArn :: Text
$sel:secretArn:ConnectionConfiguration' :: ConnectionConfiguration -> Text
secretArn} -> Text
secretArn) (\s :: ConnectionConfiguration
s@ConnectionConfiguration' {} Text
a -> ConnectionConfiguration
s {$sel:secretArn:ConnectionConfiguration' :: Text
secretArn = Text
a} :: ConnectionConfiguration)
instance Data.FromJSON ConnectionConfiguration where
parseJSON :: Value -> Parser ConnectionConfiguration
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"ConnectionConfiguration"
( \Object
x ->
Text -> Natural -> Text -> Text -> Text -> ConnectionConfiguration
ConnectionConfiguration'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"DatabaseHost")
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
"DatabasePort")
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
"DatabaseName")
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
"TableName")
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
"SecretArn")
)
instance Prelude.Hashable ConnectionConfiguration where
hashWithSalt :: Int -> ConnectionConfiguration -> Int
hashWithSalt Int
_salt ConnectionConfiguration' {Natural
Text
secretArn :: Text
tableName :: Text
databaseName :: Text
databasePort :: Natural
databaseHost :: Text
$sel:secretArn:ConnectionConfiguration' :: ConnectionConfiguration -> Text
$sel:tableName:ConnectionConfiguration' :: ConnectionConfiguration -> Text
$sel:databaseName:ConnectionConfiguration' :: ConnectionConfiguration -> Text
$sel:databasePort:ConnectionConfiguration' :: ConnectionConfiguration -> Natural
$sel:databaseHost:ConnectionConfiguration' :: ConnectionConfiguration -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
databaseHost
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
databasePort
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
databaseName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
tableName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
secretArn
instance Prelude.NFData ConnectionConfiguration where
rnf :: ConnectionConfiguration -> ()
rnf ConnectionConfiguration' {Natural
Text
secretArn :: Text
tableName :: Text
databaseName :: Text
databasePort :: Natural
databaseHost :: Text
$sel:secretArn:ConnectionConfiguration' :: ConnectionConfiguration -> Text
$sel:tableName:ConnectionConfiguration' :: ConnectionConfiguration -> Text
$sel:databaseName:ConnectionConfiguration' :: ConnectionConfiguration -> Text
$sel:databasePort:ConnectionConfiguration' :: ConnectionConfiguration -> Natural
$sel:databaseHost:ConnectionConfiguration' :: ConnectionConfiguration -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
databaseHost
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
databasePort
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
databaseName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
tableName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
secretArn
instance Data.ToJSON ConnectionConfiguration where
toJSON :: ConnectionConfiguration -> Value
toJSON ConnectionConfiguration' {Natural
Text
secretArn :: Text
tableName :: Text
databaseName :: Text
databasePort :: Natural
databaseHost :: Text
$sel:secretArn:ConnectionConfiguration' :: ConnectionConfiguration -> Text
$sel:tableName:ConnectionConfiguration' :: ConnectionConfiguration -> Text
$sel:databaseName:ConnectionConfiguration' :: ConnectionConfiguration -> Text
$sel:databasePort:ConnectionConfiguration' :: ConnectionConfiguration -> Natural
$sel:databaseHost:ConnectionConfiguration' :: ConnectionConfiguration -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"DatabaseHost" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
databaseHost),
forall a. a -> Maybe a
Prelude.Just (Key
"DatabasePort" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
databasePort),
forall a. a -> Maybe a
Prelude.Just (Key
"DatabaseName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
databaseName),
forall a. a -> Maybe a
Prelude.Just (Key
"TableName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
tableName),
forall a. a -> Maybe a
Prelude.Just (Key
"SecretArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
secretArn)
]
)