{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.WAFRegional.GetSqlInjectionMatchSet
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- This is __AWS WAF Classic__ documentation. For more information, see
-- <https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html AWS WAF Classic>
-- in the developer guide.
--
-- __For the latest version of AWS WAF__, use the AWS WAFV2 API and see the
-- <https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html AWS WAF Developer Guide>.
-- With the latest version, AWS WAF has a single set of endpoints for
-- regional and global use.
--
-- Returns the SqlInjectionMatchSet that is specified by
-- @SqlInjectionMatchSetId@.
module Amazonka.WAFRegional.GetSqlInjectionMatchSet
  ( -- * Creating a Request
    GetSqlInjectionMatchSet (..),
    newGetSqlInjectionMatchSet,

    -- * Request Lenses
    getSqlInjectionMatchSet_sqlInjectionMatchSetId,

    -- * Destructuring the Response
    GetSqlInjectionMatchSetResponse (..),
    newGetSqlInjectionMatchSetResponse,

    -- * Response Lenses
    getSqlInjectionMatchSetResponse_sqlInjectionMatchSet,
    getSqlInjectionMatchSetResponse_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.WAFRegional.Types

-- | A request to get a SqlInjectionMatchSet.
--
-- /See:/ 'newGetSqlInjectionMatchSet' smart constructor.
data GetSqlInjectionMatchSet = GetSqlInjectionMatchSet'
  { -- | The @SqlInjectionMatchSetId@ of the SqlInjectionMatchSet that you want
    -- to get. @SqlInjectionMatchSetId@ is returned by
    -- CreateSqlInjectionMatchSet and by ListSqlInjectionMatchSets.
    GetSqlInjectionMatchSet -> Text
sqlInjectionMatchSetId :: Prelude.Text
  }
  deriving (GetSqlInjectionMatchSet -> GetSqlInjectionMatchSet -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSqlInjectionMatchSet -> GetSqlInjectionMatchSet -> Bool
$c/= :: GetSqlInjectionMatchSet -> GetSqlInjectionMatchSet -> Bool
== :: GetSqlInjectionMatchSet -> GetSqlInjectionMatchSet -> Bool
$c== :: GetSqlInjectionMatchSet -> GetSqlInjectionMatchSet -> Bool
Prelude.Eq, ReadPrec [GetSqlInjectionMatchSet]
ReadPrec GetSqlInjectionMatchSet
Int -> ReadS GetSqlInjectionMatchSet
ReadS [GetSqlInjectionMatchSet]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSqlInjectionMatchSet]
$creadListPrec :: ReadPrec [GetSqlInjectionMatchSet]
readPrec :: ReadPrec GetSqlInjectionMatchSet
$creadPrec :: ReadPrec GetSqlInjectionMatchSet
readList :: ReadS [GetSqlInjectionMatchSet]
$creadList :: ReadS [GetSqlInjectionMatchSet]
readsPrec :: Int -> ReadS GetSqlInjectionMatchSet
$creadsPrec :: Int -> ReadS GetSqlInjectionMatchSet
Prelude.Read, Int -> GetSqlInjectionMatchSet -> ShowS
[GetSqlInjectionMatchSet] -> ShowS
GetSqlInjectionMatchSet -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSqlInjectionMatchSet] -> ShowS
$cshowList :: [GetSqlInjectionMatchSet] -> ShowS
show :: GetSqlInjectionMatchSet -> String
$cshow :: GetSqlInjectionMatchSet -> String
showsPrec :: Int -> GetSqlInjectionMatchSet -> ShowS
$cshowsPrec :: Int -> GetSqlInjectionMatchSet -> ShowS
Prelude.Show, forall x. Rep GetSqlInjectionMatchSet x -> GetSqlInjectionMatchSet
forall x. GetSqlInjectionMatchSet -> Rep GetSqlInjectionMatchSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetSqlInjectionMatchSet x -> GetSqlInjectionMatchSet
$cfrom :: forall x. GetSqlInjectionMatchSet -> Rep GetSqlInjectionMatchSet x
Prelude.Generic)

