{-# 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.IoT.Types.ProvisioningTemplateVersionSummary
-- 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.IoT.Types.ProvisioningTemplateVersionSummary where

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

-- | A summary of information about a fleet provision template version.
--
-- /See:/ 'newProvisioningTemplateVersionSummary' smart constructor.
data ProvisioningTemplateVersionSummary = ProvisioningTemplateVersionSummary'
  { -- | The ID of the fleet privisioning template version.
    ProvisioningTemplateVersionSummary -> Maybe Int
versionId :: Prelude.Maybe Prelude.Int,
    -- | The date when the fleet provisioning template version was created
    ProvisioningTemplateVersionSummary -> Maybe POSIX
creationDate :: Prelude.Maybe Core.POSIX,
    -- | True if the fleet provisioning template version is the default version,
    -- otherwise false.
    ProvisioningTemplateVersionSummary -> Maybe Bool
isDefaultVersion :: Prelude.Maybe Prelude.Bool
  }
  deriving (ProvisioningTemplateVersionSummary
-> ProvisioningTemplateVersionSummary -> Bool
(ProvisioningTemplateVersionSummary
 -> ProvisioningTemplateVersionSummary -> Bool)
-> (ProvisioningTemplateVersionSummary
    -> ProvisioningTemplateVersionSummary -> Bool)
-> Eq ProvisioningTemplateVersionSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProvisioningTemplateVersionSummary
-> ProvisioningTemplateVersionSummary -> Bool
$c/= :: ProvisioningTemplateVersionSummary
-> ProvisioningTemplateVersionSummary -> Bool
== :: ProvisioningTemplateVersionSummary
-> ProvisioningTemplateVersionSummary -> Bool
$c== :: ProvisioningTemplateVersionSummary
-> ProvisioningTemplateVersionSummary -> Bool
Prelude.Eq, ReadPrec [ProvisioningTemplateVersionSummary]
ReadPrec ProvisioningTemplateVersionSummary
Int -> ReadS ProvisioningTemplateVersionSummary
ReadS [ProvisioningTemplateVersionSummary]
(Int -> ReadS ProvisioningTemplateVersionSummary)
-> ReadS [ProvisioningTemplateVersionSummary]
-> ReadPrec ProvisioningTemplateVersionSummary
-> ReadPrec [ProvisioningTemplateVersionSummary]
-> Read ProvisioningTemplateVersionSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProvisioningTemplateVersionSummary]
$creadListPrec :: ReadPrec [ProvisioningTemplateVersionSummary]
readPrec :: ReadPrec ProvisioningTemplateVersionSummary
$creadPrec :: ReadPrec ProvisioningTemplateVersionSummary
readList :: ReadS [ProvisioningTemplateVersionSummary]
$creadList :: ReadS [ProvisioningTemplateVersionSummary]
readsPrec :: Int -> ReadS ProvisioningTemplateVersionSummary
$creadsPrec :: Int -> ReadS ProvisioningTemplateVersionSummary
Prelude.Read, Int -> ProvisioningTemplateVersionSummary -> ShowS
[ProvisioningTemplateVersionSummary] -> ShowS
ProvisioningTemplateVersionSummary -> String
(Int -> ProvisioningTemplateVersionSummary -> ShowS)
-> (ProvisioningTemplateVersionSummary -> String)
-> ([ProvisioningTemplateVersionSummary] -> ShowS)
-> Show ProvisioningTemplateVersionSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProvisioningTemplateVersionSummary] -> ShowS
$cshowList :: [ProvisioningTemplateVersionSummary] -> ShowS
show :: ProvisioningTemplateVersionSummary -> String
$cshow :: ProvisioningTemplateVersionSummary -> String
showsPrec :: Int -> ProvisioningTemplateVersionSummary -> ShowS
$cshowsPrec :: Int -> ProvisioningTemplateVersionSummary -> ShowS
Prelude.Show, (forall x.
 ProvisioningTemplateVersionSummary
 -> Rep ProvisioningTemplateVersionSummary x)
