{-# 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.StartCallAnalyticsJob
-- 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)
--
-- Starts an asynchronous analytics job that not only transcribes the audio
-- recording of a caller and agent, but also returns additional insights.
-- These insights include how quickly or loudly the caller or agent was
-- speaking. To retrieve additional insights with your analytics jobs,
-- create categories. A category is a way to classify analytics jobs based
-- on attributes, such as a customer\'s sentiment or a particular phrase
-- being used during the call. For more information, see the operation.
module Amazonka.Transcribe.StartCallAnalyticsJob
  ( -- * Creating a Request
    StartCallAnalyticsJob (..),
    newStartCallAnalyticsJob,

    -- * Request Lenses
    startCallAnalyticsJob_settings,
    startCallAnalyticsJob_outputEncryptionKMSKeyId,
    startCallAnalyticsJob_outputLocation,
    startCallAnalyticsJob_channelDefinitions,
    startCallAnalyticsJob_callAnalyticsJobName,
    startCallAnalyticsJob_media,
    startCallAnalyticsJob_dataAccessRoleArn,

    -- * Destructuring the Response
    StartCallAnalyticsJobResponse (..),
    newStartCallAnalyticsJobResponse,

    -- * Response Lenses
    startCallAnalyticsJobResponse_callAnalyticsJob,
    startCallAnalyticsJobResponse_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:/ 'newStartCallAnalyticsJob' smart constructor.
data StartCallAnalyticsJob = StartCallAnalyticsJob'
  { -- | A @Settings@ object that provides optional settings for a call analytics
    -- job.
    StartCallAnalyticsJob -> Maybe CallAnalyticsJobSettings
settings :: Prelude.Maybe CallAnalyticsJobSettings,
    -- | The Amazon Resource Name (ARN) of the Amazon Web Services Key Management
    -- Service key used to encrypt the output of the call analytics job. The
    -- user calling the operation must have permission to use the specified KMS
    -- key.
    --
    -- You use either of the following to identify an Amazon Web Services KMS
    -- key in the current account:
    --
    -- -   KMS Key ID: \"1234abcd-12ab-34cd-56ef-1234567890ab\"
    --
    -- -   KMS Key Alias: \"alias\/ExampleAlias\"
    --
    -- You can use either of the following to identify a KMS key in the current
    -- account or another account:
    --
    -- -   Amazon Resource Name (ARN) of a KMS key in the current account or
    --     another account: \"arn:aws:kms:region:account
    --     ID:key\/1234abcd-12ab-34cd-56ef1234567890ab\"
    --
    -- -   ARN of a KMS Key Alias: \"arn:aws:kms:region:account
    --     ID:alias\/ExampleAlias\"
    --
    -- If you don\'t specify an encryption key, the output of the call
    -- analytics job is encrypted with the default Amazon S3 key (SSE-S3).
    --
    -- If you specify a KMS key to encrypt your output, you must also specify
    -- an output location in the @OutputLocation@ parameter.
    StartCallAnalyticsJob -> Maybe Text
outputEncryptionKMSKeyId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon S3 location where the output of the call analytics job is
    -- stored. You can provide the following location types to store the output
    -- of call analytics job:
    --
    -- -   s3:\/\/DOC-EXAMPLE-BUCKET1
    --
    --     If you specify a bucket, Amazon Transcribe saves the output of the
    --     analytics job as a JSON file at the root level of the bucket.
    --
    -- -   s3:\/\/DOC-EXAMPLE-BUCKET1\/folder\/
    --
    --     f you specify a path, Amazon Transcribe saves the output of the
    --     analytics job as
    --     s3:\/\/DOC-EXAMPLE-BUCKET1\/folder\/your-transcription-job-name.json
    --
    --     If you specify a folder, you must provide a trailing slash.
    --
    -- -   s3:\/\/DOC-EXAMPLE-BUCKET1\/folder\/filename.json
    --
    --     If you provide a path that has the filename specified, Amazon
    --     Transcribe saves the output of the analytics job as
    --     s3:\/\/DOC-EXAMPLEBUCKET1\/folder\/filename.json
    --
    -- You can specify an Amazon Web Services Key Management Service (KMS) key
    -- to encrypt the output of our analytics job using the
    -- @OutputEncryptionKMSKeyId@ parameter. If you don\'t specify a KMS key,
    -- Amazon Transcribe uses the default Amazon S3 key for server-side
    -- encryption of the analytics job output that is placed in your S3 bucket.
    StartCallAnalyticsJob -> Maybe Text
outputLocation :: Prelude.Maybe Prelude.Text,
    -- | When you start a call analytics job, you must pass an array that maps
    -- the agent and the customer to specific audio channels. The values you
    -- can assign to a channel are 0 and 1. The agent and the customer must
    -- each have their own channel. You can\'t assign more than one channel to
    -- an agent or customer.
    StartCallAnalyticsJob -> Maybe (NonEmpty ChannelDefinition)
channelDefinitions :: Prelude.Maybe (Prelude.NonEmpty ChannelDefinition),
    -- | The name of the call analytics job. You can\'t use the string \".\" or
    -- \"..\" by themselves as the job name. The name must also be unique
    -- within an Amazon Web Services account. If you try to create a call
    -- analytics job with the same name as a previous call analytics job, you
    -- get a @ConflictException@ error.
    StartCallAnalyticsJob -> Text
callAnalyticsJobName :: Prelude.Text,
    StartCallAnalyticsJob -> Media
media :: Media,
    -- | The Amazon Resource Name (ARN) of a role that has access to the S3
    -- bucket that contains your input files. Amazon Transcribe assumes this
    -- role to read queued audio files. If you have specified an output S3
    -- bucket for your transcription results, this role should have access to
    -- the output bucket as well.
    StartCallAnalyticsJob -> Text
dataAccessRoleArn :: Prelude.Text
  }
  deriving (StartCallAnalyticsJob -> StartCallAnalyticsJob -> Bool
(StartCallAnalyticsJob -> StartCallAnalyticsJob -> Bool)
-> (StartCallAnalyticsJob -> StartCallAnalyticsJob -> Bool)
-> Eq StartCallAnalyticsJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartCallAnalyticsJob -> StartCallAnalyticsJob -> Bool
$c/= :: StartCallAnalyticsJob -> StartCallAnalyticsJob -> Bool
== :: StartCallAnalyticsJob -> StartCallAnalyticsJob -> Bool
$c== :: StartCallAnalyticsJob -> StartCallAnalyticsJob -> Bool
Prelude.Eq, ReadPrec [StartCallAnalyticsJob]
ReadPrec StartCallAnalyticsJob
Int -> ReadS StartCallAnalyticsJob
ReadS [StartCallAnalyticsJob]
(Int -> ReadS StartCallAnalyticsJob)
-> ReadS [StartCallAnalyticsJob]
-> ReadPrec StartCallAnalyticsJob
-> ReadPrec [StartCallAnalyticsJob]
-> Read StartCallAnalyticsJob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartCallAnalyticsJob]
$creadListPrec :: ReadPrec [StartCallAnalyticsJob]
readPrec :: ReadPrec StartCallAnalyticsJob
$creadPrec :: ReadPrec StartCallAnalyticsJob
readList :: ReadS [StartCallAnalyticsJob]
$creadList :: ReadS [StartCallAnalyticsJob]
readsPrec :: Int -> ReadS StartCallAnalyticsJob
$creadsPrec :: Int -> ReadS StartCallAnalyticsJob
Prelude.Read, Int -> StartCallAnalyticsJob -> ShowS
[StartCallAnalyticsJob] -> ShowS
StartCallAnalyticsJob -> String
(Int -> StartCallAnalyticsJob -> ShowS)
-> (StartCallAnalyticsJob -> String)
-> ([StartCallAnalyticsJob] -> ShowS)
-> Show StartCallAnalyticsJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartCallAnalyticsJob] -> ShowS
$cshowList :: [StartCallAnalyticsJob] -> ShowS
show :: StartCallAnalyticsJob -> String
$cshow :: StartCallAnalyticsJob -> String
showsPrec :: Int -> StartCallAnalyticsJob -> ShowS
$cshowsPrec :: Int -> StartCallAnalyticsJob -> ShowS
Prelude.Show, (forall x. StartCallAnalyticsJob -> Rep StartCallAnalyticsJob x)
-> (forall x. Rep StartCallAnalyticsJob x -> StartCallAnalyticsJob)
-> Generic StartCallAnalyticsJob
forall x. Rep StartCallAnalyticsJob x -> StartCallAnalyticsJob
forall x. StartCallAnalyticsJob -> Rep StartCallAnalyticsJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartCallAnalyticsJob x -> StartCallAnalyticsJob
$cfrom :: forall x. StartCallAnalyticsJob -> Rep StartCallAnalyticsJob x
Prelude.Generic)

