{-# 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.CustomErrorResponse where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data CustomErrorResponse = CustomErrorResponse'
{
CustomErrorResponse -> Maybe Text
responsePagePath :: Prelude.Maybe Prelude.Text,
CustomErrorResponse -> Maybe Text
responseCode :: Prelude.Maybe Prelude.Text,
CustomErrorResponse -> Maybe Integer
errorCachingMinTTL :: Prelude.Maybe Prelude.Integer,
CustomErrorResponse -> Int
errorCode :: Prelude.Int
}
deriving (CustomErrorResponse -> CustomErrorResponse -> Bool
(CustomErrorResponse -> CustomErrorResponse -> Bool)
-> (CustomErrorResponse -> CustomErrorResponse -> Bool)
-> Eq CustomErrorResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CustomErrorResponse -> CustomErrorResponse -> Bool
$c/= :: CustomErrorResponse -> CustomErrorResponse -> Bool
== :: CustomErrorResponse -> CustomErrorResponse -> Bool
$c== :: CustomErrorResponse -> CustomErrorResponse -> Bool
Prelude.Eq, ReadPrec [CustomErrorResponse]
ReadPrec CustomErrorResponse
Int -> ReadS CustomErrorResponse
ReadS [CustomErrorResponse]
(Int -> ReadS CustomErrorResponse)
-> ReadS [CustomErrorResponse]
-> ReadPrec CustomErrorResponse
-> ReadPrec [CustomErrorResponse]
-> Read CustomErrorResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CustomErrorResponse]
$creadListPrec :: ReadPrec [CustomErrorResponse]
readPrec :: ReadPrec CustomErrorResponse
$creadPrec :: ReadPrec CustomErrorResponse
readList :: ReadS [CustomErrorResponse]
$creadList :: ReadS [CustomErrorResponse]
readsPrec :: Int -> ReadS CustomErrorResponse
$creadsPrec :: Int -> ReadS CustomErrorResponse
Prelude.Read, Int -> CustomErrorResponse -> ShowS
[CustomErrorResponse] -> ShowS
CustomErrorResponse -> String
(Int -> CustomErrorResponse -> ShowS)
-> (CustomErrorResponse -> String)
-> ([CustomErrorResponse] -> ShowS)
-> Show CustomErrorResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CustomErrorResponse] -> ShowS
$cshowList :: [CustomErrorResponse] -> ShowS
show :: CustomErrorResponse -> String
$cshow :: CustomErrorResponse -> String
showsPrec :: Int -> CustomErrorResponse -> ShowS
$cshowsPrec :: Int -> CustomErrorResponse -> ShowS
Prelude.Show, (forall x. CustomErrorResponse -> Rep CustomErrorResponse x)
-> (forall x. Rep CustomErrorResponse x -> CustomErrorResponse)
-> Generic CustomErrorResponse
forall x. Rep CustomErrorResponse x -> CustomErrorResponse
forall x. CustomErrorResponse -> Rep CustomErrorResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CustomErrorResponse x -> CustomErrorResponse
$cfrom :: forall x. CustomErrorResponse -> Rep CustomErrorResponse x
Prelude.Generic)
newCustomErrorResponse ::
Prelude.Int ->
CustomErrorResponse
newCustomErrorResponse :: Int -> CustomErrorResponse
newCustomErrorResponse Int
pErrorCode_ =
CustomErrorResponse' :: Maybe Text
-> Maybe Text -> Maybe Integer -> Int -> CustomErrorResponse
CustomErrorResponse'
{ $sel:responsePagePath:CustomErrorResponse' :: Maybe Text
responsePagePath =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:responseCode:CustomErrorResponse' :: Maybe Text
responseCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:errorCachingMinTTL:CustomErrorResponse' :: Maybe Integer
errorCachingMinTTL = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
$sel:errorCode:CustomErrorResponse' :: Int
errorCode = Int
pErrorCode_
}
customErrorResponse_responsePagePath :: Lens.Lens' CustomErrorResponse (Prelude.Maybe Prelude.Text)
customErrorResponse_responsePagePath :: (Maybe Text -> f (Maybe Text))
-> CustomErrorResponse -> f CustomErrorResponse
customErrorResponse_responsePagePath = (CustomErrorResponse -> Maybe Text)
-> (CustomErrorResponse -> Maybe Text -> CustomErrorResponse)
-> Lens
CustomErrorResponse CustomErrorResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomErrorResponse' {Maybe Text
responsePagePath :: Maybe Text
$sel:responsePagePath:CustomErrorResponse' :: CustomErrorResponse -> Maybe Text
responsePagePath} -> Maybe Text
responsePagePath) (\s :: CustomErrorResponse
s@CustomErrorResponse' {} Maybe Text
a -> CustomErrorResponse
s {$sel:responsePagePath:CustomErrorResponse' :: Maybe Text
responsePagePath = Maybe Text
a} :: CustomErrorResponse)
customErrorResponse_responseCode :: Lens.Lens' CustomErrorResponse (Prelude.Maybe Prelude.Text)
customErrorResponse_responseCode :: (Maybe Text -> f (Maybe Text))
-> CustomErrorResponse -> f CustomErrorResponse
customErrorResponse_responseCode = (CustomErrorResponse -> Maybe Text)
-> (CustomErrorResponse -> Maybe Text -> CustomErrorResponse)
-> Lens
CustomErrorResponse CustomErrorResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomErrorResponse' {Maybe Text
responseCode :: Maybe Text
$sel:responseCode:CustomErrorResponse' :: CustomErrorResponse -> Maybe Text
responseCode} -> Maybe Text
responseCode) (\s :: CustomErrorResponse
s@CustomErrorResponse' {} Maybe Text
a -> CustomErrorResponse
s {$sel:responseCode:CustomErrorResponse' :: Maybe Text
responseCode = Maybe Text
a} :: CustomErrorResponse)
customErrorResponse_errorCachingMinTTL :: Lens.Lens' CustomErrorResponse (Prelude.Maybe Prelude.Integer)
customErrorResponse_errorCachingMinTTL :: (Maybe Integer -> f (Maybe Integer))
-> CustomErrorResponse -> f CustomErrorResponse
customErrorResponse_errorCachingMinTTL = (CustomErrorResponse -> Maybe Integer)
-> (CustomErrorResponse -> Maybe Integer -> CustomErrorResponse)
-> Lens
CustomErrorResponse
CustomErrorResponse
(Maybe Integer)
(Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomErrorResponse' {Maybe Integer
errorCachingMinTTL :: Maybe Integer
$sel:errorCachingMinTTL:CustomErrorResponse' :: CustomErrorResponse -> Maybe Integer
errorCachingMinTTL} -> Maybe Integer
errorCachingMinTTL) (\s :: CustomErrorResponse
s@CustomErrorResponse' {} Maybe Integer
a -> CustomErrorResponse
s {$sel:errorCachingMinTTL:CustomErrorResponse' :: Maybe Integer
errorCachingMinTTL = Maybe Integer
a} :: CustomErrorResponse)
customErrorResponse_errorCode :: Lens.Lens' CustomErrorResponse Prelude.Int
customErrorResponse_errorCode :: (Int -> f Int) -> CustomErrorResponse -> f CustomErrorResponse
customErrorResponse_errorCode = (CustomErrorResponse -> Int)
-> (CustomErrorResponse -> Int -> CustomErrorResponse)
-> Lens CustomErrorResponse CustomErrorResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomErrorResponse' {Int
errorCode :: Int
$sel:errorCode:CustomErrorResponse' :: CustomErrorResponse -> Int
errorCode} -> Int
errorCode) (\s :: CustomErrorResponse
s@CustomErrorResponse' {} Int
a -> CustomErrorResponse
s {$sel:errorCode:CustomErrorResponse' :: Int
errorCode = Int
a} :: CustomErrorResponse)
instance Core.FromXML CustomErrorResponse where
parseXML :: [Node] -> Either String CustomErrorResponse
parseXML [Node]
x =
Maybe Text
-> Maybe Text -> Maybe Integer -> Int -> CustomErrorResponse
CustomErrorResponse'
(Maybe Text
-> Maybe Text -> Maybe Integer -> Int -> CustomErrorResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe Text -> Maybe Integer -> Int -> CustomErrorResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ResponsePagePath")
Either
String (Maybe Text -> Maybe Integer -> Int -> CustomErrorResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Integer -> Int -> CustomErrorResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ResponseCode")
Either String (Maybe Integer -> Int -> CustomErrorResponse)
-> Either String (Maybe Integer)
-> Either String (Int -> CustomErrorResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Integer)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ErrorCachingMinTTL")
Either String (Int -> CustomErrorResponse)
-> Either String Int -> Either String CustomErrorResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Int
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"ErrorCode")
instance Prelude.Hashable CustomErrorResponse
instance Prelude.NFData CustomErrorResponse
instance Core.ToXML CustomErrorResponse where
toXML :: CustomErrorResponse -> XML
toXML CustomErrorResponse' {Int
Maybe Integer
Maybe Text
errorCode :: Int
errorCachingMinTTL :: Maybe Integer
responseCode :: Maybe Text
responsePagePath :: Maybe Text
$sel:errorCode:CustomErrorResponse' :: CustomErrorResponse -> Int
$sel:errorCachingMinTTL:CustomErrorResponse' :: CustomErrorResponse -> Maybe Integer
$sel:responseCode:CustomErrorResponse' :: CustomErrorResponse -> Maybe Text
$sel:responsePagePath:CustomErrorResponse' :: CustomErrorResponse -> Maybe Text
..} =
[XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"ResponsePagePath" Name -> Maybe Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Text
responsePagePath,
Name
"ResponseCode" Name -> Maybe Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Text
responseCode,
Name
"ErrorCachingMinTTL" Name -> Maybe Integer -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Integer
errorCachingMinTTL,
Name
"ErrorCode" Name -> Int -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Int
errorCode
]