{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.AppSync.Types.RdsHttpEndpointConfig
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.AppSync.Types.RdsHttpEndpointConfig 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

-- | The Amazon Relational Database Service (Amazon RDS) HTTP endpoint
-- configuration.
--
-- /See:/ 'newRdsHttpEndpointConfig' smart constructor.
data RdsHttpEndpointConfig = RdsHttpEndpointConfig'
  { -- | Amazon Web Services Region for Amazon RDS HTTP endpoint.
    RdsHttpEndpointConfig -> Maybe Text
awsRegion :: Prelude.Maybe Prelude.Text,
    -- | Amazon Web Services secret store Amazon Resource Name (ARN) for database
    -- credentials.
    RdsHttpEndpointConfig -> Maybe Text
awsSecretStoreArn :: Prelude.Maybe Prelude.Text,
    -- | Logical database name.
    RdsHttpEndpointConfig -> Maybe Text
databaseName :: Prelude.Maybe Prelude.Text,
    -- | Amazon RDS cluster Amazon Resource Name (ARN).
    RdsHttpEndpointConfig -> Maybe Text
dbClusterIdentifier :: Prelude.Maybe Prelude.Text,
    -- | Logical schema name.
    RdsHttpEndpointConfig -> Maybe Text
schema :: Prelude.Maybe Prelude.Text
  }
  deriving (RdsHttpEndpointConfig -> RdsHttpEndpointConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RdsHttpEndpointConfig -> RdsHttpEndpointConfig -> Bool
$c/= :: RdsHttpEndpointConfig -> RdsHttpEndpointConfig -> Bool
== :: RdsHttpEndpointConfig -> RdsHttpEndpointConfig -> Bool
$c== :: RdsHttpEndpointConfig -> RdsHttpEndpointConfig -> Bool
Prelude.Eq, ReadPrec [RdsHttpEndpointConfig]
ReadPrec RdsHttpEndpointConfig
Int -> ReadS RdsHttpEndpointConfig
ReadS [RdsHttpEndpointConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RdsHttpEndpointConfig]
$creadListPrec :: ReadPrec [RdsHttpEndpointConfig]
readPrec :: ReadPrec RdsHttpEndpointConfig
$creadPrec :: ReadPrec RdsHttpEndpointConfig
readList :: ReadS [RdsHttpEndpointConfig]
$creadList :: ReadS [RdsHttpEndpointConfig]
readsPrec :: Int -> ReadS RdsHttpEndpointConfig
$creadsPrec :: Int -> ReadS RdsHttpEndpointConfig
Prelude.Read, Int -> RdsHttpEndpointConfig -> ShowS
[RdsHttpEndpointConfig] -> ShowS
RdsHttpEndpointConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RdsHttpEndpointConfig] -> ShowS
$cshowList :: [RdsHttpEndpointConfig] -> ShowS
show :: RdsHttpEndpointConfig -> String
$cshow :: RdsHttpEndpointConfig -> String
showsPrec :: Int -> RdsHttpEndpointConfig -> ShowS
$cshowsPrec :: Int -> RdsHttpEndpointConfig -> ShowS
Prelude.Show, forall x. Rep RdsHttpEndpointConfig x -> RdsHttpEndpointConfig
forall x. RdsHttpEndpointConfig -> Rep RdsHttpEndpointConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RdsHttpEndpointConfig x -> RdsHttpEndpointConfig
$cfrom :: forall x. RdsHttpEndpointConfig -> Rep RdsHttpEndpointConfig x
Prelude.Generic)

-- |
-- Create a value of 'RdsHttpEndpointConfig' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'awsRegion', 'rdsHttpEndpointConfig_awsRegion' - Amazon Web Services Region for Amazon RDS HTTP endpoint.
--
-- 'awsSecretStoreArn', 'rdsHttpEndpointConfig_awsSecretStoreArn' - Amazon Web Services secret store Amazon Resource Name (ARN) for database
-- credentials.
--
-- 'databaseName', 'rdsHttpEndpointConfig_databaseName' - Logical database name.
--
-- 'dbClusterIdentifier', 'rdsHttpEndpointConfig_dbClusterIdentifier' - Amazon RDS cluster Amazon Resource Name (ARN).
--
-- 'schema', 'rdsHttpEndpointConfig_schema' - Logical schema name.
newRdsHttpEndpointConfig ::
  RdsHttpEndpointConfig
