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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.QuickSight.Types.AnalysisSourceTemplate

-- | The source entity of an analysis.
--
-- /See:/ 'newAnalysisSourceEntity' smart constructor.
data AnalysisSourceEntity = AnalysisSourceEntity'
  { -- | The source template for the source entity of the analysis.
    AnalysisSourceEntity -> Maybe AnalysisSourceTemplate
sourceTemplate :: Prelude.Maybe AnalysisSourceTemplate
  }
  deriving (AnalysisSourceEntity -> AnalysisSourceEntity -> Bool
(AnalysisSourceEntity -> AnalysisSourceEntity -> Bool)
-> (AnalysisSourceEntity -> AnalysisSourceEntity -> Bool)
-> Eq AnalysisSourceEntity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AnalysisSourceEntity -> AnalysisSourceEntity -> Bool
$c/= :: AnalysisSourceEntity -> AnalysisSourceEntity -> Bool
== :: AnalysisSourceEntity -> AnalysisSourceEntity -> Bool
$c== :: AnalysisSourceEntity -> AnalysisSourceEntity -> Bool
Prelude.Eq, ReadPrec [AnalysisSourceEntity]
ReadPrec AnalysisSourceEntity
Int -> ReadS AnalysisSourceEntity
ReadS [AnalysisSourceEntity]
(Int -> ReadS AnalysisSourceEntity)
-> ReadS [AnalysisSourceEntity]
-> ReadPrec AnalysisSourceEntity
-> ReadPrec [AnalysisSourceEntity]
-> Read AnalysisSourceEntity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AnalysisSourceEntity]
$creadListPrec :: ReadPrec [AnalysisSourceEntity]
readPrec :: ReadPrec AnalysisSourceEntity
$creadPrec :: ReadPrec AnalysisSourceEntity
readList :: ReadS [AnalysisSourceEntity]
$creadList :: ReadS [AnalysisSourceEntity]
readsPrec :: Int -> ReadS AnalysisSourceEntity
$creadsPrec :: Int -> ReadS AnalysisSourceEntity
Prelude.Read, Int -> AnalysisSourceEntity -> ShowS
[AnalysisSourceEntity] -> ShowS
AnalysisSourceEntity -> String
(Int -> AnalysisSourceEntity -> ShowS)
-> (AnalysisSourceEntity -> String)
-> ([AnalysisSourceEntity] -> ShowS)
-> Show AnalysisSourceEntity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AnalysisSourceEntity] -> ShowS
$cshowList :: [AnalysisSourceEntity] -> ShowS
show :: AnalysisSourceEntity -> String
$cshow :: AnalysisSourceEntity -> String
showsPrec :: Int -> AnalysisSourceEntity -> ShowS
$cshowsPrec :: Int -> AnalysisSourceEntity -> ShowS
Prelude.Show, (forall x. AnalysisSourceEntity -> Rep AnalysisSourceEntity x)
-> (forall x. Rep AnalysisSourceEntity x -> AnalysisSourceEntity)
-> Generic AnalysisSourceEntity
forall x. Rep AnalysisSourceEntity x -> AnalysisSourceEntity
forall x. AnalysisSourceEntity -> Rep AnalysisSourceEntity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AnalysisSourceEntity x -> AnalysisSourceEntity
$cfrom :: forall x. AnalysisSourceEntity -> Rep AnalysisSourceEntity x
Prelude.Generic)

-- |
-- Create a value of 'AnalysisSourceEntity' 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:
--
-- 'sourceTemplate', 'analysisSourceEntity_sourceTemplate' - The source template for the source entity of the analysis.
newAnalysisSourceEntity ::
  AnalysisSourceEntity
newAnalysisSourceEntity :: AnalysisSourceEntity
newAnalysisSourceEntity =
  AnalysisSourceEntity' :: Maybe AnalysisSourceTemplate -> AnalysisSourceEntity
AnalysisSourceEntity'
    { $sel:sourceTemplate:AnalysisSourceEntity' :: Maybe AnalysisSourceTemplate
sourceTemplate =
        Maybe AnalysisSourceTemplate
forall a. Maybe a
Prelude.Nothing
    }

-- | The source template for the source entity of the analysis.
analysisSourceEntity_sourceTemplate :: Lens.Lens' AnalysisSourceEntity (Prelude.Maybe AnalysisSourceTemplate)
analysisSourceEntity_sourceTemplate :: (Maybe AnalysisSourceTemplate -> f (Maybe AnalysisSourceTemplate))
-> AnalysisSourceEntity -> f AnalysisSourceEntity
analysisSourceEntity_sourceTemplate = (AnalysisSourceEntity -> Maybe AnalysisSourceTemplate)
-> (AnalysisSourceEntity
    -> Maybe AnalysisSourceTemplate -> AnalysisSourceEntity)
-> Lens
     AnalysisSourceEntity
     AnalysisSourceEntity
     (Maybe AnalysisSourceTemplate)
     (Maybe AnalysisSourceTemplate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnalysisSourceEntity' {Maybe AnalysisSourceTemplate
sourceTemplate :: Maybe AnalysisSourceTemplate
$sel:sourceTemplate:AnalysisSourceEntity' :: AnalysisSourceEntity -> Maybe AnalysisSourceTemplate
sourceTemplate} -> Maybe AnalysisSourceTemplate
sourceTemplate) (\s :: AnalysisSourceEntity
s@AnalysisSourceEntity' {} Maybe AnalysisSourceTemplate
a -> AnalysisSourceEntity
s {$sel:sourceTemplate:AnalysisSourceEntity' :: Maybe AnalysisSourceTemplate
sourceTemplate = Maybe AnalysisSourceTemplate
a} :: AnalysisSourceEntity)

instance Prelude.Hashable AnalysisSourceEntity

instance Prelude.NFData AnalysisSourceEntity

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