{-# 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.StreamFile where
import qualified Amazonka.Core as Core
import Amazonka.IoT.Types.S3Location
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data StreamFile = StreamFile'
{
StreamFile -> Maybe S3Location
s3Location :: Prelude.Maybe S3Location,
StreamFile -> Maybe Natural
fileId :: Prelude.Maybe Prelude.Natural
}
deriving (StreamFile -> StreamFile -> Bool
(StreamFile -> StreamFile -> Bool)
-> (StreamFile -> StreamFile -> Bool) -> Eq StreamFile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StreamFile -> StreamFile -> Bool
$c/= :: StreamFile -> StreamFile -> Bool
== :: StreamFile -> StreamFile -> Bool
$c== :: StreamFile -> StreamFile -> Bool
Prelude.Eq, ReadPrec [StreamFile]
ReadPrec StreamFile
Int -> ReadS StreamFile
ReadS [StreamFile]
(Int -> ReadS StreamFile)
-> ReadS [StreamFile]
-> ReadPrec StreamFile
-> ReadPrec [StreamFile]
-> Read StreamFile
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StreamFile]
$creadListPrec :: ReadPrec [StreamFile]
readPrec :: ReadPrec StreamFile
$creadPrec :: ReadPrec StreamFile
readList :: ReadS [StreamFile]
$creadList :: ReadS [StreamFile]
readsPrec :: Int -> ReadS StreamFile
$creadsPrec :: Int -> ReadS StreamFile
Prelude.Read, Int -> StreamFile -> ShowS
[StreamFile] -> ShowS
StreamFile -> String
(Int -> StreamFile -> ShowS)
-> (StreamFile -> String)
-> ([StreamFile] -> ShowS)
-> Show StreamFile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StreamFile] -> ShowS
$cshowList :: [StreamFile] -> ShowS
show :: StreamFile -> String
$cshow :: StreamFile -> String
showsPrec :: Int -> StreamFile -> ShowS
$cshowsPrec :: Int -> StreamFile -> ShowS
Prelude.Show, (forall x. StreamFile -> Rep StreamFile x)
-> (forall x. Rep StreamFile x -> StreamFile) -> Generic StreamFile
forall x. Rep StreamFile x -> StreamFile
forall x. StreamFile -> Rep StreamFile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StreamFile x -> StreamFile
$cfrom :: forall x. StreamFile -> Rep StreamFile x
Prelude.Generic)
newStreamFile ::
StreamFile
newStreamFile :: StreamFile
newStreamFile =
StreamFile' :: Maybe S3Location -> Maybe Natural -> StreamFile
StreamFile'
{ $sel:s3Location:StreamFile' :: Maybe S3Location
s3Location = Maybe S3Location
forall a. Maybe a
Prelude.Nothing,
$sel:fileId:StreamFile' :: Maybe Natural
fileId = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
streamFile_s3Location :: Lens.Lens' StreamFile (Prelude.Maybe S3Location)
streamFile_s3Location :: (Maybe S3Location -> f (Maybe S3Location))
-> StreamFile -> f StreamFile
streamFile_s3Location = (StreamFile -> Maybe S3Location)
-> (StreamFile -> Maybe S3Location -> StreamFile)
-> Lens StreamFile StreamFile (Maybe S3Location) (Maybe S3Location)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamFile' {Maybe S3Location
s3Location :: Maybe S3Location
$sel:s3Location:StreamFile' :: StreamFile -> Maybe S3Location
s3Location} -> Maybe S3Location
s3Location) (\s :: StreamFile
s@StreamFile' {} Maybe S3Location
a -> StreamFile
s {$sel:s3Location:StreamFile' :: Maybe S3Location
s3Location = Maybe S3Location
a} :: StreamFile)
streamFile_fileId :: Lens.Lens' StreamFile (Prelude.Maybe Prelude.Natural)
streamFile_fileId :: (Maybe Natural -> f (Maybe Natural)) -> StreamFile -> f StreamFile
streamFile_fileId = (StreamFile -> Maybe Natural)
-> (StreamFile -> Maybe Natural -> StreamFile)
-> Lens StreamFile StreamFile (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamFile' {Maybe Natural
fileId :: Maybe Natural
$sel:fileId:StreamFile' :: StreamFile -> Maybe Natural
fileId} -> Maybe Natural
fileId) (\s :: StreamFile
s@StreamFile' {} Maybe Natural
a -> StreamFile
s {$sel:fileId:StreamFile' :: Maybe Natural
fileId = Maybe Natural
a} :: StreamFile)
instance Core.FromJSON StreamFile where
parseJSON :: Value -> Parser StreamFile
parseJSON =
String
-> (Object -> Parser StreamFile) -> Value -> Parser StreamFile
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"StreamFile"
( \Object
x ->
Maybe S3Location -> Maybe Natural -> StreamFile
StreamFile'
(Maybe S3Location -> Maybe Natural -> StreamFile)
-> Parser (Maybe S3Location)
-> Parser (Maybe Natural -> StreamFile)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe S3Location)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"s3Location")
Parser (Maybe Natural -> StreamFile)
-> Parser (Maybe Natural) -> Parser StreamFile
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"fileId")
)
instance Prelude.Hashable StreamFile
instance Prelude.NFData StreamFile
instance Core.ToJSON StreamFile where
toJSON :: StreamFile -> Value
toJSON StreamFile' {Maybe Natural
Maybe S3Location
fileId :: Maybe Natural
s3Location :: Maybe S3Location
$sel:fileId:StreamFile' :: StreamFile -> Maybe Natural
$sel:s3Location:StreamFile' :: StreamFile -> Maybe S3Location
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"s3Location" Text -> S3Location -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (S3Location -> Pair) -> Maybe S3Location -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe S3Location
s3Location,
(Text
"fileId" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
fileId
]
)