{-# 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.MediaStoreData.Types.Item where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaStoreData.Types.ItemType
import qualified Amazonka.Prelude as Prelude
data Item = Item'
{
Item -> Maybe Text
eTag :: Prelude.Maybe Prelude.Text,
Item -> Maybe Natural
contentLength :: Prelude.Maybe Prelude.Natural,
Item -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
Item -> Maybe ItemType
type' :: Prelude.Maybe ItemType,
Item -> Maybe POSIX
lastModified :: Prelude.Maybe Core.POSIX,
Item -> Maybe Text
contentType :: Prelude.Maybe Prelude.Text
}
deriving (Item -> Item -> Bool
(Item -> Item -> Bool) -> (Item -> Item -> Bool) -> Eq Item
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Item -> Item -> Bool
$c/= :: Item -> Item -> Bool
== :: Item -> Item -> Bool
$c== :: Item -> Item -> Bool
Prelude.Eq, ReadPrec [Item]
ReadPrec Item
Int -> ReadS Item
ReadS [Item]
(Int -> ReadS Item)
-> ReadS [Item] -> ReadPrec Item -> ReadPrec [Item] -> Read Item
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Item]
$creadListPrec :: ReadPrec [Item]
readPrec :: ReadPrec Item
$creadPrec :: ReadPrec Item
readList :: ReadS [Item]
$creadList :: ReadS [Item]
readsPrec :: Int -> ReadS Item
$creadsPrec :: Int -> ReadS Item
Prelude.Read, Int -> Item -> ShowS
[Item] -> ShowS
Item -> String
(Int -> Item -> ShowS)
-> (Item -> String) -> ([Item] -> ShowS) -> Show Item
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Item] -> ShowS
$cshowList :: [Item] -> ShowS
show :: Item -> String
$cshow :: Item -> String
showsPrec :: Int -> Item -> ShowS
$cshowsPrec :: Int -> Item -> ShowS
Prelude.Show, (forall x. Item -> Rep Item x)
-> (forall x. Rep Item x -> Item) -> Generic Item
forall x. Rep Item x -> Item
forall x. Item -> Rep Item x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Item x -> Item
$cfrom :: forall x. Item -> Rep Item x
Prelude.Generic)
newItem ::
Item
newItem :: Item
newItem =
Item' :: Maybe Text
-> Maybe Natural
-> Maybe Text
-> Maybe ItemType
-> Maybe POSIX
-> Maybe Text
-> Item
Item'
{ $sel:eTag:Item' :: Maybe Text
eTag = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:contentLength:Item' :: Maybe Natural
contentLength = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:name:Item' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:type':Item' :: Maybe ItemType
type' = Maybe ItemType
forall a. Maybe a
Prelude.Nothing,
$sel:lastModified:Item' :: Maybe POSIX
lastModified = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:contentType:Item' :: Maybe Text
contentType = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
item_eTag :: Lens.Lens' Item (Prelude.Maybe Prelude.Text)
item_eTag :: (Maybe Text -> f (Maybe Text)) -> Item -> f Item
item_eTag = (Item -> Maybe Text)
-> (Item -> Maybe Text -> Item)
-> Lens Item Item (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Item' {Maybe Text
eTag :: Maybe Text
$sel:eTag:Item' :: Item -> Maybe Text
eTag} -> Maybe Text
eTag) (\s :: Item
s@Item' {} Maybe Text
a -> Item
s {$sel:eTag:Item' :: Maybe Text
eTag = Maybe Text
a} :: Item)
item_contentLength :: Lens.Lens' Item (Prelude.Maybe Prelude.Natural)
item_contentLength :: (Maybe Natural -> f (Maybe Natural)) -> Item -> f Item
item_contentLength = (Item -> Maybe Natural)
-> (Item -> Maybe Natural -> Item)
-> Lens Item Item (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Item' {Maybe Natural
contentLength :: Maybe Natural
$sel:contentLength:Item' :: Item -> Maybe Natural
contentLength} -> Maybe Natural
contentLength) (\s :: Item
s@Item' {} Maybe Natural
a -> Item
s {$sel:contentLength:Item' :: Maybe Natural
contentLength = Maybe Natural
a} :: Item)
item_name :: Lens.Lens' Item (Prelude.Maybe Prelude.Text)
item_name :: (Maybe Text -> f (Maybe Text)) -> Item -> f Item
item_name = (Item -> Maybe Text)
-> (Item -> Maybe Text -> Item)
-> Lens Item Item (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Item' {Maybe Text
name :: Maybe Text
$sel:name:Item' :: Item -> Maybe Text
name} -> Maybe Text
name) (\s :: Item
s@Item' {} Maybe Text
a -> Item
s {$sel:name:Item' :: Maybe Text
name = Maybe Text
a} :: Item)
item_type :: Lens.Lens' Item (Prelude.Maybe ItemType)
item_type :: (Maybe ItemType -> f (Maybe ItemType)) -> Item -> f Item
item_type = (Item -> Maybe ItemType)
-> (Item -> Maybe ItemType -> Item)
-> Lens Item Item (Maybe ItemType) (Maybe ItemType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Item' {Maybe ItemType
type' :: Maybe ItemType
$sel:type':Item' :: Item -> Maybe ItemType
type'} -> Maybe ItemType
type') (\s :: Item
s@Item' {} Maybe ItemType
a -> Item
s {$sel:type':Item' :: Maybe ItemType
type' = Maybe ItemType
a} :: Item)
item_lastModified :: Lens.Lens' Item (Prelude.Maybe Prelude.UTCTime)
item_lastModified :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Item -> f Item
item_lastModified = (Item -> Maybe POSIX)
-> (Item -> Maybe POSIX -> Item)
-> Lens Item Item (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Item' {Maybe POSIX
lastModified :: Maybe POSIX
$sel:lastModified:Item' :: Item -> Maybe POSIX
lastModified} -> Maybe POSIX
lastModified) (\s :: Item
s@Item' {} Maybe POSIX
a -> Item
s {$sel:lastModified:Item' :: Maybe POSIX
lastModified = Maybe POSIX
a} :: Item) ((Maybe POSIX -> f (Maybe POSIX)) -> Item -> f Item)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Item
-> f Item
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
item_contentType :: Lens.Lens' Item (Prelude.Maybe Prelude.Text)
item_contentType :: (Maybe Text -> f (Maybe Text)) -> Item -> f Item
item_contentType = (Item -> Maybe Text)
-> (Item -> Maybe Text -> Item)
-> Lens Item Item (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Item' {Maybe Text
contentType :: Maybe Text
$sel:contentType:Item' :: Item -> Maybe Text
contentType} -> Maybe Text
contentType) (\s :: Item
s@Item' {} Maybe Text
a -> Item
s {$sel:contentType:Item' :: Maybe Text
contentType = Maybe Text
a} :: Item)
instance Core.FromJSON Item where
parseJSON :: Value -> Parser Item
parseJSON =
String -> (Object -> Parser Item) -> Value -> Parser Item
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Item"
( \Object
x ->
Maybe Text
-> Maybe Natural
-> Maybe Text
-> Maybe ItemType
-> Maybe POSIX
-> Maybe Text
-> Item
Item'
(Maybe Text
-> Maybe Natural
-> Maybe Text
-> Maybe ItemType
-> Maybe POSIX
-> Maybe Text
-> Item)
-> Parser (Maybe Text)
-> Parser
(Maybe Natural
-> Maybe Text
-> Maybe ItemType
-> Maybe POSIX
-> Maybe Text
-> Item)
forall (f :: * -> *) a b. Functor 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
"ETag")
Parser
(Maybe Natural
-> Maybe Text
-> Maybe ItemType
-> Maybe POSIX
-> Maybe Text
-> Item)
-> Parser (Maybe Natural)
-> Parser
(Maybe Text -> Maybe ItemType -> Maybe POSIX -> Maybe Text -> Item)
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
"ContentLength")
Parser
(Maybe Text -> Maybe ItemType -> Maybe POSIX -> Maybe Text -> Item)
-> Parser (Maybe Text)
-> Parser (Maybe ItemType -> Maybe POSIX -> Maybe Text -> Item)
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
"Name")
Parser (Maybe ItemType -> Maybe POSIX -> Maybe Text -> Item)
-> Parser (Maybe ItemType)
-> Parser (Maybe POSIX -> Maybe Text -> Item)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ItemType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Type")
Parser (Maybe POSIX -> Maybe Text -> Item)
-> Parser (Maybe POSIX) -> Parser (Maybe Text -> Item)
forall (f :: * -> *) a b. Applicative f => 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
"LastModified")
Parser (Maybe Text -> Item) -> Parser (Maybe Text) -> Parser Item
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
"ContentType")
)
instance Prelude.Hashable Item
instance Prelude.NFData Item