{-# 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.OTAUpdateInfo
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IoT.Types.OTAUpdateInfo where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoT.Types.AwsJobExecutionsRolloutConfig
import Amazonka.IoT.Types.AwsJobPresignedUrlConfig
import Amazonka.IoT.Types.ErrorInfo
import Amazonka.IoT.Types.OTAUpdateFile
import Amazonka.IoT.Types.OTAUpdateStatus
import Amazonka.IoT.Types.Protocol
import Amazonka.IoT.Types.TargetSelection
import qualified Amazonka.Prelude as Prelude

-- | Information about an OTA update.
--
-- /See:/ 'newOTAUpdateInfo' smart constructor.
data OTAUpdateInfo = OTAUpdateInfo'
  { -- | A collection of name\/value pairs
    OTAUpdateInfo -> Maybe (HashMap Text Text)
additionalParameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The IoT job ARN associated with the OTA update.
    OTAUpdateInfo -> Maybe Text
awsIotJobArn :: Prelude.Maybe Prelude.Text,
    -- | The IoT job ID associated with the OTA update.
    OTAUpdateInfo -> Maybe Text
awsIotJobId :: Prelude.Maybe Prelude.Text,
    -- | Configuration for the rollout of OTA updates.
    OTAUpdateInfo -> Maybe AwsJobExecutionsRolloutConfig
awsJobExecutionsRolloutConfig :: Prelude.Maybe AwsJobExecutionsRolloutConfig,
    -- | Configuration information for pre-signed URLs. Valid when @protocols@
    -- contains HTTP.
    OTAUpdateInfo -> Maybe AwsJobPresignedUrlConfig
awsJobPresignedUrlConfig :: Prelude.Maybe AwsJobPresignedUrlConfig,
    -- | The date when the OTA update was created.
    OTAUpdateInfo -> Maybe POSIX
creationDate :: Prelude.Maybe Data.POSIX,
    -- | A description of the OTA update.
    OTAUpdateInfo -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Error information associated with the OTA update.
    OTAUpdateInfo -> Maybe ErrorInfo
errorInfo :: Prelude.Maybe ErrorInfo,
    -- | The date when the OTA update was last updated.
    OTAUpdateInfo -> Maybe POSIX
lastModifiedDate :: Prelude.Maybe Data.POSIX,
    -- | The OTA update ARN.
    OTAUpdateInfo -> Maybe Text
otaUpdateArn :: Prelude.Maybe Prelude.Text,
    -- | A list of files associated with the OTA update.
    OTAUpdateInfo -> Maybe (NonEmpty OTAUpdateFile)
otaUpdateFiles :: Prelude.Maybe (Prelude.NonEmpty OTAUpdateFile),
    -- | The OTA update ID.
    OTAUpdateInfo -> Maybe Text
otaUpdateId :: Prelude.Maybe Prelude.Text,
    -- | The status of the OTA update.
    OTAUpdateInfo -> Maybe OTAUpdateStatus
otaUpdateStatus :: Prelude.Maybe OTAUpdateStatus,
    -- | The protocol used to transfer the OTA update image. Valid values are
    -- [HTTP], [MQTT], [HTTP, MQTT]. When both HTTP and MQTT are specified, the
    -- target device can choose the protocol.
    OTAUpdateInfo -> Maybe (NonEmpty Protocol)
protocols :: Prelude.Maybe (Prelude.NonEmpty Protocol),
    -- | Specifies whether the OTA update will continue to run (CONTINUOUS), or
    -- will be complete after all those things specified as targets have
    -- completed the OTA update (SNAPSHOT). If continuous, the OTA update may
    -- also be run on a thing when a change is detected in a target. For
    -- example, an OTA update will run on a thing when the thing is added to a
    -- target group, even after the OTA update was completed by all things
    -- originally in the group.
    OTAUpdateInfo -> Maybe TargetSelection
targetSelection :: Prelude.Maybe TargetSelection,
    -- | The targets of the OTA update.
    OTAUpdateInfo -> Maybe (NonEmpty Text)
targets :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text)
  }
  deriving (OTAUpdateInfo -> OTAUpdateInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OTAUpdateInfo -> OTAUpdateInfo -> Bool
$c/= :: OTAUpdateInfo -> OTAUpdateInfo -> Bool
== :: OTAUpdateInfo -> OTAUpdateInfo -> Bool
$c== :: OTAUpdateInfo -> OTAUpdateInfo -> Bool
Prelude.Eq, ReadPrec [OTAUpdateInfo]
ReadPrec OTAUpdateInfo
Int -> ReadS OTAUpdateInfo
ReadS [OTAUpdateInfo]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OTAUpdateInfo]
$creadListPrec :: ReadPrec [OTAUpdateInfo]
readPrec :: ReadPrec OTAUpdateInfo
$creadPrec :: ReadPrec OTAUpdateInfo
readList :: ReadS [OTAUpdateInfo]
$creadList :: ReadS [OTAUpdateInfo]
readsPrec :: Int -> ReadS OTAUpdateInfo
$creadsPrec :: Int -> ReadS OTAUpdateInfo
Prelude.Read, Int -> OTAUpdateInfo -> ShowS
[OTAUpdateInfo] -> ShowS
OTAUpdateInfo -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OTAUpdateInfo] -> ShowS
$cshowList :: [OTAUpdateInfo] -> ShowS
show :: OTAUpdateInfo -> String
$cshow :: OTAUpdateInfo -> String
showsPrec :: Int -> OTAUpdateInfo -> ShowS
$cshowsPrec :: Int -> OTAUpdateInfo -> ShowS
Prelude.Show, forall x. Rep OTAUpdateInfo x -> OTAUpdateInfo
forall x. OTAUpdateInfo -> Rep OTAUpdateInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OTAUpdateInfo x -> OTAUpdateInfo
$cfrom :: forall x. OTAUpdateInfo -> Rep OTAUpdateInfo x
Prelude.Generic)

