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

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

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

-- |
-- Create a value of 'OracleParameters' 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', 'oracleParameters_host' - An Oracle host.
--
-- 'port', 'oracleParameters_port' - Port.
--
-- 'database', 'oracleParameters_database' - Database.
newOracleParameters ::
  -- | 'host'
  Prelude.Text ->
  -- | 'port'
  Prelude.Natural ->
  -- | 'database'
  Prelude.Text ->
  OracleParameters
newOracleParameters :: Text -> Natural -> Text -> OracleParameters
newOracleParameters Text
pHost_ Natural
pPort_ Text
pDatabase_ =
  OracleParameters' :: Text -> Natural -> Text -> OracleParameters
OracleParameters'
    { $sel:host:OracleParameters' :: Text
host = Text
pHost_,
      $sel:port:OracleParameters' :: Natural
port = Natural
pPort_,
      $sel:database:OracleParameters' :: Text
database = Text
pDatabase_
    }

-- | An Oracle host.
oracleParameters_host :: Lens.Lens' OracleParameters Prelude.Text
oracleParameters_host :: (Text -> f Text) -> OracleParameters -> f OracleParameters
oracleParameters_host = (OracleParameters -> Text)
-> (OracleParameters -> Text -> OracleParameters)
-> Lens OracleParameters OracleParameters Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OracleParameters' {Text
host :: Text
$sel:host:OracleParameters' :: OracleParameters -> Text
host} -> Text
host) (\s :: OracleParameters
s@OracleParameters' {} Text
a -> OracleParameters
s {$sel:host:OracleParameters' :: Text
host = Text
a} :: OracleParameters)

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

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

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

instance Prelude.NFData OracleParameters

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