{-# 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.MariaDbParameters
-- 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.QuickSight.Types.MariaDbParameters 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 parameters for MariaDB.
--
-- /See:/ 'newMariaDbParameters' smart constructor.
data MariaDbParameters = MariaDbParameters'
  { -- | Host.
    MariaDbParameters -> Text
host :: Prelude.Text,
    -- | Port.
    MariaDbParameters -> Natural
port :: Prelude.Natural,
    -- | Database.
    MariaDbParameters -> Text
database :: Prelude.Text
  }
  deriving (MariaDbParameters -> MariaDbParameters -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MariaDbParameters -> MariaDbParameters -> Bool
$c/= :: MariaDbParameters -> MariaDbParameters -> Bool
== :: MariaDbParameters -> MariaDbParameters -> Bool
$c== :: MariaDbParameters -> MariaDbParameters -> Bool
Prelude.Eq, ReadPrec [MariaDbParameters]
ReadPrec MariaDbParameters
Int -> ReadS MariaDbParameters
ReadS [MariaDbParameters]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MariaDbParameters]
$creadListPrec :: ReadPrec [MariaDbParameters]
readPrec :: ReadPrec MariaDbParameters
$creadPrec :: ReadPrec MariaDbParameters
readList :: ReadS [MariaDbParameters]
$creadList :: ReadS [MariaDbParameters]
readsPrec :: Int -> ReadS MariaDbParameters
$creadsPrec :: Int -> ReadS MariaDbParameters
Prelude.Read, Int -> MariaDbParameters -> ShowS
[MariaDbParameters] -> ShowS
MariaDbParameters -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MariaDbParameters] -> ShowS
$cshowList :: [MariaDbParameters] -> ShowS
show :: MariaDbParameters -> String
$cshow :: MariaDbParameters -> String
showsPrec :: Int -> MariaDbParameters -> ShowS
$cshowsPrec :: Int -> MariaDbParameters -> ShowS
Prelude.Show, forall x. Rep MariaDbParameters x -> MariaDbParameters
forall x. MariaDbParameters -> Rep MariaDbParameters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MariaDbParameters x -> MariaDbParameters
$cfrom :: forall x. MariaDbParameters -> Rep MariaDbParameters x
Prelude.Generic)

-- |
-- Create a value of 'MariaDbParameters' 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', 'mariaDbParameters_host' - Host.
--
-- 'port', 'mariaDbParameters_port' - Port.
--
-- 'database', 'mariaDbParameters_database' - Database.
newMariaDbParameters ::
  -- | 'host'
  Prelude.Text ->
  -- | 'port'
  Prelude.Natural ->
  -- | 'database'
  Prelude.Text ->
  MariaDbParameters
newMariaDbParameters :: Text -> Natural -> Text -> MariaDbParameters
newMariaDbParameters Text
pHost_ Natural
pPort_ Text
pDatabase_ =
  MariaDbParameters'
    { $sel:host:MariaDbParameters' :: Text
host = Text
pHost_,
      $sel:port:MariaDbParameters' :: Natural
port = Natural
pPort_,
      $sel:database:MariaDbParameters' :: Text
database = Text
pDatabase_
    }

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

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

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

instance Data.FromJSON MariaDbParameters where
  parseJSON :: Value -> Parser MariaDbParameters
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"MariaDbParameters"
      ( \Object
x ->
          Text -> Natural -> Text -> MariaDbParameters
MariaDbParameters'
            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
"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")
            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
"Database")
      )

instance Prelude.Hashable MariaDbParameters where
  hashWithSalt :: Int -> MariaDbParameters -> Int
hashWithSalt Int
_salt MariaDbParameters' {Natural
Text
database :: Text
port :: Natural
host :: Text
$sel:database:MariaDbParameters' :: MariaDbParameters -> Text
$sel:port:MariaDbParameters' :: MariaDbParameters -> Natural
$sel:host:MariaDbParameters' :: MariaDbParameters -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
host
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
port
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
database

instance Prelude.NFData MariaDbParameters where
  rnf :: MariaDbParameters -> ()
rnf MariaDbParameters' {Natural
Text
database :: Text
port :: Natural
host :: Text
$sel:database:MariaDbParameters' :: MariaDbParameters -> Text
$sel:port:MariaDbParameters' :: MariaDbParameters -> Natural
$sel:host:MariaDbParameters' :: MariaDbParameters -> Text
..} =
    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
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
database

instance Data.ToJSON MariaDbParameters where
  toJSON :: MariaDbParameters -> Value
toJSON MariaDbParameters' {Natural
Text
database :: Text
port :: Natural
host :: Text
$sel:database:MariaDbParameters' :: MariaDbParameters -> Text
$sel:port:MariaDbParameters' :: MariaDbParameters -> Natural
$sel:host:MariaDbParameters' :: MariaDbParameters -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ 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),
            forall a. a -> Maybe a
Prelude.Just (Key
"Database" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
database)
          ]
      )