-- |
-- Create a value of 'OTAUpdateInfo' 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:
--
-- 'additionalParameters', 'oTAUpdateInfo_additionalParameters' - A collection of name\/value pairs
--
-- 'awsIotJobArn', 'oTAUpdateInfo_awsIotJobArn' - The IoT job ARN associated with the OTA update.
--
-- 'awsIotJobId', 'oTAUpdateInfo_awsIotJobId' - The IoT job ID associated with the OTA update.
--
-- 'awsJobExecutionsRolloutConfig', 'oTAUpdateInfo_awsJobExecutionsRolloutConfig' - Configuration for the rollout of OTA updates.
--
-- 'awsJobPresignedUrlConfig', 'oTAUpdateInfo_awsJobPresignedUrlConfig' - Configuration information for pre-signed URLs. Valid when @protocols@
-- contains HTTP.
--
-- 'creationDate', 'oTAUpdateInfo_creationDate' - The date when the OTA update was created.
--
-- 'description', 'oTAUpdateInfo_description' - A description of the OTA update.
--
-- 'errorInfo', 'oTAUpdateInfo_errorInfo' - Error information associated with the OTA update.
--
-- 'lastModifiedDate', 'oTAUpdateInfo_lastModifiedDate' - The date when the OTA update was last updated.
--
-- 'otaUpdateArn', 'oTAUpdateInfo_otaUpdateArn' - The OTA update ARN.
--
-- 'otaUpdateFiles', 'oTAUpdateInfo_otaUpdateFiles' - A list of files associated with the OTA update.
--
-- 'otaUpdateId', 'oTAUpdateInfo_otaUpdateId' - The OTA update ID.
--
-- 'otaUpdateStatus', 'oTAUpdateInfo_otaUpdateStatus' - The status of the OTA update.
--
-- 'protocols', 'oTAUpdateInfo_protocols' - The protocol used to transfer the OTA update image. Valid values are
-- [HTTP], [MQTT], [HTTP, MQTT]. When both HTTP and MQTT are specified, the
-- target device can choose the protocol.
--
-- 'targetSelection', 'oTAUpdateInfo_targetSelection' - Specifies whether the OTA update will continue to run (CONTINUOUS), or
-- will be complete after all those things specified as targets have
-- completed the OTA update (SNAPSHOT). If continuous, the OTA update may
-- also be run on a thing when a change is detected in a target. For
-- example, an OTA update will run on a thing when the thing is added to a
-- target group, even after the OTA update was completed by all things
-- originally in the group.
--
-- 'targets', 'oTAUpdateInfo_targets' - The targets of the OTA update.
newOTAUpdateInfo ::
  OTAUpdateInfo
