{-# 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.Comprehend.DescribeEntityRecognizer
-- 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)
--
-- Provides details about an entity recognizer including status, S3 buckets
-- containing training data, recognizer metadata, metrics, and so on.
module Amazonka.Comprehend.DescribeEntityRecognizer
  ( -- * Creating a Request
    DescribeEntityRecognizer (..),
    newDescribeEntityRecognizer,

    -- * Request Lenses
    describeEntityRecognizer_entityRecognizerArn,

    -- * Destructuring the Response
    DescribeEntityRecognizerResponse (..),
    newDescribeEntityRecognizerResponse,

    -- * Response Lenses
    describeEntityRecognizerResponse_entityRecognizerProperties,
    describeEntityRecognizerResponse_httpStatus,
  )
where

import Amazonka.Comprehend.Types
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

-- | /See:/ 'newDescribeEntityRecognizer' smart constructor.
data DescribeEntityRecognizer = DescribeEntityRecognizer'
  { -- | The Amazon Resource Name (ARN) that identifies the entity recognizer.
    DescribeEntityRecognizer -> Text
entityRecognizerArn :: Prelude.Text
  }
  deriving (DescribeEntityRecognizer -> DescribeEntityRecognizer -> Bool
(DescribeEntityRecognizer -> DescribeEntityRecognizer -> Bool)
-> (DescribeEntityRecognizer -> DescribeEntityRecognizer -> Bool)
-> Eq DescribeEntityRecognizer
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeEntityRecognizer -> DescribeEntityRecognizer -> Bool
$c/= :: DescribeEntityRecognizer -> DescribeEntityRecognizer -> Bool
== :: DescribeEntityRecognizer -> DescribeEntityRecognizer -> Bool
$c== :: DescribeEntityRecognizer -> DescribeEntityRecognizer -> Bool
Prelude.Eq, ReadPrec [DescribeEntityRecognizer]
ReadPrec DescribeEntityRecognizer
Int -> ReadS DescribeEntityRecognizer
ReadS [DescribeEntityRecognizer]
(Int -> ReadS DescribeEntityRecognizer)
-> ReadS [DescribeEntityRecognizer]
-> ReadPrec DescribeEntityRecognizer
-> ReadPrec [DescribeEntityRecognizer]
-> Read DescribeEntityRecognizer
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeEntityRecognizer]
$creadListPrec :: ReadPrec [DescribeEntityRecognizer]
readPrec :: ReadPrec DescribeEntityRecognizer
$creadPrec :: ReadPrec DescribeEntityRecognizer
readList :: ReadS [DescribeEntityRecognizer]
$creadList :: ReadS [DescribeEntityRecognizer]
readsPrec :: Int -> ReadS DescribeEntityRecognizer
$creadsPrec :: Int -> ReadS DescribeEntityRecognizer
Prelude.Read, Int -> DescribeEntityRecognizer -> ShowS
[DescribeEntityRecognizer] -> ShowS
DescribeEntityRecognizer -> String
(Int -> DescribeEntityRecognizer -> ShowS)
-> (DescribeEntityRecognizer -> String)
-> ([DescribeEntityRecognizer] -> ShowS)
-> Show DescribeEntityRecognizer
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeEntityRecognizer] -> ShowS
$cshowList :: [DescribeEntityRecognizer] -> ShowS
show :: DescribeEntityRecognizer -> String
$cshow :: DescribeEntityRecognizer -> String
showsPrec :: Int -> DescribeEntityRecognizer -> ShowS
$cshowsPrec :: Int -> DescribeEntityRecognizer -> ShowS
Prelude.Show, (forall x.
 DescribeEntityRecognizer -> Rep DescribeEntityRecognizer x)
-> (forall x.
    Rep DescribeEntityRecognizer x -> DescribeEntityRecognizer)
-> Generic DescribeEntityRecognizer
forall x.
Rep DescribeEntityRecognizer x -> DescribeEntityRecognizer
forall x.
DescribeEntityRecognizer -> Rep DescribeEntityRecognizer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeEntityRecognizer x -> DescribeEntityRecognizer
$cfrom :: forall x.
DescribeEntityRecognizer -> Rep DescribeEntityRecognizer x
Prelude.Generic)

