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

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

-- | The template alias.
--
-- /See:/ 'newTemplateAlias' smart constructor.
data TemplateAlias = TemplateAlias'
  { -- | The Amazon Resource Name (ARN) of the template alias.
    TemplateAlias -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The display name of the template alias.
    TemplateAlias -> Maybe Text
aliasName :: Prelude.Maybe Prelude.Text,
    -- | The version number of the template alias.
    TemplateAlias -> Maybe Natural
templateVersionNumber :: Prelude.Maybe Prelude.Natural
  }
  deriving (TemplateAlias -> TemplateAlias -> Bool
(TemplateAlias -> TemplateAlias -> Bool)
-> (TemplateAlias -> TemplateAlias -> Bool) -> Eq TemplateAlias
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TemplateAlias -> TemplateAlias -> Bool
$c/= :: TemplateAlias -> TemplateAlias -> Bool
== :: TemplateAlias -> TemplateAlias -> Bool
$c== :: TemplateAlias -> TemplateAlias -> Bool
Prelude.Eq, ReadPrec [TemplateAlias]
ReadPrec TemplateAlias
Int -> ReadS TemplateAlias
ReadS [TemplateAlias]
(Int -> ReadS TemplateAlias)
-> ReadS [TemplateAlias]
-> ReadPrec TemplateAlias
-> ReadPrec [TemplateAlias]
-> Read TemplateAlias
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TemplateAlias]
$creadListPrec :: ReadPrec [TemplateAlias]
readPrec :: ReadPrec TemplateAlias
$creadPrec :: ReadPrec TemplateAlias
readList :: ReadS [TemplateAlias]
$creadList :: ReadS [TemplateAlias]
readsPrec :: Int -> ReadS TemplateAlias
$creadsPrec :: Int -> ReadS TemplateAlias
Prelude.Read, Int -> TemplateAlias -> ShowS
[TemplateAlias] -> ShowS
TemplateAlias -> String
(Int -> TemplateAlias -> ShowS)
-> (TemplateAlias -> String)
-> ([TemplateAlias] -> ShowS)
-> Show TemplateAlias
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TemplateAlias] -> ShowS
$cshowList :: [TemplateAlias] -> ShowS
show :: TemplateAlias -> String
$cshow :: TemplateAlias -> String
showsPrec :: Int -> TemplateAlias -> ShowS
$cshowsPrec :: Int -> TemplateAlias -> ShowS
Prelude.Show, (forall x. TemplateAlias -> Rep TemplateAlias x)
-> (forall x. Rep TemplateAlias x -> TemplateAlias)
-> Generic TemplateAlias
forall x. Rep TemplateAlias x -> TemplateAlias
forall x. TemplateAlias -> Rep TemplateAlias x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TemplateAlias x -> TemplateAlias
$cfrom :: forall x. TemplateAlias -> Rep TemplateAlias x
Prelude.Generic)

-- |
-- Create a value of 'TemplateAlias' 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', 'templateAlias_arn' - The Amazon Resource Name (ARN) of the template alias.
--
-- 'aliasName', 'templateAlias_aliasName' - The display name of the template alias.
--
-- 'templateVersionNumber', 'templateAlias_templateVersionNumber' - The version number of the template alias.
newTemplateAlias ::
  TemplateAlias
newTemplateAlias :: TemplateAlias
newTemplateAlias =
  TemplateAlias' :: Maybe Text -> Maybe Text -> Maybe Natural -> TemplateAlias
TemplateAlias'
    { $sel:arn:TemplateAlias' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:aliasName:TemplateAlias' :: Maybe Text
aliasName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:templateVersionNumber:TemplateAlias' :: Maybe Natural
templateVersionNumber = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

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

-- | The display name of the template alias.
templateAlias_aliasName :: Lens.Lens' TemplateAlias (Prelude.Maybe Prelude.Text)
templateAlias_aliasName :: (Maybe Text -> f (Maybe Text)) -> TemplateAlias -> f TemplateAlias
templateAlias_aliasName = (TemplateAlias -> Maybe Text)
-> (TemplateAlias -> Maybe Text -> TemplateAlias)
-> Lens TemplateAlias TemplateAlias (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateAlias' {Maybe Text
aliasName :: Maybe Text
$sel:aliasName:TemplateAlias' :: TemplateAlias -> Maybe Text
aliasName} -> Maybe Text
aliasName) (\s :: TemplateAlias
s@TemplateAlias' {} Maybe Text
a -> TemplateAlias
s {$sel:aliasName:TemplateAlias' :: Maybe Text
aliasName = Maybe Text
a} :: TemplateAlias)

-- | The version number of the template alias.
templateAlias_templateVersionNumber :: Lens.Lens' TemplateAlias (Prelude.Maybe Prelude.Natural)
templateAlias_templateVersionNumber :: (Maybe Natural -> f (Maybe Natural))
-> TemplateAlias -> f TemplateAlias
templateAlias_templateVersionNumber = (TemplateAlias -> Maybe Natural)
-> (TemplateAlias -> Maybe Natural -> TemplateAlias)
-> Lens TemplateAlias TemplateAlias (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateAlias' {Maybe Natural
templateVersionNumber :: Maybe Natural
$sel:templateVersionNumber:TemplateAlias' :: TemplateAlias -> Maybe Natural
templateVersionNumber} -> Maybe Natural
templateVersionNumber) (\s :: TemplateAlias
s@TemplateAlias' {} Maybe Natural
a -> TemplateAlias
s {$sel:templateVersionNumber:TemplateAlias' :: Maybe Natural
templateVersionNumber = Maybe Natural
a} :: TemplateAlias)

instance Core.FromJSON TemplateAlias where
  parseJSON :: Value -> Parser TemplateAlias
parseJSON =
    String
-> (Object -> Parser TemplateAlias)
-> Value
-> Parser TemplateAlias
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TemplateAlias"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Natural -> TemplateAlias
TemplateAlias'
            (Maybe Text -> Maybe Text -> Maybe Natural -> TemplateAlias)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Natural -> TemplateAlias)
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
"Arn")
            Parser (Maybe Text -> Maybe Natural -> TemplateAlias)
-> Parser (Maybe Text) -> Parser (Maybe Natural -> TemplateAlias)
forall (f :: * -> *) a b. Applicative f => 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
"AliasName")
            Parser (Maybe Natural -> TemplateAlias)
-> Parser (Maybe Natural) -> Parser TemplateAlias
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TemplateVersionNumber")
      )

instance Prelude.Hashable TemplateAlias

instance Prelude.NFData TemplateAlias