{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

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

-- |
-- Module      : Amazonka.Comprehend.Types.EntityRecognizerAnnotations
-- 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)
module Amazonka.Comprehend.Types.EntityRecognizerAnnotations where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes the annotations associated with a entity recognizer.
--
-- /See:/ 'newEntityRecognizerAnnotations' smart constructor.
data EntityRecognizerAnnotations = EntityRecognizerAnnotations'
  { -- | This specifies the Amazon S3 location where the test annotations for an
    -- entity recognizer are located. The URI must be in the same AWS Region as
    -- the API endpoint that you are calling.
    EntityRecognizerAnnotations -> Maybe Text
testS3Uri :: Prelude.Maybe Prelude.Text,
    -- | Specifies the Amazon S3 location where the annotations for an entity
    -- recognizer are located. The URI must be in the same region as the API
    -- endpoint that you are calling.
    EntityRecognizerAnnotations -> Text
s3Uri :: Prelude.Text
  }
  deriving (EntityRecognizerAnnotations -> EntityRecognizerAnnotations -> Bool
(EntityRecognizerAnnotations
 -> EntityRecognizerAnnotations -> Bool)
-> (EntityRecognizerAnnotations
    -> EntityRecognizerAnnotations -> Bool)
-> Eq EntityRecognizerAnnotations
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EntityRecognizerAnnotations -> EntityRecognizerAnnotations -> Bool
$c/= :: EntityRecognizerAnnotations -> EntityRecognizerAnnotations -> Bool
== :: EntityRecognizerAnnotations -> EntityRecognizerAnnotations -> Bool
$c== :: EntityRecognizerAnnotations -> EntityRecognizerAnnotations -> Bool
Prelude.Eq, ReadPrec [EntityRecognizerAnnotations]
ReadPrec EntityRecognizerAnnotations
Int -> ReadS EntityRecognizerAnnotations
ReadS [EntityRecognizerAnnotations]
(Int -> ReadS EntityRecognizerAnnotations)
-> ReadS [EntityRecognizerAnnotations]
-> ReadPrec EntityRecognizerAnnotations
-> ReadPrec [EntityRecognizerAnnotations]
-> Read EntityRecognizerAnnotations
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EntityRecognizerAnnotations]
$creadListPrec :: ReadPrec [EntityRecognizerAnnotations]
readPrec :: ReadPrec EntityRecognizerAnnotations
$creadPrec :: ReadPrec EntityRecognizerAnnotations
readList :: ReadS [EntityRecognizerAnnotations]
$creadList :: ReadS [EntityRecognizerAnnotations]
readsPrec :: Int -> ReadS EntityRecognizerAnnotations
$creadsPrec :: Int -> ReadS EntityRecognizerAnnotations
Prelude.Read, Int -> EntityRecognizerAnnotations -> ShowS
[EntityRecognizerAnnotations] -> ShowS
EntityRecognizerAnnotations -> String
(Int -> EntityRecognizerAnnotations -> ShowS)
-> (EntityRecognizerAnnotations -> String)
-> ([EntityRecognizerAnnotations] -> ShowS)
-> Show EntityRecognizerAnnotations
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EntityRecognizerAnnotations] -> ShowS
$cshowList :: [EntityRecognizerAnnotations] -> ShowS
show :: EntityRecognizerAnnotations -> String
$cshow :: EntityRecognizerAnnotations -> String
showsPrec :: Int -> EntityRecognizerAnnotations -> ShowS
$cshowsPrec :: Int -> EntityRecognizerAnnotations -> ShowS
Prelude.Show, (forall x.
 EntityRecognizerAnnotations -> Rep EntityRecognizerAnnotations x)
-> (forall x.
    Rep EntityRecognizerAnnotations x -> EntityRecognizerAnnotations)
-> Generic EntityRecognizerAnnotations
forall x.
Rep EntityRecognizerAnnotations x -> EntityRecognizerAnnotations
forall x.
EntityRecognizerAnnotations -> Rep EntityRecognizerAnnotations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep EntityRecognizerAnnotations x -> EntityRecognizerAnnotations
$cfrom :: forall x.
EntityRecognizerAnnotations -> Rep EntityRecognizerAnnotations x
Prelude.Generic)

-- |
-- Create a value of 'EntityRecognizerAnnotations' 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:
--
-- 'testS3Uri', 'entityRecognizerAnnotations_testS3Uri' - This specifies the Amazon S3 location where the test annotations for an
-- entity recognizer are located. The URI must be in the same AWS Region as
-- the API endpoint that you are calling.
--
-- 's3Uri', 'entityRecognizerAnnotations_s3Uri' - Specifies the Amazon S3 location where the annotations for an entity
-- recognizer are located. The URI must be in the same region as the API
-- endpoint that you are calling.
newEntityRecognizerAnnotations ::
  -- | 's3Uri'
  Prelude.Text ->
  EntityRecognizerAnnotations
newEntityRecognizerAnnotations :: Text -> EntityRecognizerAnnotations
newEntityRecognizerAnnotations Text
pS3Uri_ =
  EntityRecognizerAnnotations' :: Maybe Text -> Text -> EntityRecognizerAnnotations
EntityRecognizerAnnotations'
    { $sel:testS3Uri:EntityRecognizerAnnotations' :: Maybe Text
testS3Uri =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:s3Uri:EntityRecognizerAnnotations' :: Text
s3Uri = Text
pS3Uri_
    }

-- | This specifies the Amazon S3 location where the test annotations for an
-- entity recognizer are located. The URI must be in the same AWS Region as
-- the API endpoint that you are calling.
entityRecognizerAnnotations_testS3Uri :: Lens.Lens' EntityRecognizerAnnotations (Prelude.Maybe Prelude.Text)
entityRecognizerAnnotations_testS3Uri :: (Maybe Text -> f (Maybe Text))
-> EntityRecognizerAnnotations -> f EntityRecognizerAnnotations
entityRecognizerAnnotations_testS3Uri = (EntityRecognizerAnnotations -> Maybe Text)
-> (EntityRecognizerAnnotations
    -> Maybe Text -> EntityRecognizerAnnotations)
-> Lens
     EntityRecognizerAnnotations
     EntityRecognizerAnnotations
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EntityRecognizerAnnotations' {Maybe Text
testS3Uri :: Maybe Text
$sel:testS3Uri:EntityRecognizerAnnotations' :: EntityRecognizerAnnotations -> Maybe Text
testS3Uri} -> Maybe Text
testS3Uri) (\s :: EntityRecognizerAnnotations
s@EntityRecognizerAnnotations' {} Maybe Text
a -> EntityRecognizerAnnotations
s {$sel:testS3Uri:EntityRecognizerAnnotations' :: Maybe Text
testS3Uri = Maybe Text
a} :: EntityRecognizerAnnotations)

-- | Specifies the Amazon S3 location where the annotations for an entity
-- recognizer are located. The URI must be in the same region as the API
-- endpoint that you are calling.
entityRecognizerAnnotations_s3Uri :: Lens.Lens' EntityRecognizerAnnotations Prelude.Text
entityRecognizerAnnotations_s3Uri :: (Text -> f Text)
-> EntityRecognizerAnnotations -> f EntityRecognizerAnnotations
entityRecognizerAnnotations_s3Uri = (EntityRecognizerAnnotations -> Text)
-> (EntityRecognizerAnnotations
    -> Text -> EntityRecognizerAnnotations)
-> Lens
     EntityRecognizerAnnotations EntityRecognizerAnnotations Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EntityRecognizerAnnotations' {Text
s3Uri :: Text
$sel:s3Uri:EntityRecognizerAnnotations' :: EntityRecognizerAnnotations -> Text
s3Uri} -> Text
s3Uri) (\s :: EntityRecognizerAnnotations
s@EntityRecognizerAnnotations' {} Text
a -> EntityRecognizerAnnotations
s {$sel:s3Uri:EntityRecognizerAnnotations' :: Text
s3Uri = Text
a} :: EntityRecognizerAnnotations)

instance Core.FromJSON EntityRecognizerAnnotations where
  parseJSON :: Value -> Parser EntityRecognizerAnnotations
parseJSON =
    String
-> (Object -> Parser EntityRecognizerAnnotations)
-> Value
-> Parser EntityRecognizerAnnotations
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EntityRecognizerAnnotations"
      ( \Object
x ->
          Maybe Text -> Text -> EntityRecognizerAnnotations
EntityRecognizerAnnotations'
            (Maybe Text -> Text -> EntityRecognizerAnnotations)
-> Parser (Maybe Text)
-> Parser (Text -> EntityRecognizerAnnotations)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TestS3Uri")
            Parser (Text -> EntityRecognizerAnnotations)
-> Parser Text -> Parser EntityRecognizerAnnotations
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"S3Uri")
      )

instance Prelude.Hashable EntityRecognizerAnnotations

instance Prelude.NFData EntityRecognizerAnnotations

instance Core.ToJSON EntityRecognizerAnnotations where
  toJSON :: EntityRecognizerAnnotations -> Value
toJSON EntityRecognizerAnnotations' {Maybe Text
Text
s3Uri :: Text
testS3Uri :: Maybe Text
$sel:s3Uri:EntityRecognizerAnnotations' :: EntityRecognizerAnnotations -> Text
$sel:testS3Uri:EntityRecognizerAnnotations' :: EntityRecognizerAnnotations -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"TestS3Uri" 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
testS3Uri,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"S3Uri" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
s3Uri)
          ]
      )