-- |
-- Create a value of 'DescribeEntityRecognizer' 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:
--
-- 'entityRecognizerArn', 'describeEntityRecognizer_entityRecognizerArn' - The Amazon Resource Name (ARN) that identifies the entity recognizer.
newDescribeEntityRecognizer ::
  -- | 'entityRecognizerArn'
  Prelude.Text ->
  DescribeEntityRecognizer
newDescribeEntityRecognizer :: Text -> DescribeEntityRecognizer
newDescribeEntityRecognizer Text
pEntityRecognizerArn_ =
  DescribeEntityRecognizer' :: Text -> DescribeEntityRecognizer
DescribeEntityRecognizer'
    { $sel:entityRecognizerArn:DescribeEntityRecognizer' :: Text
entityRecognizerArn =
        Text
pEntityRecognizerArn_
    }

-- | The Amazon Resource Name (ARN) that identifies the entity recognizer.
describeEntityRecognizer_entityRecognizerArn :: Lens.Lens' DescribeEntityRecognizer Prelude.Text
describeEntityRecognizer_entityRecognizerArn :: (Text -> f Text)
-> DescribeEntityRecognizer -> f DescribeEntityRecognizer
describeEntityRecognizer_entityRecognizerArn = (DescribeEntityRecognizer -> Text)
-> (DescribeEntityRecognizer -> Text -> DescribeEntityRecognizer)
-> Lens DescribeEntityRecognizer DescribeEntityRecognizer Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEntityRecognizer' {Text
entityRecognizerArn :: Text
$sel:entityRecognizerArn:DescribeEntityRecognizer' :: DescribeEntityRecognizer -> Text
entityRecognizerArn} -> Text
entityRecognizerArn) (\s :: DescribeEntityRecognizer
s@DescribeEntityRecognizer' {} Text
a -> DescribeEntityRecognizer
s {$sel:entityRecognizerArn:DescribeEntityRecognizer' :: Text
entityRecognizerArn = Text
a} :: DescribeEntityRecognizer)

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

instance Prelude.NFData DescribeEntityRecognizer

instance Core.ToHeaders DescribeEntityRecognizer where
  toHeaders :: DescribeEntityRecognizer -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeEntityRecognizer -> 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
"Comprehend_20171127.DescribeEntityRecognizer" ::
                          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 DescribeEntityRecognizer where
  toJSON :: DescribeEntityRecognizer -> Value
toJSON DescribeEntityRecognizer' {Text
entityRecognizerArn :: Text
$sel:entityRecognizerArn:DescribeEntityRecognizer' :: DescribeEntityRecognizer -> 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
"EntityRecognizerArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
entityRecognizerArn)
          ]
      )

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

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

-- | /See:/ 'newDescribeEntityRecognizerResponse' smart constructor.
data DescribeEntityRecognizerResponse = DescribeEntityRecognizerResponse'
  { -- | Describes information associated with an entity recognizer.
    DescribeEntityRecognizerResponse
-> Maybe EntityRecognizerProperties
entityRecognizerProperties :: Prelude.Maybe EntityRecognizerProperties,
    -- | The response's http status code.
    DescribeEntityRecognizerResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeEntityRecognizerResponse
-> DescribeEntityRecognizerResponse -> Bool
(DescribeEntityRecognizerResponse
 -> DescribeEntityRecognizerResponse -> Bool)
-> (DescribeEntityRecognizerResponse
    -> DescribeEntityRecognizerResponse -> Bool)
-> Eq DescribeEntityRecognizerResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeEntityRecognizerResponse
-> DescribeEntityRecognizerResponse -> Bool
$c/= :: DescribeEntityRecognizerResponse
-> DescribeEntityRecognizerResponse -> Bool
== :: DescribeEntityRecognizerResponse
-> DescribeEntityRecognizerResponse -> Bool
$c== :: DescribeEntityRecognizerResponse
-> DescribeEntityRecognizerResponse -> Bool
Prelude.Eq, Int -> DescribeEntityRecognizerResponse -> ShowS
[DescribeEntityRecognizerResponse] -> ShowS
DescribeEntityRecognizerResponse -> String
(Int -> DescribeEntityRecognizerResponse -> ShowS)
-> (DescribeEntityRecognizerResponse -> String)
-> ([DescribeEntityRecognizerResponse] -> ShowS)
-> Show DescribeEntityRecognizerResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeEntityRecognizerResponse] -> ShowS
$cshowList :: [DescribeEntityRecognizerResponse] -> ShowS
show :: DescribeEntityRecognizerResponse -> String
$cshow :: DescribeEntityRecognizerResponse -> String
showsPrec :: Int -> DescribeEntityRecognizerResponse -> ShowS
$cshowsPrec :: Int -> DescribeEntityRecognizerResponse -> ShowS
Prelude.Show, (forall x.
 DescribeEntityRecognizerResponse
 -> Rep DescribeEntityRecognizerResponse x)
