{-# 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.RobOMaker.Types.TemplateSummary
-- 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.RobOMaker.Types.TemplateSummary where

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

-- | Summary information for a template.
--
-- /See:/ 'newTemplateSummary' smart constructor.
data TemplateSummary = TemplateSummary'
  { -- | The time, in milliseconds since the epoch, when the template was last
    -- updated.
    TemplateSummary -> Maybe POSIX
lastUpdatedAt :: Prelude.Maybe Core.POSIX,
    -- | The Amazon Resource Name (ARN) of the template.
    TemplateSummary -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The time, in milliseconds since the epoch, when the template was
    -- created.
    TemplateSummary -> Maybe POSIX
createdAt :: Prelude.Maybe Core.POSIX,
    -- | The name of the template.
    TemplateSummary -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The version of the template that you\'re using.
    TemplateSummary -> Maybe Text
version :: Prelude.Maybe Prelude.Text
  }
  deriving (TemplateSummary -> TemplateSummary -> Bool
(TemplateSummary -> TemplateSummary -> Bool)
-> (TemplateSummary -> TemplateSummary -> Bool)
-> Eq TemplateSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TemplateSummary -> TemplateSummary -> Bool
$c/= :: TemplateSummary -> TemplateSummary -> Bool
== :: TemplateSummary -> TemplateSummary -> Bool
$c== :: TemplateSummary -> TemplateSummary -> Bool
Prelude.Eq, ReadPrec [TemplateSummary]
ReadPrec TemplateSummary
Int -> ReadS TemplateSummary
ReadS [TemplateSummary]
(Int -> ReadS TemplateSummary)
-> ReadS [TemplateSummary]
-> ReadPrec TemplateSummary
-> ReadPrec [TemplateSummary]
-> Read TemplateSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TemplateSummary]
$creadListPrec :: ReadPrec [TemplateSummary]
readPrec :: ReadPrec TemplateSummary
$creadPrec :: ReadPrec TemplateSummary
readList :: ReadS [TemplateSummary]
$creadList :: ReadS [TemplateSummary]
readsPrec :: Int -> ReadS TemplateSummary
$creadsPrec :: Int -> ReadS TemplateSummary
Prelude.Read, Int -> TemplateSummary -> ShowS
[TemplateSummary] -> ShowS
TemplateSummary -> String
(Int -> TemplateSummary -> ShowS)
-> (TemplateSummary -> String)
-> ([TemplateSummary] -> ShowS)
-> Show TemplateSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TemplateSummary] -> ShowS
$cshowList :: [TemplateSummary] -> ShowS
show :: TemplateSummary -> String
$cshow :: TemplateSummary -> String
showsPrec :: Int -> TemplateSummary -> ShowS
$cshowsPrec :: Int -> TemplateSummary -> ShowS
Prelude.Show, (forall x. TemplateSummary -> Rep TemplateSummary x)
-> (forall x. Rep TemplateSummary x -> TemplateSummary)
-> Generic TemplateSummary
forall x. Rep TemplateSummary x -> TemplateSummary
forall x. TemplateSummary -> Rep TemplateSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TemplateSummary x -> TemplateSummary
$cfrom :: forall x. TemplateSummary -> Rep TemplateSummary x
Prelude.Generic)

-- |
-- Create a value of 'TemplateSummary' 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:
--
-- 'lastUpdatedAt', 'templateSummary_lastUpdatedAt' - The time, in milliseconds since the epoch, when the template was last
-- updated.
--
-- 'arn', 'templateSummary_arn' - The Amazon Resource Name (ARN) of the template.
--
-- 'createdAt', 'templateSummary_createdAt' - The time, in milliseconds since the epoch, when the template was
-- created.
--
-- 'name', 'templateSummary_name' - The name of the template.
--
-- 'version', 'templateSummary_version' - The version of the template that you\'re using.
newTemplateSummary ::
  TemplateSummary
newTemplateSummary :: TemplateSummary
newTemplateSummary =
  TemplateSummary' :: Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> TemplateSummary