newOTAUpdateInfo :: OTAUpdateInfo
newOTAUpdateInfo =
  OTAUpdateInfo'
    { $sel:additionalParameters:OTAUpdateInfo' :: Maybe (HashMap Text Text)
additionalParameters =
        forall a. Maybe a
Prelude.Nothing,
      $sel:awsIotJobArn:OTAUpdateInfo' :: Maybe Text
awsIotJobArn = forall a. Maybe a
Prelude.Nothing,
      $sel:awsIotJobId:OTAUpdateInfo' :: Maybe Text
awsIotJobId = forall a. Maybe a
Prelude.Nothing,
      $sel:awsJobExecutionsRolloutConfig:OTAUpdateInfo' :: Maybe AwsJobExecutionsRolloutConfig
awsJobExecutionsRolloutConfig = forall a. Maybe a
Prelude.Nothing,
      $sel:awsJobPresignedUrlConfig:OTAUpdateInfo' :: Maybe AwsJobPresignedUrlConfig
awsJobPresignedUrlConfig = forall a. Maybe a
Prelude.Nothing,
      $sel:creationDate:OTAUpdateInfo' :: Maybe POSIX
creationDate = forall a. Maybe a
Prelude.Nothing,
      $sel:description:OTAUpdateInfo' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:errorInfo:OTAUpdateInfo' :: Maybe ErrorInfo
errorInfo = forall a. Maybe a
Prelude.Nothing,
      $sel:lastModifiedDate:OTAUpdateInfo' :: Maybe POSIX
lastModifiedDate = forall a. Maybe a
Prelude.Nothing,
      $sel:otaUpdateArn:OTAUpdateInfo' :: Maybe Text
otaUpdateArn = forall a. Maybe a
Prelude.Nothing,
      $sel:otaUpdateFiles:OTAUpdateInfo' :: Maybe (NonEmpty OTAUpdateFile)
otaUpdateFiles = forall a. Maybe a
Prelude.Nothing,
      $sel:otaUpdateId:OTAUpdateInfo' :: Maybe Text
otaUpdateId = forall a. Maybe a
Prelude.Nothing,
      $sel:otaUpdateStatus:OTAUpdateInfo' :: Maybe OTAUpdateStatus
otaUpdateStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:protocols:OTAUpdateInfo' :: Maybe (NonEmpty Protocol)
protocols = forall a. Maybe a
Prelude.Nothing,
      $sel:targetSelection:OTAUpdateInfo' :: Maybe TargetSelection
targetSelection = forall a. Maybe a
Prelude.Nothing,
      $sel:targets:OTAUpdateInfo' :: Maybe (NonEmpty Text)
targets = forall a. Maybe a
Prelude.Nothing
    }

-- | A collection of name\/value pairs
oTAUpdateInfo_additionalParameters :: Lens.Lens' OTAUpdateInfo (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
oTAUpdateInfo_additionalParameters :: Lens' OTAUpdateInfo (Maybe (HashMap Text Text))
oTAUpdateInfo_additionalParameters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OTAUpdateInfo' {Maybe (HashMap Text Text)
additionalParameters :: Maybe (HashMap Text Text)
$sel:additionalParameters:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe (HashMap Text Text)
additionalParameters} -> Maybe (HashMap Text Text)
additionalParameters) (\s :: OTAUpdateInfo
s@OTAUpdateInfo' {} Maybe (HashMap Text Text)
a -> OTAUpdateInfo
s {$sel:additionalParameters:OTAUpdateInfo' :: Maybe (HashMap Text Text)
additionalParameters = Maybe (HashMap Text Text)
a} :: OTAUpdateInfo) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The IoT job ARN associated with the OTA update.
oTAUpdateInfo_awsIotJobArn :: Lens.Lens' OTAUpdateInfo (Prelude.Maybe Prelude.Text)
oTAUpdateInfo_awsIotJobArn :: Lens' OTAUpdateInfo (Maybe Text)
oTAUpdateInfo_awsIotJobArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OTAUpdateInfo' {Maybe Text
awsIotJobArn :: Maybe Text
$sel:awsIotJobArn:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe Text
awsIotJobArn} -> Maybe Text
awsIotJobArn) (\s :: OTAUpdateInfo
s@OTAUpdateInfo' {} Maybe Text
a -> OTAUpdateInfo
s {$sel:awsIotJobArn:OTAUpdateInfo' :: Maybe Text
awsIotJobArn = Maybe Text
a} :: OTAUpdateInfo)