-- |
-- Create a value of 'StartCallAnalyticsJob' 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:
--
-- 'settings', 'startCallAnalyticsJob_settings' - A @Settings@ object that provides optional settings for a call analytics
-- job.
--
-- 'outputEncryptionKMSKeyId', 'startCallAnalyticsJob_outputEncryptionKMSKeyId' - The Amazon Resource Name (ARN) of the Amazon Web Services Key Management
-- Service key used to encrypt the output of the call analytics job. The
-- user calling the operation must have permission to use the specified KMS
-- key.
--
-- You use either of the following to identify an Amazon Web Services KMS
-- key in the current account:
--
-- -   KMS Key ID: \"1234abcd-12ab-34cd-56ef-1234567890ab\"
--
-- -   KMS Key Alias: \"alias\/ExampleAlias\"
--
-- You can use either of the following to identify a KMS key in the current
-- account or another account:
--
-- -   Amazon Resource Name (ARN) of a KMS key in the current account or
--     another account: \"arn:aws:kms:region:account
--     ID:key\/1234abcd-12ab-34cd-56ef1234567890ab\"
--
-- -   ARN of a KMS Key Alias: \"arn:aws:kms:region:account
--     ID:alias\/ExampleAlias\"
--
-- If you don\'t specify an encryption key, the output of the call
-- analytics job is encrypted with the default Amazon S3 key (SSE-S3).
--
-- If you specify a KMS key to encrypt your output, you must also specify
-- an output location in the @OutputLocation@ parameter.
--
-- 'outputLocation', 'startCallAnalyticsJob_outputLocation' - The Amazon S3 location where the output of the call analytics job is
-- stored. You can provide the following location types to store the output
-- of call analytics job:
--
-- -   s3:\/\/DOC-EXAMPLE-BUCKET1
--
--     If you specify a bucket, Amazon Transcribe saves the output of the
--     analytics job as a JSON file at the root level of the bucket.
--
-- -   s3:\/\/DOC-EXAMPLE-BUCKET1\/folder\/
--
--     f you specify a path, Amazon Transcribe saves the output of the
--     analytics job as
--     s3:\/\/DOC-EXAMPLE-BUCKET1\/folder\/your-transcription-job-name.json
--
--     If you specify a folder, you must provide a trailing slash.
--
-- -   s3:\/\/DOC-EXAMPLE-BUCKET1\/folder\/filename.json
--
--     If you provide a path that has the filename specified, Amazon
--     Transcribe saves the output of the analytics job as
--     s3:\/\/DOC-EXAMPLEBUCKET1\/folder\/filename.json
--
-- You can specify an Amazon Web Services Key Management Service (KMS) key
-- to encrypt the output of our analytics job using the
-- @OutputEncryptionKMSKeyId@ parameter. If you don\'t specify a KMS key,
-- Amazon Transcribe uses the default Amazon S3 key for server-side
-- encryption of the analytics job output that is placed in your S3 bucket.
--
-- 'channelDefinitions', 'startCallAnalyticsJob_channelDefinitions' - When you start a call analytics job, you must pass an array that maps
-- the agent and the customer to specific audio channels. The values you
-- can assign to a channel are 0 and 1. The agent and the customer must
-- each have their own channel. You can\'t assign more than one channel to
-- an agent or customer.
--
-- 'callAnalyticsJobName', 'startCallAnalyticsJob_callAnalyticsJobName' - The name of the call analytics job. You can\'t use the string \".\" or
-- \"..\" by themselves as the job name. The name must also be unique
-- within an Amazon Web Services account. If you try to create a call
-- analytics job with the same name as a previous call analytics job, you
-- get a @ConflictException@ error.
--
-- 'media', 'startCallAnalyticsJob_media' - Undocumented member.
--
-- 'dataAccessRoleArn', 'startCallAnalyticsJob_dataAccessRoleArn' - The Amazon Resource Name (ARN) of a role that has access to the S3
-- bucket that contains your input files. Amazon Transcribe assumes this
-- role to read queued audio files. If you have specified an output S3
-- bucket for your transcription results, this role should have access to
-- the output bucket as well.
newStartCallAnalyticsJob ::
  -- | 'callAnalyticsJobName'
  Prelude.Text ->
  -- | 'media'
  Media ->
  -- | 'dataAccessRoleArn'
  Prelude.Text ->
  StartCallAnalyticsJob
