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

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

-- | An OTA update summary.
--
-- /See:/ 'newOTAUpdateSummary' smart constructor.
data OTAUpdateSummary = OTAUpdateSummary'
  { -- | The date when the OTA update was created.
    OTAUpdateSummary -> Maybe POSIX
creationDate :: Prelude.Maybe Core.POSIX,
    -- | The OTA update ID.
    OTAUpdateSummary -> Maybe Text
otaUpdateId :: Prelude.Maybe Prelude.Text,
    -- | The OTA update ARN.
    OTAUpdateSummary -> Maybe Text
otaUpdateArn :: Prelude.Maybe Prelude.Text
  }
  deriving (OTAUpdateSummary -> OTAUpdateSummary -> Bool
(OTAUpdateSummary -> OTAUpdateSummary -> Bool)
-> (OTAUpdateSummary -> OTAUpdateSummary -> Bool)
-> Eq OTAUpdateSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OTAUpdateSummary -> OTAUpdateSummary -> Bool
$c/= :: OTAUpdateSummary -> OTAUpdateSummary -> Bool
== :: OTAUpdateSummary -> OTAUpdateSummary -> Bool
$c== :: OTAUpdateSummary -> OTAUpdateSummary -> Bool
Prelude.Eq, ReadPrec [OTAUpdateSummary]
ReadPrec OTAUpdateSummary
Int -> ReadS OTAUpdateSummary
ReadS [OTAUpdateSummary]
(Int -> ReadS OTAUpdateSummary)
-> ReadS [OTAUpdateSummary]
-> ReadPrec OTAUpdateSummary
-> ReadPrec [OTAUpdateSummary]
-> Read OTAUpdateSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OTAUpdateSummary]
$creadListPrec :: ReadPrec [OTAUpdateSummary]
readPrec :: ReadPrec OTAUpdateSummary
$creadPrec :: ReadPrec OTAUpdateSummary
readList :: ReadS [OTAUpdateSummary]
$creadList :: ReadS [OTAUpdateSummary]
readsPrec :: Int -> ReadS OTAUpdateSummary
$creadsPrec :: Int -> ReadS OTAUpdateSummary
Prelude.Read, Int -> OTAUpdateSummary -> ShowS
[OTAUpdateSummary] -> ShowS
OTAUpdateSummary -> String
(Int -> OTAUpdateSummary -> ShowS)
-> (OTAUpdateSummary -> String)
-> ([OTAUpdateSummary] -> ShowS)
-> Show OTAUpdateSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OTAUpdateSummary] -> ShowS
$cshowList :: [OTAUpdateSummary] -> ShowS
show :: OTAUpdateSummary -> String
$cshow :: OTAUpdateSummary -> String
showsPrec :: Int -> OTAUpdateSummary -> ShowS
$cshowsPrec :: Int -> OTAUpdateSummary -> ShowS
Prelude.Show, (forall x. OTAUpdateSummary -> Rep OTAUpdateSummary x)
-> (forall x. Rep OTAUpdateSummary x -> OTAUpdateSummary)
-> Generic OTAUpdateSummary
forall x. Rep OTAUpdateSummary x -> OTAUpdateSummary
forall x. OTAUpdateSummary -> Rep OTAUpdateSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OTAUpdateSummary x -> OTAUpdateSummary
$cfrom :: forall x. OTAUpdateSummary -> Rep OTAUpdateSummary x
Prelude.Generic)

-- |
-- Create a value of 'OTAUpdateSummary' 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:
--
-- 'creationDate', 'oTAUpdateSummary_creationDate' - The date when the OTA update was created.
--
-- 'otaUpdateId', 'oTAUpdateSummary_otaUpdateId' - The OTA update ID.
--
-- 'otaUpdateArn', 'oTAUpdateSummary_otaUpdateArn' - The OTA update ARN.
newOTAUpdateSummary ::
  OTAUpdateSummary
newOTAUpdateSummary :: OTAUpdateSummary
newOTAUpdateSummary =
  OTAUpdateSummary' :: Maybe POSIX -> Maybe Text -> Maybe Text -> OTAUpdateSummary