-- | The IoT job ID associated with the OTA update.
oTAUpdateInfo_awsIotJobId :: Lens.Lens' OTAUpdateInfo (Prelude.Maybe Prelude.Text)
oTAUpdateInfo_awsIotJobId :: Lens' OTAUpdateInfo (Maybe Text)
oTAUpdateInfo_awsIotJobId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OTAUpdateInfo' {Maybe Text
awsIotJobId :: Maybe Text
$sel:awsIotJobId:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe Text
awsIotJobId} -> Maybe Text
awsIotJobId) (\s :: OTAUpdateInfo
s@OTAUpdateInfo' {} Maybe Text
a -> OTAUpdateInfo
s {$sel:awsIotJobId:OTAUpdateInfo' :: Maybe Text
awsIotJobId = Maybe Text
a} :: OTAUpdateInfo)

-- | Configuration for the rollout of OTA updates.
oTAUpdateInfo_awsJobExecutionsRolloutConfig :: Lens.Lens' OTAUpdateInfo (Prelude.Maybe AwsJobExecutionsRolloutConfig)
oTAUpdateInfo_awsJobExecutionsRolloutConfig :: Lens' OTAUpdateInfo (Maybe AwsJobExecutionsRolloutConfig)
oTAUpdateInfo_awsJobExecutionsRolloutConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OTAUpdateInfo' {Maybe AwsJobExecutionsRolloutConfig
awsJobExecutionsRolloutConfig :: Maybe AwsJobExecutionsRolloutConfig
$sel:awsJobExecutionsRolloutConfig:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe AwsJobExecutionsRolloutConfig
awsJobExecutionsRolloutConfig} -> Maybe AwsJobExecutionsRolloutConfig
awsJobExecutionsRolloutConfig) (\s :: OTAUpdateInfo
s@OTAUpdateInfo' {} Maybe AwsJobExecutionsRolloutConfig
a -> OTAUpdateInfo
s {$sel:awsJobExecutionsRolloutConfig:OTAUpdateInfo' :: Maybe AwsJobExecutionsRolloutConfig
awsJobExecutionsRolloutConfig = Maybe AwsJobExecutionsRolloutConfig
a} :: OTAUpdateInfo)

-- | Configuration information for pre-signed URLs. Valid when @protocols@
-- contains HTTP.
oTAUpdateInfo_awsJobPresignedUrlConfig :: Lens.Lens' OTAUpdateInfo (Prelude.Maybe AwsJobPresignedUrlConfig)
oTAUpdateInfo_awsJobPresignedUrlConfig :: Lens' OTAUpdateInfo (Maybe AwsJobPresignedUrlConfig)
oTAUpdateInfo_awsJobPresignedUrlConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OTAUpdateInfo' {Maybe AwsJobPresignedUrlConfig
awsJobPresignedUrlConfig :: Maybe AwsJobPresignedUrlConfig
$sel:awsJobPresignedUrlConfig:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe AwsJobPresignedUrlConfig
awsJobPresignedUrlConfig} -> Maybe AwsJobPresignedUrlConfig
awsJobPresignedUrlConfig) (\s :: OTAUpdateInfo
s@OTAUpdateInfo' {} Maybe AwsJobPresignedUrlConfig
a -> OTAUpdateInfo
s {$sel:awsJobPresignedUrlConfig:OTAUpdateInfo' :: Maybe AwsJobPresignedUrlConfig
awsJobPresignedUrlConfig = Maybe AwsJobPresignedUrlConfig
a} :: OTAUpdateInfo)

