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

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

-- | The source analysis of the template.
--
-- /See:/ 'newTemplateSourceAnalysis' smart constructor.
data TemplateSourceAnalysis = TemplateSourceAnalysis'
  { -- | The Amazon Resource Name (ARN) of the resource.
    TemplateSourceAnalysis -> Text
arn :: Prelude.Text,
    -- | A structure containing information about the dataset references used as
    -- placeholders in the template.
    TemplateSourceAnalysis -> NonEmpty DataSetReference
dataSetReferences :: Prelude.NonEmpty DataSetReference
  }
  deriving (TemplateSourceAnalysis -> TemplateSourceAnalysis -> Bool
(TemplateSourceAnalysis -> TemplateSourceAnalysis -> Bool)
-> (TemplateSourceAnalysis -> TemplateSourceAnalysis -> Bool)
-> Eq TemplateSourceAnalysis
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TemplateSourceAnalysis -> TemplateSourceAnalysis -> Bool
$c/= :: TemplateSourceAnalysis -> TemplateSourceAnalysis -> Bool
== :: TemplateSourceAnalysis -> TemplateSourceAnalysis -> Bool
$c== :: TemplateSourceAnalysis -> TemplateSourceAnalysis -> Bool
Prelude.Eq, ReadPrec [TemplateSourceAnalysis]
ReadPrec TemplateSourceAnalysis
Int -> ReadS TemplateSourceAnalysis
ReadS [TemplateSourceAnalysis]
(Int -> ReadS TemplateSourceAnalysis)
-> ReadS [TemplateSourceAnalysis]
-> ReadPrec TemplateSourceAnalysis
-> ReadPrec [TemplateSourceAnalysis]
-> Read TemplateSourceAnalysis
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TemplateSourceAnalysis]
$creadListPrec :: ReadPrec [TemplateSourceAnalysis]
readPrec :: ReadPrec TemplateSourceAnalysis
$creadPrec :: ReadPrec TemplateSourceAnalysis
readList :: ReadS [TemplateSourceAnalysis]
$creadList :: ReadS [TemplateSourceAnalysis]
readsPrec :: Int -> ReadS TemplateSourceAnalysis
$creadsPrec :: Int -> ReadS TemplateSourceAnalysis
Prelude.Read, Int -> TemplateSourceAnalysis -> ShowS
[TemplateSourceAnalysis] -> ShowS
TemplateSourceAnalysis -> String
(Int -> TemplateSourceAnalysis -> ShowS)
-> (TemplateSourceAnalysis -> String)
-> ([TemplateSourceAnalysis] -> ShowS)
-> Show TemplateSourceAnalysis
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TemplateSourceAnalysis] -> ShowS
$cshowList :: [TemplateSourceAnalysis] -> ShowS
show :: TemplateSourceAnalysis -> String
$cshow :: TemplateSourceAnalysis -> String
showsPrec :: Int -> TemplateSourceAnalysis -> ShowS
$cshowsPrec :: Int -> TemplateSourceAnalysis -> ShowS
Prelude.Show, (forall x. TemplateSourceAnalysis -> Rep TemplateSourceAnalysis x)
-> (forall x.
    Rep TemplateSourceAnalysis x -> TemplateSourceAnalysis)
-> Generic TemplateSourceAnalysis
forall x. Rep TemplateSourceAnalysis x -> TemplateSourceAnalysis
forall x. TemplateSourceAnalysis -> Rep TemplateSourceAnalysis x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TemplateSourceAnalysis x -> TemplateSourceAnalysis
$cfrom :: forall x. TemplateSourceAnalysis -> Rep TemplateSourceAnalysis x
Prelude.Generic)

-- |
-- Create a value of 'TemplateSourceAnalysis' 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:
--
-- 'arn', 'templateSourceAnalysis_arn' - The Amazon Resource Name (ARN) of the resource.
--
-- 'dataSetReferences', 'templateSourceAnalysis_dataSetReferences' - A structure containing information about the dataset references used as
-- placeholders in the template.
newTemplateSourceAnalysis ::
  -- | 'arn'
  Prelude.Text ->
  -- | 'dataSetReferences'
  Prelude.NonEmpty DataSetReference ->
  TemplateSourceAnalysis
newTemplateSourceAnalysis :: Text -> NonEmpty DataSetReference -> TemplateSourceAnalysis
newTemplateSourceAnalysis Text
pArn_ NonEmpty DataSetReference
pDataSetReferences_ =
  TemplateSourceAnalysis' :: Text -> NonEmpty DataSetReference -> TemplateSourceAnalysis