newRdsHttpEndpointConfig :: RdsHttpEndpointConfig
newRdsHttpEndpointConfig =
  RdsHttpEndpointConfig'
    { $sel:awsRegion:RdsHttpEndpointConfig' :: Maybe Text
awsRegion = forall a. Maybe a
Prelude.Nothing,
      $sel:awsSecretStoreArn:RdsHttpEndpointConfig' :: Maybe Text
awsSecretStoreArn = forall a. Maybe a
Prelude.Nothing,
      $sel:databaseName:RdsHttpEndpointConfig' :: Maybe Text
databaseName = forall a. Maybe a
Prelude.Nothing,
      $sel:dbClusterIdentifier:RdsHttpEndpointConfig' :: Maybe Text
dbClusterIdentifier = forall a. Maybe a
Prelude.Nothing,
      $sel:schema:RdsHttpEndpointConfig' :: Maybe Text
schema = forall a. Maybe a
Prelude.Nothing
    }

-- | Amazon Web Services Region for Amazon RDS HTTP endpoint.
rdsHttpEndpointConfig_awsRegion :: Lens.Lens' RdsHttpEndpointConfig (Prelude.Maybe Prelude.Text)
rdsHttpEndpointConfig_awsRegion :: Lens' RdsHttpEndpointConfig (Maybe Text)
rdsHttpEndpointConfig_awsRegion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RdsHttpEndpointConfig' {Maybe Text
awsRegion :: Maybe Text
$sel:awsRegion:RdsHttpEndpointConfig' :: RdsHttpEndpointConfig -> Maybe Text
awsRegion} -> Maybe Text
awsRegion) (\s :: RdsHttpEndpointConfig
s@RdsHttpEndpointConfig' {} Maybe Text
a -> RdsHttpEndpointConfig
s {$sel:awsRegion:RdsHttpEndpointConfig' :: Maybe Text
awsRegion = Maybe Text
a} :: RdsHttpEndpointConfig)

-- | Amazon Web Services secret store Amazon Resource Name (ARN) for database
-- credentials.
rdsHttpEndpointConfig_awsSecretStoreArn :: Lens.Lens' RdsHttpEndpointConfig (Prelude.Maybe Prelude.Text)
rdsHttpEndpointConfig_awsSecretStoreArn :: Lens' RdsHttpEndpointConfig (Maybe Text)
rdsHttpEndpointConfig_awsSecretStoreArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RdsHttpEndpointConfig' {Maybe Text
awsSecretStoreArn :: Maybe Text
$sel:awsSecretStoreArn:RdsHttpEndpointConfig' :: RdsHttpEndpointConfig -> Maybe Text
awsSecretStoreArn} -> Maybe Text
awsSecretStoreArn) (\s :: RdsHttpEndpointConfig
s@RdsHttpEndpointConfig' {} Maybe Text
a -> RdsHttpEndpointConfig
s {$sel:awsSecretStoreArn:RdsHttpEndpointConfig' :: Maybe Text
awsSecretStoreArn = Maybe Text
a} :: RdsHttpEndpointConfig)

-- | Logical database name.
rdsHttpEndpointConfig_databaseName :: Lens.Lens' RdsHttpEndpointConfig (Prelude.Maybe Prelude.Text)
rdsHttpEndpointConfig_databaseName :: Lens' RdsHttpEndpointConfig (Maybe Text)
rdsHttpEndpointConfig_databaseName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RdsHttpEndpointConfig' {Maybe Text
databaseName :: Maybe Text
$sel:databaseName:RdsHttpEndpointConfig' :: RdsHttpEndpointConfig -> Maybe Text
databaseName} -> Maybe Text
databaseName) (\s :: RdsHttpEndpointConfig
s@RdsHttpEndpointConfig' {} Maybe Text
a -> RdsHttpEndpointConfig
s {$sel:databaseName:RdsHttpEndpointConfig' :: Maybe Text
databaseName = Maybe Text
a} :: RdsHttpEndpointConfig)

-- | Amazon RDS cluster Amazon Resource Name (ARN).
rdsHttpEndpointConfig_dbClusterIdentifier :: Lens.Lens' RdsHttpEndpointConfig (Prelude.Maybe Prelude.Text)
rdsHttpEndpointConfig_dbClusterIdentifier :: Lens' RdsHttpEndpointConfig (Maybe Text)
rdsHttpEndpointConfig_dbClusterIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RdsHttpEndpointConfig' {Maybe Text
dbClusterIdentifier :: Maybe Text
$sel:dbClusterIdentifier:RdsHttpEndpointConfig' :: RdsHttpEndpointConfig -> Maybe Text
dbClusterIdentifier} -> Maybe Text
dbClusterIdentifier) (\s :: RdsHttpEndpointConfig
s@RdsHttpEndpointConfig' {} Maybe Text
a -> RdsHttpEndpointConfig
s {$sel:dbClusterIdentifier:RdsHttpEndpointConfig' :: Maybe Text
dbClusterIdentifier = Maybe Text
a} :: RdsHttpEndpointConfig)