-- | The date when the OTA update was created.
oTAUpdateInfo_creationDate :: Lens.Lens' OTAUpdateInfo (Prelude.Maybe Prelude.UTCTime)
oTAUpdateInfo_creationDate :: Lens' OTAUpdateInfo (Maybe UTCTime)
oTAUpdateInfo_creationDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OTAUpdateInfo' {Maybe POSIX
creationDate :: Maybe POSIX
$sel:creationDate:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe POSIX
creationDate} -> Maybe POSIX
creationDate) (\s :: OTAUpdateInfo
s@OTAUpdateInfo' {} Maybe POSIX
a -> OTAUpdateInfo
s {$sel:creationDate:OTAUpdateInfo' :: Maybe POSIX
creationDate = Maybe POSIX
a} :: OTAUpdateInfo) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | A description of the OTA update.
oTAUpdateInfo_description :: Lens.Lens' OTAUpdateInfo (Prelude.Maybe Prelude.Text)
oTAUpdateInfo_description :: Lens' OTAUpdateInfo (Maybe Text)
oTAUpdateInfo_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OTAUpdateInfo' {Maybe Text
description :: Maybe Text
$sel:description:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe Text
description} -> Maybe Text
description) (\s :: OTAUpdateInfo
s@OTAUpdateInfo' {} Maybe Text
a -> OTAUpdateInfo
s {$sel:description:OTAUpdateInfo' :: Maybe Text
description = Maybe Text
a} :: OTAUpdateInfo)

-- | Error information associated with the OTA update.
oTAUpdateInfo_errorInfo :: Lens.Lens' OTAUpdateInfo (Prelude.Maybe ErrorInfo)
oTAUpdateInfo_errorInfo :: Lens' OTAUpdateInfo (Maybe ErrorInfo)
oTAUpdateInfo_errorInfo = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OTAUpdateInfo' {Maybe ErrorInfo
errorInfo :: Maybe ErrorInfo
$sel:errorInfo:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe ErrorInfo
errorInfo} -> Maybe ErrorInfo
errorInfo) (\s :: OTAUpdateInfo
s@OTAUpdateInfo' {} Maybe ErrorInfo
a -> OTAUpdateInfo
s {$sel:errorInfo:OTAUpdateInfo' :: Maybe ErrorInfo
errorInfo = Maybe ErrorInfo
a} :: OTAUpdateInfo)

-- | The date when the OTA update was last updated.
oTAUpdateInfo_lastModifiedDate :: Lens.Lens' OTAUpdateInfo (Prelude.Maybe Prelude.UTCTime)
oTAUpdateInfo_lastModifiedDate :: Lens' OTAUpdateInfo (Maybe UTCTime)
oTAUpdateInfo_lastModifiedDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OTAUpdateInfo' {Maybe POSIX
lastModifiedDate :: Maybe POSIX
$sel:lastModifiedDate:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe POSIX
lastModifiedDate} -> Maybe POSIX
lastModifiedDate) (\s :: OTAUpdateInfo
s@OTAUpdateInfo' {} Maybe POSIX
a -> OTAUpdateInfo
s {$sel:lastModifiedDate:OTAUpdateInfo' :: Maybe POSIX
lastModifiedDate = Maybe POSIX
a} :: OTAUpdateInfo) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

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

