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

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

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

-- |
-- Create a value of 'PrestoParameters' 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', 'prestoParameters_host' - Host.
--
-- 'port', 'prestoParameters_port' - Port.
--
-- 'catalog', 'prestoParameters_catalog' - Catalog.
newPrestoParameters ::
  -- | 'host'
  Prelude.Text ->
  -- | 'port'
  Prelude.Natural ->
  -- | 'catalog'
  Prelude.Text ->
  PrestoParameters
newPrestoParameters :: Text -> Natural -> Text -> PrestoParameters
newPrestoParameters Text
pHost_ Natural
pPort_ Text
pCatalog_ =
  PrestoParameters' :: Text -> Natural -> Text -> PrestoParameters
PrestoParameters'
    { $sel:host:PrestoParameters' :: Text
host = Text
pHost_,
      $sel:port:PrestoParameters' :: Natural
port = Natural
pPort_,
      $sel:catalog:PrestoParameters' :: Text
catalog = Text
pCatalog_
    }

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

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

-- | Catalog.
prestoParameters_catalog :: Lens.Lens' PrestoParameters Prelude.Text
prestoParameters_catalog :: (Text -> f Text) -> PrestoParameters -> f PrestoParameters
prestoParameters_catalog = (PrestoParameters -> Text)
-> (PrestoParameters -> Text -> PrestoParameters)
-> Lens PrestoParameters PrestoParameters Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PrestoParameters' {Text
catalog :: Text
$sel:catalog:PrestoParameters' :: PrestoParameters -> Text
catalog} -> Text
catalog) (\s :: PrestoParameters
s@PrestoParameters' {} Text
a -> PrestoParameters
s {$sel:catalog:PrestoParameters' :: Text
catalog = Text
a} :: PrestoParameters)

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

instance Prelude.Hashable PrestoParameters

instance Prelude.NFData PrestoParameters

instance Core.ToJSON PrestoParameters where
  toJSON :: PrestoParameters -> Value
toJSON PrestoParameters' {Natural
Text
catalog :: Text
port :: Natural
host :: Text
$sel:catalog:PrestoParameters' :: PrestoParameters -> Text
$sel:port:PrestoParameters' :: PrestoParameters -> Natural
$sel:host:PrestoParameters' :: PrestoParameters -> 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
"Catalog" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
catalog)
          ]
      )