{-# 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.CloudFront.Types.FunctionMetadata where
import Amazonka.CloudFront.Types.FunctionStage
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data FunctionMetadata = FunctionMetadata'
{
FunctionMetadata -> Maybe FunctionStage
stage :: Prelude.Maybe FunctionStage,
FunctionMetadata -> Maybe ISO8601
createdTime :: Prelude.Maybe Core.ISO8601,
FunctionMetadata -> Text
functionARN :: Prelude.Text,
FunctionMetadata -> ISO8601
lastModifiedTime :: Core.ISO8601
}
deriving (FunctionMetadata -> FunctionMetadata -> Bool
(FunctionMetadata -> FunctionMetadata -> Bool)
-> (FunctionMetadata -> FunctionMetadata -> Bool)
-> Eq FunctionMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FunctionMetadata -> FunctionMetadata -> Bool
$c/= :: FunctionMetadata -> FunctionMetadata -> Bool
== :: FunctionMetadata -> FunctionMetadata -> Bool
$c== :: FunctionMetadata -> FunctionMetadata -> Bool
Prelude.Eq, ReadPrec [FunctionMetadata]
ReadPrec FunctionMetadata
Int -> ReadS FunctionMetadata
ReadS [FunctionMetadata]
(Int -> ReadS FunctionMetadata)
-> ReadS [FunctionMetadata]
-> ReadPrec FunctionMetadata
-> ReadPrec [FunctionMetadata]
-> Read FunctionMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FunctionMetadata]
$creadListPrec :: ReadPrec [FunctionMetadata]
readPrec :: ReadPrec FunctionMetadata
$creadPrec :: ReadPrec FunctionMetadata
readList :: ReadS [FunctionMetadata]
$creadList :: ReadS [FunctionMetadata]
readsPrec :: Int -> ReadS FunctionMetadata
$creadsPrec :: Int -> ReadS FunctionMetadata
Prelude.Read, Int -> FunctionMetadata -> ShowS
[FunctionMetadata] -> ShowS
FunctionMetadata -> String
(Int -> FunctionMetadata -> ShowS)
-> (FunctionMetadata -> String)
-> ([FunctionMetadata] -> ShowS)
-> Show FunctionMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FunctionMetadata] -> ShowS
$cshowList :: [FunctionMetadata] -> ShowS
show :: FunctionMetadata -> String
$cshow :: FunctionMetadata -> String
showsPrec :: Int -> FunctionMetadata -> ShowS
$cshowsPrec :: Int -> FunctionMetadata -> ShowS
Prelude.Show, (forall x. FunctionMetadata -> Rep FunctionMetadata x)
-> (forall x. Rep FunctionMetadata x -> FunctionMetadata)
-> Generic FunctionMetadata
forall x. Rep FunctionMetadata x -> FunctionMetadata
forall x. FunctionMetadata -> Rep FunctionMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FunctionMetadata x -> FunctionMetadata
$cfrom :: forall x. FunctionMetadata -> Rep FunctionMetadata x
Prelude.Generic)
newFunctionMetadata ::
Prelude.Text ->
Prelude.UTCTime ->
FunctionMetadata
newFunctionMetadata :: Text -> UTCTime -> FunctionMetadata
newFunctionMetadata Text
pFunctionARN_ UTCTime
pLastModifiedTime_ =
FunctionMetadata' :: Maybe FunctionStage
-> Maybe ISO8601 -> Text -> ISO8601 -> FunctionMetadata
FunctionMetadata'
{ $sel:stage:FunctionMetadata' :: Maybe FunctionStage
stage = Maybe FunctionStage
forall a. Maybe a
Prelude.Nothing,
$sel:createdTime:FunctionMetadata' :: Maybe ISO8601
createdTime = Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
$sel:functionARN:FunctionMetadata' :: Text
functionARN = Text
pFunctionARN_,
$sel:lastModifiedTime:FunctionMetadata' :: ISO8601
lastModifiedTime =
Tagged UTCTime (Identity UTCTime)
-> Tagged ISO8601 (Identity ISO8601)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
-> Tagged ISO8601 (Identity ISO8601))
-> UTCTime -> ISO8601
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pLastModifiedTime_
}
functionMetadata_stage :: Lens.Lens' FunctionMetadata (Prelude.Maybe FunctionStage)
functionMetadata_stage :: (Maybe FunctionStage -> f (Maybe FunctionStage))
-> FunctionMetadata -> f FunctionMetadata
functionMetadata_stage = (FunctionMetadata -> Maybe FunctionStage)
-> (FunctionMetadata -> Maybe FunctionStage -> FunctionMetadata)
-> Lens
FunctionMetadata
FunctionMetadata
(Maybe FunctionStage)
(Maybe FunctionStage)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FunctionMetadata' {Maybe FunctionStage
stage :: Maybe FunctionStage
$sel:stage:FunctionMetadata' :: FunctionMetadata -> Maybe FunctionStage
stage} -> Maybe FunctionStage
stage) (\s :: FunctionMetadata
s@FunctionMetadata' {} Maybe FunctionStage
a -> FunctionMetadata
s {$sel:stage:FunctionMetadata' :: Maybe FunctionStage
stage = Maybe FunctionStage
a} :: FunctionMetadata)
functionMetadata_createdTime :: Lens.Lens' FunctionMetadata (Prelude.Maybe Prelude.UTCTime)
functionMetadata_createdTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> FunctionMetadata -> f FunctionMetadata
functionMetadata_createdTime = (FunctionMetadata -> Maybe ISO8601)
-> (FunctionMetadata -> Maybe ISO8601 -> FunctionMetadata)
-> Lens
FunctionMetadata FunctionMetadata (Maybe ISO8601) (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FunctionMetadata' {Maybe ISO8601
createdTime :: Maybe ISO8601
$sel:createdTime:FunctionMetadata' :: FunctionMetadata -> Maybe ISO8601
createdTime} -> Maybe ISO8601
createdTime) (\s :: FunctionMetadata
s@FunctionMetadata' {} Maybe ISO8601
a -> FunctionMetadata
s {$sel:createdTime:FunctionMetadata' :: Maybe ISO8601
createdTime = Maybe ISO8601
a} :: FunctionMetadata) ((Maybe ISO8601 -> f (Maybe ISO8601))
-> FunctionMetadata -> f FunctionMetadata)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> FunctionMetadata
-> f FunctionMetadata
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
(Maybe ISO8601) (Maybe ISO8601) (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 ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
functionMetadata_functionARN :: Lens.Lens' FunctionMetadata Prelude.Text
functionMetadata_functionARN :: (Text -> f Text) -> FunctionMetadata -> f FunctionMetadata
functionMetadata_functionARN = (FunctionMetadata -> Text)
-> (FunctionMetadata -> Text -> FunctionMetadata)
-> Lens FunctionMetadata FunctionMetadata Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FunctionMetadata' {Text
functionARN :: Text
$sel:functionARN:FunctionMetadata' :: FunctionMetadata -> Text
functionARN} -> Text
functionARN) (\s :: FunctionMetadata
s@FunctionMetadata' {} Text
a -> FunctionMetadata
s {$sel:functionARN:FunctionMetadata' :: Text
functionARN = Text
a} :: FunctionMetadata)
functionMetadata_lastModifiedTime :: Lens.Lens' FunctionMetadata Prelude.UTCTime
functionMetadata_lastModifiedTime :: (UTCTime -> f UTCTime) -> FunctionMetadata -> f FunctionMetadata
functionMetadata_lastModifiedTime = (FunctionMetadata -> ISO8601)
-> (FunctionMetadata -> ISO8601 -> FunctionMetadata)
-> Lens FunctionMetadata FunctionMetadata ISO8601 ISO8601
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FunctionMetadata' {ISO8601
lastModifiedTime :: ISO8601
$sel:lastModifiedTime:FunctionMetadata' :: FunctionMetadata -> ISO8601
lastModifiedTime} -> ISO8601
lastModifiedTime) (\s :: FunctionMetadata
s@FunctionMetadata' {} ISO8601
a -> FunctionMetadata
s {$sel:lastModifiedTime:FunctionMetadata' :: ISO8601
lastModifiedTime = ISO8601
a} :: FunctionMetadata) ((ISO8601 -> f ISO8601) -> FunctionMetadata -> f FunctionMetadata)
-> ((UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601)
-> (UTCTime -> f UTCTime)
-> FunctionMetadata
-> f FunctionMetadata
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
instance Core.FromXML FunctionMetadata where
parseXML :: [Node] -> Either String FunctionMetadata
parseXML [Node]
x =
Maybe FunctionStage
-> Maybe ISO8601 -> Text -> ISO8601 -> FunctionMetadata
FunctionMetadata'
(Maybe FunctionStage
-> Maybe ISO8601 -> Text -> ISO8601 -> FunctionMetadata)
-> Either String (Maybe FunctionStage)
-> Either
String (Maybe ISO8601 -> Text -> ISO8601 -> FunctionMetadata)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe FunctionStage)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Stage")
Either
String (Maybe ISO8601 -> Text -> ISO8601 -> FunctionMetadata)
-> Either String (Maybe ISO8601)
-> Either String (Text -> ISO8601 -> FunctionMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ISO8601)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"CreatedTime")
Either String (Text -> ISO8601 -> FunctionMetadata)
-> Either String Text
-> Either String (ISO8601 -> FunctionMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"FunctionARN")
Either String (ISO8601 -> FunctionMetadata)
-> Either String ISO8601 -> Either String FunctionMetadata
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String ISO8601
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"LastModifiedTime")
instance Prelude.Hashable FunctionMetadata
instance Prelude.NFData FunctionMetadata