{-# 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 #-}
module Amazonka.IoT.Types.OTAUpdateFile 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.CodeSigning
import Amazonka.IoT.Types.FileLocation
import qualified Amazonka.Prelude as Prelude
data OTAUpdateFile = OTAUpdateFile'
{
OTAUpdateFile -> Maybe (HashMap Text Text)
attributes :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
OTAUpdateFile -> Maybe CodeSigning
codeSigning :: Prelude.Maybe CodeSigning,
OTAUpdateFile -> Maybe FileLocation
fileLocation :: Prelude.Maybe FileLocation,
OTAUpdateFile -> Maybe Text
fileName :: Prelude.Maybe Prelude.Text,
OTAUpdateFile -> Maybe Natural
fileType :: Prelude.Maybe Prelude.Natural,
OTAUpdateFile -> Maybe Text
fileVersion :: Prelude.Maybe Prelude.Text
}
deriving (OTAUpdateFile -> OTAUpdateFile -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OTAUpdateFile -> OTAUpdateFile -> Bool
$c/= :: OTAUpdateFile -> OTAUpdateFile -> Bool
== :: OTAUpdateFile -> OTAUpdateFile -> Bool
$c== :: OTAUpdateFile -> OTAUpdateFile -> Bool
Prelude.Eq, ReadPrec [OTAUpdateFile]
ReadPrec OTAUpdateFile
Int -> ReadS OTAUpdateFile
ReadS [OTAUpdateFile]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OTAUpdateFile]
$creadListPrec :: ReadPrec [OTAUpdateFile]
readPrec :: ReadPrec OTAUpdateFile
$creadPrec :: ReadPrec OTAUpdateFile
readList :: ReadS [OTAUpdateFile]
$creadList :: ReadS [OTAUpdateFile]
readsPrec :: Int -> ReadS OTAUpdateFile
$creadsPrec :: Int -> ReadS OTAUpdateFile
Prelude.Read, Int -> OTAUpdateFile -> ShowS
[OTAUpdateFile] -> ShowS
OTAUpdateFile -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OTAUpdateFile] -> ShowS
$cshowList :: [OTAUpdateFile] -> ShowS
show :: OTAUpdateFile -> String
$cshow :: OTAUpdateFile -> String
showsPrec :: Int -> OTAUpdateFile -> ShowS
$cshowsPrec :: Int -> OTAUpdateFile -> ShowS
Prelude.Show, forall x. Rep OTAUpdateFile x -> OTAUpdateFile
forall x. OTAUpdateFile -> Rep OTAUpdateFile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OTAUpdateFile x -> OTAUpdateFile
$cfrom :: forall x. OTAUpdateFile -> Rep OTAUpdateFile x
Prelude.Generic)
newOTAUpdateFile ::
OTAUpdateFile
newOTAUpdateFile :: OTAUpdateFile
newOTAUpdateFile =
OTAUpdateFile'
{ $sel:attributes:OTAUpdateFile' :: Maybe (HashMap Text Text)
attributes = forall a. Maybe a
Prelude.Nothing,
$sel:codeSigning:OTAUpdateFile' :: Maybe CodeSigning
codeSigning = forall a. Maybe a
Prelude.Nothing,
$sel:fileLocation:OTAUpdateFile' :: Maybe FileLocation
fileLocation = forall a. Maybe a
Prelude.Nothing,
$sel:fileName:OTAUpdateFile' :: Maybe Text
fileName = forall a. Maybe a
Prelude.Nothing,
$sel:fileType:OTAUpdateFile' :: Maybe Natural
fileType = forall a. Maybe a
Prelude.Nothing,
$sel:fileVersion:OTAUpdateFile' :: Maybe Text
fileVersion = forall a. Maybe a
Prelude.Nothing
}
oTAUpdateFile_attributes :: Lens.Lens' OTAUpdateFile (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
oTAUpdateFile_attributes :: Lens' OTAUpdateFile (Maybe (HashMap Text Text))
oTAUpdateFile_attributes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OTAUpdateFile' {Maybe (HashMap Text Text)
attributes :: Maybe (HashMap Text Text)
$sel:attributes:OTAUpdateFile' :: OTAUpdateFile -> Maybe (HashMap Text Text)
attributes} -> Maybe (HashMap Text Text)
attributes) (\s :: OTAUpdateFile
s@OTAUpdateFile' {} Maybe (HashMap Text Text)
a -> OTAUpdateFile
s {$sel:attributes:OTAUpdateFile' :: Maybe (HashMap Text Text)
attributes = Maybe (HashMap Text Text)
a} :: OTAUpdateFile) 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
oTAUpdateFile_codeSigning :: Lens.Lens' OTAUpdateFile (Prelude.Maybe CodeSigning)
oTAUpdateFile_codeSigning :: Lens' OTAUpdateFile (Maybe CodeSigning)
oTAUpdateFile_codeSigning = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OTAUpdateFile' {Maybe CodeSigning
codeSigning :: Maybe CodeSigning
$sel:codeSigning:OTAUpdateFile' :: OTAUpdateFile -> Maybe CodeSigning
codeSigning} -> Maybe CodeSigning
codeSigning) (\s :: OTAUpdateFile
s@OTAUpdateFile' {} Maybe CodeSigning
a -> OTAUpdateFile
s {$sel:codeSigning:OTAUpdateFile' :: Maybe CodeSigning
codeSigning = Maybe CodeSigning
a} :: OTAUpdateFile)
oTAUpdateFile_fileLocation :: Lens.Lens' OTAUpdateFile (Prelude.Maybe FileLocation)
oTAUpdateFile_fileLocation :: Lens' OTAUpdateFile (Maybe FileLocation)
oTAUpdateFile_fileLocation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OTAUpdateFile' {Maybe FileLocation
fileLocation :: Maybe FileLocation
$sel:fileLocation:OTAUpdateFile' :: OTAUpdateFile -> Maybe FileLocation
fileLocation} -> Maybe FileLocation
fileLocation) (\s :: OTAUpdateFile
s@OTAUpdateFile' {} Maybe FileLocation
a -> OTAUpdateFile
s {$sel:fileLocation:OTAUpdateFile' :: Maybe FileLocation
fileLocation = Maybe FileLocation
a} :: OTAUpdateFile)
oTAUpdateFile_fileName :: Lens.Lens' OTAUpdateFile (Prelude.Maybe Prelude.Text)
oTAUpdateFile_fileName :: Lens' OTAUpdateFile (Maybe Text)
oTAUpdateFile_fileName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OTAUpdateFile' {Maybe Text
fileName :: Maybe Text
$sel:fileName:OTAUpdateFile' :: OTAUpdateFile -> Maybe Text
fileName} -> Maybe Text
fileName) (\s :: OTAUpdateFile
s@OTAUpdateFile' {} Maybe Text
a -> OTAUpdateFile
s {$sel:fileName:OTAUpdateFile' :: Maybe Text
fileName = Maybe Text
a} :: OTAUpdateFile)
oTAUpdateFile_fileType :: Lens.Lens' OTAUpdateFile (Prelude.Maybe Prelude.Natural)
oTAUpdateFile_fileType :: Lens' OTAUpdateFile (Maybe Natural)
oTAUpdateFile_fileType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OTAUpdateFile' {Maybe Natural
fileType :: Maybe Natural
$sel:fileType:OTAUpdateFile' :: OTAUpdateFile -> Maybe Natural
fileType} -> Maybe Natural
fileType) (\s :: OTAUpdateFile
s@OTAUpdateFile' {} Maybe Natural
a -> OTAUpdateFile
s {$sel:fileType:OTAUpdateFile' :: Maybe Natural
fileType = Maybe Natural
a} :: OTAUpdateFile)
oTAUpdateFile_fileVersion :: Lens.Lens' OTAUpdateFile (Prelude.Maybe Prelude.Text)
oTAUpdateFile_fileVersion :: Lens' OTAUpdateFile (Maybe Text)
oTAUpdateFile_fileVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OTAUpdateFile' {Maybe Text
fileVersion :: Maybe Text
$sel:fileVersion:OTAUpdateFile' :: OTAUpdateFile -> Maybe Text
fileVersion} -> Maybe Text
fileVersion) (\s :: OTAUpdateFile
s@OTAUpdateFile' {} Maybe Text
a -> OTAUpdateFile
s {$sel:fileVersion:OTAUpdateFile' :: Maybe Text
fileVersion = Maybe Text
a} :: OTAUpdateFile)
instance Data.FromJSON OTAUpdateFile where
parseJSON :: Value -> Parser OTAUpdateFile
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"OTAUpdateFile"
( \Object
x ->
Maybe (HashMap Text Text)
-> Maybe CodeSigning
-> Maybe FileLocation
-> Maybe Text
-> Maybe Natural
-> Maybe Text
-> OTAUpdateFile
OTAUpdateFile'
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
"attributes" 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
"codeSigning")
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
"fileLocation")
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
"fileName")
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
"fileType")
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
"fileVersion")
)
instance Prelude.Hashable OTAUpdateFile where
hashWithSalt :: Int -> OTAUpdateFile -> Int
hashWithSalt Int
_salt OTAUpdateFile' {Maybe Natural
Maybe Text
Maybe (HashMap Text Text)
Maybe CodeSigning
Maybe FileLocation
fileVersion :: Maybe Text
fileType :: Maybe Natural
fileName :: Maybe Text
fileLocation :: Maybe FileLocation
codeSigning :: Maybe CodeSigning
attributes :: Maybe (HashMap Text Text)
$sel:fileVersion:OTAUpdateFile' :: OTAUpdateFile -> Maybe Text
$sel:fileType:OTAUpdateFile' :: OTAUpdateFile -> Maybe Natural
$sel:fileName:OTAUpdateFile' :: OTAUpdateFile -> Maybe Text
$sel:fileLocation:OTAUpdateFile' :: OTAUpdateFile -> Maybe FileLocation
$sel:codeSigning:OTAUpdateFile' :: OTAUpdateFile -> Maybe CodeSigning
$sel:attributes:OTAUpdateFile' :: OTAUpdateFile -> Maybe (HashMap Text Text)
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
attributes
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CodeSigning
codeSigning
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FileLocation
fileLocation
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
fileName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
fileType
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
fileVersion
instance Prelude.NFData OTAUpdateFile where
rnf :: OTAUpdateFile -> ()
rnf OTAUpdateFile' {Maybe Natural
Maybe Text
Maybe (HashMap Text Text)
Maybe CodeSigning
Maybe FileLocation
fileVersion :: Maybe Text
fileType :: Maybe Natural
fileName :: Maybe Text
fileLocation :: Maybe FileLocation
codeSigning :: Maybe CodeSigning
attributes :: Maybe (HashMap Text Text)
$sel:fileVersion:OTAUpdateFile' :: OTAUpdateFile -> Maybe Text
$sel:fileType:OTAUpdateFile' :: OTAUpdateFile -> Maybe Natural
$sel:fileName:OTAUpdateFile' :: OTAUpdateFile -> Maybe Text
$sel:fileLocation:OTAUpdateFile' :: OTAUpdateFile -> Maybe FileLocation
$sel:codeSigning:OTAUpdateFile' :: OTAUpdateFile -> Maybe CodeSigning
$sel:attributes:OTAUpdateFile' :: OTAUpdateFile -> Maybe (HashMap Text Text)
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
attributes
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CodeSigning
codeSigning
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe FileLocation
fileLocation
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
fileName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
fileType
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
fileVersion
instance Data.ToJSON OTAUpdateFile where
toJSON :: OTAUpdateFile -> Value
toJSON OTAUpdateFile' {Maybe Natural
Maybe Text
Maybe (HashMap Text Text)
Maybe CodeSigning
Maybe FileLocation
fileVersion :: Maybe Text
fileType :: Maybe Natural
fileName :: Maybe Text
fileLocation :: Maybe FileLocation
codeSigning :: Maybe CodeSigning
attributes :: Maybe (HashMap Text Text)
$sel:fileVersion:OTAUpdateFile' :: OTAUpdateFile -> Maybe Text
$sel:fileType:OTAUpdateFile' :: OTAUpdateFile -> Maybe Natural
$sel:fileName:OTAUpdateFile' :: OTAUpdateFile -> Maybe Text
$sel:fileLocation:OTAUpdateFile' :: OTAUpdateFile -> Maybe FileLocation
$sel:codeSigning:OTAUpdateFile' :: OTAUpdateFile -> Maybe CodeSigning
$sel:attributes:OTAUpdateFile' :: OTAUpdateFile -> Maybe (HashMap Text Text)
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"attributes" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
attributes,
(Key
"codeSigning" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CodeSigning
codeSigning,
(Key
"fileLocation" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FileLocation
fileLocation,
(Key
"fileName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
fileName,
(Key
"fileType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
fileType,
(Key
"fileVersion" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
fileVersion
]
)