-> (forall x.
    Rep ProvisioningTemplateVersionSummary x
    -> ProvisioningTemplateVersionSummary)
-> Generic ProvisioningTemplateVersionSummary
forall x.
Rep ProvisioningTemplateVersionSummary x
-> ProvisioningTemplateVersionSummary
forall x.
ProvisioningTemplateVersionSummary
-> Rep ProvisioningTemplateVersionSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ProvisioningTemplateVersionSummary x
-> ProvisioningTemplateVersionSummary
$cfrom :: forall x.
ProvisioningTemplateVersionSummary
-> Rep ProvisioningTemplateVersionSummary x
Prelude.Generic)

-- |
-- Create a value of 'ProvisioningTemplateVersionSummary' 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:
--
-- 'versionId', 'provisioningTemplateVersionSummary_versionId' - The ID of the fleet privisioning template version.
--
-- 'creationDate', 'provisioningTemplateVersionSummary_creationDate' - The date when the fleet provisioning template version was created
--
-- 'isDefaultVersion', 'provisioningTemplateVersionSummary_isDefaultVersion' - True if the fleet provisioning template version is the default version,
-- otherwise false.
newProvisioningTemplateVersionSummary ::
  ProvisioningTemplateVersionSummary
newProvisioningTemplateVersionSummary :: ProvisioningTemplateVersionSummary
newProvisioningTemplateVersionSummary =
  ProvisioningTemplateVersionSummary' :: Maybe Int
-> Maybe POSIX -> Maybe Bool -> ProvisioningTemplateVersionSummary
ProvisioningTemplateVersionSummary'
    { $sel:versionId:ProvisioningTemplateVersionSummary' :: Maybe Int
versionId =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDate:ProvisioningTemplateVersionSummary' :: Maybe POSIX
creationDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:isDefaultVersion:ProvisioningTemplateVersionSummary' :: Maybe Bool
isDefaultVersion = Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the fleet privisioning template version.
provisioningTemplateVersionSummary_versionId :: Lens.Lens' ProvisioningTemplateVersionSummary (Prelude.Maybe Prelude.Int)
provisioningTemplateVersionSummary_versionId :: (Maybe Int -> f (Maybe Int))
-> ProvisioningTemplateVersionSummary
-> f ProvisioningTemplateVersionSummary
provisioningTemplateVersionSummary_versionId = (ProvisioningTemplateVersionSummary -> Maybe Int)
-> (ProvisioningTemplateVersionSummary
    -> Maybe Int -> ProvisioningTemplateVersionSummary)
-> Lens
     ProvisioningTemplateVersionSummary
     ProvisioningTemplateVersionSummary
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProvisioningTemplateVersionSummary' {Maybe Int
versionId :: Maybe Int
$sel:versionId:ProvisioningTemplateVersionSummary' :: ProvisioningTemplateVersionSummary -> Maybe Int
versionId} -> Maybe Int
versionId) (\s :: ProvisioningTemplateVersionSummary
s@ProvisioningTemplateVersionSummary' {} Maybe Int
a -> ProvisioningTemplateVersionSummary
s {$sel:versionId:ProvisioningTemplateVersionSummary' :: Maybe Int
versionId = Maybe Int
a} :: ProvisioningTemplateVersionSummary)

-- | The date when the fleet provisioning template version was created
provisioningTemplateVersionSummary_creationDate :: Lens.Lens' ProvisioningTemplateVersionSummary (Prelude.Maybe Prelude.UTCTime)
provisioningTemplateVersionSummary_creationDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ProvisioningTemplateVersionSummary
-> f ProvisioningTemplateVersionSummary
provisioningTemplateVersionSummary_creationDate = (ProvisioningTemplateVersionSummary -> Maybe POSIX)
-> (ProvisioningTemplateVersionSummary
    -> Maybe POSIX -> ProvisioningTemplateVersionSummary)
