{-# 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.QuickSight.Types.AuroraParameters
-- 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.QuickSight.Types.AuroraParameters where

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

-- | Parameters for Amazon Aurora.
--
-- /See:/ 'newAuroraParameters' smart constructor.
data AuroraParameters = AuroraParameters'
  { -- | Host.
    AuroraParameters -> Text
host :: Prelude.Text,
    -- | Port.
    AuroraParameters -> Natural
port :: Prelude.Natural,
    -- | Database.
    AuroraParameters -> Text
database :: Prelude.Text
  }
  deriving (AuroraParameters -> AuroraParameters -> Bool
(AuroraParameters -> AuroraParameters -> Bool)
-> (AuroraParameters -> AuroraParameters -> Bool)
-> Eq AuroraParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AuroraParameters -> AuroraParameters -> Bool
$c/= :: AuroraParameters -> AuroraParameters -> Bool
== :: AuroraParameters -> AuroraParameters -> Bool
$c== :: AuroraParameters -> AuroraParameters -> Bool
Prelude.Eq, ReadPrec [AuroraParameters]
ReadPrec AuroraParameters
Int -> ReadS AuroraParameters
ReadS [AuroraParameters]
(Int -> ReadS AuroraParameters)
-> ReadS [AuroraParameters]
-> ReadPrec AuroraParameters
-> ReadPrec [AuroraParameters]
-> Read AuroraParameters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AuroraParameters]
$creadListPrec :: ReadPrec [AuroraParameters]
readPrec :: ReadPrec AuroraParameters
$creadPrec :: ReadPrec AuroraParameters
readList :: ReadS [AuroraParameters]
$creadList :: ReadS [AuroraParameters]
readsPrec :: Int -> ReadS AuroraParameters
$creadsPrec :: Int -> ReadS AuroraParameters
Prelude.Read, Int -> AuroraParameters -> ShowS
[AuroraParameters] -> ShowS
AuroraParameters -> String
(Int -> AuroraParameters -> ShowS)
-> (AuroraParameters -> String)
-> ([AuroraParameters] -> ShowS)
-> Show AuroraParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AuroraParameters] -> ShowS
$cshowList :: [AuroraParameters] -> ShowS
show :: AuroraParameters -> String
$cshow :: AuroraParameters -> String
showsPrec :: Int -> AuroraParameters -> ShowS
$cshowsPrec :: Int -> AuroraParameters -> ShowS
Prelude.Show, (forall x. AuroraParameters -> Rep AuroraParameters x)
-> (forall x. Rep AuroraParameters x -> AuroraParameters)
-> Generic AuroraParameters
forall x. Rep AuroraParameters x -> AuroraParameters
forall x. AuroraParameters -> Rep AuroraParameters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AuroraParameters x -> AuroraParameters
$cfrom :: forall x. AuroraParameters -> Rep AuroraParameters x
Prelude.Generic)

-- |
-- Create a value of 'AuroraParameters' 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:
--
-- 'host', 'auroraParameters_host' - Host.
--
-- 'port', 'auroraParameters_port' - Port.
--
-- 'database', 'auroraParameters_database' - Database.
newAuroraParameters ::
  -- | 'host'
  Prelude.Text ->
  -- | 'port'
  Prelude.Natural ->
  -- | 'database'
  Prelude.Text ->
  AuroraParameters
newAuroraParameters :: Text -> Natural -> Text -> AuroraParameters
newAuroraParameters Text
pHost_ Natural
pPort_ Text
pDatabase_ =
  AuroraParameters' :: Text -> Natural -> Text -> AuroraParameters
AuroraParameters'
    { $sel:host:AuroraParameters' :: Text
host = Text
pHost_,
      $sel:port:AuroraParameters' :: Natural
port = Natural
pPort_,
      $sel:database:AuroraParameters' :: Text
database = Text
pDatabase_
    }

-- | Host.
auroraParameters_host :: Lens.Lens' AuroraParameters Prelude.Text
auroraParameters_host :: (Text -> f Text) -> AuroraParameters -> f AuroraParameters
auroraParameters_host = (AuroraParameters -> Text)
-> (AuroraParameters -> Text -> AuroraParameters)
-> Lens AuroraParameters AuroraParameters Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuroraParameters' {Text
host :: Text
$sel:host:AuroraParameters' :: AuroraParameters -> Text
host} -> Text
host) (\s :: AuroraParameters
s@AuroraParameters' {} Text
a -> AuroraParameters
s {$sel:host:AuroraParameters' :: Text
host = Text
a} :: AuroraParameters)

-- | Port.
auroraParameters_port :: Lens.Lens' AuroraParameters Prelude.Natural
auroraParameters_port :: (Natural -> f Natural) -> AuroraParameters -> f AuroraParameters
auroraParameters_port = (AuroraParameters -> Natural)
-> (AuroraParameters -> Natural -> AuroraParameters)
-> Lens AuroraParameters AuroraParameters Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuroraParameters' {Natural
port :: Natural
$sel:port:AuroraParameters' :: AuroraParameters -> Natural
port} -> Natural
port) (\s :: AuroraParameters
s@AuroraParameters' {} Natural
a -> AuroraParameters
s {$sel:port:AuroraParameters' :: Natural
port = Natural
a} :: AuroraParameters)

-- | Database.
auroraParameters_database :: Lens.Lens' AuroraParameters Prelude.Text
auroraParameters_database :: (Text -> f Text) -> AuroraParameters -> f AuroraParameters
auroraParameters_database = (AuroraParameters -> Text)
-> (AuroraParameters -> Text -> AuroraParameters)
-> Lens AuroraParameters AuroraParameters Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuroraParameters' {Text
database :: Text
$sel:database:AuroraParameters' :: AuroraParameters -> Text
database} -> Text
database) (\s :: AuroraParameters
s@AuroraParameters' {} Text
a -> AuroraParameters
s {$sel:database:AuroraParameters' :: Text
database = Text
a} :: AuroraParameters)

instance Core.FromJSON AuroraParameters where
  parseJSON :: Value -> Parser AuroraParameters
parseJSON =
    String
-> (Object -> Parser AuroraParameters)
-> Value
-> Parser AuroraParameters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AuroraParameters"
      ( \Object
x ->
          Text -> Natural -> Text -> AuroraParameters
AuroraParameters'
            (Text -> Natural -> Text -> AuroraParameters)
-> Parser Text -> Parser (Natural -> Text -> AuroraParameters)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Host")
            Parser (Natural -> Text -> AuroraParameters)
-> Parser Natural -> Parser (Text -> AuroraParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Port")
            Parser (Text -> AuroraParameters)
-> Parser Text -> Parser AuroraParameters
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Database")
      )

instance Prelude.Hashable AuroraParameters

instance Prelude.NFData AuroraParameters

instance Core.ToJSON AuroraParameters where
  toJSON :: AuroraParameters -> Value
toJSON AuroraParameters' {Natural
Text
database :: Text
port :: Natural
host :: Text
$sel:database:AuroraParameters' :: AuroraParameters -> Text
$sel:port:AuroraParameters' :: AuroraParameters -> Natural
$sel:host:AuroraParameters' :: AuroraParameters -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Host" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
host),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Port" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
port),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Database" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
database)
          ]
      )