-- | A list of files associated with the OTA update.
oTAUpdateInfo_otaUpdateFiles :: Lens.Lens' OTAUpdateInfo (Prelude.Maybe (Prelude.NonEmpty OTAUpdateFile))
oTAUpdateInfo_otaUpdateFiles :: Lens' OTAUpdateInfo (Maybe (NonEmpty OTAUpdateFile))
oTAUpdateInfo_otaUpdateFiles = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OTAUpdateInfo' {Maybe (NonEmpty OTAUpdateFile)
otaUpdateFiles :: Maybe (NonEmpty OTAUpdateFile)
$sel:otaUpdateFiles:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe (NonEmpty OTAUpdateFile)
otaUpdateFiles} -> Maybe (NonEmpty OTAUpdateFile)
otaUpdateFiles) (\s :: OTAUpdateInfo
s@OTAUpdateInfo' {} Maybe (NonEmpty OTAUpdateFile)
a -> OTAUpdateInfo
s {$sel:otaUpdateFiles:OTAUpdateInfo' :: Maybe (NonEmpty OTAUpdateFile)
otaUpdateFiles = Maybe (NonEmpty OTAUpdateFile)
a} :: OTAUpdateInfo) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The OTA update ID.
oTAUpdateInfo_otaUpdateId :: Lens.Lens' OTAUpdateInfo (Prelude.Maybe Prelude.Text)
oTAUpdateInfo_otaUpdateId :: Lens' OTAUpdateInfo (Maybe Text)
oTAUpdateInfo_otaUpdateId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OTAUpdateInfo' {Maybe Text
otaUpdateId :: Maybe Text
$sel:otaUpdateId:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe Text
otaUpdateId} -> Maybe Text
otaUpdateId) (\s :: OTAUpdateInfo
s@OTAUpdateInfo' {} Maybe Text
a -> OTAUpdateInfo
s {$sel:otaUpdateId:OTAUpdateInfo' :: Maybe Text
otaUpdateId = Maybe Text
a} :: OTAUpdateInfo)

-- | The status of the OTA update.
oTAUpdateInfo_otaUpdateStatus :: Lens.Lens' OTAUpdateInfo (Prelude.Maybe OTAUpdateStatus)
oTAUpdateInfo_otaUpdateStatus :: Lens' OTAUpdateInfo (Maybe OTAUpdateStatus)
oTAUpdateInfo_otaUpdateStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OTAUpdateInfo' {Maybe OTAUpdateStatus
otaUpdateStatus :: Maybe OTAUpdateStatus
$sel:otaUpdateStatus:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe OTAUpdateStatus
otaUpdateStatus} -> Maybe OTAUpdateStatus
otaUpdateStatus) (\s :: OTAUpdateInfo
s@OTAUpdateInfo' {} Maybe OTAUpdateStatus
a -> OTAUpdateInfo
s {$sel:otaUpdateStatus:OTAUpdateInfo' :: Maybe OTAUpdateStatus
otaUpdateStatus = Maybe OTAUpdateStatus
a} :: OTAUpdateInfo)

-- | The protocol used to transfer the OTA update image. Valid values are
-- [HTTP], [MQTT], [HTTP, MQTT]. When both HTTP and MQTT are specified, the
-- target device can choose the protocol.
oTAUpdateInfo_protocols :: Lens.Lens' OTAUpdateInfo (Prelude.Maybe (Prelude.NonEmpty Protocol))
oTAUpdateInfo_protocols :: Lens' OTAUpdateInfo (Maybe (NonEmpty Protocol))
oTAUpdateInfo_protocols = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OTAUpdateInfo' {Maybe (NonEmpty Protocol)
protocols :: Maybe (NonEmpty Protocol)
$sel:protocols:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe (NonEmpty Protocol)
protocols} -> Maybe (NonEmpty Protocol)
protocols) (\s :: OTAUpdateInfo
s@OTAUpdateInfo' {} Maybe (NonEmpty Protocol)
a -> OTAUpdateInfo
s {$sel:protocols:OTAUpdateInfo' :: Maybe (NonEmpty Protocol)
protocols = Maybe (NonEmpty Protocol)
a} :: OTAUpdateInfo) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Specifies whether the OTA update will continue to run (CONTINUOUS), or
-- will be complete after all those things specified as targets have
-- completed the OTA update (SNAPSHOT). If continuous, the OTA update may
-- also be run on a thing when a change is detected in a target. For
-- example, an OTA update will run on a thing when the thing is added to a
-- target group, even after the OTA update was completed by all things
-- originally in the group.
oTAUpdateInfo_targetSelection :: Lens.Lens' OTAUpdateInfo (Prelude.Maybe TargetSelection)
oTAUpdateInfo_targetSelection :: Lens' OTAUpdateInfo (Maybe TargetSelection)
oTAUpdateInfo_targetSelection = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OTAUpdateInfo' {Maybe TargetSelection
targetSelection :: Maybe TargetSelection
$sel:targetSelection:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe TargetSelection
targetSelection} -> Maybe TargetSelection
targetSelection) (\s :: OTAUpdateInfo
s@OTAUpdateInfo' {} Maybe TargetSelection
a -> OTAUpdateInfo
s {$sel:targetSelection:OTAUpdateInfo' :: Maybe TargetSelection
targetSelection = Maybe TargetSelection
a} :: OTAUpdateInfo)

