{-# 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.RealtimeLogConfig where
import Amazonka.CloudFront.Types.EndPoint
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data RealtimeLogConfig = RealtimeLogConfig'
{
RealtimeLogConfig -> Text
arn :: Prelude.Text,
RealtimeLogConfig -> Text
name :: Prelude.Text,
RealtimeLogConfig -> Integer
samplingRate :: Prelude.Integer,
RealtimeLogConfig -> [EndPoint]
endPoints :: [EndPoint],
RealtimeLogConfig -> [Text]
fields :: [Prelude.Text]
}
deriving (RealtimeLogConfig -> RealtimeLogConfig -> Bool
(RealtimeLogConfig -> RealtimeLogConfig -> Bool)
-> (RealtimeLogConfig -> RealtimeLogConfig -> Bool)
-> Eq RealtimeLogConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RealtimeLogConfig -> RealtimeLogConfig -> Bool
$c/= :: RealtimeLogConfig -> RealtimeLogConfig -> Bool
== :: RealtimeLogConfig -> RealtimeLogConfig -> Bool
$c== :: RealtimeLogConfig -> RealtimeLogConfig -> Bool
Prelude.Eq, ReadPrec [RealtimeLogConfig]
ReadPrec RealtimeLogConfig
Int -> ReadS RealtimeLogConfig
ReadS [RealtimeLogConfig]
(Int -> ReadS RealtimeLogConfig)
-> ReadS [RealtimeLogConfig]
-> ReadPrec RealtimeLogConfig
-> ReadPrec [RealtimeLogConfig]
-> Read RealtimeLogConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RealtimeLogConfig]
$creadListPrec :: ReadPrec [RealtimeLogConfig]
readPrec :: ReadPrec RealtimeLogConfig
$creadPrec :: ReadPrec RealtimeLogConfig
readList :: ReadS [RealtimeLogConfig]
$creadList :: ReadS [RealtimeLogConfig]
readsPrec :: Int -> ReadS RealtimeLogConfig
$creadsPrec :: Int -> ReadS RealtimeLogConfig
Prelude.Read, Int -> RealtimeLogConfig -> ShowS
[RealtimeLogConfig] -> ShowS
RealtimeLogConfig -> String
(Int -> RealtimeLogConfig -> ShowS)
-> (RealtimeLogConfig -> String)
-> ([RealtimeLogConfig] -> ShowS)
-> Show RealtimeLogConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RealtimeLogConfig] -> ShowS
$cshowList :: [RealtimeLogConfig] -> ShowS
show :: RealtimeLogConfig -> String
$cshow :: RealtimeLogConfig -> String
showsPrec :: Int -> RealtimeLogConfig -> ShowS
$cshowsPrec :: Int -> RealtimeLogConfig -> ShowS
Prelude.Show, (forall x. RealtimeLogConfig -> Rep RealtimeLogConfig x)
-> (forall x. Rep RealtimeLogConfig x -> RealtimeLogConfig)
-> Generic RealtimeLogConfig
forall x. Rep RealtimeLogConfig x -> RealtimeLogConfig
forall x. RealtimeLogConfig -> Rep RealtimeLogConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RealtimeLogConfig x -> RealtimeLogConfig
$cfrom :: forall x. RealtimeLogConfig -> Rep RealtimeLogConfig x
Prelude.Generic)
newRealtimeLogConfig ::
Prelude.Text ->
Prelude.Text ->
Prelude.Integer ->
RealtimeLogConfig
newRealtimeLogConfig :: Text -> Text -> Integer -> RealtimeLogConfig
newRealtimeLogConfig Text
pARN_ Text
pName_ Integer
pSamplingRate_ =
RealtimeLogConfig' :: Text
-> Text -> Integer -> [EndPoint] -> [Text] -> RealtimeLogConfig
RealtimeLogConfig'
{ $sel:arn:RealtimeLogConfig' :: Text
arn = Text
pARN_,
$sel:name:RealtimeLogConfig' :: Text
name = Text
pName_,
$sel:samplingRate:RealtimeLogConfig' :: Integer
samplingRate = Integer
pSamplingRate_,
$sel:endPoints:RealtimeLogConfig' :: [EndPoint]
endPoints = [EndPoint]
forall a. Monoid a => a
Prelude.mempty,
$sel:fields:RealtimeLogConfig' :: [Text]
fields = [Text]
forall a. Monoid a => a
Prelude.mempty
}
realtimeLogConfig_arn :: Lens.Lens' RealtimeLogConfig Prelude.Text
realtimeLogConfig_arn :: (Text -> f Text) -> RealtimeLogConfig -> f RealtimeLogConfig
realtimeLogConfig_arn = (RealtimeLogConfig -> Text)
-> (RealtimeLogConfig -> Text -> RealtimeLogConfig)
-> Lens RealtimeLogConfig RealtimeLogConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RealtimeLogConfig' {Text
arn :: Text
$sel:arn:RealtimeLogConfig' :: RealtimeLogConfig -> Text
arn} -> Text
arn) (\s :: RealtimeLogConfig
s@RealtimeLogConfig' {} Text
a -> RealtimeLogConfig
s {$sel:arn:RealtimeLogConfig' :: Text
arn = Text
a} :: RealtimeLogConfig)
realtimeLogConfig_name :: Lens.Lens' RealtimeLogConfig Prelude.Text
realtimeLogConfig_name :: (Text -> f Text) -> RealtimeLogConfig -> f RealtimeLogConfig
realtimeLogConfig_name = (RealtimeLogConfig -> Text)
-> (RealtimeLogConfig -> Text -> RealtimeLogConfig)
-> Lens RealtimeLogConfig RealtimeLogConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RealtimeLogConfig' {Text
name :: Text
$sel:name:RealtimeLogConfig' :: RealtimeLogConfig -> Text
name} -> Text
name) (\s :: RealtimeLogConfig
s@RealtimeLogConfig' {} Text
a -> RealtimeLogConfig
s {$sel:name:RealtimeLogConfig' :: Text
name = Text
a} :: RealtimeLogConfig)
realtimeLogConfig_samplingRate :: Lens.Lens' RealtimeLogConfig Prelude.Integer
realtimeLogConfig_samplingRate :: (Integer -> f Integer) -> RealtimeLogConfig -> f RealtimeLogConfig
realtimeLogConfig_samplingRate = (RealtimeLogConfig -> Integer)
-> (RealtimeLogConfig -> Integer -> RealtimeLogConfig)
-> Lens RealtimeLogConfig RealtimeLogConfig Integer Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RealtimeLogConfig' {Integer
samplingRate :: Integer
$sel:samplingRate:RealtimeLogConfig' :: RealtimeLogConfig -> Integer
samplingRate} -> Integer
samplingRate) (\s :: RealtimeLogConfig
s@RealtimeLogConfig' {} Integer
a -> RealtimeLogConfig
s {$sel:samplingRate:RealtimeLogConfig' :: Integer
samplingRate = Integer
a} :: RealtimeLogConfig)
realtimeLogConfig_endPoints :: Lens.Lens' RealtimeLogConfig [EndPoint]
realtimeLogConfig_endPoints :: ([EndPoint] -> f [EndPoint])
-> RealtimeLogConfig -> f RealtimeLogConfig
realtimeLogConfig_endPoints = (RealtimeLogConfig -> [EndPoint])
-> (RealtimeLogConfig -> [EndPoint] -> RealtimeLogConfig)
-> Lens RealtimeLogConfig RealtimeLogConfig [EndPoint] [EndPoint]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RealtimeLogConfig' {[EndPoint]
endPoints :: [EndPoint]
$sel:endPoints:RealtimeLogConfig' :: RealtimeLogConfig -> [EndPoint]
endPoints} -> [EndPoint]
endPoints) (\s :: RealtimeLogConfig
s@RealtimeLogConfig' {} [EndPoint]
a -> RealtimeLogConfig
s {$sel:endPoints:RealtimeLogConfig' :: [EndPoint]
endPoints = [EndPoint]
a} :: RealtimeLogConfig) (([EndPoint] -> f [EndPoint])
-> RealtimeLogConfig -> f RealtimeLogConfig)
-> (([EndPoint] -> f [EndPoint]) -> [EndPoint] -> f [EndPoint])
-> ([EndPoint] -> f [EndPoint])
-> RealtimeLogConfig
-> f RealtimeLogConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([EndPoint] -> f [EndPoint]) -> [EndPoint] -> f [EndPoint]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
realtimeLogConfig_fields :: Lens.Lens' RealtimeLogConfig [Prelude.Text]
realtimeLogConfig_fields :: ([Text] -> f [Text]) -> RealtimeLogConfig -> f RealtimeLogConfig
realtimeLogConfig_fields = (RealtimeLogConfig -> [Text])
-> (RealtimeLogConfig -> [Text] -> RealtimeLogConfig)
-> Lens RealtimeLogConfig RealtimeLogConfig [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RealtimeLogConfig' {[Text]
fields :: [Text]
$sel:fields:RealtimeLogConfig' :: RealtimeLogConfig -> [Text]
fields} -> [Text]
fields) (\s :: RealtimeLogConfig
s@RealtimeLogConfig' {} [Text]
a -> RealtimeLogConfig
s {$sel:fields:RealtimeLogConfig' :: [Text]
fields = [Text]
a} :: RealtimeLogConfig) (([Text] -> f [Text]) -> RealtimeLogConfig -> f RealtimeLogConfig)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> RealtimeLogConfig
-> f RealtimeLogConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromXML RealtimeLogConfig where
parseXML :: [Node] -> Either String RealtimeLogConfig
parseXML [Node]
x =
Text
-> Text -> Integer -> [EndPoint] -> [Text] -> RealtimeLogConfig
RealtimeLogConfig'
(Text
-> Text -> Integer -> [EndPoint] -> [Text] -> RealtimeLogConfig)
-> Either String Text
-> Either
String
(Text -> Integer -> [EndPoint] -> [Text] -> RealtimeLogConfig)
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
"ARN")
Either
String
(Text -> Integer -> [EndPoint] -> [Text] -> RealtimeLogConfig)
-> Either String Text
-> Either
String (Integer -> [EndPoint] -> [Text] -> RealtimeLogConfig)
forall (f :: * -> *) a b. Applicative f => 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
"Name")
Either
String (Integer -> [EndPoint] -> [Text] -> RealtimeLogConfig)
-> Either String Integer
-> Either String ([EndPoint] -> [Text] -> RealtimeLogConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Integer
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"SamplingRate")
Either String ([EndPoint] -> [Text] -> RealtimeLogConfig)
-> Either String [EndPoint]
-> Either String ([Text] -> RealtimeLogConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"EndPoints" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
Either String [Node]
-> ([Node] -> Either String [EndPoint]) -> Either String [EndPoint]
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= Text -> [Node] -> Either String [EndPoint]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member"
)
Either String ([Text] -> RealtimeLogConfig)
-> Either String [Text] -> Either String RealtimeLogConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Fields" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
Either String [Node]
-> ([Node] -> Either String [Text]) -> Either String [Text]
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= Text -> [Node] -> Either String [Text]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"Field"
)
instance Prelude.Hashable RealtimeLogConfig
instance Prelude.NFData RealtimeLogConfig