-> (forall x.
    Rep DescribeEntityRecognizerResponse x
    -> DescribeEntityRecognizerResponse)
-> Generic DescribeEntityRecognizerResponse
forall x.
Rep DescribeEntityRecognizerResponse x
-> DescribeEntityRecognizerResponse
forall x.
DescribeEntityRecognizerResponse
-> Rep DescribeEntityRecognizerResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeEntityRecognizerResponse x
-> DescribeEntityRecognizerResponse
$cfrom :: forall x.
DescribeEntityRecognizerResponse
-> Rep DescribeEntityRecognizerResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeEntityRecognizerResponse' 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:
--
-- 'entityRecognizerProperties', 'describeEntityRecognizerResponse_entityRecognizerProperties' - Describes information associated with an entity recognizer.
--
-- 'httpStatus', 'describeEntityRecognizerResponse_httpStatus' - The response's http status code.
newDescribeEntityRecognizerResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeEntityRecognizerResponse
newDescribeEntityRecognizerResponse :: Int -> DescribeEntityRecognizerResponse
newDescribeEntityRecognizerResponse Int
pHttpStatus_ =
  DescribeEntityRecognizerResponse' :: Maybe EntityRecognizerProperties
-> Int -> DescribeEntityRecognizerResponse
DescribeEntityRecognizerResponse'
    { $sel:entityRecognizerProperties:DescribeEntityRecognizerResponse' :: Maybe EntityRecognizerProperties
entityRecognizerProperties =
        Maybe EntityRecognizerProperties
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeEntityRecognizerResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Describes information associated with an entity recognizer.
describeEntityRecognizerResponse_entityRecognizerProperties :: Lens.Lens' DescribeEntityRecognizerResponse (Prelude.Maybe EntityRecognizerProperties)
describeEntityRecognizerResponse_entityRecognizerProperties :: (Maybe EntityRecognizerProperties
 -> f (Maybe EntityRecognizerProperties))
-> DescribeEntityRecognizerResponse
-> f DescribeEntityRecognizerResponse
describeEntityRecognizerResponse_entityRecognizerProperties = (DescribeEntityRecognizerResponse
 -> Maybe EntityRecognizerProperties)
-> (DescribeEntityRecognizerResponse
    -> Maybe EntityRecognizerProperties
    -> DescribeEntityRecognizerResponse)
-> Lens
     DescribeEntityRecognizerResponse
     DescribeEntityRecognizerResponse
     (Maybe EntityRecognizerProperties)
     (Maybe EntityRecognizerProperties)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEntityRecognizerResponse' {Maybe EntityRecognizerProperties
entityRecognizerProperties :: Maybe EntityRecognizerProperties
$sel:entityRecognizerProperties:DescribeEntityRecognizerResponse' :: DescribeEntityRecognizerResponse
-> Maybe EntityRecognizerProperties
entityRecognizerProperties} -> Maybe EntityRecognizerProperties
entityRecognizerProperties) (\s :: DescribeEntityRecognizerResponse
s@DescribeEntityRecognizerResponse' {} Maybe EntityRecognizerProperties
a -> DescribeEntityRecognizerResponse
s {$sel:entityRecognizerProperties:DescribeEntityRecognizerResponse' :: Maybe EntityRecognizerProperties
entityRecognizerProperties = Maybe EntityRecognizerProperties
a} :: DescribeEntityRecognizerResponse)

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

instance
  Prelude.NFData
    DescribeEntityRecognizerResponse