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

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

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

-- |
-- Create a value of 'DashboardSourceEntity' 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', 'dashboardSourceEntity_sourceTemplate' - Source template.
newDashboardSourceEntity ::
  DashboardSourceEntity
newDashboardSourceEntity :: DashboardSourceEntity
newDashboardSourceEntity =
  DashboardSourceEntity' :: Maybe DashboardSourceTemplate -> DashboardSourceEntity
DashboardSourceEntity'
    { $sel:sourceTemplate:DashboardSourceEntity' :: Maybe DashboardSourceTemplate
sourceTemplate =
        Maybe DashboardSourceTemplate
forall a. Maybe a
Prelude.Nothing
    }

-- | Source template.
dashboardSourceEntity_sourceTemplate :: Lens.Lens' DashboardSourceEntity (Prelude.Maybe DashboardSourceTemplate)
dashboardSourceEntity_sourceTemplate :: (Maybe DashboardSourceTemplate
 -> f (Maybe DashboardSourceTemplate))
-> DashboardSourceEntity -> f DashboardSourceEntity
dashboardSourceEntity_sourceTemplate = (DashboardSourceEntity -> Maybe DashboardSourceTemplate)
-> (DashboardSourceEntity
    -> Maybe DashboardSourceTemplate -> DashboardSourceEntity)
-> Lens
     DashboardSourceEntity
     DashboardSourceEntity
     (Maybe DashboardSourceTemplate)
     (Maybe DashboardSourceTemplate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DashboardSourceEntity' {Maybe DashboardSourceTemplate
sourceTemplate :: Maybe DashboardSourceTemplate
$sel:sourceTemplate:DashboardSourceEntity' :: DashboardSourceEntity -> Maybe DashboardSourceTemplate
sourceTemplate} -> Maybe DashboardSourceTemplate
sourceTemplate) (\s :: DashboardSourceEntity
s@DashboardSourceEntity' {} Maybe DashboardSourceTemplate
a -> DashboardSourceEntity
s {$sel:sourceTemplate:DashboardSourceEntity' :: Maybe DashboardSourceTemplate
sourceTemplate = Maybe DashboardSourceTemplate
a} :: DashboardSourceEntity)

instance Prelude.Hashable DashboardSourceEntity

instance Prelude.NFData DashboardSourceEntity

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