{-# 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.OriginGroup where
import Amazonka.CloudFront.Types.OriginGroupFailoverCriteria
import Amazonka.CloudFront.Types.OriginGroupMembers
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data OriginGroup = OriginGroup'
{
OriginGroup -> Text
id :: Prelude.Text,
OriginGroup -> OriginGroupFailoverCriteria
failoverCriteria :: OriginGroupFailoverCriteria,
OriginGroup -> OriginGroupMembers
members :: OriginGroupMembers
}
deriving (OriginGroup -> OriginGroup -> Bool
(OriginGroup -> OriginGroup -> Bool)
-> (OriginGroup -> OriginGroup -> Bool) -> Eq OriginGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OriginGroup -> OriginGroup -> Bool
$c/= :: OriginGroup -> OriginGroup -> Bool
== :: OriginGroup -> OriginGroup -> Bool
$c== :: OriginGroup -> OriginGroup -> Bool
Prelude.Eq, ReadPrec [OriginGroup]
ReadPrec OriginGroup
Int -> ReadS OriginGroup
ReadS [OriginGroup]
(Int -> ReadS OriginGroup)
-> ReadS [OriginGroup]
-> ReadPrec OriginGroup
-> ReadPrec [OriginGroup]
-> Read OriginGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OriginGroup]
$creadListPrec :: ReadPrec [OriginGroup]
readPrec :: ReadPrec OriginGroup
$creadPrec :: ReadPrec OriginGroup
readList :: ReadS [OriginGroup]
$creadList :: ReadS [OriginGroup]
readsPrec :: Int -> ReadS OriginGroup
$creadsPrec :: Int -> ReadS OriginGroup
Prelude.Read, Int -> OriginGroup -> ShowS
[OriginGroup] -> ShowS
OriginGroup -> String
(Int -> OriginGroup -> ShowS)
-> (OriginGroup -> String)
-> ([OriginGroup] -> ShowS)
-> Show OriginGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OriginGroup] -> ShowS
$cshowList :: [OriginGroup] -> ShowS
show :: OriginGroup -> String
$cshow :: OriginGroup -> String
showsPrec :: Int -> OriginGroup -> ShowS
$cshowsPrec :: Int -> OriginGroup -> ShowS
Prelude.Show, (forall x. OriginGroup -> Rep OriginGroup x)
-> (forall x. Rep OriginGroup x -> OriginGroup)
-> Generic OriginGroup
forall x. Rep OriginGroup x -> OriginGroup
forall x. OriginGroup -> Rep OriginGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OriginGroup x -> OriginGroup
$cfrom :: forall x. OriginGroup -> Rep OriginGroup x
Prelude.Generic)
newOriginGroup ::
Prelude.Text ->
OriginGroupFailoverCriteria ->
OriginGroupMembers ->
OriginGroup
newOriginGroup :: Text
-> OriginGroupFailoverCriteria -> OriginGroupMembers -> OriginGroup
newOriginGroup Text
pId_ OriginGroupFailoverCriteria
pFailoverCriteria_ OriginGroupMembers
pMembers_ =
OriginGroup' :: Text
-> OriginGroupFailoverCriteria -> OriginGroupMembers -> OriginGroup
OriginGroup'
{ $sel:id:OriginGroup' :: Text
id = Text
pId_,
$sel:failoverCriteria:OriginGroup' :: OriginGroupFailoverCriteria
failoverCriteria = OriginGroupFailoverCriteria
pFailoverCriteria_,
$sel:members:OriginGroup' :: OriginGroupMembers
members = OriginGroupMembers
pMembers_
}
originGroup_id :: Lens.Lens' OriginGroup Prelude.Text
originGroup_id :: (Text -> f Text) -> OriginGroup -> f OriginGroup
originGroup_id = (OriginGroup -> Text)
-> (OriginGroup -> Text -> OriginGroup)
-> Lens OriginGroup OriginGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OriginGroup' {Text
id :: Text
$sel:id:OriginGroup' :: OriginGroup -> Text
id} -> Text
id) (\s :: OriginGroup
s@OriginGroup' {} Text
a -> OriginGroup
s {$sel:id:OriginGroup' :: Text
id = Text
a} :: OriginGroup)
originGroup_failoverCriteria :: Lens.Lens' OriginGroup OriginGroupFailoverCriteria
originGroup_failoverCriteria :: (OriginGroupFailoverCriteria -> f OriginGroupFailoverCriteria)
-> OriginGroup -> f OriginGroup
originGroup_failoverCriteria = (OriginGroup -> OriginGroupFailoverCriteria)
-> (OriginGroup -> OriginGroupFailoverCriteria -> OriginGroup)
-> Lens
OriginGroup
OriginGroup
OriginGroupFailoverCriteria
OriginGroupFailoverCriteria
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OriginGroup' {OriginGroupFailoverCriteria
failoverCriteria :: OriginGroupFailoverCriteria
$sel:failoverCriteria:OriginGroup' :: OriginGroup -> OriginGroupFailoverCriteria
failoverCriteria} -> OriginGroupFailoverCriteria
failoverCriteria) (\s :: OriginGroup
s@OriginGroup' {} OriginGroupFailoverCriteria
a -> OriginGroup
s {$sel:failoverCriteria:OriginGroup' :: OriginGroupFailoverCriteria
failoverCriteria = OriginGroupFailoverCriteria
a} :: OriginGroup)
originGroup_members :: Lens.Lens' OriginGroup OriginGroupMembers
originGroup_members :: (OriginGroupMembers -> f OriginGroupMembers)
-> OriginGroup -> f OriginGroup
originGroup_members = (OriginGroup -> OriginGroupMembers)
-> (OriginGroup -> OriginGroupMembers -> OriginGroup)
-> Lens
OriginGroup OriginGroup OriginGroupMembers OriginGroupMembers
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OriginGroup' {OriginGroupMembers
members :: OriginGroupMembers
$sel:members:OriginGroup' :: OriginGroup -> OriginGroupMembers
members} -> OriginGroupMembers
members) (\s :: OriginGroup
s@OriginGroup' {} OriginGroupMembers
a -> OriginGroup
s {$sel:members:OriginGroup' :: OriginGroupMembers
members = OriginGroupMembers
a} :: OriginGroup)
instance Core.FromXML OriginGroup where
parseXML :: [Node] -> Either String OriginGroup
parseXML [Node]
x =
Text
-> OriginGroupFailoverCriteria -> OriginGroupMembers -> OriginGroup
OriginGroup'
(Text
-> OriginGroupFailoverCriteria
-> OriginGroupMembers
-> OriginGroup)
-> Either String Text
-> Either
String
(OriginGroupFailoverCriteria -> OriginGroupMembers -> OriginGroup)
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
(OriginGroupFailoverCriteria -> OriginGroupMembers -> OriginGroup)
-> Either String OriginGroupFailoverCriteria
-> Either String (OriginGroupMembers -> OriginGroup)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String OriginGroupFailoverCriteria
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"FailoverCriteria")
Either String (OriginGroupMembers -> OriginGroup)
-> Either String OriginGroupMembers -> Either String OriginGroup
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String OriginGroupMembers
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Members")
instance Prelude.Hashable OriginGroup
instance Prelude.NFData OriginGroup
instance Core.ToXML OriginGroup where
toXML :: OriginGroup -> XML
toXML OriginGroup' {Text
OriginGroupMembers
OriginGroupFailoverCriteria
members :: OriginGroupMembers
failoverCriteria :: OriginGroupFailoverCriteria
id :: Text
$sel:members:OriginGroup' :: OriginGroup -> OriginGroupMembers
$sel:failoverCriteria:OriginGroup' :: OriginGroup -> OriginGroupFailoverCriteria
$sel:id:OriginGroup' :: OriginGroup -> Text
..} =
[XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"Id" Name -> Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Text
id,
Name
"FailoverCriteria" Name -> OriginGroupFailoverCriteria -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= OriginGroupFailoverCriteria
failoverCriteria,
Name
"Members" Name -> OriginGroupMembers -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= OriginGroupMembers
members
]