-> Lens
     ProvisioningTemplateVersionSummary
     ProvisioningTemplateVersionSummary
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProvisioningTemplateVersionSummary' {Maybe POSIX
creationDate :: Maybe POSIX
$sel:creationDate:ProvisioningTemplateVersionSummary' :: ProvisioningTemplateVersionSummary -> Maybe POSIX
creationDate} -> Maybe POSIX
creationDate) (\s :: ProvisioningTemplateVersionSummary
s@ProvisioningTemplateVersionSummary' {} Maybe POSIX
a -> ProvisioningTemplateVersionSummary
s {$sel:creationDate:ProvisioningTemplateVersionSummary' :: Maybe POSIX
creationDate = Maybe POSIX
a} :: ProvisioningTemplateVersionSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> ProvisioningTemplateVersionSummary
 -> f ProvisioningTemplateVersionSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ProvisioningTemplateVersionSummary
-> f ProvisioningTemplateVersionSummary
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

-- | True if the fleet provisioning template version is the default version,
-- otherwise false.
provisioningTemplateVersionSummary_isDefaultVersion :: Lens.Lens' ProvisioningTemplateVersionSummary (Prelude.Maybe Prelude.Bool)
provisioningTemplateVersionSummary_isDefaultVersion :: (Maybe Bool -> f (Maybe Bool))
-> ProvisioningTemplateVersionSummary
-> f ProvisioningTemplateVersionSummary
provisioningTemplateVersionSummary_isDefaultVersion = (ProvisioningTemplateVersionSummary -> Maybe Bool)
-> (ProvisioningTemplateVersionSummary
    -> Maybe Bool -> ProvisioningTemplateVersionSummary)
-> Lens
     ProvisioningTemplateVersionSummary
     ProvisioningTemplateVersionSummary
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProvisioningTemplateVersionSummary' {Maybe Bool
isDefaultVersion :: Maybe Bool
$sel:isDefaultVersion:ProvisioningTemplateVersionSummary' :: ProvisioningTemplateVersionSummary -> Maybe Bool
isDefaultVersion} -> Maybe Bool
isDefaultVersion) (\s :: ProvisioningTemplateVersionSummary
s@ProvisioningTemplateVersionSummary' {} Maybe Bool
a -> ProvisioningTemplateVersionSummary
s {$sel:isDefaultVersion:ProvisioningTemplateVersionSummary' :: Maybe Bool
isDefaultVersion = Maybe Bool
a} :: ProvisioningTemplateVersionSummary)

instance
  Core.FromJSON
    ProvisioningTemplateVersionSummary
  where
  parseJSON :: Value -> Parser ProvisioningTemplateVersionSummary
parseJSON =
    String
-> (Object -> Parser ProvisioningTemplateVersionSummary)
-> Value
-> Parser ProvisioningTemplateVersionSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ProvisioningTemplateVersionSummary"
      ( \Object
x ->
          Maybe Int
-> Maybe POSIX -> Maybe Bool -> ProvisioningTemplateVersionSummary
ProvisioningTemplateVersionSummary'
            (Maybe Int
 -> Maybe POSIX -> Maybe Bool -> ProvisioningTemplateVersionSummary)
-> Parser (Maybe Int)
-> Parser
     (Maybe POSIX -> Maybe Bool -> ProvisioningTemplateVersionSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"versionId")
            Parser
  (Maybe POSIX -> Maybe Bool -> ProvisioningTemplateVersionSummary)
-> Parser (Maybe POSIX)
-> Parser (Maybe Bool -> ProvisioningTemplateVersionSummary)
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
"creationDate")
            Parser (Maybe Bool -> ProvisioningTemplateVersionSummary)
-> Parser (Maybe Bool) -> Parser ProvisioningTemplateVersionSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"isDefaultVersion")
      )

instance
  Prelude.Hashable
    ProvisioningTemplateVersionSummary

instance
  Prelude.NFData
    ProvisioningTemplateVersionSummary