newStartCallAnalyticsJob :: Text -> Media -> Text -> StartCallAnalyticsJob
newStartCallAnalyticsJob
  Text
pCallAnalyticsJobName_
  Media
pMedia_
  Text
pDataAccessRoleArn_ =
    StartCallAnalyticsJob' :: Maybe CallAnalyticsJobSettings
-> Maybe Text
-> Maybe Text
-> Maybe (NonEmpty ChannelDefinition)
-> Text
-> Media
-> Text
-> StartCallAnalyticsJob
StartCallAnalyticsJob'
      { $sel:settings:StartCallAnalyticsJob' :: Maybe CallAnalyticsJobSettings
settings = Maybe CallAnalyticsJobSettings
forall a. Maybe a
Prelude.Nothing,
        $sel:outputEncryptionKMSKeyId:StartCallAnalyticsJob' :: Maybe Text
outputEncryptionKMSKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:outputLocation:StartCallAnalyticsJob' :: Maybe Text
outputLocation = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:channelDefinitions:StartCallAnalyticsJob' :: Maybe (NonEmpty ChannelDefinition)
channelDefinitions = Maybe (NonEmpty ChannelDefinition)
forall a. Maybe a
Prelude.Nothing,
        $sel:callAnalyticsJobName:StartCallAnalyticsJob' :: Text
callAnalyticsJobName = Text
pCallAnalyticsJobName_,
        $sel:media:StartCallAnalyticsJob' :: Media
media = Media
pMedia_,
        $sel:dataAccessRoleArn:StartCallAnalyticsJob' :: Text
dataAccessRoleArn = Text
pDataAccessRoleArn_
      }

