{-# 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.MacieV2.TestCustomDataIdentifier
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Tests a custom data identifier.
module Amazonka.MacieV2.TestCustomDataIdentifier
  ( -- * Creating a Request
    TestCustomDataIdentifier (..),
    newTestCustomDataIdentifier,

    -- * Request Lenses
    testCustomDataIdentifier_keywords,
    testCustomDataIdentifier_ignoreWords,
    testCustomDataIdentifier_maximumMatchDistance,
    testCustomDataIdentifier_regex,
    testCustomDataIdentifier_sampleText,

    -- * Destructuring the Response
    TestCustomDataIdentifierResponse (..),
    newTestCustomDataIdentifierResponse,

    -- * Response Lenses
    testCustomDataIdentifierResponse_matchCount,
    testCustomDataIdentifierResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MacieV2.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newTestCustomDataIdentifier' smart constructor.
data TestCustomDataIdentifier = TestCustomDataIdentifier'
  { -- | An array that lists specific character sequences (keywords), one of
    -- which must be within proximity (maximumMatchDistance) of the regular
    -- expression to match. The array can contain as many as 50 keywords. Each
    -- keyword can contain 3-90 UTF-8 characters. Keywords aren\'t case
    -- sensitive.
    TestCustomDataIdentifier -> Maybe [Text]
keywords :: Prelude.Maybe [Prelude.Text],
    -- | An array that lists specific character sequences (ignore words) to
    -- exclude from the results. If the text matched by the regular expression
    -- is the same as any string in this array, Amazon Macie ignores it. The
    -- array can contain as many as 10 ignore words. Each ignore word can
    -- contain 4-90 UTF-8 characters. Ignore words are case sensitive.
    TestCustomDataIdentifier -> Maybe [Text]
ignoreWords :: Prelude.Maybe [Prelude.Text],
    -- | The maximum number of characters that can exist between text that
    -- matches the regex pattern and the character sequences specified by the
    -- keywords array. Amazon Macie includes or excludes a result based on the
    -- proximity of a keyword to text that matches the regex pattern. The
    -- distance can be 1-300 characters. The default value is 50.
    TestCustomDataIdentifier -> Maybe Int
maximumMatchDistance :: Prelude.Maybe Prelude.Int,
    -- | The regular expression (/regex/) that defines the pattern to match. The
    -- expression can contain as many as 512 characters.
    TestCustomDataIdentifier -> Text
regex :: Prelude.Text,
    -- | The sample text to inspect by using the custom data identifier. The text
    -- can contain as many as 1,000 characters.
    TestCustomDataIdentifier -> Text
sampleText :: Prelude.Text
  }
  deriving (TestCustomDataIdentifier -> TestCustomDataIdentifier -> Bool
(TestCustomDataIdentifier -> TestCustomDataIdentifier -> Bool)
-> (TestCustomDataIdentifier -> TestCustomDataIdentifier -> Bool)
-> Eq TestCustomDataIdentifier
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TestCustomDataIdentifier -> TestCustomDataIdentifier -> Bool
$c/= :: TestCustomDataIdentifier -> TestCustomDataIdentifier -> Bool
== :: TestCustomDataIdentifier -> TestCustomDataIdentifier -> Bool
$c== :: TestCustomDataIdentifier -> TestCustomDataIdentifier -> Bool
Prelude.Eq, ReadPrec [TestCustomDataIdentifier]
ReadPrec TestCustomDataIdentifier
Int -> ReadS TestCustomDataIdentifier
ReadS [TestCustomDataIdentifier]
(Int -> ReadS TestCustomDataIdentifier)
-> ReadS [TestCustomDataIdentifier]
-> ReadPrec TestCustomDataIdentifier
-> ReadPrec [TestCustomDataIdentifier]
-> Read TestCustomDataIdentifier
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TestCustomDataIdentifier]
$creadListPrec :: ReadPrec [TestCustomDataIdentifier]
readPrec :: ReadPrec TestCustomDataIdentifier
$creadPrec :: ReadPrec TestCustomDataIdentifier
readList :: ReadS [TestCustomDataIdentifier]
$creadList :: ReadS [TestCustomDataIdentifier]
readsPrec :: Int -> ReadS TestCustomDataIdentifier
$creadsPrec :: Int -> ReadS TestCustomDataIdentifier
Prelude.Read, Int -> TestCustomDataIdentifier -> ShowS
[TestCustomDataIdentifier] -> ShowS
TestCustomDataIdentifier -> String
(Int -> TestCustomDataIdentifier -> ShowS)
-> (TestCustomDataIdentifier -> String)
-> ([TestCustomDataIdentifier] -> ShowS)
-> Show TestCustomDataIdentifier
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TestCustomDataIdentifier] -> ShowS
$cshowList :: [TestCustomDataIdentifier] -> ShowS
show :: TestCustomDataIdentifier -> String
$cshow :: TestCustomDataIdentifier -> String
showsPrec :: Int -> TestCustomDataIdentifier -> ShowS
$cshowsPrec :: Int -> TestCustomDataIdentifier -> ShowS
Prelude.Show, (forall x.
 TestCustomDataIdentifier -> Rep TestCustomDataIdentifier x)
-> (forall x.
    Rep TestCustomDataIdentifier x -> TestCustomDataIdentifier)
-> Generic TestCustomDataIdentifier
forall x.
Rep TestCustomDataIdentifier x -> TestCustomDataIdentifier
forall x.
TestCustomDataIdentifier -> Rep TestCustomDataIdentifier x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TestCustomDataIdentifier x -> TestCustomDataIdentifier
$cfrom :: forall x.
TestCustomDataIdentifier -> Rep TestCustomDataIdentifier x
Prelude.Generic)

-- |
-- Create a value of 'TestCustomDataIdentifier' 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:
--
-- 'keywords', 'testCustomDataIdentifier_keywords' - An array that lists specific character sequences (keywords), one of
-- which must be within proximity (maximumMatchDistance) of the regular
-- expression to match. The array can contain as many as 50 keywords. Each
-- keyword can contain 3-90 UTF-8 characters. Keywords aren\'t case
-- sensitive.
--
-- 'ignoreWords', 'testCustomDataIdentifier_ignoreWords' - An array that lists specific character sequences (ignore words) to
-- exclude from the results. If the text matched by the regular expression
-- is the same as any string in this array, Amazon Macie ignores it. The
-- array can contain as many as 10 ignore words. Each ignore word can
-- contain 4-90 UTF-8 characters. Ignore words are case sensitive.
--
-- 'maximumMatchDistance', 'testCustomDataIdentifier_maximumMatchDistance' - The maximum number of characters that can exist between text that
-- matches the regex pattern and the character sequences specified by the
-- keywords array. Amazon Macie includes or excludes a result based on the
-- proximity of a keyword to text that matches the regex pattern. The
-- distance can be 1-300 characters. The default value is 50.
--
-- 'regex', 'testCustomDataIdentifier_regex' - The regular expression (/regex/) that defines the pattern to match. The
-- expression can contain as many as 512 characters.
--
-- 'sampleText', 'testCustomDataIdentifier_sampleText' - The sample text to inspect by using the custom data identifier. The text
-- can contain as many as 1,000 characters.
newTestCustomDataIdentifier ::
  -- | 'regex'
  Prelude.Text ->
  -- | 'sampleText'
  Prelude.Text ->
  TestCustomDataIdentifier
newTestCustomDataIdentifier :: Text -> Text -> TestCustomDataIdentifier
newTestCustomDataIdentifier Text
pRegex_ Text
pSampleText_ =
  TestCustomDataIdentifier' :: Maybe [Text]
-> Maybe [Text]
-> Maybe Int
-> Text
-> Text
-> TestCustomDataIdentifier
TestCustomDataIdentifier'
    { $sel:keywords:TestCustomDataIdentifier' :: Maybe [Text]
keywords =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:ignoreWords:TestCustomDataIdentifier' :: Maybe [Text]
ignoreWords = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:maximumMatchDistance:TestCustomDataIdentifier' :: Maybe Int
maximumMatchDistance = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:regex:TestCustomDataIdentifier' :: Text
regex = Text
pRegex_,
      $sel:sampleText:TestCustomDataIdentifier' :: Text
sampleText = Text
pSampleText_
    }

-- | An array that lists specific character sequences (keywords), one of
-- which must be within proximity (maximumMatchDistance) of the regular
-- expression to match. The array can contain as many as 50 keywords. Each
-- keyword can contain 3-90 UTF-8 characters. Keywords aren\'t case
-- sensitive.
testCustomDataIdentifier_keywords :: Lens.Lens' TestCustomDataIdentifier (Prelude.Maybe [Prelude.Text])
testCustomDataIdentifier_keywords :: (Maybe [Text] -> f (Maybe [Text]))
-> TestCustomDataIdentifier -> f TestCustomDataIdentifier
testCustomDataIdentifier_keywords = (TestCustomDataIdentifier -> Maybe [Text])
-> (TestCustomDataIdentifier
    -> Maybe [Text] -> TestCustomDataIdentifier)
-> Lens
     TestCustomDataIdentifier
     TestCustomDataIdentifier
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestCustomDataIdentifier' {Maybe [Text]
keywords :: Maybe [Text]
$sel:keywords:TestCustomDataIdentifier' :: TestCustomDataIdentifier -> Maybe [Text]
keywords} -> Maybe [Text]
keywords) (\s :: TestCustomDataIdentifier
s@TestCustomDataIdentifier' {} Maybe [Text]
a -> TestCustomDataIdentifier
s {$sel:keywords:TestCustomDataIdentifier' :: Maybe [Text]
keywords = Maybe [Text]
a} :: TestCustomDataIdentifier) ((Maybe [Text] -> f (Maybe [Text]))
 -> TestCustomDataIdentifier -> f TestCustomDataIdentifier)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> TestCustomDataIdentifier
-> f TestCustomDataIdentifier
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An array that lists specific character sequences (ignore words) to
-- exclude from the results. If the text matched by the regular expression
-- is the same as any string in this array, Amazon Macie ignores it. The
-- array can contain as many as 10 ignore words. Each ignore word can
-- contain 4-90 UTF-8 characters. Ignore words are case sensitive.
testCustomDataIdentifier_ignoreWords :: Lens.Lens' TestCustomDataIdentifier (Prelude.Maybe [Prelude.Text])
testCustomDataIdentifier_ignoreWords :: (Maybe [Text] -> f (Maybe [Text]))
-> TestCustomDataIdentifier -> f TestCustomDataIdentifier
testCustomDataIdentifier_ignoreWords = (TestCustomDataIdentifier -> Maybe [Text])
-> (TestCustomDataIdentifier
    -> Maybe [Text] -> TestCustomDataIdentifier)
-> Lens
     TestCustomDataIdentifier
     TestCustomDataIdentifier
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestCustomDataIdentifier' {Maybe [Text]
ignoreWords :: Maybe [Text]
$sel:ignoreWords:TestCustomDataIdentifier' :: TestCustomDataIdentifier -> Maybe [Text]
ignoreWords} -> Maybe [Text]
ignoreWords) (\s :: TestCustomDataIdentifier
s@TestCustomDataIdentifier' {} Maybe [Text]
a -> TestCustomDataIdentifier
s {$sel:ignoreWords:TestCustomDataIdentifier' :: Maybe [Text]
ignoreWords = Maybe [Text]
a} :: TestCustomDataIdentifier) ((Maybe [Text] -> f (Maybe [Text]))
 -> TestCustomDataIdentifier -> f TestCustomDataIdentifier)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> TestCustomDataIdentifier
-> f TestCustomDataIdentifier
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The maximum number of characters that can exist between text that
-- matches the regex pattern and the character sequences specified by the
-- keywords array. Amazon Macie includes or excludes a result based on the
-- proximity of a keyword to text that matches the regex pattern. The
-- distance can be 1-300 characters. The default value is 50.
testCustomDataIdentifier_maximumMatchDistance :: Lens.Lens' TestCustomDataIdentifier (Prelude.Maybe Prelude.Int)
testCustomDataIdentifier_maximumMatchDistance :: (Maybe Int -> f (Maybe Int))
-> TestCustomDataIdentifier -> f TestCustomDataIdentifier
testCustomDataIdentifier_maximumMatchDistance = (TestCustomDataIdentifier -> Maybe Int)
-> (TestCustomDataIdentifier
    -> Maybe Int -> TestCustomDataIdentifier)
-> Lens
     TestCustomDataIdentifier
     TestCustomDataIdentifier
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestCustomDataIdentifier' {Maybe Int
maximumMatchDistance :: Maybe Int
$sel:maximumMatchDistance:TestCustomDataIdentifier' :: TestCustomDataIdentifier -> Maybe Int
maximumMatchDistance} -> Maybe Int
maximumMatchDistance) (\s :: TestCustomDataIdentifier
s@TestCustomDataIdentifier' {} Maybe Int
a -> TestCustomDataIdentifier
s {$sel:maximumMatchDistance:TestCustomDataIdentifier' :: Maybe Int
maximumMatchDistance = Maybe Int
a} :: TestCustomDataIdentifier)

-- | The regular expression (/regex/) that defines the pattern to match. The
-- expression can contain as many as 512 characters.
testCustomDataIdentifier_regex :: Lens.Lens' TestCustomDataIdentifier Prelude.Text
testCustomDataIdentifier_regex :: (Text -> f Text)
-> TestCustomDataIdentifier -> f TestCustomDataIdentifier
testCustomDataIdentifier_regex = (TestCustomDataIdentifier -> Text)
-> (TestCustomDataIdentifier -> Text -> TestCustomDataIdentifier)
-> Lens TestCustomDataIdentifier TestCustomDataIdentifier Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestCustomDataIdentifier' {Text
regex :: Text
$sel:regex:TestCustomDataIdentifier' :: TestCustomDataIdentifier -> Text
regex} -> Text
regex) (\s :: TestCustomDataIdentifier
s@TestCustomDataIdentifier' {} Text
a -> TestCustomDataIdentifier
s {$sel:regex:TestCustomDataIdentifier' :: Text
regex = Text
a} :: TestCustomDataIdentifier)

-- | The sample text to inspect by using the custom data identifier. The text
-- can contain as many as 1,000 characters.
testCustomDataIdentifier_sampleText :: Lens.Lens' TestCustomDataIdentifier Prelude.Text
testCustomDataIdentifier_sampleText :: (Text -> f Text)
-> TestCustomDataIdentifier -> f TestCustomDataIdentifier
testCustomDataIdentifier_sampleText = (TestCustomDataIdentifier -> Text)
-> (TestCustomDataIdentifier -> Text -> TestCustomDataIdentifier)
-> Lens TestCustomDataIdentifier TestCustomDataIdentifier Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestCustomDataIdentifier' {Text
sampleText :: Text
$sel:sampleText:TestCustomDataIdentifier' :: TestCustomDataIdentifier -> Text
sampleText} -> Text
sampleText) (\s :: TestCustomDataIdentifier
s@TestCustomDataIdentifier' {} Text
a -> TestCustomDataIdentifier
s {$sel:sampleText:TestCustomDataIdentifier' :: Text
sampleText = Text
a} :: TestCustomDataIdentifier)

instance Core.AWSRequest TestCustomDataIdentifier where
  type
    AWSResponse TestCustomDataIdentifier =
      TestCustomDataIdentifierResponse
  request :: TestCustomDataIdentifier -> Request TestCustomDataIdentifier
request = Service
-> TestCustomDataIdentifier -> Request TestCustomDataIdentifier
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy TestCustomDataIdentifier
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse TestCustomDataIdentifier)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse TestCustomDataIdentifier))
-> Logger
-> Service
-> Proxy TestCustomDataIdentifier
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse TestCustomDataIdentifier)))
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 Int -> Int -> TestCustomDataIdentifierResponse
TestCustomDataIdentifierResponse'
            (Maybe Int -> Int -> TestCustomDataIdentifierResponse)
-> Either String (Maybe Int)
-> Either String (Int -> TestCustomDataIdentifierResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Int)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"matchCount")
            Either String (Int -> TestCustomDataIdentifierResponse)
-> Either String Int
-> Either String TestCustomDataIdentifierResponse
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 TestCustomDataIdentifier

instance Prelude.NFData TestCustomDataIdentifier

instance Core.ToHeaders TestCustomDataIdentifier where
  toHeaders :: TestCustomDataIdentifier -> ResponseHeaders
toHeaders =
    ResponseHeaders -> TestCustomDataIdentifier -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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 TestCustomDataIdentifier where
  toJSON :: TestCustomDataIdentifier -> Value
toJSON TestCustomDataIdentifier' {Maybe Int
Maybe [Text]
Text
sampleText :: Text
regex :: Text
maximumMatchDistance :: Maybe Int
ignoreWords :: Maybe [Text]
keywords :: Maybe [Text]
$sel:sampleText:TestCustomDataIdentifier' :: TestCustomDataIdentifier -> Text
$sel:regex:TestCustomDataIdentifier' :: TestCustomDataIdentifier -> Text
$sel:maximumMatchDistance:TestCustomDataIdentifier' :: TestCustomDataIdentifier -> Maybe Int
$sel:ignoreWords:TestCustomDataIdentifier' :: TestCustomDataIdentifier -> Maybe [Text]
$sel:keywords:TestCustomDataIdentifier' :: TestCustomDataIdentifier -> Maybe [Text]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"keywords" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
keywords,
            (Text
"ignoreWords" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
ignoreWords,
            (Text
"maximumMatchDistance" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maximumMatchDistance,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"regex" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
regex),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"sampleText" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
sampleText)
          ]
      )

instance Core.ToPath TestCustomDataIdentifier where
  toPath :: TestCustomDataIdentifier -> ByteString
toPath =
    ByteString -> TestCustomDataIdentifier -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/custom-data-identifiers/test"

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

-- | /See:/ 'newTestCustomDataIdentifierResponse' smart constructor.
data TestCustomDataIdentifierResponse = TestCustomDataIdentifierResponse'
  { -- | The number of instances of sample text that matched the detection
    -- criteria specified in the custom data identifier.
    TestCustomDataIdentifierResponse -> Maybe Int
matchCount :: Prelude.Maybe Prelude.Int,
    -- | The response's http status code.
    TestCustomDataIdentifierResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (TestCustomDataIdentifierResponse
-> TestCustomDataIdentifierResponse -> Bool
(TestCustomDataIdentifierResponse
 -> TestCustomDataIdentifierResponse -> Bool)
-> (TestCustomDataIdentifierResponse
    -> TestCustomDataIdentifierResponse -> Bool)
-> Eq TestCustomDataIdentifierResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TestCustomDataIdentifierResponse
-> TestCustomDataIdentifierResponse -> Bool
$c/= :: TestCustomDataIdentifierResponse
-> TestCustomDataIdentifierResponse -> Bool
== :: TestCustomDataIdentifierResponse
-> TestCustomDataIdentifierResponse -> Bool
$c== :: TestCustomDataIdentifierResponse
-> TestCustomDataIdentifierResponse -> Bool
Prelude.Eq, ReadPrec [TestCustomDataIdentifierResponse]
ReadPrec TestCustomDataIdentifierResponse
Int -> ReadS TestCustomDataIdentifierResponse
ReadS [TestCustomDataIdentifierResponse]
(Int -> ReadS TestCustomDataIdentifierResponse)
-> ReadS [TestCustomDataIdentifierResponse]
-> ReadPrec TestCustomDataIdentifierResponse
-> ReadPrec [TestCustomDataIdentifierResponse]
-> Read TestCustomDataIdentifierResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TestCustomDataIdentifierResponse]
$creadListPrec :: ReadPrec [TestCustomDataIdentifierResponse]
readPrec :: ReadPrec TestCustomDataIdentifierResponse
$creadPrec :: ReadPrec TestCustomDataIdentifierResponse
readList :: ReadS [TestCustomDataIdentifierResponse]
$creadList :: ReadS [TestCustomDataIdentifierResponse]
readsPrec :: Int -> ReadS TestCustomDataIdentifierResponse
$creadsPrec :: Int -> ReadS TestCustomDataIdentifierResponse
Prelude.Read, Int -> TestCustomDataIdentifierResponse -> ShowS
[TestCustomDataIdentifierResponse] -> ShowS
TestCustomDataIdentifierResponse -> String
(Int -> TestCustomDataIdentifierResponse -> ShowS)
-> (TestCustomDataIdentifierResponse -> String)
-> ([TestCustomDataIdentifierResponse] -> ShowS)
-> Show TestCustomDataIdentifierResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TestCustomDataIdentifierResponse] -> ShowS
$cshowList :: [TestCustomDataIdentifierResponse] -> ShowS
show :: TestCustomDataIdentifierResponse -> String
$cshow :: TestCustomDataIdentifierResponse -> String
showsPrec :: Int -> TestCustomDataIdentifierResponse -> ShowS
$cshowsPrec :: Int -> TestCustomDataIdentifierResponse -> ShowS
Prelude.Show, (forall x.
 TestCustomDataIdentifierResponse
 -> Rep TestCustomDataIdentifierResponse x)
-> (forall x.
    Rep TestCustomDataIdentifierResponse x
    -> TestCustomDataIdentifierResponse)
-> Generic TestCustomDataIdentifierResponse
forall x.
Rep TestCustomDataIdentifierResponse x
-> TestCustomDataIdentifierResponse
forall x.
TestCustomDataIdentifierResponse
-> Rep TestCustomDataIdentifierResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TestCustomDataIdentifierResponse x
-> TestCustomDataIdentifierResponse
$cfrom :: forall x.
TestCustomDataIdentifierResponse
-> Rep TestCustomDataIdentifierResponse x
Prelude.Generic)

-- |
-- Create a value of 'TestCustomDataIdentifierResponse' 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:
--
-- 'matchCount', 'testCustomDataIdentifierResponse_matchCount' - The number of instances of sample text that matched the detection
-- criteria specified in the custom data identifier.
--
-- 'httpStatus', 'testCustomDataIdentifierResponse_httpStatus' - The response's http status code.
newTestCustomDataIdentifierResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  TestCustomDataIdentifierResponse
newTestCustomDataIdentifierResponse :: Int -> TestCustomDataIdentifierResponse
newTestCustomDataIdentifierResponse Int
pHttpStatus_ =
  TestCustomDataIdentifierResponse' :: Maybe Int -> Int -> TestCustomDataIdentifierResponse
TestCustomDataIdentifierResponse'
    { $sel:matchCount:TestCustomDataIdentifierResponse' :: Maybe Int
matchCount =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:TestCustomDataIdentifierResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The number of instances of sample text that matched the detection
-- criteria specified in the custom data identifier.
testCustomDataIdentifierResponse_matchCount :: Lens.Lens' TestCustomDataIdentifierResponse (Prelude.Maybe Prelude.Int)
testCustomDataIdentifierResponse_matchCount :: (Maybe Int -> f (Maybe Int))
-> TestCustomDataIdentifierResponse
-> f TestCustomDataIdentifierResponse
testCustomDataIdentifierResponse_matchCount = (TestCustomDataIdentifierResponse -> Maybe Int)
-> (TestCustomDataIdentifierResponse
    -> Maybe Int -> TestCustomDataIdentifierResponse)
-> Lens
     TestCustomDataIdentifierResponse
     TestCustomDataIdentifierResponse
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestCustomDataIdentifierResponse' {Maybe Int
matchCount :: Maybe Int
$sel:matchCount:TestCustomDataIdentifierResponse' :: TestCustomDataIdentifierResponse -> Maybe Int
matchCount} -> Maybe Int
matchCount) (\s :: TestCustomDataIdentifierResponse
s@TestCustomDataIdentifierResponse' {} Maybe Int
a -> TestCustomDataIdentifierResponse
s {$sel:matchCount:TestCustomDataIdentifierResponse' :: Maybe Int
matchCount = Maybe Int
a} :: TestCustomDataIdentifierResponse)

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

instance
  Prelude.NFData
    TestCustomDataIdentifierResponse