OTAUpdateSummary'
    { $sel:creationDate:OTAUpdateSummary' :: Maybe POSIX
creationDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:otaUpdateId:OTAUpdateSummary' :: Maybe Text
otaUpdateId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:otaUpdateArn:OTAUpdateSummary' :: Maybe Text
otaUpdateArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The date when the OTA update was created.
oTAUpdateSummary_creationDate :: Lens.Lens' OTAUpdateSummary (Prelude.Maybe Prelude.UTCTime)
oTAUpdateSummary_creationDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> OTAUpdateSummary -> f OTAUpdateSummary
oTAUpdateSummary_creationDate = (OTAUpdateSummary -> Maybe POSIX)
-> (OTAUpdateSummary -> Maybe POSIX -> OTAUpdateSummary)
-> Lens
     OTAUpdateSummary OTAUpdateSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OTAUpdateSummary' {Maybe POSIX
creationDate :: Maybe POSIX
$sel:creationDate:OTAUpdateSummary' :: OTAUpdateSummary -> Maybe POSIX
creationDate} -> Maybe POSIX
creationDate) (\s :: OTAUpdateSummary
s@OTAUpdateSummary' {} Maybe POSIX
a -> OTAUpdateSummary
s {$sel:creationDate:OTAUpdateSummary' :: Maybe POSIX
creationDate = Maybe POSIX
a} :: OTAUpdateSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> OTAUpdateSummary -> f OTAUpdateSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> OTAUpdateSummary
-> f OTAUpdateSummary
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 OTA update ID.
oTAUpdateSummary_otaUpdateId :: Lens.Lens' OTAUpdateSummary (Prelude.Maybe Prelude.Text)
oTAUpdateSummary_otaUpdateId :: (Maybe Text -> f (Maybe Text))
-> OTAUpdateSummary -> f OTAUpdateSummary
oTAUpdateSummary_otaUpdateId = (OTAUpdateSummary -> Maybe Text)
-> (OTAUpdateSummary -> Maybe Text -> OTAUpdateSummary)
-> Lens OTAUpdateSummary OTAUpdateSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OTAUpdateSummary' {Maybe Text
otaUpdateId :: Maybe Text
$sel:otaUpdateId:OTAUpdateSummary' :: OTAUpdateSummary -> Maybe Text
otaUpdateId} -> Maybe Text
otaUpdateId) (\s :: OTAUpdateSummary
s@OTAUpdateSummary' {} Maybe Text
a -> OTAUpdateSummary
s {$sel:otaUpdateId:OTAUpdateSummary' :: Maybe Text
otaUpdateId = Maybe Text
a} :: OTAUpdateSummary)

-- | The OTA update ARN.
oTAUpdateSummary_otaUpdateArn :: Lens.Lens' OTAUpdateSummary (Prelude.Maybe Prelude.Text)
oTAUpdateSummary_otaUpdateArn :: (Maybe Text -> f (Maybe Text))
-> OTAUpdateSummary -> f OTAUpdateSummary
oTAUpdateSummary_otaUpdateArn = (OTAUpdateSummary -> Maybe Text)
-> (OTAUpdateSummary -> Maybe Text -> OTAUpdateSummary)
-> Lens OTAUpdateSummary OTAUpdateSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OTAUpdateSummary' {Maybe Text
otaUpdateArn :: Maybe Text
$sel:otaUpdateArn:OTAUpdateSummary' :: OTAUpdateSummary -> Maybe Text
otaUpdateArn} -> Maybe Text
otaUpdateArn) (\s :: OTAUpdateSummary
s@OTAUpdateSummary' {} Maybe Text
a -> OTAUpdateSummary
s {$sel:otaUpdateArn:OTAUpdateSummary' :: Maybe Text
otaUpdateArn = Maybe Text
a} :: OTAUpdateSummary)

instance Core.FromJSON OTAUpdateSummary where
  parseJSON :: Value -> Parser OTAUpdateSummary
parseJSON =
    String
-> (Object -> Parser OTAUpdateSummary)
-> Value
-> Parser OTAUpdateSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"OTAUpdateSummary"
      ( \Object
x ->
          Maybe POSIX -> Maybe Text -> Maybe Text -> OTAUpdateSummary
OTAUpdateSummary'
            (Maybe POSIX -> Maybe Text -> Maybe Text -> OTAUpdateSummary)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> Maybe Text -> OTAUpdateSummary)
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
"creationDate")
            Parser (Maybe Text -> Maybe Text -> OTAUpdateSummary)
-> Parser (Maybe Text) -> Parser (Maybe Text -> OTAUpdateSummary)
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
"otaUpdateId")
            Parser (Maybe Text -> OTAUpdateSummary)
-> Parser (Maybe Text) -> Parser OTAUpdateSummary
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
"otaUpdateArn")
      )

instance Prelude.Hashable OTAUpdateSummary

instance Prelude.NFData OTAUpdateSummary