TemplateSourceAnalysis'
    { $sel:arn:TemplateSourceAnalysis' :: Text
arn = Text
pArn_,
      $sel:dataSetReferences:TemplateSourceAnalysis' :: NonEmpty DataSetReference
dataSetReferences =
        Tagged
  (NonEmpty DataSetReference) (Identity (NonEmpty DataSetReference))
-> Tagged
     (NonEmpty DataSetReference) (Identity (NonEmpty DataSetReference))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
   (NonEmpty DataSetReference) (Identity (NonEmpty DataSetReference))
 -> Tagged
      (NonEmpty DataSetReference) (Identity (NonEmpty DataSetReference)))
-> NonEmpty DataSetReference -> NonEmpty DataSetReference
forall t b. AReview t b -> b -> t
Lens.# NonEmpty DataSetReference
pDataSetReferences_
    }

-- | The Amazon Resource Name (ARN) of the resource.
templateSourceAnalysis_arn :: Lens.Lens' TemplateSourceAnalysis Prelude.Text
templateSourceAnalysis_arn :: (Text -> f Text)
-> TemplateSourceAnalysis -> f TemplateSourceAnalysis
templateSourceAnalysis_arn = (TemplateSourceAnalysis -> Text)
-> (TemplateSourceAnalysis -> Text -> TemplateSourceAnalysis)
-> Lens TemplateSourceAnalysis TemplateSourceAnalysis Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateSourceAnalysis' {Text
arn :: Text
$sel:arn:TemplateSourceAnalysis' :: TemplateSourceAnalysis -> Text
arn} -> Text
arn) (\s :: TemplateSourceAnalysis
s@TemplateSourceAnalysis' {} Text
a -> TemplateSourceAnalysis
s {$sel:arn:TemplateSourceAnalysis' :: Text
arn = Text
a} :: TemplateSourceAnalysis)

-- | A structure containing information about the dataset references used as
-- placeholders in the template.
templateSourceAnalysis_dataSetReferences :: Lens.Lens' TemplateSourceAnalysis (Prelude.NonEmpty DataSetReference)
templateSourceAnalysis_dataSetReferences :: (NonEmpty DataSetReference -> f (NonEmpty DataSetReference))
-> TemplateSourceAnalysis -> f TemplateSourceAnalysis
templateSourceAnalysis_dataSetReferences = (TemplateSourceAnalysis -> NonEmpty DataSetReference)
-> (TemplateSourceAnalysis
    -> NonEmpty DataSetReference -> TemplateSourceAnalysis)
-> Lens
     TemplateSourceAnalysis
     TemplateSourceAnalysis
     (NonEmpty DataSetReference)
     (NonEmpty DataSetReference)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateSourceAnalysis' {NonEmpty DataSetReference
dataSetReferences :: NonEmpty DataSetReference
$sel:dataSetReferences:TemplateSourceAnalysis' :: TemplateSourceAnalysis -> NonEmpty DataSetReference
dataSetReferences} -> NonEmpty DataSetReference
dataSetReferences) (\s :: TemplateSourceAnalysis
s@TemplateSourceAnalysis' {} NonEmpty DataSetReference
a -> TemplateSourceAnalysis
s {$sel:dataSetReferences:TemplateSourceAnalysis' :: NonEmpty DataSetReference
dataSetReferences = NonEmpty DataSetReference
a} :: TemplateSourceAnalysis) ((NonEmpty DataSetReference -> f (NonEmpty DataSetReference))
 -> TemplateSourceAnalysis -> f TemplateSourceAnalysis)
-> ((NonEmpty DataSetReference -> f (NonEmpty DataSetReference))
    -> NonEmpty DataSetReference -> f (NonEmpty DataSetReference))
-> (NonEmpty DataSetReference -> f (NonEmpty DataSetReference))
-> TemplateSourceAnalysis
-> f TemplateSourceAnalysis
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty DataSetReference -> f (NonEmpty DataSetReference))
-> NonEmpty DataSetReference -> f (NonEmpty DataSetReference)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.Hashable TemplateSourceAnalysis

instance Prelude.NFData TemplateSourceAnalysis

instance Core.ToJSON TemplateSourceAnalysis where
  toJSON :: TemplateSourceAnalysis -> Value
toJSON TemplateSourceAnalysis' {NonEmpty DataSetReference
Text
dataSetReferences :: NonEmpty DataSetReference
arn :: Text
$sel:dataSetReferences:TemplateSourceAnalysis' :: TemplateSourceAnalysis -> NonEmpty DataSetReference
$sel:arn:TemplateSourceAnalysis' :: TemplateSourceAnalysis -> 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
"Arn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
arn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"DataSetReferences" Text -> NonEmpty DataSetReference -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty DataSetReference
dataSetReferences)
          ]
      )