{-# 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.OriginShield where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data OriginShield = OriginShield'
{
OriginShield -> Maybe Text
originShieldRegion :: Prelude.Maybe Prelude.Text,
OriginShield -> Bool
enabled :: Prelude.Bool
}
deriving (OriginShield -> OriginShield -> Bool
(OriginShield -> OriginShield -> Bool)
-> (OriginShield -> OriginShield -> Bool) -> Eq OriginShield
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OriginShield -> OriginShield -> Bool
$c/= :: OriginShield -> OriginShield -> Bool
== :: OriginShield -> OriginShield -> Bool
$c== :: OriginShield -> OriginShield -> Bool
Prelude.Eq, ReadPrec [OriginShield]
ReadPrec OriginShield
Int -> ReadS OriginShield
ReadS [OriginShield]
(Int -> ReadS OriginShield)
-> ReadS [OriginShield]
-> ReadPrec OriginShield
-> ReadPrec [OriginShield]
-> Read OriginShield
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OriginShield]
$creadListPrec :: ReadPrec [OriginShield]
readPrec :: ReadPrec OriginShield
$creadPrec :: ReadPrec OriginShield
readList :: ReadS [OriginShield]
$creadList :: ReadS [OriginShield]
readsPrec :: Int -> ReadS OriginShield
$creadsPrec :: Int -> ReadS OriginShield
Prelude.Read, Int -> OriginShield -> ShowS
[OriginShield] -> ShowS
OriginShield -> String
(Int -> OriginShield -> ShowS)
-> (OriginShield -> String)
-> ([OriginShield] -> ShowS)
-> Show OriginShield
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OriginShield] -> ShowS
$cshowList :: [OriginShield] -> ShowS
show :: OriginShield -> String
$cshow :: OriginShield -> String
showsPrec :: Int -> OriginShield -> ShowS
$cshowsPrec :: Int -> OriginShield -> ShowS
Prelude.Show, (forall x. OriginShield -> Rep OriginShield x)
-> (forall x. Rep OriginShield x -> OriginShield)
-> Generic OriginShield
forall x. Rep OriginShield x -> OriginShield
forall x. OriginShield -> Rep OriginShield x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OriginShield x -> OriginShield
$cfrom :: forall x. OriginShield -> Rep OriginShield x
Prelude.Generic)
newOriginShield ::
Prelude.Bool ->
OriginShield
newOriginShield :: Bool -> OriginShield
newOriginShield Bool
pEnabled_ =
OriginShield' :: Maybe Text -> Bool -> OriginShield
OriginShield'
{ $sel:originShieldRegion:OriginShield' :: Maybe Text
originShieldRegion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:enabled:OriginShield' :: Bool
enabled = Bool
pEnabled_
}
originShield_originShieldRegion :: Lens.Lens' OriginShield (Prelude.Maybe Prelude.Text)
originShield_originShieldRegion :: (Maybe Text -> f (Maybe Text)) -> OriginShield -> f OriginShield
originShield_originShieldRegion = (OriginShield -> Maybe Text)
-> (OriginShield -> Maybe Text -> OriginShield)
-> Lens OriginShield OriginShield (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OriginShield' {Maybe Text
originShieldRegion :: Maybe Text
$sel:originShieldRegion:OriginShield' :: OriginShield -> Maybe Text
originShieldRegion} -> Maybe Text
originShieldRegion) (\s :: OriginShield
s@OriginShield' {} Maybe Text
a -> OriginShield
s {$sel:originShieldRegion:OriginShield' :: Maybe Text
originShieldRegion = Maybe Text
a} :: OriginShield)
originShield_enabled :: Lens.Lens' OriginShield Prelude.Bool
originShield_enabled :: (Bool -> f Bool) -> OriginShield -> f OriginShield
originShield_enabled = (OriginShield -> Bool)
-> (OriginShield -> Bool -> OriginShield)
-> Lens OriginShield OriginShield Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OriginShield' {Bool
enabled :: Bool
$sel:enabled:OriginShield' :: OriginShield -> Bool
enabled} -> Bool
enabled) (\s :: OriginShield
s@OriginShield' {} Bool
a -> OriginShield
s {$sel:enabled:OriginShield' :: Bool
enabled = Bool
a} :: OriginShield)
instance Core.FromXML OriginShield where
parseXML :: [Node] -> Either String OriginShield
parseXML [Node]
x =
Maybe Text -> Bool -> OriginShield
OriginShield'
(Maybe Text -> Bool -> OriginShield)
-> Either String (Maybe Text)
-> Either String (Bool -> OriginShield)
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
"OriginShieldRegion")
Either String (Bool -> OriginShield)
-> Either String Bool -> Either String OriginShield
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Bool
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Enabled")
instance Prelude.Hashable OriginShield
instance Prelude.NFData OriginShield
instance Core.ToXML OriginShield where
toXML :: OriginShield -> XML
toXML OriginShield' {Bool
Maybe Text
enabled :: Bool
originShieldRegion :: Maybe Text
$sel:enabled:OriginShield' :: OriginShield -> Bool
$sel:originShieldRegion:OriginShield' :: OriginShield -> Maybe Text
..} =
[XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"OriginShieldRegion" Name -> Maybe Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Text
originShieldRegion,
Name
"Enabled" Name -> Bool -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Bool
enabled
]