{-# 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.Transcribe.GetCallAnalyticsJob
-- 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)
--
-- Returns information about a call analytics job. To see the status of the
-- job, check the @CallAnalyticsJobStatus@ field. If the status is
-- @COMPLETED@, the job is finished and you can find the results at the
-- location specified in the @TranscriptFileUri@ field. If you enable
-- personally identifiable information (PII) redaction, the redacted
-- transcript appears in the @RedactedTranscriptFileUri@ field.
module Amazonka.Transcribe.GetCallAnalyticsJob
  ( -- * Creating a Request
    GetCallAnalyticsJob (..),
    newGetCallAnalyticsJob,

    -- * Request Lenses
    getCallAnalyticsJob_callAnalyticsJobName,

    -- * Destructuring the Response
    GetCallAnalyticsJobResponse (..),
    newGetCallAnalyticsJobResponse,

    -- * Response Lenses
    getCallAnalyticsJobResponse_callAnalyticsJob,
    getCallAnalyticsJobResponse_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.Transcribe.Types

-- | /See:/ 'newGetCallAnalyticsJob' smart constructor.
data GetCallAnalyticsJob = GetCallAnalyticsJob'
  { -- | The name of the analytics job you want information about. This value is
    -- case sensitive.
    GetCallAnalyticsJob -> Text
callAnalyticsJobName :: Prelude.Text
  }
  deriving (GetCallAnalyticsJob -> GetCallAnalyticsJob -> Bool
(GetCallAnalyticsJob -> GetCallAnalyticsJob -> Bool)
-> (GetCallAnalyticsJob -> GetCallAnalyticsJob -> Bool)
-> Eq GetCallAnalyticsJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCallAnalyticsJob -> GetCallAnalyticsJob -> Bool
$c/= :: GetCallAnalyticsJob -> GetCallAnalyticsJob -> Bool
== :: GetCallAnalyticsJob -> GetCallAnalyticsJob -> Bool
$c== :: GetCallAnalyticsJob -> GetCallAnalyticsJob -> Bool
Prelude.Eq, ReadPrec [GetCallAnalyticsJob]
ReadPrec GetCallAnalyticsJob
Int -> ReadS GetCallAnalyticsJob
ReadS [GetCallAnalyticsJob]
(Int -> ReadS GetCallAnalyticsJob)
-> ReadS [GetCallAnalyticsJob]
-> ReadPrec GetCallAnalyticsJob
-> ReadPrec [GetCallAnalyticsJob]
-> Read GetCallAnalyticsJob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCallAnalyticsJob]
$creadListPrec :: ReadPrec [GetCallAnalyticsJob]
readPrec :: ReadPrec GetCallAnalyticsJob
$creadPrec :: ReadPrec GetCallAnalyticsJob
readList :: ReadS [GetCallAnalyticsJob]
$creadList :: ReadS [GetCallAnalyticsJob]
readsPrec :: Int -> ReadS GetCallAnalyticsJob
$creadsPrec :: Int -> ReadS GetCallAnalyticsJob
Prelude.Read, Int -> GetCallAnalyticsJob -> ShowS
[GetCallAnalyticsJob] -> ShowS
GetCallAnalyticsJob -> String
(Int -> GetCallAnalyticsJob -> ShowS)
-> (GetCallAnalyticsJob -> String)
-> ([GetCallAnalyticsJob] -> ShowS)
-> Show GetCallAnalyticsJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCallAnalyticsJob] -> ShowS
$cshowList :: [GetCallAnalyticsJob] -> ShowS
show :: GetCallAnalyticsJob -> String
$cshow :: GetCallAnalyticsJob -> String
showsPrec :: Int -> GetCallAnalyticsJob -> ShowS
$cshowsPrec :: Int -> GetCallAnalyticsJob -> ShowS
Prelude.Show, (forall x. GetCallAnalyticsJob -> Rep GetCallAnalyticsJob x)
-> (forall x. Rep GetCallAnalyticsJob x -> GetCallAnalyticsJob)
-> Generic GetCallAnalyticsJob
forall x. Rep GetCallAnalyticsJob x -> GetCallAnalyticsJob
forall x. GetCallAnalyticsJob -> Rep GetCallAnalyticsJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetCallAnalyticsJob x -> GetCallAnalyticsJob
$cfrom :: forall x. GetCallAnalyticsJob -> Rep GetCallAnalyticsJob x
Prelude.Generic)

-- |
-- Create a value of 'GetCallAnalyticsJob' 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:
--
-- 'callAnalyticsJobName', 'getCallAnalyticsJob_callAnalyticsJobName' - The name of the analytics job you want information about. This value is
-- case sensitive.
newGetCallAnalyticsJob ::
  -- | 'callAnalyticsJobName'
  Prelude.Text ->
  GetCallAnalyticsJob
newGetCallAnalyticsJob :: Text -> GetCallAnalyticsJob
newGetCallAnalyticsJob Text
pCallAnalyticsJobName_ =
  GetCallAnalyticsJob' :: Text -> GetCallAnalyticsJob
GetCallAnalyticsJob'
    { $sel:callAnalyticsJobName:GetCallAnalyticsJob' :: Text
callAnalyticsJobName =
        Text
pCallAnalyticsJobName_
    }

-- | The name of the analytics job you want information about. This value is
-- case sensitive.
getCallAnalyticsJob_callAnalyticsJobName :: Lens.Lens' GetCallAnalyticsJob Prelude.Text
getCallAnalyticsJob_callAnalyticsJobName :: (Text -> f Text) -> GetCallAnalyticsJob -> f GetCallAnalyticsJob
getCallAnalyticsJob_callAnalyticsJobName = (GetCallAnalyticsJob -> Text)
-> (GetCallAnalyticsJob -> Text -> GetCallAnalyticsJob)
-> Lens GetCallAnalyticsJob GetCallAnalyticsJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCallAnalyticsJob' {Text
callAnalyticsJobName :: Text
$sel:callAnalyticsJobName:GetCallAnalyticsJob' :: GetCallAnalyticsJob -> Text
callAnalyticsJobName} -> Text
callAnalyticsJobName) (\s :: GetCallAnalyticsJob
s@GetCallAnalyticsJob' {} Text
a -> GetCallAnalyticsJob
s {$sel:callAnalyticsJobName:GetCallAnalyticsJob' :: Text
callAnalyticsJobName = Text
a} :: GetCallAnalyticsJob)

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

instance Prelude.NFData GetCallAnalyticsJob

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

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

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

-- | /See:/ 'newGetCallAnalyticsJobResponse' smart constructor.
data GetCallAnalyticsJobResponse = GetCallAnalyticsJobResponse'
  { -- | An object that contains the results of your call analytics job.
    GetCallAnalyticsJobResponse -> Maybe CallAnalyticsJob
callAnalyticsJob :: Prelude.Maybe CallAnalyticsJob,
    -- | The response's http status code.
    GetCallAnalyticsJobResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetCallAnalyticsJobResponse -> GetCallAnalyticsJobResponse -> Bool
(GetCallAnalyticsJobResponse
 -> GetCallAnalyticsJobResponse -> Bool)
-> (GetCallAnalyticsJobResponse
    -> GetCallAnalyticsJobResponse -> Bool)
-> Eq GetCallAnalyticsJobResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCallAnalyticsJobResponse -> GetCallAnalyticsJobResponse -> Bool
$c/= :: GetCallAnalyticsJobResponse -> GetCallAnalyticsJobResponse -> Bool
== :: GetCallAnalyticsJobResponse -> GetCallAnalyticsJobResponse -> Bool
$c== :: GetCallAnalyticsJobResponse -> GetCallAnalyticsJobResponse -> Bool
Prelude.Eq, ReadPrec [GetCallAnalyticsJobResponse]
ReadPrec GetCallAnalyticsJobResponse
Int -> ReadS GetCallAnalyticsJobResponse
ReadS [GetCallAnalyticsJobResponse]
(Int -> ReadS GetCallAnalyticsJobResponse)
-> ReadS [GetCallAnalyticsJobResponse]
-> ReadPrec GetCallAnalyticsJobResponse
-> ReadPrec [GetCallAnalyticsJobResponse]
-> Read GetCallAnalyticsJobResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCallAnalyticsJobResponse]
$creadListPrec :: ReadPrec [GetCallAnalyticsJobResponse]
readPrec :: ReadPrec GetCallAnalyticsJobResponse
$creadPrec :: ReadPrec GetCallAnalyticsJobResponse
readList :: ReadS [GetCallAnalyticsJobResponse]
$creadList :: ReadS [GetCallAnalyticsJobResponse]
readsPrec :: Int -> ReadS GetCallAnalyticsJobResponse
$creadsPrec :: Int -> ReadS GetCallAnalyticsJobResponse
Prelude.Read, Int -> GetCallAnalyticsJobResponse -> ShowS
[GetCallAnalyticsJobResponse] -> ShowS
GetCallAnalyticsJobResponse -> String
(Int -> GetCallAnalyticsJobResponse -> ShowS)
-> (GetCallAnalyticsJobResponse -> String)
-> ([GetCallAnalyticsJobResponse] -> ShowS)
-> Show GetCallAnalyticsJobResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCallAnalyticsJobResponse] -> ShowS
$cshowList :: [GetCallAnalyticsJobResponse] -> ShowS
show :: GetCallAnalyticsJobResponse -> String
$cshow :: GetCallAnalyticsJobResponse -> String
showsPrec :: Int -> GetCallAnalyticsJobResponse -> ShowS
$cshowsPrec :: Int -> GetCallAnalyticsJobResponse -> ShowS
Prelude.Show, (forall x.
 GetCallAnalyticsJobResponse -> Rep GetCallAnalyticsJobResponse x)
-> (forall x.
    Rep GetCallAnalyticsJobResponse x -> GetCallAnalyticsJobResponse)
-> Generic GetCallAnalyticsJobResponse
forall x.
Rep GetCallAnalyticsJobResponse x -> GetCallAnalyticsJobResponse
forall x.
GetCallAnalyticsJobResponse -> Rep GetCallAnalyticsJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetCallAnalyticsJobResponse x -> GetCallAnalyticsJobResponse
$cfrom :: forall x.
GetCallAnalyticsJobResponse -> Rep GetCallAnalyticsJobResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetCallAnalyticsJobResponse' 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:
--
-- 'callAnalyticsJob', 'getCallAnalyticsJobResponse_callAnalyticsJob' - An object that contains the results of your call analytics job.
--
-- 'httpStatus', 'getCallAnalyticsJobResponse_httpStatus' - The response's http status code.
newGetCallAnalyticsJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetCallAnalyticsJobResponse
newGetCallAnalyticsJobResponse :: Int -> GetCallAnalyticsJobResponse
newGetCallAnalyticsJobResponse Int
pHttpStatus_ =
  GetCallAnalyticsJobResponse' :: Maybe CallAnalyticsJob -> Int -> GetCallAnalyticsJobResponse
GetCallAnalyticsJobResponse'
    { $sel:callAnalyticsJob:GetCallAnalyticsJobResponse' :: Maybe CallAnalyticsJob
callAnalyticsJob =
        Maybe CallAnalyticsJob
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetCallAnalyticsJobResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An object that contains the results of your call analytics job.
getCallAnalyticsJobResponse_callAnalyticsJob :: Lens.Lens' GetCallAnalyticsJobResponse (Prelude.Maybe CallAnalyticsJob)
getCallAnalyticsJobResponse_callAnalyticsJob :: (Maybe CallAnalyticsJob -> f (Maybe CallAnalyticsJob))
-> GetCallAnalyticsJobResponse -> f GetCallAnalyticsJobResponse
getCallAnalyticsJobResponse_callAnalyticsJob = (GetCallAnalyticsJobResponse -> Maybe CallAnalyticsJob)
-> (GetCallAnalyticsJobResponse
    -> Maybe CallAnalyticsJob -> GetCallAnalyticsJobResponse)
-> Lens
     GetCallAnalyticsJobResponse
     GetCallAnalyticsJobResponse
     (Maybe CallAnalyticsJob)
     (Maybe CallAnalyticsJob)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCallAnalyticsJobResponse' {Maybe CallAnalyticsJob
callAnalyticsJob :: Maybe CallAnalyticsJob
$sel:callAnalyticsJob:GetCallAnalyticsJobResponse' :: GetCallAnalyticsJobResponse -> Maybe CallAnalyticsJob
callAnalyticsJob} -> Maybe CallAnalyticsJob
callAnalyticsJob) (\s :: GetCallAnalyticsJobResponse
s@GetCallAnalyticsJobResponse' {} Maybe CallAnalyticsJob
a -> GetCallAnalyticsJobResponse
s {$sel:callAnalyticsJob:GetCallAnalyticsJobResponse' :: Maybe CallAnalyticsJob
callAnalyticsJob = Maybe CallAnalyticsJob
a} :: GetCallAnalyticsJobResponse)

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

instance Prelude.NFData GetCallAnalyticsJobResponse