-- |
-- Create a value of 'GetSqlInjectionMatchSet' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'sqlInjectionMatchSetId', 'getSqlInjectionMatchSet_sqlInjectionMatchSetId' - The @SqlInjectionMatchSetId@ of the SqlInjectionMatchSet that you want
-- to get. @SqlInjectionMatchSetId@ is returned by
-- CreateSqlInjectionMatchSet and by ListSqlInjectionMatchSets.
newGetSqlInjectionMatchSet ::
  -- | 'sqlInjectionMatchSetId'
  Prelude.Text ->
  GetSqlInjectionMatchSet
newGetSqlInjectionMatchSet :: Text -> GetSqlInjectionMatchSet
newGetSqlInjectionMatchSet Text
pSqlInjectionMatchSetId_ =
  GetSqlInjectionMatchSet'
    { $sel:sqlInjectionMatchSetId:GetSqlInjectionMatchSet' :: Text
sqlInjectionMatchSetId =
        Text
pSqlInjectionMatchSetId_
    }

-- | The @SqlInjectionMatchSetId@ of the SqlInjectionMatchSet that you want
-- to get. @SqlInjectionMatchSetId@ is returned by
-- CreateSqlInjectionMatchSet and by ListSqlInjectionMatchSets.
getSqlInjectionMatchSet_sqlInjectionMatchSetId :: Lens.Lens' GetSqlInjectionMatchSet Prelude.Text
getSqlInjectionMatchSet_sqlInjectionMatchSetId :: Lens' GetSqlInjectionMatchSet Text
getSqlInjectionMatchSet_sqlInjectionMatchSetId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSqlInjectionMatchSet' {Text
sqlInjectionMatchSetId :: Text
$sel:sqlInjectionMatchSetId:GetSqlInjectionMatchSet' :: GetSqlInjectionMatchSet -> Text
sqlInjectionMatchSetId} -> Text
sqlInjectionMatchSetId) (\s :: GetSqlInjectionMatchSet
s@GetSqlInjectionMatchSet' {} Text
a -> GetSqlInjectionMatchSet
s {$sel:sqlInjectionMatchSetId:GetSqlInjectionMatchSet' :: Text
sqlInjectionMatchSetId = Text
a} :: GetSqlInjectionMatchSet)

instance Core.AWSRequest GetSqlInjectionMatchSet where
  type
    AWSResponse GetSqlInjectionMatchSet =
      GetSqlInjectionMatchSetResponse
  request :: (Service -> Service)
-> GetSqlInjectionMatchSet -> Request GetSqlInjectionMatchSet
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 GetSqlInjectionMatchSet
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetSqlInjectionMatchSet)))
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 SqlInjectionMatchSet
-> Int -> GetSqlInjectionMatchSetResponse
GetSqlInjectionMatchSetResponse'
            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
"SqlInjectionMatchSet")
            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 GetSqlInjectionMatchSet where
  hashWithSalt :: Int -> GetSqlInjectionMatchSet -> Int
hashWithSalt Int
_salt GetSqlInjectionMatchSet' {Text
sqlInjectionMatchSetId :: Text
$sel:sqlInjectionMatchSetId:GetSqlInjectionMatchSet' :: GetSqlInjectionMatchSet -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
sqlInjectionMatchSetId

instance Prelude.NFData GetSqlInjectionMatchSet where
  rnf :: GetSqlInjectionMatchSet -> ()
rnf GetSqlInjectionMatchSet' {Text
sqlInjectionMatchSetId :: Text
$sel:sqlInjectionMatchSetId:GetSqlInjectionMatchSet' :: GetSqlInjectionMatchSet -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
sqlInjectionMatchSetId

instance Data.ToHeaders GetSqlInjectionMatchSet where
  toHeaders :: GetSqlInjectionMatchSet -> 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_Regional_20161128.GetSqlInjectionMatchSet" ::
                          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 GetSqlInjectionMatchSet where
  toJSON :: GetSqlInjectionMatchSet -> Value
toJSON GetSqlInjectionMatchSet' {Text
sqlInjectionMatchSetId :: Text
$sel:sqlInjectionMatchSetId:GetSqlInjectionMatchSet' :: GetSqlInjectionMatchSet -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              ( Key
"SqlInjectionMatchSetId"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
sqlInjectionMatchSetId
              )
          ]
      )

instance Data.ToPath GetSqlInjectionMatchSet where
  toPath :: GetSqlInjectionMatchSet -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery GetSqlInjectionMatchSet where
  toQuery :: GetSqlInjectionMatchSet -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | The response to a GetSqlInjectionMatchSet request.
--
-- /See:/ 'newGetSqlInjectionMatchSetResponse' smart constructor.
data GetSqlInjectionMatchSetResponse = GetSqlInjectionMatchSetResponse'
  { -- | Information about the SqlInjectionMatchSet that you specified in the
    -- @GetSqlInjectionMatchSet@ request. For more information, see the
    -- following topics:
    --
    -- -   SqlInjectionMatchSet: Contains @Name@, @SqlInjectionMatchSetId@, and
    --     an array of @SqlInjectionMatchTuple@ objects
    --
    -- -   SqlInjectionMatchTuple: Each @SqlInjectionMatchTuple@ object
    --     contains @FieldToMatch@ and @TextTransformation@
    --
    -- -   FieldToMatch: Contains @Data@ and @Type@
    GetSqlInjectionMatchSetResponse -> Maybe SqlInjectionMatchSet
sqlInjectionMatchSet :: Prelude.Maybe SqlInjectionMatchSet,
    -- | The response's http status code.
    GetSqlInjectionMatchSetResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetSqlInjectionMatchSetResponse
-> GetSqlInjectionMatchSetResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSqlInjectionMatchSetResponse
-> GetSqlInjectionMatchSetResponse -> Bool
$c/= :: GetSqlInjectionMatchSetResponse
-> GetSqlInjectionMatchSetResponse -> Bool
== :: GetSqlInjectionMatchSetResponse
-> GetSqlInjectionMatchSetResponse -> Bool
$c== :: GetSqlInjectionMatchSetResponse
-> GetSqlInjectionMatchSetResponse -> Bool
Prelude.Eq, ReadPrec [GetSqlInjectionMatchSetResponse]
ReadPrec GetSqlInjectionMatchSetResponse
Int -> ReadS GetSqlInjectionMatchSetResponse
ReadS [GetSqlInjectionMatchSetResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSqlInjectionMatchSetResponse]
$creadListPrec :: ReadPrec [GetSqlInjectionMatchSetResponse]
readPrec :: ReadPrec GetSqlInjectionMatchSetResponse
$creadPrec :: ReadPrec GetSqlInjectionMatchSetResponse
readList :: ReadS [GetSqlInjectionMatchSetResponse]
$creadList :: ReadS [GetSqlInjectionMatchSetResponse]
readsPrec :: Int -> ReadS GetSqlInjectionMatchSetResponse
$creadsPrec :: Int -> ReadS GetSqlInjectionMatchSetResponse
Prelude.Read, Int -> GetSqlInjectionMatchSetResponse -> ShowS
[GetSqlInjectionMatchSetResponse] -> ShowS
GetSqlInjectionMatchSetResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSqlInjectionMatchSetResponse] -> ShowS
$cshowList :: [GetSqlInjectionMatchSetResponse] -> ShowS
show :: GetSqlInjectionMatchSetResponse -> String
$cshow :: GetSqlInjectionMatchSetResponse -> String
showsPrec :: Int -> GetSqlInjectionMatchSetResponse -> ShowS
$cshowsPrec :: Int -> GetSqlInjectionMatchSetResponse -> ShowS
Prelude.Show, forall x.
Rep GetSqlInjectionMatchSetResponse x
-> GetSqlInjectionMatchSetResponse
forall x.
GetSqlInjectionMatchSetResponse
-> Rep GetSqlInjectionMatchSetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetSqlInjectionMatchSetResponse x
-> GetSqlInjectionMatchSetResponse
$cfrom :: forall x.
GetSqlInjectionMatchSetResponse
-> Rep GetSqlInjectionMatchSetResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetSqlInjectionMatchSetResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'sqlInjectionMatchSet', 'getSqlInjectionMatchSetResponse_sqlInjectionMatchSet' - Information about the SqlInjectionMatchSet that you specified in the
-- @GetSqlInjectionMatchSet@ request. For more information, see the
-- following topics:
--
-- -   SqlInjectionMatchSet: Contains @Name@, @SqlInjectionMatchSetId@, and
--     an array of @SqlInjectionMatchTuple@ objects
--
-- -   SqlInjectionMatchTuple: Each @SqlInjectionMatchTuple@ object
--     contains @FieldToMatch@ and @TextTransformation@
--
-- -   FieldToMatch: Contains @Data@ and @Type@
--
-- 'httpStatus', 'getSqlInjectionMatchSetResponse_httpStatus' - The response's http status code.
newGetSqlInjectionMatchSetResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetSqlInjectionMatchSetResponse
newGetSqlInjectionMatchSetResponse :: Int -> GetSqlInjectionMatchSetResponse
newGetSqlInjectionMatchSetResponse Int
pHttpStatus_ =
  GetSqlInjectionMatchSetResponse'
    { $sel:sqlInjectionMatchSet:GetSqlInjectionMatchSetResponse' :: Maybe SqlInjectionMatchSet
sqlInjectionMatchSet =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetSqlInjectionMatchSetResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the SqlInjectionMatchSet that you specified in the
-- @GetSqlInjectionMatchSet@ request. For more information, see the
-- following topics:
--
-- -   SqlInjectionMatchSet: Contains @Name@, @SqlInjectionMatchSetId@, and
--     an array of @SqlInjectionMatchTuple@ objects
--
-- -   SqlInjectionMatchTuple: Each @SqlInjectionMatchTuple@ object
--     contains @FieldToMatch@ and @TextTransformation@
--
-- -   FieldToMatch: Contains @Data@ and @Type@
getSqlInjectionMatchSetResponse_sqlInjectionMatchSet :: Lens.Lens' GetSqlInjectionMatchSetResponse (Prelude.Maybe SqlInjectionMatchSet)
getSqlInjectionMatchSetResponse_sqlInjectionMatchSet :: Lens' GetSqlInjectionMatchSetResponse (Maybe SqlInjectionMatchSet)
getSqlInjectionMatchSetResponse_sqlInjectionMatchSet = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSqlInjectionMatchSetResponse' {Maybe SqlInjectionMatchSet
sqlInjectionMatchSet :: Maybe SqlInjectionMatchSet
$sel:sqlInjectionMatchSet:GetSqlInjectionMatchSetResponse' :: GetSqlInjectionMatchSetResponse -> Maybe SqlInjectionMatchSet
sqlInjectionMatchSet} -> Maybe SqlInjectionMatchSet
sqlInjectionMatchSet) (\s :: GetSqlInjectionMatchSetResponse
s@GetSqlInjectionMatchSetResponse' {} Maybe SqlInjectionMatchSet
a -> GetSqlInjectionMatchSetResponse
s {$sel:sqlInjectionMatchSet:GetSqlInjectionMatchSetResponse' :: Maybe SqlInjectionMatchSet
sqlInjectionMatchSet = Maybe SqlInjectionMatchSet
a} :: GetSqlInjectionMatchSetResponse)

-- | The response's http status code.
getSqlInjectionMatchSetResponse_httpStatus :: Lens.Lens' GetSqlInjectionMatchSetResponse Prelude.Int
getSqlInjectionMatchSetResponse_httpStatus :: Lens' GetSqlInjectionMatchSetResponse Int
getSqlInjectionMatchSetResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSqlInjectionMatchSetResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetSqlInjectionMatchSetResponse' :: GetSqlInjectionMatchSetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetSqlInjectionMatchSetResponse
s@GetSqlInjectionMatchSetResponse' {} Int
a -> GetSqlInjectionMatchSetResponse
s {$sel:httpStatus:GetSqlInjectionMatchSetResponse' :: Int
httpStatus = Int
a} :: GetSqlInjectionMatchSetResponse)

instance
  Prelude.NFData
    GetSqlInjectionMatchSetResponse
  where
  rnf :: GetSqlInjectionMatchSetResponse -> ()
rnf GetSqlInjectionMatchSetResponse' {Int
Maybe SqlInjectionMatchSet
httpStatus :: Int
sqlInjectionMatchSet :: Maybe SqlInjectionMatchSet
$sel:httpStatus:GetSqlInjectionMatchSetResponse' :: GetSqlInjectionMatchSetResponse -> Int
$sel:sqlInjectionMatchSet:GetSqlInjectionMatchSetResponse' :: GetSqlInjectionMatchSetResponse -> Maybe SqlInjectionMatchSet
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe SqlInjectionMatchSet
sqlInjectionMatchSet
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus