{-# 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.IoTSiteWise.Types.ImageFile where
import qualified Amazonka.Core as Core
import Amazonka.IoTSiteWise.Types.ImageFileType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ImageFile = ImageFile'
{
ImageFile -> Base64
data' :: Core.Base64,
ImageFile -> ImageFileType
type' :: ImageFileType
}
deriving (ImageFile -> ImageFile -> Bool
(ImageFile -> ImageFile -> Bool)
-> (ImageFile -> ImageFile -> Bool) -> Eq ImageFile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImageFile -> ImageFile -> Bool
$c/= :: ImageFile -> ImageFile -> Bool
== :: ImageFile -> ImageFile -> Bool
$c== :: ImageFile -> ImageFile -> Bool
Prelude.Eq, ReadPrec [ImageFile]
ReadPrec ImageFile
Int -> ReadS ImageFile
ReadS [ImageFile]
(Int -> ReadS ImageFile)
-> ReadS [ImageFile]
-> ReadPrec ImageFile
-> ReadPrec [ImageFile]
-> Read ImageFile
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ImageFile]
$creadListPrec :: ReadPrec [ImageFile]
readPrec :: ReadPrec ImageFile
$creadPrec :: ReadPrec ImageFile
readList :: ReadS [ImageFile]
$creadList :: ReadS [ImageFile]
readsPrec :: Int -> ReadS ImageFile
$creadsPrec :: Int -> ReadS ImageFile
Prelude.Read, Int -> ImageFile -> ShowS
[ImageFile] -> ShowS
ImageFile -> String
(Int -> ImageFile -> ShowS)
-> (ImageFile -> String)
-> ([ImageFile] -> ShowS)
-> Show ImageFile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImageFile] -> ShowS
$cshowList :: [ImageFile] -> ShowS
show :: ImageFile -> String
$cshow :: ImageFile -> String
showsPrec :: Int -> ImageFile -> ShowS
$cshowsPrec :: Int -> ImageFile -> ShowS
Prelude.Show, (forall x. ImageFile -> Rep ImageFile x)
-> (forall x. Rep ImageFile x -> ImageFile) -> Generic ImageFile
forall x. Rep ImageFile x -> ImageFile
forall x. ImageFile -> Rep ImageFile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImageFile x -> ImageFile
$cfrom :: forall x. ImageFile -> Rep ImageFile x
Prelude.Generic)
newImageFile ::
Prelude.ByteString ->
ImageFileType ->
ImageFile
newImageFile :: ByteString -> ImageFileType -> ImageFile
newImageFile ByteString
pData_ ImageFileType
pType_ =
ImageFile' :: Base64 -> ImageFileType -> ImageFile
ImageFile'
{ $sel:data':ImageFile' :: Base64
data' = Tagged ByteString (Identity ByteString)
-> Tagged Base64 (Identity Base64)
Iso' Base64 ByteString
Core._Base64 (Tagged ByteString (Identity ByteString)
-> Tagged Base64 (Identity Base64))
-> ByteString -> Base64
forall t b. AReview t b -> b -> t
Lens.# ByteString
pData_,
$sel:type':ImageFile' :: ImageFileType
type' = ImageFileType
pType_
}
imageFile_data :: Lens.Lens' ImageFile Prelude.ByteString
imageFile_data :: (ByteString -> f ByteString) -> ImageFile -> f ImageFile
imageFile_data = (ImageFile -> Base64)
-> (ImageFile -> Base64 -> ImageFile)
-> Lens ImageFile ImageFile Base64 Base64
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImageFile' {Base64
data' :: Base64
$sel:data':ImageFile' :: ImageFile -> Base64
data'} -> Base64
data') (\s :: ImageFile
s@ImageFile' {} Base64
a -> ImageFile
s {$sel:data':ImageFile' :: Base64
data' = Base64
a} :: ImageFile) ((Base64 -> f Base64) -> ImageFile -> f ImageFile)
-> ((ByteString -> f ByteString) -> Base64 -> f Base64)
-> (ByteString -> f ByteString)
-> ImageFile
-> f ImageFile
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (ByteString -> f ByteString) -> Base64 -> f Base64
Iso' Base64 ByteString
Core._Base64
imageFile_type :: Lens.Lens' ImageFile ImageFileType
imageFile_type :: (ImageFileType -> f ImageFileType) -> ImageFile -> f ImageFile
imageFile_type = (ImageFile -> ImageFileType)
-> (ImageFile -> ImageFileType -> ImageFile)
-> Lens ImageFile ImageFile ImageFileType ImageFileType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImageFile' {ImageFileType
type' :: ImageFileType
$sel:type':ImageFile' :: ImageFile -> ImageFileType
type'} -> ImageFileType
type') (\s :: ImageFile
s@ImageFile' {} ImageFileType
a -> ImageFile
s {$sel:type':ImageFile' :: ImageFileType
type' = ImageFileType
a} :: ImageFile)
instance Prelude.Hashable ImageFile
instance Prelude.NFData ImageFile
instance Core.ToJSON ImageFile where
toJSON :: ImageFile -> Value
toJSON ImageFile' {Base64
ImageFileType
type' :: ImageFileType
data' :: Base64
$sel:type':ImageFile' :: ImageFile -> ImageFileType
$sel:data':ImageFile' :: ImageFile -> Base64
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"data" Text -> Base64 -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Base64
data'),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"type" Text -> ImageFileType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ImageFileType
type')
]
)