{-# 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.CachePolicy where
import Amazonka.CloudFront.Types.CachePolicyConfig
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data CachePolicy = CachePolicy'
{
CachePolicy -> Text
id :: Prelude.Text,
CachePolicy -> ISO8601
lastModifiedTime :: Core.ISO8601,
CachePolicy -> CachePolicyConfig
cachePolicyConfig :: CachePolicyConfig
}
deriving (CachePolicy -> CachePolicy -> Bool
(CachePolicy -> CachePolicy -> Bool)
-> (CachePolicy -> CachePolicy -> Bool) -> Eq CachePolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CachePolicy -> CachePolicy -> Bool
$c/= :: CachePolicy -> CachePolicy -> Bool
== :: CachePolicy -> CachePolicy -> Bool
$c== :: CachePolicy -> CachePolicy -> Bool
Prelude.Eq, ReadPrec [CachePolicy]
ReadPrec CachePolicy
Int -> ReadS CachePolicy
ReadS [CachePolicy]
(Int -> ReadS CachePolicy)
-> ReadS [CachePolicy]
-> ReadPrec CachePolicy
-> ReadPrec [CachePolicy]
-> Read CachePolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CachePolicy]
$creadListPrec :: ReadPrec [CachePolicy]
readPrec :: ReadPrec CachePolicy
$creadPrec :: ReadPrec CachePolicy
readList :: ReadS [CachePolicy]
$creadList :: ReadS [CachePolicy]
readsPrec :: Int -> ReadS CachePolicy
$creadsPrec :: Int -> ReadS CachePolicy
Prelude.Read, Int -> CachePolicy -> ShowS
[CachePolicy] -> ShowS
CachePolicy -> String
(Int -> CachePolicy -> ShowS)
-> (CachePolicy -> String)
-> ([CachePolicy] -> ShowS)
-> Show CachePolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CachePolicy] -> ShowS
$cshowList :: [CachePolicy] -> ShowS
show :: CachePolicy -> String
$cshow :: CachePolicy -> String
showsPrec :: Int -> CachePolicy -> ShowS
$cshowsPrec :: Int -> CachePolicy -> ShowS
Prelude.Show, (forall x. CachePolicy -> Rep CachePolicy x)
-> (forall x. Rep CachePolicy x -> CachePolicy)
-> Generic CachePolicy
forall x. Rep CachePolicy x -> CachePolicy
forall x. CachePolicy -> Rep CachePolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CachePolicy x -> CachePolicy
$cfrom :: forall x. CachePolicy -> Rep CachePolicy x
Prelude.Generic)
newCachePolicy ::
Prelude.Text ->
Prelude.UTCTime ->
CachePolicyConfig ->
CachePolicy
newCachePolicy :: Text -> UTCTime -> CachePolicyConfig -> CachePolicy
newCachePolicy
Text
pId_
UTCTime
pLastModifiedTime_
CachePolicyConfig
pCachePolicyConfig_ =
CachePolicy' :: Text -> ISO8601 -> CachePolicyConfig -> CachePolicy
CachePolicy'
{ $sel:id:CachePolicy' :: Text
id = Text
pId_,
$sel:lastModifiedTime:CachePolicy' :: 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_,
$sel:cachePolicyConfig:CachePolicy' :: CachePolicyConfig
cachePolicyConfig = CachePolicyConfig
pCachePolicyConfig_
}
cachePolicy_id :: Lens.Lens' CachePolicy Prelude.Text
cachePolicy_id :: (Text -> f Text) -> CachePolicy -> f CachePolicy
cachePolicy_id = (CachePolicy -> Text)
-> (CachePolicy -> Text -> CachePolicy)
-> Lens CachePolicy CachePolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CachePolicy' {Text
id :: Text
$sel:id:CachePolicy' :: CachePolicy -> Text
id} -> Text
id) (\s :: CachePolicy
s@CachePolicy' {} Text
a -> CachePolicy
s {$sel:id:CachePolicy' :: Text
id = Text
a} :: CachePolicy)
cachePolicy_lastModifiedTime :: Lens.Lens' CachePolicy Prelude.UTCTime
cachePolicy_lastModifiedTime :: (UTCTime -> f UTCTime) -> CachePolicy -> f CachePolicy
cachePolicy_lastModifiedTime = (CachePolicy -> ISO8601)
-> (CachePolicy -> ISO8601 -> CachePolicy)
-> Lens CachePolicy CachePolicy ISO8601 ISO8601
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CachePolicy' {ISO8601
lastModifiedTime :: ISO8601
$sel:lastModifiedTime:CachePolicy' :: CachePolicy -> ISO8601
lastModifiedTime} -> ISO8601
lastModifiedTime) (\s :: CachePolicy
s@CachePolicy' {} ISO8601
a -> CachePolicy
s {$sel:lastModifiedTime:CachePolicy' :: ISO8601
lastModifiedTime = ISO8601
a} :: CachePolicy) ((ISO8601 -> f ISO8601) -> CachePolicy -> f CachePolicy)
-> ((UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601)
-> (UTCTime -> f UTCTime)
-> CachePolicy
-> f CachePolicy
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
cachePolicy_cachePolicyConfig :: Lens.Lens' CachePolicy CachePolicyConfig
cachePolicy_cachePolicyConfig :: (CachePolicyConfig -> f CachePolicyConfig)
-> CachePolicy -> f CachePolicy
cachePolicy_cachePolicyConfig = (CachePolicy -> CachePolicyConfig)
-> (CachePolicy -> CachePolicyConfig -> CachePolicy)
-> Lens CachePolicy CachePolicy CachePolicyConfig CachePolicyConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CachePolicy' {CachePolicyConfig
cachePolicyConfig :: CachePolicyConfig
$sel:cachePolicyConfig:CachePolicy' :: CachePolicy -> CachePolicyConfig
cachePolicyConfig} -> CachePolicyConfig
cachePolicyConfig) (\s :: CachePolicy
s@CachePolicy' {} CachePolicyConfig
a -> CachePolicy
s {$sel:cachePolicyConfig:CachePolicy' :: CachePolicyConfig
cachePolicyConfig = CachePolicyConfig
a} :: CachePolicy)
instance Core.FromXML CachePolicy where
parseXML :: [Node] -> Either String CachePolicy
parseXML [Node]
x =
Text -> ISO8601 -> CachePolicyConfig -> CachePolicy
CachePolicy'
(Text -> ISO8601 -> CachePolicyConfig -> CachePolicy)
-> Either String Text
-> Either String (ISO8601 -> CachePolicyConfig -> CachePolicy)
forall (f :: * -> *) a b. Functor 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
"Id")
Either String (ISO8601 -> CachePolicyConfig -> CachePolicy)
-> Either String ISO8601
-> Either String (CachePolicyConfig -> CachePolicy)
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")
Either String (CachePolicyConfig -> CachePolicy)
-> Either String CachePolicyConfig -> Either String CachePolicy
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String CachePolicyConfig
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"CachePolicyConfig")
instance Prelude.Hashable CachePolicy
instance Prelude.NFData CachePolicy