-- | A @Settings@ object that provides optional settings for a call analytics
-- job.
startCallAnalyticsJob_settings :: Lens.Lens' StartCallAnalyticsJob (Prelude.Maybe CallAnalyticsJobSettings)
startCallAnalyticsJob_settings :: (Maybe CallAnalyticsJobSettings
 -> f (Maybe CallAnalyticsJobSettings))
-> StartCallAnalyticsJob -> f StartCallAnalyticsJob
startCallAnalyticsJob_settings = (StartCallAnalyticsJob -> Maybe CallAnalyticsJobSettings)
-> (StartCallAnalyticsJob
    -> Maybe CallAnalyticsJobSettings -> StartCallAnalyticsJob)
-> Lens
     StartCallAnalyticsJob
     StartCallAnalyticsJob
     (Maybe CallAnalyticsJobSettings)
     (Maybe CallAnalyticsJobSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartCallAnalyticsJob' {Maybe CallAnalyticsJobSettings
settings :: Maybe CallAnalyticsJobSettings
$sel:settings:StartCallAnalyticsJob' :: StartCallAnalyticsJob -> Maybe CallAnalyticsJobSettings
settings} -> Maybe CallAnalyticsJobSettings
settings) (\s :: StartCallAnalyticsJob
s@StartCallAnalyticsJob' {} Maybe CallAnalyticsJobSettings
a -> StartCallAnalyticsJob
s {$sel:settings:StartCallAnalyticsJob' :: Maybe CallAnalyticsJobSettings
settings = Maybe CallAnalyticsJobSettings
a} :: StartCallAnalyticsJob)

-- | The Amazon Resource Name (ARN) of the Amazon Web Services Key Management
-- Service key used to encrypt the output of the call analytics job. The
-- user calling the operation must have permission to use the specified KMS
-- key.
--
-- You use either of the following to identify an Amazon Web Services KMS
-- key in the current account:
--
-- -   KMS Key ID: \"1234abcd-12ab-34cd-56ef-1234567890ab\"
--
-- -   KMS Key Alias: \"alias\/ExampleAlias\"
--
-- You can use either of the following to identify a KMS key in the current
-- account or another account:
--
-- -   Amazon Resource Name (ARN) of a KMS key in the current account or
--     another account: \"arn:aws:kms:region:account
--     ID:key\/1234abcd-12ab-34cd-56ef1234567890ab\"
--
-- -   ARN of a KMS Key Alias: \"arn:aws:kms:region:account
--     ID:alias\/ExampleAlias\"
--
-- If you don\'t specify an encryption key, the output of the call
-- analytics job is encrypted with the default Amazon S3 key (SSE-S3).
--
-- If you specify a KMS key to encrypt your output, you must also specify
-- an output location in the @OutputLocation@ parameter.
startCallAnalyticsJob_outputEncryptionKMSKeyId :: Lens.Lens' StartCallAnalyticsJob (Prelude.Maybe Prelude.Text)
startCallAnalyticsJob_outputEncryptionKMSKeyId :: (Maybe Text -> f (Maybe Text))
-> StartCallAnalyticsJob -> f StartCallAnalyticsJob
startCallAnalyticsJob_outputEncryptionKMSKeyId = (StartCallAnalyticsJob -> Maybe Text)
-> (StartCallAnalyticsJob -> Maybe Text -> StartCallAnalyticsJob)
-> Lens
     StartCallAnalyticsJob
     StartCallAnalyticsJob
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartCallAnalyticsJob' {Maybe Text
outputEncryptionKMSKeyId :: Maybe Text
$sel:outputEncryptionKMSKeyId:StartCallAnalyticsJob' :: StartCallAnalyticsJob -> Maybe Text
outputEncryptionKMSKeyId} -> Maybe Text
outputEncryptionKMSKeyId) (\s :: StartCallAnalyticsJob
s@StartCallAnalyticsJob' {} Maybe Text
a -> StartCallAnalyticsJob
s {$sel:outputEncryptionKMSKeyId:StartCallAnalyticsJob' :: Maybe Text
outputEncryptionKMSKeyId = Maybe Text
a} :: StartCallAnalyticsJob)

-- | The Amazon S3 location where the output of the call analytics job is
-- stored. You can provide the following location types to store the output
-- of call analytics job:
--
-- -   s3:\/\/DOC-EXAMPLE-BUCKET1
--
--     If you specify a bucket, Amazon Transcribe saves the output of the
--     analytics job as a JSON file at the root level of the bucket.
--
-- -   s3:\/\/DOC-EXAMPLE-BUCKET1\/folder\/
--
--     f you specify a path, Amazon Transcribe saves the output of the
--     analytics job as
--     s3:\/\/DOC-EXAMPLE-BUCKET1\/folder\/your-transcription-job-name.json
--
--     If you specify a folder, you must provide a trailing slash.
--
-- -   s3:\/\/DOC-EXAMPLE-BUCKET1\/folder\/filename.json
--
--     If you provide a path that has the filename specified, Amazon
--     Transcribe saves the output of the analytics job as
--     s3:\/\/DOC-EXAMPLEBUCKET1\/folder\/filename.json
--
-- You can specify an Amazon Web Services Key Management Service (KMS) key
-- to encrypt the output of our analytics job using the
-- @OutputEncryptionKMSKeyId@ parameter. If you don\'t specify a KMS key,
-- Amazon Transcribe uses the default Amazon S3 key for server-side
-- encryption of the analytics job output that is placed in your S3 bucket.
startCallAnalyticsJob_outputLocation :: Lens.Lens' StartCallAnalyticsJob (Prelude.Maybe Prelude.Text)
startCallAnalyticsJob_outputLocation :: (Maybe Text -> f (Maybe Text))
-> StartCallAnalyticsJob -> f StartCallAnalyticsJob
startCallAnalyticsJob_outputLocation = (StartCallAnalyticsJob -> Maybe Text)
-> (StartCallAnalyticsJob -> Maybe Text -> StartCallAnalyticsJob)
-> Lens
     StartCallAnalyticsJob
     StartCallAnalyticsJob
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartCallAnalyticsJob' {Maybe Text
outputLocation :: Maybe Text
$sel:outputLocation:StartCallAnalyticsJob' :: StartCallAnalyticsJob -> Maybe Text
outputLocation} -> Maybe Text
outputLocation) (\s :: StartCallAnalyticsJob
s@StartCallAnalyticsJob' {} Maybe Text
a -> StartCallAnalyticsJob
s {$sel:outputLocation:StartCallAnalyticsJob' :: Maybe Text
outputLocation = Maybe Text
a} :: StartCallAnalyticsJob)

