{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.CloudFront.CreateRealtimeLogConfig
(
CreateRealtimeLogConfig (..),
newCreateRealtimeLogConfig,
createRealtimeLogConfig_endPoints,
createRealtimeLogConfig_fields,
createRealtimeLogConfig_name,
createRealtimeLogConfig_samplingRate,
CreateRealtimeLogConfigResponse (..),
newCreateRealtimeLogConfigResponse,
createRealtimeLogConfigResponse_realtimeLogConfig,
createRealtimeLogConfigResponse_httpStatus,
)
where
import Amazonka.CloudFront.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateRealtimeLogConfig = CreateRealtimeLogConfig'
{
CreateRealtimeLogConfig -> [EndPoint]
endPoints :: [EndPoint],
CreateRealtimeLogConfig -> [Text]
fields :: [Prelude.Text],
CreateRealtimeLogConfig -> Text
name :: Prelude.Text,
CreateRealtimeLogConfig -> Integer
samplingRate :: Prelude.Integer
}
deriving (CreateRealtimeLogConfig -> CreateRealtimeLogConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateRealtimeLogConfig -> CreateRealtimeLogConfig -> Bool
$c/= :: CreateRealtimeLogConfig -> CreateRealtimeLogConfig -> Bool
== :: CreateRealtimeLogConfig -> CreateRealtimeLogConfig -> Bool
$c== :: CreateRealtimeLogConfig -> CreateRealtimeLogConfig -> Bool
Prelude.Eq, ReadPrec [CreateRealtimeLogConfig]
ReadPrec CreateRealtimeLogConfig
Int -> ReadS CreateRealtimeLogConfig
ReadS [CreateRealtimeLogConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateRealtimeLogConfig]
$creadListPrec :: ReadPrec [CreateRealtimeLogConfig]
readPrec :: ReadPrec CreateRealtimeLogConfig
$creadPrec :: ReadPrec CreateRealtimeLogConfig
readList :: ReadS [CreateRealtimeLogConfig]
$creadList :: ReadS [CreateRealtimeLogConfig]
readsPrec :: Int -> ReadS CreateRealtimeLogConfig
$creadsPrec :: Int -> ReadS CreateRealtimeLogConfig
Prelude.Read, Int -> CreateRealtimeLogConfig -> ShowS
[CreateRealtimeLogConfig] -> ShowS
CreateRealtimeLogConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateRealtimeLogConfig] -> ShowS
$cshowList :: [CreateRealtimeLogConfig] -> ShowS
show :: CreateRealtimeLogConfig -> String
$cshow :: CreateRealtimeLogConfig -> String
showsPrec :: Int -> CreateRealtimeLogConfig -> ShowS
$cshowsPrec :: Int -> CreateRealtimeLogConfig -> ShowS
Prelude.Show, forall x. Rep CreateRealtimeLogConfig x -> CreateRealtimeLogConfig
forall x. CreateRealtimeLogConfig -> Rep CreateRealtimeLogConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateRealtimeLogConfig x -> CreateRealtimeLogConfig
$cfrom :: forall x. CreateRealtimeLogConfig -> Rep CreateRealtimeLogConfig x
Prelude.Generic)
newCreateRealtimeLogConfig ::
Prelude.Text ->
Prelude.Integer ->
CreateRealtimeLogConfig
newCreateRealtimeLogConfig :: Text -> Integer -> CreateRealtimeLogConfig
newCreateRealtimeLogConfig Text
pName_ Integer
pSamplingRate_ =
CreateRealtimeLogConfig'
{ $sel:endPoints:CreateRealtimeLogConfig' :: [EndPoint]
endPoints =
forall a. Monoid a => a
Prelude.mempty,
$sel:fields:CreateRealtimeLogConfig' :: [Text]
fields = forall a. Monoid a => a
Prelude.mempty,
$sel:name:CreateRealtimeLogConfig' :: Text
name = Text
pName_,
$sel:samplingRate:CreateRealtimeLogConfig' :: Integer
samplingRate = Integer
pSamplingRate_
}
createRealtimeLogConfig_endPoints :: Lens.Lens' CreateRealtimeLogConfig [EndPoint]
createRealtimeLogConfig_endPoints :: Lens' CreateRealtimeLogConfig [EndPoint]
createRealtimeLogConfig_endPoints = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRealtimeLogConfig' {[EndPoint]
endPoints :: [EndPoint]
$sel:endPoints:CreateRealtimeLogConfig' :: CreateRealtimeLogConfig -> [EndPoint]
endPoints} -> [EndPoint]
endPoints) (\s :: CreateRealtimeLogConfig
s@CreateRealtimeLogConfig' {} [EndPoint]
a -> CreateRealtimeLogConfig
s {$sel:endPoints:CreateRealtimeLogConfig' :: [EndPoint]
endPoints = [EndPoint]
a} :: CreateRealtimeLogConfig) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createRealtimeLogConfig_fields :: Lens.Lens' CreateRealtimeLogConfig [Prelude.Text]
createRealtimeLogConfig_fields :: Lens' CreateRealtimeLogConfig [Text]
createRealtimeLogConfig_fields = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRealtimeLogConfig' {[Text]
fields :: [Text]
$sel:fields:CreateRealtimeLogConfig' :: CreateRealtimeLogConfig -> [Text]
fields} -> [Text]
fields) (\s :: CreateRealtimeLogConfig
s@CreateRealtimeLogConfig' {} [Text]
a -> CreateRealtimeLogConfig
s {$sel:fields:CreateRealtimeLogConfig' :: [Text]
fields = [Text]
a} :: CreateRealtimeLogConfig) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createRealtimeLogConfig_name :: Lens.Lens' CreateRealtimeLogConfig Prelude.Text
createRealtimeLogConfig_name :: Lens' CreateRealtimeLogConfig Text
createRealtimeLogConfig_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRealtimeLogConfig' {Text
name :: Text
$sel:name:CreateRealtimeLogConfig' :: CreateRealtimeLogConfig -> Text
name} -> Text
name) (\s :: CreateRealtimeLogConfig
s@CreateRealtimeLogConfig' {} Text
a -> CreateRealtimeLogConfig
s {$sel:name:CreateRealtimeLogConfig' :: Text
name = Text
a} :: CreateRealtimeLogConfig)
createRealtimeLogConfig_samplingRate :: Lens.Lens' CreateRealtimeLogConfig Prelude.Integer
createRealtimeLogConfig_samplingRate :: Lens' CreateRealtimeLogConfig Integer
createRealtimeLogConfig_samplingRate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRealtimeLogConfig' {Integer
samplingRate :: Integer
$sel:samplingRate:CreateRealtimeLogConfig' :: CreateRealtimeLogConfig -> Integer
samplingRate} -> Integer
samplingRate) (\s :: CreateRealtimeLogConfig
s@CreateRealtimeLogConfig' {} Integer
a -> CreateRealtimeLogConfig
s {$sel:samplingRate:CreateRealtimeLogConfig' :: Integer
samplingRate = Integer
a} :: CreateRealtimeLogConfig)
instance Core.AWSRequest CreateRealtimeLogConfig where
type
AWSResponse CreateRealtimeLogConfig =
CreateRealtimeLogConfigResponse
request :: (Service -> Service)
-> CreateRealtimeLogConfig -> Request CreateRealtimeLogConfig
request Service -> Service
overrides =
forall a. (ToRequest a, ToElement a) => Service -> a -> Request a
Request.postXML (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateRealtimeLogConfig
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateRealtimeLogConfig)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe RealtimeLogConfig -> Int -> CreateRealtimeLogConfigResponse
CreateRealtimeLogConfigResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"RealtimeLogConfig")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable CreateRealtimeLogConfig where
hashWithSalt :: Int -> CreateRealtimeLogConfig -> Int
hashWithSalt Int
_salt CreateRealtimeLogConfig' {Integer
[Text]
[EndPoint]
Text
samplingRate :: Integer
name :: Text
fields :: [Text]
endPoints :: [EndPoint]
$sel:samplingRate:CreateRealtimeLogConfig' :: CreateRealtimeLogConfig -> Integer
$sel:name:CreateRealtimeLogConfig' :: CreateRealtimeLogConfig -> Text
$sel:fields:CreateRealtimeLogConfig' :: CreateRealtimeLogConfig -> [Text]
$sel:endPoints:CreateRealtimeLogConfig' :: CreateRealtimeLogConfig -> [EndPoint]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [EndPoint]
endPoints
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
fields
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Integer
samplingRate
instance Prelude.NFData CreateRealtimeLogConfig where
rnf :: CreateRealtimeLogConfig -> ()
rnf CreateRealtimeLogConfig' {Integer
[Text]
[EndPoint]
Text
samplingRate :: Integer
name :: Text
fields :: [Text]
endPoints :: [EndPoint]
$sel:samplingRate:CreateRealtimeLogConfig' :: CreateRealtimeLogConfig -> Integer
$sel:name:CreateRealtimeLogConfig' :: CreateRealtimeLogConfig -> Text
$sel:fields:CreateRealtimeLogConfig' :: CreateRealtimeLogConfig -> [Text]
$sel:endPoints:CreateRealtimeLogConfig' :: CreateRealtimeLogConfig -> [EndPoint]
..} =
forall a. NFData a => a -> ()
Prelude.rnf [EndPoint]
endPoints
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Text]
fields
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Integer
samplingRate
instance Data.ToElement CreateRealtimeLogConfig where
toElement :: CreateRealtimeLogConfig -> Element
toElement =
forall a. ToXML a => Name -> a -> Element
Data.mkElement
Name
"{http://cloudfront.amazonaws.com/doc/2020-05-31/}CreateRealtimeLogConfigRequest"
instance Data.ToHeaders CreateRealtimeLogConfig where
toHeaders :: CreateRealtimeLogConfig -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath CreateRealtimeLogConfig where
toPath :: CreateRealtimeLogConfig -> ByteString
toPath =
forall a b. a -> b -> a
Prelude.const ByteString
"/2020-05-31/realtime-log-config"
instance Data.ToQuery CreateRealtimeLogConfig where
toQuery :: CreateRealtimeLogConfig -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToXML CreateRealtimeLogConfig where
toXML :: CreateRealtimeLogConfig -> XML
toXML CreateRealtimeLogConfig' {Integer
[Text]
[EndPoint]
Text
samplingRate :: Integer
name :: Text
fields :: [Text]
endPoints :: [EndPoint]
$sel:samplingRate:CreateRealtimeLogConfig' :: CreateRealtimeLogConfig -> Integer
$sel:name:CreateRealtimeLogConfig' :: CreateRealtimeLogConfig -> Text
$sel:fields:CreateRealtimeLogConfig' :: CreateRealtimeLogConfig -> [Text]
$sel:endPoints:CreateRealtimeLogConfig' :: CreateRealtimeLogConfig -> [EndPoint]
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"EndPoints"
forall a. ToXML a => Name -> a -> XML
Data.@= forall a. (IsList a, ToXML (Item a)) => Name -> a -> XML
Data.toXMLList Name
"member" [EndPoint]
endPoints,
Name
"Fields" forall a. ToXML a => Name -> a -> XML
Data.@= forall a. (IsList a, ToXML (Item a)) => Name -> a -> XML
Data.toXMLList Name
"Field" [Text]
fields,
Name
"Name" forall a. ToXML a => Name -> a -> XML
Data.@= Text
name,
Name
"SamplingRate" forall a. ToXML a => Name -> a -> XML
Data.@= Integer
samplingRate
]
data CreateRealtimeLogConfigResponse = CreateRealtimeLogConfigResponse'
{
CreateRealtimeLogConfigResponse -> Maybe RealtimeLogConfig
realtimeLogConfig :: Prelude.Maybe RealtimeLogConfig,
CreateRealtimeLogConfigResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateRealtimeLogConfigResponse
-> CreateRealtimeLogConfigResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateRealtimeLogConfigResponse
-> CreateRealtimeLogConfigResponse -> Bool
$c/= :: CreateRealtimeLogConfigResponse
-> CreateRealtimeLogConfigResponse -> Bool
== :: CreateRealtimeLogConfigResponse
-> CreateRealtimeLogConfigResponse -> Bool
$c== :: CreateRealtimeLogConfigResponse
-> CreateRealtimeLogConfigResponse -> Bool
Prelude.Eq, ReadPrec [CreateRealtimeLogConfigResponse]
ReadPrec CreateRealtimeLogConfigResponse
Int -> ReadS CreateRealtimeLogConfigResponse
ReadS [CreateRealtimeLogConfigResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateRealtimeLogConfigResponse]
$creadListPrec :: ReadPrec [CreateRealtimeLogConfigResponse]
readPrec :: ReadPrec CreateRealtimeLogConfigResponse
$creadPrec :: ReadPrec CreateRealtimeLogConfigResponse
readList :: ReadS [CreateRealtimeLogConfigResponse]
$creadList :: ReadS [CreateRealtimeLogConfigResponse]
readsPrec :: Int -> ReadS CreateRealtimeLogConfigResponse
$creadsPrec :: Int -> ReadS CreateRealtimeLogConfigResponse
Prelude.Read, Int -> CreateRealtimeLogConfigResponse -> ShowS
[CreateRealtimeLogConfigResponse] -> ShowS
CreateRealtimeLogConfigResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateRealtimeLogConfigResponse] -> ShowS
$cshowList :: [CreateRealtimeLogConfigResponse] -> ShowS
show :: CreateRealtimeLogConfigResponse -> String
$cshow :: CreateRealtimeLogConfigResponse -> String
showsPrec :: Int -> CreateRealtimeLogConfigResponse -> ShowS
$cshowsPrec :: Int -> CreateRealtimeLogConfigResponse -> ShowS
Prelude.Show, forall x.
Rep CreateRealtimeLogConfigResponse x
-> CreateRealtimeLogConfigResponse
forall x.
CreateRealtimeLogConfigResponse
-> Rep CreateRealtimeLogConfigResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateRealtimeLogConfigResponse x
-> CreateRealtimeLogConfigResponse
$cfrom :: forall x.
CreateRealtimeLogConfigResponse
-> Rep CreateRealtimeLogConfigResponse x
Prelude.Generic)
newCreateRealtimeLogConfigResponse ::
Prelude.Int ->
CreateRealtimeLogConfigResponse
newCreateRealtimeLogConfigResponse :: Int -> CreateRealtimeLogConfigResponse
newCreateRealtimeLogConfigResponse Int
pHttpStatus_ =
CreateRealtimeLogConfigResponse'
{ $sel:realtimeLogConfig:CreateRealtimeLogConfigResponse' :: Maybe RealtimeLogConfig
realtimeLogConfig =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateRealtimeLogConfigResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createRealtimeLogConfigResponse_realtimeLogConfig :: Lens.Lens' CreateRealtimeLogConfigResponse (Prelude.Maybe RealtimeLogConfig)
createRealtimeLogConfigResponse_realtimeLogConfig :: Lens' CreateRealtimeLogConfigResponse (Maybe RealtimeLogConfig)
createRealtimeLogConfigResponse_realtimeLogConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRealtimeLogConfigResponse' {Maybe RealtimeLogConfig
realtimeLogConfig :: Maybe RealtimeLogConfig
$sel:realtimeLogConfig:CreateRealtimeLogConfigResponse' :: CreateRealtimeLogConfigResponse -> Maybe RealtimeLogConfig
realtimeLogConfig} -> Maybe RealtimeLogConfig
realtimeLogConfig) (\s :: CreateRealtimeLogConfigResponse
s@CreateRealtimeLogConfigResponse' {} Maybe RealtimeLogConfig
a -> CreateRealtimeLogConfigResponse
s {$sel:realtimeLogConfig:CreateRealtimeLogConfigResponse' :: Maybe RealtimeLogConfig
realtimeLogConfig = Maybe RealtimeLogConfig
a} :: CreateRealtimeLogConfigResponse)
createRealtimeLogConfigResponse_httpStatus :: Lens.Lens' CreateRealtimeLogConfigResponse Prelude.Int
createRealtimeLogConfigResponse_httpStatus :: Lens' CreateRealtimeLogConfigResponse Int
createRealtimeLogConfigResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRealtimeLogConfigResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateRealtimeLogConfigResponse' :: CreateRealtimeLogConfigResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateRealtimeLogConfigResponse
s@CreateRealtimeLogConfigResponse' {} Int
a -> CreateRealtimeLogConfigResponse
s {$sel:httpStatus:CreateRealtimeLogConfigResponse' :: Int
httpStatus = Int
a} :: CreateRealtimeLogConfigResponse)
instance
Prelude.NFData
CreateRealtimeLogConfigResponse
where
rnf :: CreateRealtimeLogConfigResponse -> ()
rnf CreateRealtimeLogConfigResponse' {Int
Maybe RealtimeLogConfig
httpStatus :: Int
realtimeLogConfig :: Maybe RealtimeLogConfig
$sel:httpStatus:CreateRealtimeLogConfigResponse' :: CreateRealtimeLogConfigResponse -> Int
$sel:realtimeLogConfig:CreateRealtimeLogConfigResponse' :: CreateRealtimeLogConfigResponse -> Maybe RealtimeLogConfig
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe RealtimeLogConfig
realtimeLogConfig
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus