{-# 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.WAF.PutLoggingConfiguration
(
PutLoggingConfiguration (..),
newPutLoggingConfiguration,
putLoggingConfiguration_loggingConfiguration,
PutLoggingConfigurationResponse (..),
newPutLoggingConfigurationResponse,
putLoggingConfigurationResponse_loggingConfiguration,
putLoggingConfigurationResponse_httpStatus,
)
where
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
import Amazonka.WAF.Types
data PutLoggingConfiguration = PutLoggingConfiguration'
{
PutLoggingConfiguration -> LoggingConfiguration
loggingConfiguration :: LoggingConfiguration
}
deriving (PutLoggingConfiguration -> PutLoggingConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutLoggingConfiguration -> PutLoggingConfiguration -> Bool
$c/= :: PutLoggingConfiguration -> PutLoggingConfiguration -> Bool
== :: PutLoggingConfiguration -> PutLoggingConfiguration -> Bool
$c== :: PutLoggingConfiguration -> PutLoggingConfiguration -> Bool
Prelude.Eq, ReadPrec [PutLoggingConfiguration]
ReadPrec PutLoggingConfiguration
Int -> ReadS PutLoggingConfiguration
ReadS [PutLoggingConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutLoggingConfiguration]
$creadListPrec :: ReadPrec [PutLoggingConfiguration]
readPrec :: ReadPrec PutLoggingConfiguration
$creadPrec :: ReadPrec PutLoggingConfiguration
readList :: ReadS [PutLoggingConfiguration]
$creadList :: ReadS [PutLoggingConfiguration]
readsPrec :: Int -> ReadS PutLoggingConfiguration
$creadsPrec :: Int -> ReadS PutLoggingConfiguration
Prelude.Read, Int -> PutLoggingConfiguration -> ShowS
[PutLoggingConfiguration] -> ShowS
PutLoggingConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutLoggingConfiguration] -> ShowS
$cshowList :: [PutLoggingConfiguration] -> ShowS
show :: PutLoggingConfiguration -> String
$cshow :: PutLoggingConfiguration -> String
showsPrec :: Int -> PutLoggingConfiguration -> ShowS
$cshowsPrec :: Int -> PutLoggingConfiguration -> ShowS
Prelude.Show, forall x. Rep PutLoggingConfiguration x -> PutLoggingConfiguration
forall x. PutLoggingConfiguration -> Rep PutLoggingConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutLoggingConfiguration x -> PutLoggingConfiguration
$cfrom :: forall x. PutLoggingConfiguration -> Rep PutLoggingConfiguration x
Prelude.Generic)
newPutLoggingConfiguration ::
LoggingConfiguration ->
PutLoggingConfiguration
newPutLoggingConfiguration :: LoggingConfiguration -> PutLoggingConfiguration
newPutLoggingConfiguration LoggingConfiguration
pLoggingConfiguration_ =
PutLoggingConfiguration'
{ $sel:loggingConfiguration:PutLoggingConfiguration' :: LoggingConfiguration
loggingConfiguration =
LoggingConfiguration
pLoggingConfiguration_
}
putLoggingConfiguration_loggingConfiguration :: Lens.Lens' PutLoggingConfiguration LoggingConfiguration
putLoggingConfiguration_loggingConfiguration :: Lens' PutLoggingConfiguration LoggingConfiguration
putLoggingConfiguration_loggingConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutLoggingConfiguration' {LoggingConfiguration
loggingConfiguration :: LoggingConfiguration
$sel:loggingConfiguration:PutLoggingConfiguration' :: PutLoggingConfiguration -> LoggingConfiguration
loggingConfiguration} -> LoggingConfiguration
loggingConfiguration) (\s :: PutLoggingConfiguration
s@PutLoggingConfiguration' {} LoggingConfiguration
a -> PutLoggingConfiguration
s {$sel:loggingConfiguration:PutLoggingConfiguration' :: LoggingConfiguration
loggingConfiguration = LoggingConfiguration
a} :: PutLoggingConfiguration)
instance Core.AWSRequest PutLoggingConfiguration where
type
AWSResponse PutLoggingConfiguration =
PutLoggingConfigurationResponse
request :: (Service -> Service)
-> PutLoggingConfiguration -> Request PutLoggingConfiguration
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy PutLoggingConfiguration
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutLoggingConfiguration)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe LoggingConfiguration
-> Int -> PutLoggingConfigurationResponse
PutLoggingConfigurationResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"LoggingConfiguration")
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 PutLoggingConfiguration where
hashWithSalt :: Int -> PutLoggingConfiguration -> Int
hashWithSalt Int
_salt PutLoggingConfiguration' {LoggingConfiguration
loggingConfiguration :: LoggingConfiguration
$sel:loggingConfiguration:PutLoggingConfiguration' :: PutLoggingConfiguration -> LoggingConfiguration
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` LoggingConfiguration
loggingConfiguration
instance Prelude.NFData PutLoggingConfiguration where
rnf :: PutLoggingConfiguration -> ()
rnf PutLoggingConfiguration' {LoggingConfiguration
loggingConfiguration :: LoggingConfiguration
$sel:loggingConfiguration:PutLoggingConfiguration' :: PutLoggingConfiguration -> LoggingConfiguration
..} =
forall a. NFData a => a -> ()
Prelude.rnf LoggingConfiguration
loggingConfiguration
instance Data.ToHeaders PutLoggingConfiguration where
toHeaders :: PutLoggingConfiguration -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWSWAF_20150824.PutLoggingConfiguration" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON PutLoggingConfiguration where
toJSON :: PutLoggingConfiguration -> Value
toJSON PutLoggingConfiguration' {LoggingConfiguration
loggingConfiguration :: LoggingConfiguration
$sel:loggingConfiguration:PutLoggingConfiguration' :: PutLoggingConfiguration -> LoggingConfiguration
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
( Key
"LoggingConfiguration"
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= LoggingConfiguration
loggingConfiguration
)
]
)
instance Data.ToPath PutLoggingConfiguration where
toPath :: PutLoggingConfiguration -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery PutLoggingConfiguration where
toQuery :: PutLoggingConfiguration -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data PutLoggingConfigurationResponse = PutLoggingConfigurationResponse'
{
PutLoggingConfigurationResponse -> Maybe LoggingConfiguration
loggingConfiguration :: Prelude.Maybe LoggingConfiguration,
PutLoggingConfigurationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutLoggingConfigurationResponse
-> PutLoggingConfigurationResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutLoggingConfigurationResponse
-> PutLoggingConfigurationResponse -> Bool
$c/= :: PutLoggingConfigurationResponse
-> PutLoggingConfigurationResponse -> Bool
== :: PutLoggingConfigurationResponse
-> PutLoggingConfigurationResponse -> Bool
$c== :: PutLoggingConfigurationResponse
-> PutLoggingConfigurationResponse -> Bool
Prelude.Eq, ReadPrec [PutLoggingConfigurationResponse]
ReadPrec PutLoggingConfigurationResponse
Int -> ReadS PutLoggingConfigurationResponse
ReadS [PutLoggingConfigurationResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutLoggingConfigurationResponse]
$creadListPrec :: ReadPrec [PutLoggingConfigurationResponse]
readPrec :: ReadPrec PutLoggingConfigurationResponse
$creadPrec :: ReadPrec PutLoggingConfigurationResponse
readList :: ReadS [PutLoggingConfigurationResponse]
$creadList :: ReadS [PutLoggingConfigurationResponse]
readsPrec :: Int -> ReadS PutLoggingConfigurationResponse
$creadsPrec :: Int -> ReadS PutLoggingConfigurationResponse
Prelude.Read, Int -> PutLoggingConfigurationResponse -> ShowS
[PutLoggingConfigurationResponse] -> ShowS
PutLoggingConfigurationResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutLoggingConfigurationResponse] -> ShowS
$cshowList :: [PutLoggingConfigurationResponse] -> ShowS
show :: PutLoggingConfigurationResponse -> String
$cshow :: PutLoggingConfigurationResponse -> String
showsPrec :: Int -> PutLoggingConfigurationResponse -> ShowS
$cshowsPrec :: Int -> PutLoggingConfigurationResponse -> ShowS
Prelude.Show, forall x.
Rep PutLoggingConfigurationResponse x
-> PutLoggingConfigurationResponse
forall x.
PutLoggingConfigurationResponse
-> Rep PutLoggingConfigurationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutLoggingConfigurationResponse x
-> PutLoggingConfigurationResponse
$cfrom :: forall x.
PutLoggingConfigurationResponse
-> Rep PutLoggingConfigurationResponse x
Prelude.Generic)
newPutLoggingConfigurationResponse ::
Prelude.Int ->
PutLoggingConfigurationResponse
newPutLoggingConfigurationResponse :: Int -> PutLoggingConfigurationResponse
newPutLoggingConfigurationResponse Int
pHttpStatus_ =
PutLoggingConfigurationResponse'
{ $sel:loggingConfiguration:PutLoggingConfigurationResponse' :: Maybe LoggingConfiguration
loggingConfiguration =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PutLoggingConfigurationResponse' :: Int
httpStatus = Int
pHttpStatus_
}
putLoggingConfigurationResponse_loggingConfiguration :: Lens.Lens' PutLoggingConfigurationResponse (Prelude.Maybe LoggingConfiguration)
putLoggingConfigurationResponse_loggingConfiguration :: Lens' PutLoggingConfigurationResponse (Maybe LoggingConfiguration)
putLoggingConfigurationResponse_loggingConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutLoggingConfigurationResponse' {Maybe LoggingConfiguration
loggingConfiguration :: Maybe LoggingConfiguration
$sel:loggingConfiguration:PutLoggingConfigurationResponse' :: PutLoggingConfigurationResponse -> Maybe LoggingConfiguration
loggingConfiguration} -> Maybe LoggingConfiguration
loggingConfiguration) (\s :: PutLoggingConfigurationResponse
s@PutLoggingConfigurationResponse' {} Maybe LoggingConfiguration
a -> PutLoggingConfigurationResponse
s {$sel:loggingConfiguration:PutLoggingConfigurationResponse' :: Maybe LoggingConfiguration
loggingConfiguration = Maybe LoggingConfiguration
a} :: PutLoggingConfigurationResponse)
putLoggingConfigurationResponse_httpStatus :: Lens.Lens' PutLoggingConfigurationResponse Prelude.Int
putLoggingConfigurationResponse_httpStatus :: Lens' PutLoggingConfigurationResponse Int
putLoggingConfigurationResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutLoggingConfigurationResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutLoggingConfigurationResponse' :: PutLoggingConfigurationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutLoggingConfigurationResponse
s@PutLoggingConfigurationResponse' {} Int
a -> PutLoggingConfigurationResponse
s {$sel:httpStatus:PutLoggingConfigurationResponse' :: Int
httpStatus = Int
a} :: PutLoggingConfigurationResponse)
instance
Prelude.NFData
PutLoggingConfigurationResponse
where
rnf :: PutLoggingConfigurationResponse -> ()
rnf PutLoggingConfigurationResponse' {Int
Maybe LoggingConfiguration
httpStatus :: Int
loggingConfiguration :: Maybe LoggingConfiguration
$sel:httpStatus:PutLoggingConfigurationResponse' :: PutLoggingConfigurationResponse -> Int
$sel:loggingConfiguration:PutLoggingConfigurationResponse' :: PutLoggingConfigurationResponse -> Maybe LoggingConfiguration
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe LoggingConfiguration
loggingConfiguration
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus