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

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

-- | Parameters for Amazon Athena.
--
-- /See:/ 'newAthenaParameters' smart constructor.
data AthenaParameters = AthenaParameters'
  { -- | The workgroup that Amazon Athena uses.
    AthenaParameters -> Maybe Text
workGroup :: Prelude.Maybe Prelude.Text
  }
  deriving (AthenaParameters -> AthenaParameters -> Bool
(AthenaParameters -> AthenaParameters -> Bool)
-> (AthenaParameters -> AthenaParameters -> Bool)
-> Eq AthenaParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AthenaParameters -> AthenaParameters -> Bool
$c/= :: AthenaParameters -> AthenaParameters -> Bool
== :: AthenaParameters -> AthenaParameters -> Bool
$c== :: AthenaParameters -> AthenaParameters -> Bool
Prelude.Eq, ReadPrec [AthenaParameters]
ReadPrec AthenaParameters
Int -> ReadS AthenaParameters
ReadS [AthenaParameters]
(Int -> ReadS AthenaParameters)
-> ReadS [AthenaParameters]
-> ReadPrec AthenaParameters
-> ReadPrec [AthenaParameters]
-> Read AthenaParameters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AthenaParameters]
$creadListPrec :: ReadPrec [AthenaParameters]
readPrec :: ReadPrec AthenaParameters
$creadPrec :: ReadPrec AthenaParameters
readList :: ReadS [AthenaParameters]
$creadList :: ReadS [AthenaParameters]
readsPrec :: Int -> ReadS AthenaParameters
$creadsPrec :: Int -> ReadS AthenaParameters
Prelude.Read, Int -> AthenaParameters -> ShowS
[AthenaParameters] -> ShowS
AthenaParameters -> String
(Int -> AthenaParameters -> ShowS)
-> (AthenaParameters -> String)
-> ([AthenaParameters] -> ShowS)
-> Show AthenaParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AthenaParameters] -> ShowS
$cshowList :: [AthenaParameters] -> ShowS
show :: AthenaParameters -> String
$cshow :: AthenaParameters -> String
showsPrec :: Int -> AthenaParameters -> ShowS
$cshowsPrec :: Int -> AthenaParameters -> ShowS
Prelude.Show, (forall x. AthenaParameters -> Rep AthenaParameters x)
-> (forall x. Rep AthenaParameters x -> AthenaParameters)
-> Generic AthenaParameters
forall x. Rep AthenaParameters x -> AthenaParameters
forall x. AthenaParameters -> Rep AthenaParameters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AthenaParameters x -> AthenaParameters
$cfrom :: forall x. AthenaParameters -> Rep AthenaParameters x
Prelude.Generic)

-- |
-- Create a value of 'AthenaParameters' 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:
--
-- 'workGroup', 'athenaParameters_workGroup' - The workgroup that Amazon Athena uses.
newAthenaParameters ::
  AthenaParameters
newAthenaParameters :: AthenaParameters
newAthenaParameters =
  AthenaParameters' :: Maybe Text -> AthenaParameters
AthenaParameters' {$sel:workGroup:AthenaParameters' :: Maybe Text
workGroup = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | The workgroup that Amazon Athena uses.
athenaParameters_workGroup :: Lens.Lens' AthenaParameters (Prelude.Maybe Prelude.Text)
athenaParameters_workGroup :: (Maybe Text -> f (Maybe Text))
-> AthenaParameters -> f AthenaParameters
athenaParameters_workGroup = (AthenaParameters -> Maybe Text)
-> (AthenaParameters -> Maybe Text -> AthenaParameters)
-> Lens AthenaParameters AthenaParameters (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AthenaParameters' {Maybe Text
workGroup :: Maybe Text
$sel:workGroup:AthenaParameters' :: AthenaParameters -> Maybe Text
workGroup} -> Maybe Text
workGroup) (\s :: AthenaParameters
s@AthenaParameters' {} Maybe Text
a -> AthenaParameters
s {$sel:workGroup:AthenaParameters' :: Maybe Text
workGroup = Maybe Text
a} :: AthenaParameters)

instance Core.FromJSON AthenaParameters where
  parseJSON :: Value -> Parser AthenaParameters
parseJSON =
    String
-> (Object -> Parser AthenaParameters)
-> Value
-> Parser AthenaParameters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AthenaParameters"
      ( \Object
x ->
          Maybe Text -> AthenaParameters
AthenaParameters'
            (Maybe Text -> AthenaParameters)
-> Parser (Maybe Text) -> Parser AthenaParameters
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"WorkGroup")
      )

instance Prelude.Hashable AthenaParameters

instance Prelude.NFData AthenaParameters

instance Core.ToJSON AthenaParameters where
  toJSON :: AthenaParameters -> Value
toJSON AthenaParameters' {Maybe Text
workGroup :: Maybe Text
$sel:workGroup:AthenaParameters' :: AthenaParameters -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"WorkGroup" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
workGroup]
      )