{-# 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.WAFRegional.PutLoggingConfiguration
(
PutLoggingConfiguration (..),
newPutLoggingConfiguration,
putLoggingConfiguration_loggingConfiguration,
PutLoggingConfigurationResponse (..),
newPutLoggingConfigurationResponse,
putLoggingConfigurationResponse_loggingConfiguration,
putLoggingConfigurationResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.WAFRegional.Types
data PutLoggingConfiguration = PutLoggingConfiguration'
{
PutLoggingConfiguration -> LoggingConfiguration
loggingConfiguration :: LoggingConfiguration
}
deriving (PutLoggingConfiguration -> PutLoggingConfiguration -> Bool
(PutLoggingConfiguration -> PutLoggingConfiguration -> Bool)
-> (PutLoggingConfiguration -> PutLoggingConfiguration -> Bool)
-> Eq PutLoggingConfiguration
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]
(Int -> ReadS PutLoggingConfiguration)
-> ReadS [PutLoggingConfiguration]
-> ReadPrec PutLoggingConfiguration
-> ReadPrec [PutLoggingConfiguration]
-> Read 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
(Int -> PutLoggingConfiguration -> ShowS)
-> (PutLoggingConfiguration -> String)
-> ([PutLoggingConfiguration] -> ShowS)
-> Show PutLoggingConfiguration
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.
PutLoggingConfiguration -> Rep PutLoggingConfiguration x)
-> (forall x.
Rep PutLoggingConfiguration x -> PutLoggingConfiguration)
-> Generic PutLoggingConfiguration
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' :: LoggingConfiguration -> PutLoggingConfiguration
PutLoggingConfiguration'
{ $sel:loggingConfiguration:PutLoggingConfiguration' :: LoggingConfiguration
loggingConfiguration =
LoggingConfiguration
pLoggingConfiguration_
}
putLoggingConfiguration_loggingConfiguration :: Lens.Lens' PutLoggingConfiguration LoggingConfiguration
putLoggingConfiguration_loggingConfiguration :: (LoggingConfiguration -> f LoggingConfiguration)
-> PutLoggingConfiguration -> f PutLoggingConfiguration
putLoggingConfiguration_loggingConfiguration = (PutLoggingConfiguration -> LoggingConfiguration)
-> (PutLoggingConfiguration
-> LoggingConfiguration -> PutLoggingConfiguration)
-> Lens
PutLoggingConfiguration
PutLoggingConfiguration
LoggingConfiguration
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 :: PutLoggingConfiguration -> Request PutLoggingConfiguration
request = Service
-> PutLoggingConfiguration -> Request PutLoggingConfiguration
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutLoggingConfiguration
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutLoggingConfiguration)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse PutLoggingConfiguration))
-> Logger
-> Service
-> Proxy PutLoggingConfiguration
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutLoggingConfiguration)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe LoggingConfiguration
-> Int -> PutLoggingConfigurationResponse
PutLoggingConfigurationResponse'
(Maybe LoggingConfiguration
-> Int -> PutLoggingConfigurationResponse)
-> Either String (Maybe LoggingConfiguration)
-> Either String (Int -> PutLoggingConfigurationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Key -> Either String (Maybe LoggingConfiguration)
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"LoggingConfiguration")
Either String (Int -> PutLoggingConfigurationResponse)
-> Either String Int
-> Either String PutLoggingConfigurationResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable PutLoggingConfiguration
instance Prelude.NFData PutLoggingConfiguration
instance Core.ToHeaders PutLoggingConfiguration where
toHeaders :: PutLoggingConfiguration -> ResponseHeaders
toHeaders =
ResponseHeaders -> PutLoggingConfiguration -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSWAF_Regional_20161128.PutLoggingConfiguration" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON PutLoggingConfiguration where
toJSON :: PutLoggingConfiguration -> Value
toJSON PutLoggingConfiguration' {LoggingConfiguration
loggingConfiguration :: LoggingConfiguration
$sel:loggingConfiguration:PutLoggingConfiguration' :: PutLoggingConfiguration -> LoggingConfiguration
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Key
"LoggingConfiguration"
Key -> LoggingConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Core..= LoggingConfiguration
loggingConfiguration
)
]
)
instance Core.ToPath PutLoggingConfiguration where
toPath :: PutLoggingConfiguration -> ByteString
toPath = ByteString -> PutLoggingConfiguration -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PutLoggingConfiguration where
toQuery :: PutLoggingConfiguration -> QueryString
toQuery = QueryString -> PutLoggingConfiguration -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(PutLoggingConfigurationResponse
-> PutLoggingConfigurationResponse -> Bool)
-> (PutLoggingConfigurationResponse
-> PutLoggingConfigurationResponse -> Bool)
-> Eq PutLoggingConfigurationResponse
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]
(Int -> ReadS PutLoggingConfigurationResponse)
-> ReadS [PutLoggingConfigurationResponse]
-> ReadPrec PutLoggingConfigurationResponse
-> ReadPrec [PutLoggingConfigurationResponse]
-> Read 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
(Int -> PutLoggingConfigurationResponse -> ShowS)
-> (PutLoggingConfigurationResponse -> String)
-> ([PutLoggingConfigurationResponse] -> ShowS)
-> Show PutLoggingConfigurationResponse
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.
PutLoggingConfigurationResponse
-> Rep PutLoggingConfigurationResponse x)
-> (forall x.
Rep PutLoggingConfigurationResponse x
-> PutLoggingConfigurationResponse)
-> Generic PutLoggingConfigurationResponse
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' :: Maybe LoggingConfiguration
-> Int -> PutLoggingConfigurationResponse
PutLoggingConfigurationResponse'
{ $sel:loggingConfiguration:PutLoggingConfigurationResponse' :: Maybe LoggingConfiguration
loggingConfiguration =
Maybe LoggingConfiguration
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PutLoggingConfigurationResponse' :: Int
httpStatus = Int
pHttpStatus_
}
putLoggingConfigurationResponse_loggingConfiguration :: Lens.Lens' PutLoggingConfigurationResponse (Prelude.Maybe LoggingConfiguration)
putLoggingConfigurationResponse_loggingConfiguration :: (Maybe LoggingConfiguration -> f (Maybe LoggingConfiguration))
-> PutLoggingConfigurationResponse
-> f PutLoggingConfigurationResponse
putLoggingConfigurationResponse_loggingConfiguration = (PutLoggingConfigurationResponse -> Maybe LoggingConfiguration)
-> (PutLoggingConfigurationResponse
-> Maybe LoggingConfiguration -> PutLoggingConfigurationResponse)
-> Lens
PutLoggingConfigurationResponse
PutLoggingConfigurationResponse
(Maybe LoggingConfiguration)
(Maybe 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 :: (Int -> f Int)
-> PutLoggingConfigurationResponse
-> f PutLoggingConfigurationResponse
putLoggingConfigurationResponse_httpStatus = (PutLoggingConfigurationResponse -> Int)
-> (PutLoggingConfigurationResponse
-> Int -> PutLoggingConfigurationResponse)
-> Lens
PutLoggingConfigurationResponse
PutLoggingConfigurationResponse
Int
Int
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