-- | The targets of the OTA update.
oTAUpdateInfo_targets :: Lens.Lens' OTAUpdateInfo (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
oTAUpdateInfo_targets :: Lens' OTAUpdateInfo (Maybe (NonEmpty Text))
oTAUpdateInfo_targets = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OTAUpdateInfo' {Maybe (NonEmpty Text)
targets :: Maybe (NonEmpty Text)
$sel:targets:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe (NonEmpty Text)
targets} -> Maybe (NonEmpty Text)
targets) (\s :: OTAUpdateInfo
s@OTAUpdateInfo' {} Maybe (NonEmpty Text)
a -> OTAUpdateInfo
s {$sel:targets:OTAUpdateInfo' :: Maybe (NonEmpty Text)
targets = Maybe (NonEmpty Text)
a} :: OTAUpdateInfo) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON OTAUpdateInfo where
  parseJSON :: Value -> Parser OTAUpdateInfo
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"OTAUpdateInfo"
      ( \Object
x ->
          Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> Maybe AwsJobExecutionsRolloutConfig
-> Maybe AwsJobPresignedUrlConfig
-> Maybe POSIX
-> Maybe Text
-> Maybe ErrorInfo
-> Maybe POSIX
-> Maybe Text
-> Maybe (NonEmpty OTAUpdateFile)
-> Maybe Text
-> Maybe OTAUpdateStatus
-> Maybe (NonEmpty Protocol)
-> Maybe TargetSelection
-> Maybe (NonEmpty Text)
-> OTAUpdateInfo
OTAUpdateInfo'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"additionalParameters"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"awsIotJobArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"awsIotJobId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"awsJobExecutionsRolloutConfig")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"awsJobPresignedUrlConfig")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"creationDate")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"description")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"errorInfo")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"lastModifiedDate")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"otaUpdateArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"otaUpdateFiles")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"otaUpdateId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"otaUpdateStatus")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"protocols")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"targetSelection")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"targets")
      )

instance Prelude.Hashable OTAUpdateInfo where
  hashWithSalt :: Int -> OTAUpdateInfo -> Int
hashWithSalt Int
_salt OTAUpdateInfo' {Maybe (NonEmpty Text)
Maybe (NonEmpty Protocol)
Maybe (NonEmpty OTAUpdateFile)
Maybe Text
Maybe (HashMap Text Text)
Maybe POSIX
Maybe AwsJobPresignedUrlConfig
Maybe AwsJobExecutionsRolloutConfig
Maybe ErrorInfo
Maybe OTAUpdateStatus
Maybe TargetSelection
targets :: Maybe (NonEmpty Text)
targetSelection :: Maybe TargetSelection
protocols :: Maybe (NonEmpty Protocol)
otaUpdateStatus :: Maybe OTAUpdateStatus
otaUpdateId :: Maybe Text
otaUpdateFiles :: Maybe (NonEmpty OTAUpdateFile)
otaUpdateArn :: Maybe Text
lastModifiedDate :: Maybe POSIX
errorInfo :: Maybe ErrorInfo
description :: Maybe Text
creationDate :: Maybe POSIX
awsJobPresignedUrlConfig :: Maybe AwsJobPresignedUrlConfig
awsJobExecutionsRolloutConfig :: Maybe AwsJobExecutionsRolloutConfig
awsIotJobId :: Maybe Text
awsIotJobArn :: Maybe Text
additionalParameters :: Maybe (HashMap Text Text)
$sel:targets:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe (NonEmpty Text)
$sel:targetSelection:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe TargetSelection
$sel:protocols:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe (NonEmpty Protocol)
$sel:otaUpdateStatus:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe OTAUpdateStatus
$sel:otaUpdateId:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe Text
$sel:otaUpdateFiles:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe (NonEmpty OTAUpdateFile)
$sel:otaUpdateArn:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe Text
$sel:lastModifiedDate:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe POSIX
$sel:errorInfo:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe ErrorInfo
$sel:description:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe Text
$sel:creationDate:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe POSIX
$sel:awsJobPresignedUrlConfig:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe AwsJobPresignedUrlConfig
$sel:awsJobExecutionsRolloutConfig:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe AwsJobExecutionsRolloutConfig
$sel:awsIotJobId:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe Text
$sel:awsIotJobArn:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe Text
$sel:additionalParameters:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe (HashMap Text Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
additionalParameters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
awsIotJobArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
awsIotJobId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AwsJobExecutionsRolloutConfig
awsJobExecutionsRolloutConfig
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AwsJobPresignedUrlConfig
awsJobPresignedUrlConfig
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ErrorInfo
errorInfo
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastModifiedDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
otaUpdateArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty OTAUpdateFile)
otaUpdateFiles
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
otaUpdateId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OTAUpdateStatus
otaUpdateStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Protocol)
protocols
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TargetSelection
targetSelection
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Text)
targets