-- | Logical schema name.
rdsHttpEndpointConfig_schema :: Lens.Lens' RdsHttpEndpointConfig (Prelude.Maybe Prelude.Text)
rdsHttpEndpointConfig_schema :: Lens' RdsHttpEndpointConfig (Maybe Text)
rdsHttpEndpointConfig_schema = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RdsHttpEndpointConfig' {Maybe Text
schema :: Maybe Text
$sel:schema:RdsHttpEndpointConfig' :: RdsHttpEndpointConfig -> Maybe Text
schema} -> Maybe Text
schema) (\s :: RdsHttpEndpointConfig
s@RdsHttpEndpointConfig' {} Maybe Text
a -> RdsHttpEndpointConfig
s {$sel:schema:RdsHttpEndpointConfig' :: Maybe Text
schema = Maybe Text
a} :: RdsHttpEndpointConfig)

instance Data.FromJSON RdsHttpEndpointConfig where
  parseJSON :: Value -> Parser RdsHttpEndpointConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RdsHttpEndpointConfig"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> RdsHttpEndpointConfig
RdsHttpEndpointConfig'
            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
"awsRegion")
            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
"awsSecretStoreArn")
            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
"databaseName")
            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
"dbClusterIdentifier")
            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
"schema")
      )

instance Prelude.Hashable RdsHttpEndpointConfig where
  hashWithSalt :: Int -> RdsHttpEndpointConfig -> Int
hashWithSalt Int
_salt RdsHttpEndpointConfig' {Maybe Text
schema :: Maybe Text
dbClusterIdentifier :: Maybe Text
databaseName :: Maybe Text
awsSecretStoreArn :: Maybe Text
awsRegion :: Maybe Text
$sel:schema:RdsHttpEndpointConfig' :: RdsHttpEndpointConfig -> Maybe Text
$sel:dbClusterIdentifier:RdsHttpEndpointConfig' :: RdsHttpEndpointConfig -> Maybe Text
$sel:databaseName:RdsHttpEndpointConfig' :: RdsHttpEndpointConfig -> Maybe Text
$sel:awsSecretStoreArn:RdsHttpEndpointConfig' :: RdsHttpEndpointConfig -> Maybe Text
$sel:awsRegion:RdsHttpEndpointConfig' :: RdsHttpEndpointConfig -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
awsRegion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
awsSecretStoreArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
databaseName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
dbClusterIdentifier
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
schema

instance Prelude.NFData RdsHttpEndpointConfig where
  rnf :: RdsHttpEndpointConfig -> ()
rnf RdsHttpEndpointConfig' {Maybe Text
schema :: Maybe Text
dbClusterIdentifier :: Maybe Text
databaseName :: Maybe Text
awsSecretStoreArn :: Maybe Text
awsRegion :: Maybe Text
$sel:schema:RdsHttpEndpointConfig' :: RdsHttpEndpointConfig -> Maybe Text
$sel:dbClusterIdentifier:RdsHttpEndpointConfig' :: RdsHttpEndpointConfig -> Maybe Text
$sel:databaseName:RdsHttpEndpointConfig' :: RdsHttpEndpointConfig -> Maybe Text
$sel:awsSecretStoreArn:RdsHttpEndpointConfig' :: RdsHttpEndpointConfig -> Maybe Text
$sel:awsRegion:RdsHttpEndpointConfig' :: RdsHttpEndpointConfig -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
awsRegion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
awsSecretStoreArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
databaseName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
dbClusterIdentifier
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
schema

instance Data.ToJSON RdsHttpEndpointConfig where
  toJSON :: RdsHttpEndpointConfig -> Value
toJSON RdsHttpEndpointConfig' {Maybe Text
schema :: Maybe Text
dbClusterIdentifier :: Maybe Text
databaseName :: Maybe Text
awsSecretStoreArn :: Maybe Text
awsRegion :: Maybe Text
$sel:schema:RdsHttpEndpointConfig' :: RdsHttpEndpointConfig -> Maybe Text
$sel:dbClusterIdentifier:RdsHttpEndpointConfig' :: RdsHttpEndpointConfig -> Maybe Text
$sel:databaseName:RdsHttpEndpointConfig' :: RdsHttpEndpointConfig -> Maybe Text
$sel:awsSecretStoreArn:RdsHttpEndpointConfig' :: RdsHttpEndpointConfig -> Maybe Text
$sel:awsRegion:RdsHttpEndpointConfig' :: RdsHttpEndpointConfig -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"awsRegion" 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
awsRegion,
            (Key
"awsSecretStoreArn" 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
awsSecretStoreArn,
            (Key
"databaseName" 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
databaseName,
            (Key
"dbClusterIdentifier" 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
dbClusterIdentifier,
            (Key
"schema" 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
schema
          ]
      )