-- | When you start a call analytics job, you must pass an array that maps
-- the agent and the customer to specific audio channels. The values you
-- can assign to a channel are 0 and 1. The agent and the customer must
-- each have their own channel. You can\'t assign more than one channel to
-- an agent or customer.
startCallAnalyticsJob_channelDefinitions :: Lens.Lens' StartCallAnalyticsJob (Prelude.Maybe (Prelude.NonEmpty ChannelDefinition))
startCallAnalyticsJob_channelDefinitions :: (Maybe (NonEmpty ChannelDefinition)
 -> f (Maybe (NonEmpty ChannelDefinition)))
-> StartCallAnalyticsJob -> f StartCallAnalyticsJob
startCallAnalyticsJob_channelDefinitions = (StartCallAnalyticsJob -> Maybe (NonEmpty ChannelDefinition))
-> (StartCallAnalyticsJob
    -> Maybe (NonEmpty ChannelDefinition) -> StartCallAnalyticsJob)
-> Lens
     StartCallAnalyticsJob
     StartCallAnalyticsJob
     (Maybe (NonEmpty ChannelDefinition))
     (Maybe (NonEmpty ChannelDefinition))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartCallAnalyticsJob' {Maybe (NonEmpty ChannelDefinition)
channelDefinitions :: Maybe (NonEmpty ChannelDefinition)
$sel:channelDefinitions:StartCallAnalyticsJob' :: StartCallAnalyticsJob -> Maybe (NonEmpty ChannelDefinition)
channelDefinitions} -> Maybe (NonEmpty ChannelDefinition)
channelDefinitions) (\s :: StartCallAnalyticsJob
s@StartCallAnalyticsJob' {} Maybe (NonEmpty ChannelDefinition)
a -> StartCallAnalyticsJob
s {$sel:channelDefinitions:StartCallAnalyticsJob' :: Maybe (NonEmpty ChannelDefinition)
channelDefinitions = Maybe (NonEmpty ChannelDefinition)
a} :: StartCallAnalyticsJob) ((Maybe (NonEmpty ChannelDefinition)
  -> f (Maybe (NonEmpty ChannelDefinition)))
 -> StartCallAnalyticsJob -> f StartCallAnalyticsJob)
-> ((Maybe (NonEmpty ChannelDefinition)
     -> f (Maybe (NonEmpty ChannelDefinition)))
    -> Maybe (NonEmpty ChannelDefinition)
    -> f (Maybe (NonEmpty ChannelDefinition)))
-> (Maybe (NonEmpty ChannelDefinition)
    -> f (Maybe (NonEmpty ChannelDefinition)))
-> StartCallAnalyticsJob
-> f StartCallAnalyticsJob
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty ChannelDefinition)
  (NonEmpty ChannelDefinition)
  (NonEmpty ChannelDefinition)
  (NonEmpty ChannelDefinition)
-> Iso
     (Maybe (NonEmpty ChannelDefinition))
     (Maybe (NonEmpty ChannelDefinition))
     (Maybe (NonEmpty ChannelDefinition))
     (Maybe (NonEmpty ChannelDefinition))
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
  (NonEmpty ChannelDefinition)
  (NonEmpty ChannelDefinition)
  (NonEmpty ChannelDefinition)
  (NonEmpty ChannelDefinition)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the call analytics job. You can\'t use the string \".\" or
-- \"..\" by themselves as the job name. The name must also be unique
-- within an Amazon Web Services account. If you try to create a call
-- analytics job with the same name as a previous call analytics job, you
-- get a @ConflictException@ error.
startCallAnalyticsJob_callAnalyticsJobName :: Lens.Lens' StartCallAnalyticsJob Prelude.Text
startCallAnalyticsJob_callAnalyticsJobName :: (Text -> f Text)
-> StartCallAnalyticsJob -> f StartCallAnalyticsJob
startCallAnalyticsJob_callAnalyticsJobName = (StartCallAnalyticsJob -> Text)
-> (StartCallAnalyticsJob -> Text -> StartCallAnalyticsJob)
-> Lens StartCallAnalyticsJob StartCallAnalyticsJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartCallAnalyticsJob' {Text
callAnalyticsJobName :: Text
$sel:callAnalyticsJobName:StartCallAnalyticsJob' :: StartCallAnalyticsJob -> Text
callAnalyticsJobName} -> Text
callAnalyticsJobName) (\s :: StartCallAnalyticsJob
s@StartCallAnalyticsJob' {} Text
a -> StartCallAnalyticsJob
s {$sel:callAnalyticsJobName:StartCallAnalyticsJob' :: Text
callAnalyticsJobName = Text
a} :: StartCallAnalyticsJob)