instance Prelude.NFData OTAUpdateInfo where
  rnf :: OTAUpdateInfo -> ()
rnf OTAUpdateInfo' {Maybe (NonEmpty Text)
Maybe (NonEmpty Protocol)
Maybe (NonEmpty OTAUpdateFile)
Maybe Text
Maybe (HashMap Text Text)
Maybe POSIX
Maybe AwsJobPresignedUrlConfig
Maybe AwsJobExecutionsRolloutConfig
Maybe ErrorInfo
Maybe OTAUpdateStatus
Maybe TargetSelection
targets :: Maybe (NonEmpty Text)
targetSelection :: Maybe TargetSelection
protocols :: Maybe (NonEmpty Protocol)
otaUpdateStatus :: Maybe OTAUpdateStatus
otaUpdateId :: Maybe Text
otaUpdateFiles :: Maybe (NonEmpty OTAUpdateFile)
otaUpdateArn :: Maybe Text
lastModifiedDate :: Maybe POSIX
errorInfo :: Maybe ErrorInfo
description :: Maybe Text
creationDate :: Maybe POSIX
awsJobPresignedUrlConfig :: Maybe AwsJobPresignedUrlConfig
awsJobExecutionsRolloutConfig :: Maybe AwsJobExecutionsRolloutConfig
awsIotJobId :: Maybe Text
awsIotJobArn :: Maybe Text
additionalParameters :: Maybe (HashMap Text Text)
$sel:targets:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe (NonEmpty Text)
$sel:targetSelection:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe TargetSelection
$sel:protocols:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe (NonEmpty Protocol)
$sel:otaUpdateStatus:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe OTAUpdateStatus
$sel:otaUpdateId:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe Text
$sel:otaUpdateFiles:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe (NonEmpty OTAUpdateFile)
$sel:otaUpdateArn:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe Text
$sel:lastModifiedDate:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe POSIX
$sel:errorInfo:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe ErrorInfo
$sel:description:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe Text
$sel:creationDate:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe POSIX
$sel:awsJobPresignedUrlConfig:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe AwsJobPresignedUrlConfig
$sel:awsJobExecutionsRolloutConfig:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe AwsJobExecutionsRolloutConfig
$sel:awsIotJobId:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe Text
$sel:awsIotJobArn:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe Text
$sel:additionalParameters:OTAUpdateInfo' :: OTAUpdateInfo -> Maybe (HashMap Text Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
additionalParameters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
awsIotJobArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
awsIotJobId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AwsJobExecutionsRolloutConfig
awsJobExecutionsRolloutConfig
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AwsJobPresignedUrlConfig
awsJobPresignedUrlConfig
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ErrorInfo
errorInfo
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastModifiedDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
otaUpdateArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty OTAUpdateFile)
otaUpdateFiles
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
otaUpdateId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe OTAUpdateStatus
otaUpdateStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Protocol)
protocols
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TargetSelection
targetSelection
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
targets