{-# 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.GetByteMatchSet
(
GetByteMatchSet (..),
newGetByteMatchSet,
getByteMatchSet_byteMatchSetId,
GetByteMatchSetResponse (..),
newGetByteMatchSetResponse,
getByteMatchSetResponse_byteMatchSet,
getByteMatchSetResponse_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 GetByteMatchSet = GetByteMatchSet'
{
GetByteMatchSet -> Text
byteMatchSetId :: Prelude.Text
}
deriving (GetByteMatchSet -> GetByteMatchSet -> Bool
(GetByteMatchSet -> GetByteMatchSet -> Bool)
-> (GetByteMatchSet -> GetByteMatchSet -> Bool)
-> Eq GetByteMatchSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetByteMatchSet -> GetByteMatchSet -> Bool
$c/= :: GetByteMatchSet -> GetByteMatchSet -> Bool
== :: GetByteMatchSet -> GetByteMatchSet -> Bool
$c== :: GetByteMatchSet -> GetByteMatchSet -> Bool
Prelude.Eq, ReadPrec [GetByteMatchSet]
ReadPrec GetByteMatchSet
Int -> ReadS GetByteMatchSet
ReadS [GetByteMatchSet]
(Int -> ReadS GetByteMatchSet)
-> ReadS [GetByteMatchSet]
-> ReadPrec GetByteMatchSet
-> ReadPrec [GetByteMatchSet]
-> Read GetByteMatchSet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetByteMatchSet]
$creadListPrec :: ReadPrec [GetByteMatchSet]
readPrec :: ReadPrec GetByteMatchSet
$creadPrec :: ReadPrec GetByteMatchSet
readList :: ReadS [GetByteMatchSet]
$creadList :: ReadS [GetByteMatchSet]
readsPrec :: Int -> ReadS GetByteMatchSet
$creadsPrec :: Int -> ReadS GetByteMatchSet
Prelude.Read, Int -> GetByteMatchSet -> ShowS
[GetByteMatchSet] -> ShowS
GetByteMatchSet -> String
(Int -> GetByteMatchSet -> ShowS)
-> (GetByteMatchSet -> String)
-> ([GetByteMatchSet] -> ShowS)
-> Show GetByteMatchSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetByteMatchSet] -> ShowS
$cshowList :: [GetByteMatchSet] -> ShowS
show :: GetByteMatchSet -> String
$cshow :: GetByteMatchSet -> String
showsPrec :: Int -> GetByteMatchSet -> ShowS
$cshowsPrec :: Int -> GetByteMatchSet -> ShowS
Prelude.Show, (forall x. GetByteMatchSet -> Rep GetByteMatchSet x)
-> (forall x. Rep GetByteMatchSet x -> GetByteMatchSet)
-> Generic GetByteMatchSet
forall x. Rep GetByteMatchSet x -> GetByteMatchSet
forall x. GetByteMatchSet -> Rep GetByteMatchSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetByteMatchSet x -> GetByteMatchSet
$cfrom :: forall x. GetByteMatchSet -> Rep GetByteMatchSet x
Prelude.Generic)
newGetByteMatchSet ::
Prelude.Text ->
GetByteMatchSet
newGetByteMatchSet :: Text -> GetByteMatchSet
newGetByteMatchSet Text
pByteMatchSetId_ =
GetByteMatchSet' :: Text -> GetByteMatchSet
GetByteMatchSet' {$sel:byteMatchSetId:GetByteMatchSet' :: Text
byteMatchSetId = Text
pByteMatchSetId_}
getByteMatchSet_byteMatchSetId :: Lens.Lens' GetByteMatchSet Prelude.Text
getByteMatchSet_byteMatchSetId :: (Text -> f Text) -> GetByteMatchSet -> f GetByteMatchSet
getByteMatchSet_byteMatchSetId = (GetByteMatchSet -> Text)
-> (GetByteMatchSet -> Text -> GetByteMatchSet)
-> Lens GetByteMatchSet GetByteMatchSet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetByteMatchSet' {Text
byteMatchSetId :: Text
$sel:byteMatchSetId:GetByteMatchSet' :: GetByteMatchSet -> Text
byteMatchSetId} -> Text
byteMatchSetId) (\s :: GetByteMatchSet
s@GetByteMatchSet' {} Text
a -> GetByteMatchSet
s {$sel:byteMatchSetId:GetByteMatchSet' :: Text
byteMatchSetId = Text
a} :: GetByteMatchSet)
instance Core.AWSRequest GetByteMatchSet where
type
AWSResponse GetByteMatchSet =
GetByteMatchSetResponse
request :: GetByteMatchSet -> Request GetByteMatchSet
request = Service -> GetByteMatchSet -> Request GetByteMatchSet
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetByteMatchSet
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetByteMatchSet)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetByteMatchSet))
-> Logger
-> Service
-> Proxy GetByteMatchSet
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetByteMatchSet)))
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 ByteMatchSet -> Int -> GetByteMatchSetResponse
GetByteMatchSetResponse'
(Maybe ByteMatchSet -> Int -> GetByteMatchSetResponse)
-> Either String (Maybe ByteMatchSet)
-> Either String (Int -> GetByteMatchSetResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ByteMatchSet)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ByteMatchSet")
Either String (Int -> GetByteMatchSetResponse)
-> Either String Int -> Either String GetByteMatchSetResponse
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 GetByteMatchSet
instance Prelude.NFData GetByteMatchSet
instance Core.ToHeaders GetByteMatchSet where
toHeaders :: GetByteMatchSet -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetByteMatchSet -> 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.GetByteMatchSet" ::
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 GetByteMatchSet where
toJSON :: GetByteMatchSet -> Value
toJSON GetByteMatchSet' {Text
byteMatchSetId :: Text
$sel:byteMatchSetId:GetByteMatchSet' :: GetByteMatchSet -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"ByteMatchSetId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
byteMatchSetId)
]
)
instance Core.ToPath GetByteMatchSet where
toPath :: GetByteMatchSet -> ByteString
toPath = ByteString -> GetByteMatchSet -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetByteMatchSet where
toQuery :: GetByteMatchSet -> QueryString
toQuery = QueryString -> GetByteMatchSet -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetByteMatchSetResponse = GetByteMatchSetResponse'
{
GetByteMatchSetResponse -> Maybe ByteMatchSet
byteMatchSet :: Prelude.Maybe ByteMatchSet,
GetByteMatchSetResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetByteMatchSetResponse -> GetByteMatchSetResponse -> Bool
(GetByteMatchSetResponse -> GetByteMatchSetResponse -> Bool)
-> (GetByteMatchSetResponse -> GetByteMatchSetResponse -> Bool)
-> Eq GetByteMatchSetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetByteMatchSetResponse -> GetByteMatchSetResponse -> Bool
$c/= :: GetByteMatchSetResponse -> GetByteMatchSetResponse -> Bool
== :: GetByteMatchSetResponse -> GetByteMatchSetResponse -> Bool
$c== :: GetByteMatchSetResponse -> GetByteMatchSetResponse -> Bool
Prelude.Eq, ReadPrec [GetByteMatchSetResponse]
ReadPrec GetByteMatchSetResponse
Int -> ReadS GetByteMatchSetResponse
ReadS [GetByteMatchSetResponse]
(Int -> ReadS GetByteMatchSetResponse)
-> ReadS [GetByteMatchSetResponse]
-> ReadPrec GetByteMatchSetResponse
-> ReadPrec [GetByteMatchSetResponse]
-> Read GetByteMatchSetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetByteMatchSetResponse]
$creadListPrec :: ReadPrec [GetByteMatchSetResponse]
readPrec :: ReadPrec GetByteMatchSetResponse
$creadPrec :: ReadPrec GetByteMatchSetResponse
readList :: ReadS [GetByteMatchSetResponse]
$creadList :: ReadS [GetByteMatchSetResponse]
readsPrec :: Int -> ReadS GetByteMatchSetResponse
$creadsPrec :: Int -> ReadS GetByteMatchSetResponse
Prelude.Read, Int -> GetByteMatchSetResponse -> ShowS
[GetByteMatchSetResponse] -> ShowS
GetByteMatchSetResponse -> String
(Int -> GetByteMatchSetResponse -> ShowS)
-> (GetByteMatchSetResponse -> String)
-> ([GetByteMatchSetResponse] -> ShowS)
-> Show GetByteMatchSetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetByteMatchSetResponse] -> ShowS
$cshowList :: [GetByteMatchSetResponse] -> ShowS
show :: GetByteMatchSetResponse -> String
$cshow :: GetByteMatchSetResponse -> String
showsPrec :: Int -> GetByteMatchSetResponse -> ShowS
$cshowsPrec :: Int -> GetByteMatchSetResponse -> ShowS
Prelude.Show, (forall x.
GetByteMatchSetResponse -> Rep GetByteMatchSetResponse x)
-> (forall x.
Rep GetByteMatchSetResponse x -> GetByteMatchSetResponse)
-> Generic GetByteMatchSetResponse
forall x. Rep GetByteMatchSetResponse x -> GetByteMatchSetResponse
forall x. GetByteMatchSetResponse -> Rep GetByteMatchSetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetByteMatchSetResponse x -> GetByteMatchSetResponse
$cfrom :: forall x. GetByteMatchSetResponse -> Rep GetByteMatchSetResponse x
Prelude.Generic)
newGetByteMatchSetResponse ::
Prelude.Int ->
GetByteMatchSetResponse
newGetByteMatchSetResponse :: Int -> GetByteMatchSetResponse
newGetByteMatchSetResponse Int
pHttpStatus_ =
GetByteMatchSetResponse' :: Maybe ByteMatchSet -> Int -> GetByteMatchSetResponse
GetByteMatchSetResponse'
{ $sel:byteMatchSet:GetByteMatchSetResponse' :: Maybe ByteMatchSet
byteMatchSet =
Maybe ByteMatchSet
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetByteMatchSetResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getByteMatchSetResponse_byteMatchSet :: Lens.Lens' GetByteMatchSetResponse (Prelude.Maybe ByteMatchSet)
getByteMatchSetResponse_byteMatchSet :: (Maybe ByteMatchSet -> f (Maybe ByteMatchSet))
-> GetByteMatchSetResponse -> f GetByteMatchSetResponse
getByteMatchSetResponse_byteMatchSet = (GetByteMatchSetResponse -> Maybe ByteMatchSet)
-> (GetByteMatchSetResponse
-> Maybe ByteMatchSet -> GetByteMatchSetResponse)
-> Lens
GetByteMatchSetResponse
GetByteMatchSetResponse
(Maybe ByteMatchSet)
(Maybe ByteMatchSet)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetByteMatchSetResponse' {Maybe ByteMatchSet
byteMatchSet :: Maybe ByteMatchSet
$sel:byteMatchSet:GetByteMatchSetResponse' :: GetByteMatchSetResponse -> Maybe ByteMatchSet
byteMatchSet} -> Maybe ByteMatchSet
byteMatchSet) (\s :: GetByteMatchSetResponse
s@GetByteMatchSetResponse' {} Maybe ByteMatchSet
a -> GetByteMatchSetResponse
s {$sel:byteMatchSet:GetByteMatchSetResponse' :: Maybe ByteMatchSet
byteMatchSet = Maybe ByteMatchSet
a} :: GetByteMatchSetResponse)
getByteMatchSetResponse_httpStatus :: Lens.Lens' GetByteMatchSetResponse Prelude.Int
getByteMatchSetResponse_httpStatus :: (Int -> f Int)
-> GetByteMatchSetResponse -> f GetByteMatchSetResponse
getByteMatchSetResponse_httpStatus = (GetByteMatchSetResponse -> Int)
-> (GetByteMatchSetResponse -> Int -> GetByteMatchSetResponse)
-> Lens GetByteMatchSetResponse GetByteMatchSetResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetByteMatchSetResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetByteMatchSetResponse' :: GetByteMatchSetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetByteMatchSetResponse
s@GetByteMatchSetResponse' {} Int
a -> GetByteMatchSetResponse
s {$sel:httpStatus:GetByteMatchSetResponse' :: Int
httpStatus = Int
a} :: GetByteMatchSetResponse)
instance Prelude.NFData GetByteMatchSetResponse