-- | Undocumented member.
startCallAnalyticsJob_media :: Lens.Lens' StartCallAnalyticsJob Media
startCallAnalyticsJob_media :: (Media -> f Media)
-> StartCallAnalyticsJob -> f StartCallAnalyticsJob
startCallAnalyticsJob_media = (StartCallAnalyticsJob -> Media)
-> (StartCallAnalyticsJob -> Media -> StartCallAnalyticsJob)
-> Lens StartCallAnalyticsJob StartCallAnalyticsJob Media Media
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartCallAnalyticsJob' {Media
media :: Media
$sel:media:StartCallAnalyticsJob' :: StartCallAnalyticsJob -> Media
media} -> Media
media) (\s :: StartCallAnalyticsJob
s@StartCallAnalyticsJob' {} Media
a -> StartCallAnalyticsJob
s {$sel:media:StartCallAnalyticsJob' :: Media
media = Media
a} :: StartCallAnalyticsJob)

-- | The Amazon Resource Name (ARN) of a role that has access to the S3
-- bucket that contains your input files. Amazon Transcribe assumes this
-- role to read queued audio files. If you have specified an output S3
-- bucket for your transcription results, this role should have access to
-- the output bucket as well.
startCallAnalyticsJob_dataAccessRoleArn :: Lens.Lens' StartCallAnalyticsJob Prelude.Text
startCallAnalyticsJob_dataAccessRoleArn :: (Text -> f Text)
-> StartCallAnalyticsJob -> f StartCallAnalyticsJob
startCallAnalyticsJob_dataAccessRoleArn = (StartCallAnalyticsJob -> Text)
-> (StartCallAnalyticsJob -> Text -> StartCallAnalyticsJob)
-> Lens StartCallAnalyticsJob StartCallAnalyticsJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartCallAnalyticsJob' {Text
dataAccessRoleArn :: Text
$sel:dataAccessRoleArn:StartCallAnalyticsJob' :: StartCallAnalyticsJob -> Text
dataAccessRoleArn} -> Text
dataAccessRoleArn) (\s :: StartCallAnalyticsJob
s@StartCallAnalyticsJob' {} Text
a -> StartCallAnalyticsJob
s {$sel:dataAccessRoleArn:StartCallAnalyticsJob' :: Text
dataAccessRoleArn = Text
a} :: StartCallAnalyticsJob)

instance Core.AWSRequest StartCallAnalyticsJob where
  type
    AWSResponse StartCallAnalyticsJob =
      StartCallAnalyticsJobResponse
  request :: StartCallAnalyticsJob -> Request StartCallAnalyticsJob
request = Service -> StartCallAnalyticsJob -> Request StartCallAnalyticsJob
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy StartCallAnalyticsJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StartCallAnalyticsJob)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse StartCallAnalyticsJob))
-> Logger
-> Service
-> Proxy StartCallAnalyticsJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StartCallAnalyticsJob)))
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 -> StartCallAnalyticsJobResponse
StartCallAnalyticsJobResponse'
            (Maybe CallAnalyticsJob -> Int -> StartCallAnalyticsJobResponse)
-> Either String (Maybe CallAnalyticsJob)
-> Either String (Int -> StartCallAnalyticsJobResponse)
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 -> StartCallAnalyticsJobResponse)
-> Either String Int -> Either String StartCallAnalyticsJobResponse
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 StartCallAnalyticsJob

instance Prelude.NFData StartCallAnalyticsJob

instance Core.ToHeaders StartCallAnalyticsJob where
  toHeaders :: StartCallAnalyticsJob -> ResponseHeaders
toHeaders =
    ResponseHeaders -> StartCallAnalyticsJob -> 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.StartCallAnalyticsJob" ::
                          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 StartCallAnalyticsJob where
  toJSON :: StartCallAnalyticsJob -> Value
