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