{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.AppSync.Types.RdsHttpEndpointConfig where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The Amazon RDS HTTP endpoint configuration.
--
-- /See:/ 'newRdsHttpEndpointConfig' smart constructor.
data RdsHttpEndpointConfig = RdsHttpEndpointConfig'
  { -- | Amazon RDS cluster ARN.
    RdsHttpEndpointConfig -> Maybe Text
dbClusterIdentifier :: Prelude.Maybe Prelude.Text,
    -- | Logical schema name.
    RdsHttpEndpointConfig -> Maybe Text
schema :: Prelude.Maybe Prelude.Text,
    -- | Logical database name.
    RdsHttpEndpointConfig -> Maybe Text
databaseName :: Prelude.Maybe Prelude.Text,
    -- | Amazon Web Services Region for RDS HTTP endpoint.
    RdsHttpEndpointConfig -> Maybe Text
awsRegion :: Prelude.Maybe Prelude.Text,
    -- | Amazon Web Services secret store ARN for database credentials.
    RdsHttpEndpointConfig -> Maybe Text
awsSecretStoreArn :: Prelude.Maybe Prelude.Text
  }
  deriving (RdsHttpEndpointConfig -> RdsHttpEndpointConfig -> Bool
(RdsHttpEndpointConfig -> RdsHttpEndpointConfig -> Bool)
-> (RdsHttpEndpointConfig -> RdsHttpEndpointConfig -> Bool)
-> Eq RdsHttpEndpointConfig
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]
(Int -> ReadS RdsHttpEndpointConfig)
-> ReadS [RdsHttpEndpointConfig]
-> ReadPrec RdsHttpEndpointConfig
-> ReadPrec [RdsHttpEndpointConfig]
-> Read 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
(Int -> RdsHttpEndpointConfig -> ShowS)
-> (RdsHttpEndpointConfig -> String)
-> ([RdsHttpEndpointConfig] -> ShowS)
-> Show RdsHttpEndpointConfig
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. RdsHttpEndpointConfig -> Rep RdsHttpEndpointConfig x)
-> (forall x. Rep RdsHttpEndpointConfig x -> RdsHttpEndpointConfig)
-> Generic RdsHttpEndpointConfig
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:
--
-- 'dbClusterIdentifier', 'rdsHttpEndpointConfig_dbClusterIdentifier' - Amazon RDS cluster ARN.
--
-- 'schema', 'rdsHttpEndpointConfig_schema' - Logical schema name.
--
-- 'databaseName', 'rdsHttpEndpointConfig_databaseName' - Logical database name.
--
-- 'awsRegion', 'rdsHttpEndpointConfig_awsRegion' - Amazon Web Services Region for RDS HTTP endpoint.
--
-- 'awsSecretStoreArn', 'rdsHttpEndpointConfig_awsSecretStoreArn' - Amazon Web Services secret store ARN for database credentials.
newRdsHttpEndpointConfig ::
  RdsHttpEndpointConfig
newRdsHttpEndpointConfig :: RdsHttpEndpointConfig
newRdsHttpEndpointConfig =
  RdsHttpEndpointConfig' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> RdsHttpEndpointConfig
RdsHttpEndpointConfig'
    { $sel:dbClusterIdentifier:RdsHttpEndpointConfig' :: Maybe Text
dbClusterIdentifier =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:schema:RdsHttpEndpointConfig' :: Maybe Text
schema = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:databaseName:RdsHttpEndpointConfig' :: Maybe Text
databaseName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:awsRegion:RdsHttpEndpointConfig' :: Maybe Text
awsRegion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:awsSecretStoreArn:RdsHttpEndpointConfig' :: Maybe Text
awsSecretStoreArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Amazon RDS cluster ARN.
rdsHttpEndpointConfig_dbClusterIdentifier :: Lens.Lens' RdsHttpEndpointConfig (Prelude.Maybe Prelude.Text)
rdsHttpEndpointConfig_dbClusterIdentifier :: (Maybe Text -> f (Maybe Text))
-> RdsHttpEndpointConfig -> f RdsHttpEndpointConfig
rdsHttpEndpointConfig_dbClusterIdentifier = (RdsHttpEndpointConfig -> Maybe Text)
-> (RdsHttpEndpointConfig -> Maybe Text -> RdsHttpEndpointConfig)
-> Lens
     RdsHttpEndpointConfig
     RdsHttpEndpointConfig
     (Maybe Text)
     (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> RdsHttpEndpointConfig -> f RdsHttpEndpointConfig
rdsHttpEndpointConfig_schema = (RdsHttpEndpointConfig -> Maybe Text)
-> (RdsHttpEndpointConfig -> Maybe Text -> RdsHttpEndpointConfig)
-> Lens
     RdsHttpEndpointConfig
     RdsHttpEndpointConfig
     (Maybe Text)
     (Maybe Text)
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)

-- | Logical database name.
rdsHttpEndpointConfig_databaseName :: Lens.Lens' RdsHttpEndpointConfig (Prelude.Maybe Prelude.Text)
rdsHttpEndpointConfig_databaseName :: (Maybe Text -> f (Maybe Text))
-> RdsHttpEndpointConfig -> f RdsHttpEndpointConfig
rdsHttpEndpointConfig_databaseName = (RdsHttpEndpointConfig -> Maybe Text)
-> (RdsHttpEndpointConfig -> Maybe Text -> RdsHttpEndpointConfig)
-> Lens
     RdsHttpEndpointConfig
     RdsHttpEndpointConfig
     (Maybe Text)
     (Maybe Text)
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 Web Services Region for RDS HTTP endpoint.
rdsHttpEndpointConfig_awsRegion :: Lens.Lens' RdsHttpEndpointConfig (Prelude.Maybe Prelude.Text)
rdsHttpEndpointConfig_awsRegion :: (Maybe Text -> f (Maybe Text))
-> RdsHttpEndpointConfig -> f RdsHttpEndpointConfig
rdsHttpEndpointConfig_awsRegion = (RdsHttpEndpointConfig -> Maybe Text)
-> (RdsHttpEndpointConfig -> Maybe Text -> RdsHttpEndpointConfig)
-> Lens
     RdsHttpEndpointConfig
     RdsHttpEndpointConfig
     (Maybe Text)
     (Maybe Text)
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 ARN for database credentials.
rdsHttpEndpointConfig_awsSecretStoreArn :: Lens.Lens' RdsHttpEndpointConfig (Prelude.Maybe Prelude.Text)
rdsHttpEndpointConfig_awsSecretStoreArn :: (Maybe Text -> f (Maybe Text))
-> RdsHttpEndpointConfig -> f RdsHttpEndpointConfig
rdsHttpEndpointConfig_awsSecretStoreArn = (RdsHttpEndpointConfig -> Maybe Text)
-> (RdsHttpEndpointConfig -> Maybe Text -> RdsHttpEndpointConfig)
-> Lens
     RdsHttpEndpointConfig
     RdsHttpEndpointConfig
     (Maybe Text)
     (Maybe Text)
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)

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

instance Prelude.Hashable RdsHttpEndpointConfig

instance Prelude.NFData RdsHttpEndpointConfig

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