toJSON StartCallAnalyticsJob' {Maybe (NonEmpty ChannelDefinition)
Maybe Text
Maybe CallAnalyticsJobSettings
Text
Media
dataAccessRoleArn :: Text
media :: Media
callAnalyticsJobName :: Text
channelDefinitions :: Maybe (NonEmpty ChannelDefinition)
outputLocation :: Maybe Text
outputEncryptionKMSKeyId :: Maybe Text
settings :: Maybe CallAnalyticsJobSettings
$sel:dataAccessRoleArn:StartCallAnalyticsJob' :: StartCallAnalyticsJob -> Text
$sel:media:StartCallAnalyticsJob' :: StartCallAnalyticsJob -> Media
$sel:callAnalyticsJobName:StartCallAnalyticsJob' :: StartCallAnalyticsJob -> Text
$sel:channelDefinitions:StartCallAnalyticsJob' :: StartCallAnalyticsJob -> Maybe (NonEmpty ChannelDefinition)
$sel:outputLocation:StartCallAnalyticsJob' :: StartCallAnalyticsJob -> Maybe Text
$sel:outputEncryptionKMSKeyId:StartCallAnalyticsJob' :: StartCallAnalyticsJob -> Maybe Text
$sel:settings:StartCallAnalyticsJob' :: StartCallAnalyticsJob -> Maybe CallAnalyticsJobSettings
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Settings" Text -> CallAnalyticsJobSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (CallAnalyticsJobSettings -> Pair)
-> Maybe CallAnalyticsJobSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CallAnalyticsJobSettings
settings,
            (Text
"OutputEncryptionKMSKeyId" 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
outputEncryptionKMSKeyId,
            (Text
"OutputLocation" 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
outputLocation,
            (Text
"ChannelDefinitions" Text -> NonEmpty ChannelDefinition -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NonEmpty ChannelDefinition -> Pair)
-> Maybe (NonEmpty ChannelDefinition) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty ChannelDefinition)
channelDefinitions,
            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
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Media" Text -> Media -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Media
media),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"DataAccessRoleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
dataAccessRoleArn)
          ]
      )

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

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

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

-- |
-- Create a value of 'StartCallAnalyticsJobResponse' 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', 'startCallAnalyticsJobResponse_callAnalyticsJob' - An object containing the details of the asynchronous call analytics job.
--
-- 'httpStatus', 'startCallAnalyticsJobResponse_httpStatus' - The response's http status code.
newStartCallAnalyticsJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StartCallAnalyticsJobResponse
newStartCallAnalyticsJobResponse :: Int -> StartCallAnalyticsJobResponse
newStartCallAnalyticsJobResponse Int
pHttpStatus_ =
  StartCallAnalyticsJobResponse' :: Maybe CallAnalyticsJob -> Int -> StartCallAnalyticsJobResponse
StartCallAnalyticsJobResponse'
    { $sel:callAnalyticsJob:StartCallAnalyticsJobResponse' :: Maybe CallAnalyticsJob
callAnalyticsJob =
        Maybe CallAnalyticsJob
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:StartCallAnalyticsJobResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An object containing the details of the asynchronous call analytics job.
startCallAnalyticsJobResponse_callAnalyticsJob :: Lens.Lens' StartCallAnalyticsJobResponse (Prelude.Maybe CallAnalyticsJob)
startCallAnalyticsJobResponse_callAnalyticsJob :: (Maybe CallAnalyticsJob -> f (Maybe CallAnalyticsJob))
-> StartCallAnalyticsJobResponse -> f StartCallAnalyticsJobResponse
startCallAnalyticsJobResponse_callAnalyticsJob = (StartCallAnalyticsJobResponse -> Maybe CallAnalyticsJob)
-> (StartCallAnalyticsJobResponse
    -> Maybe CallAnalyticsJob -> StartCallAnalyticsJobResponse)
-> Lens
     StartCallAnalyticsJobResponse
     StartCallAnalyticsJobResponse
     (Maybe CallAnalyticsJob)
     (Maybe CallAnalyticsJob)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartCallAnalyticsJobResponse' {Maybe CallAnalyticsJob
callAnalyticsJob :: Maybe CallAnalyticsJob
$sel:callAnalyticsJob:StartCallAnalyticsJobResponse' :: StartCallAnalyticsJobResponse -> Maybe CallAnalyticsJob
callAnalyticsJob} -> Maybe CallAnalyticsJob
callAnalyticsJob) (\s :: StartCallAnalyticsJobResponse
s@StartCallAnalyticsJobResponse' {} Maybe CallAnalyticsJob
a -> StartCallAnalyticsJobResponse
s {$sel:callAnalyticsJob:StartCallAnalyticsJobResponse' :: Maybe CallAnalyticsJob
callAnalyticsJob = Maybe CallAnalyticsJob
a} :: StartCallAnalyticsJobResponse)

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

instance Prelude.NFData StartCallAnalyticsJobResponse