TemplateSummary'
    { $sel:lastUpdatedAt:TemplateSummary' :: Maybe POSIX
lastUpdatedAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:TemplateSummary' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createdAt:TemplateSummary' :: Maybe POSIX
createdAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:name:TemplateSummary' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:version:TemplateSummary' :: Maybe Text
version = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The time, in milliseconds since the epoch, when the template was last
-- updated.
templateSummary_lastUpdatedAt :: Lens.Lens' TemplateSummary (Prelude.Maybe Prelude.UTCTime)
templateSummary_lastUpdatedAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> TemplateSummary -> f TemplateSummary
templateSummary_lastUpdatedAt = (TemplateSummary -> Maybe POSIX)
-> (TemplateSummary -> Maybe POSIX -> TemplateSummary)
-> Lens TemplateSummary TemplateSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateSummary' {Maybe POSIX
lastUpdatedAt :: Maybe POSIX
$sel:lastUpdatedAt:TemplateSummary' :: TemplateSummary -> Maybe POSIX
lastUpdatedAt} -> Maybe POSIX
lastUpdatedAt) (\s :: TemplateSummary
s@TemplateSummary' {} Maybe POSIX
a -> TemplateSummary
s {$sel:lastUpdatedAt:TemplateSummary' :: Maybe POSIX
lastUpdatedAt = Maybe POSIX
a} :: TemplateSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> TemplateSummary -> f TemplateSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> TemplateSummary
-> f TemplateSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

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

-- | The time, in milliseconds since the epoch, when the template was
-- created.
templateSummary_createdAt :: Lens.Lens' TemplateSummary (Prelude.Maybe Prelude.UTCTime)
templateSummary_createdAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> TemplateSummary -> f TemplateSummary
templateSummary_createdAt = (TemplateSummary -> Maybe POSIX)
-> (TemplateSummary -> Maybe POSIX -> TemplateSummary)
-> Lens TemplateSummary TemplateSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateSummary' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:TemplateSummary' :: TemplateSummary -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: TemplateSummary
s@TemplateSummary' {} Maybe POSIX
a -> TemplateSummary
s {$sel:createdAt:TemplateSummary' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: TemplateSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> TemplateSummary -> f TemplateSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> TemplateSummary
-> f TemplateSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

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

-- | The version of the template that you\'re using.
templateSummary_version :: Lens.Lens' TemplateSummary (Prelude.Maybe Prelude.Text)
templateSummary_version :: (Maybe Text -> f (Maybe Text))
-> TemplateSummary -> f TemplateSummary
templateSummary_version = (TemplateSummary -> Maybe Text)
-> (TemplateSummary -> Maybe Text -> TemplateSummary)
-> Lens TemplateSummary TemplateSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateSummary' {Maybe Text
version :: Maybe Text
$sel:version:TemplateSummary' :: TemplateSummary -> Maybe Text
version} -> Maybe Text
version) (\s :: TemplateSummary
s@TemplateSummary' {} Maybe Text
a -> TemplateSummary
s {$sel:version:TemplateSummary' :: Maybe Text
version = Maybe Text
a} :: TemplateSummary)

instance Core.FromJSON TemplateSummary where
  parseJSON :: Value -> Parser TemplateSummary
parseJSON =
    String
-> (Object -> Parser TemplateSummary)
-> Value
-> Parser TemplateSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TemplateSummary"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> TemplateSummary
TemplateSummary'
            (Maybe POSIX
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> TemplateSummary)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe POSIX -> Maybe Text -> Maybe Text -> TemplateSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"lastUpdatedAt")
            Parser
  (Maybe Text
   -> Maybe POSIX -> Maybe Text -> Maybe Text -> TemplateSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX -> Maybe Text -> Maybe Text -> TemplateSummary)
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
"arn")
            Parser (Maybe POSIX -> Maybe Text -> Maybe Text -> TemplateSummary)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> Maybe Text -> TemplateSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"createdAt")
            Parser (Maybe Text -> Maybe Text -> TemplateSummary)
-> Parser (Maybe Text) -> Parser (Maybe Text -> TemplateSummary)
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
"name")
            Parser (Maybe Text -> TemplateSummary)
-> Parser (Maybe Text) -> Parser TemplateSummary
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
"version")
      )

instance Prelude.Hashable TemplateSummary

instance Prelude.NFData TemplateSummary