{-# 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.TeradataParameters
-- 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.TeradataParameters where

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

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

-- |
-- Create a value of 'TeradataParameters' 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', 'teradataParameters_host' - Host.
--
-- 'port', 'teradataParameters_port' - Port.
--
-- 'database', 'teradataParameters_database' - Database.
newTeradataParameters ::
  -- | 'host'
  Prelude.Text ->
  -- | 'port'
  Prelude.Natural ->
  -- | 'database'
  Prelude.Text ->
  TeradataParameters
newTeradataParameters :: Text -> Natural -> Text -> TeradataParameters
newTeradataParameters Text
pHost_ Natural
pPort_ Text
pDatabase_ =
  TeradataParameters' :: Text -> Natural -> Text -> TeradataParameters
TeradataParameters'
    { $sel:host:TeradataParameters' :: Text
host = Text
pHost_,
      $sel:port:TeradataParameters' :: Natural
port = Natural
pPort_,
      $sel:database:TeradataParameters' :: Text
database = Text
pDatabase_
    }

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

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

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

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

instance Prelude.NFData TeradataParameters

instance Core.ToJSON TeradataParameters where
  toJSON :: TeradataParameters -> Value
toJSON TeradataParameters' {Natural
Text
database :: Text
port :: Natural
host :: Text
$sel:database:TeradataParameters' :: TeradataParameters -> Text
$sel:port:TeradataParameters' :: TeradataParameters -> Natural
$sel:host:TeradataParameters' :: TeradataParameters -> 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)
          ]
      )