{-# 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.VoiceId.StartSpeakerEnrollmentJob
-- 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 a new batch speaker enrollment job using specified details.
module Amazonka.VoiceId.StartSpeakerEnrollmentJob
  ( -- * Creating a Request
    StartSpeakerEnrollmentJob (..),
    newStartSpeakerEnrollmentJob,

    -- * Request Lenses
    startSpeakerEnrollmentJob_clientToken,
    startSpeakerEnrollmentJob_jobName,
    startSpeakerEnrollmentJob_enrollmentConfig,
    startSpeakerEnrollmentJob_dataAccessRoleArn,
    startSpeakerEnrollmentJob_domainId,
    startSpeakerEnrollmentJob_inputDataConfig,
    startSpeakerEnrollmentJob_outputDataConfig,

    -- * Destructuring the Response
    StartSpeakerEnrollmentJobResponse (..),
    newStartSpeakerEnrollmentJobResponse,

    -- * Response Lenses
    startSpeakerEnrollmentJobResponse_job,
    startSpeakerEnrollmentJobResponse_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.VoiceId.Types

-- | /See:/ 'newStartSpeakerEnrollmentJob' smart constructor.
data StartSpeakerEnrollmentJob = StartSpeakerEnrollmentJob'
  { -- | The idempotency token for starting a new speaker enrollment Job. If not
    -- provided, Amazon Web Services SDK populates this field.
    StartSpeakerEnrollmentJob -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | A name for your speaker enrollment job.
    StartSpeakerEnrollmentJob -> Maybe (Sensitive Text)
jobName :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The enrollment config that contains details such as the action to take
    -- when a speaker is already enrolled in the Voice ID system or when a
    -- speaker is identified as a fraudster.
    StartSpeakerEnrollmentJob -> Maybe EnrollmentConfig
enrollmentConfig :: Prelude.Maybe EnrollmentConfig,
    -- | The IAM role Amazon Resource Name (ARN) that grants Voice ID permissions
    -- to access customer\'s buckets to read the input manifest file and write
    -- the job output file. Refer to
    -- <https://docs.aws.amazon.com/connect/latest/adminguide/voiceid-batch-enrollment.html Batch enrollment using audio data from prior calls>
    -- documentation for the permissions needed in this role.
    StartSpeakerEnrollmentJob -> Text
dataAccessRoleArn :: Prelude.Text,
    -- | The identifier of the domain that contains the speaker enrollment job
    -- and in which the speakers are enrolled.
    StartSpeakerEnrollmentJob -> Text
domainId :: Prelude.Text,
    -- | The input data config containing the S3 location for the input manifest
    -- file that contains the list of speaker enrollment requests.
    StartSpeakerEnrollmentJob -> InputDataConfig
inputDataConfig :: InputDataConfig,
    -- | The output data config containing the S3 location where Voice ID writes
    -- the job output file; you must also include a KMS Key ID to encrypt the
    -- file.
    StartSpeakerEnrollmentJob -> OutputDataConfig
outputDataConfig :: OutputDataConfig
  }
  deriving (StartSpeakerEnrollmentJob -> StartSpeakerEnrollmentJob -> Bool
(StartSpeakerEnrollmentJob -> StartSpeakerEnrollmentJob -> Bool)
-> (StartSpeakerEnrollmentJob -> StartSpeakerEnrollmentJob -> Bool)
-> Eq StartSpeakerEnrollmentJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartSpeakerEnrollmentJob -> StartSpeakerEnrollmentJob -> Bool
$c/= :: StartSpeakerEnrollmentJob -> StartSpeakerEnrollmentJob -> Bool
== :: StartSpeakerEnrollmentJob -> StartSpeakerEnrollmentJob -> Bool
$c== :: StartSpeakerEnrollmentJob -> StartSpeakerEnrollmentJob -> Bool
Prelude.Eq, Int -> StartSpeakerEnrollmentJob -> ShowS
[StartSpeakerEnrollmentJob] -> ShowS
StartSpeakerEnrollmentJob -> String
(Int -> StartSpeakerEnrollmentJob -> ShowS)
-> (StartSpeakerEnrollmentJob -> String)
-> ([StartSpeakerEnrollmentJob] -> ShowS)
-> Show StartSpeakerEnrollmentJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartSpeakerEnrollmentJob] -> ShowS
$cshowList :: [StartSpeakerEnrollmentJob] -> ShowS
show :: StartSpeakerEnrollmentJob -> String
$cshow :: StartSpeakerEnrollmentJob -> String
showsPrec :: Int -> StartSpeakerEnrollmentJob -> ShowS
$cshowsPrec :: Int -> StartSpeakerEnrollmentJob -> ShowS
Prelude.Show, (forall x.
 StartSpeakerEnrollmentJob -> Rep StartSpeakerEnrollmentJob x)
-> (forall x.
    Rep StartSpeakerEnrollmentJob x -> StartSpeakerEnrollmentJob)
-> Generic StartSpeakerEnrollmentJob
forall x.
Rep StartSpeakerEnrollmentJob x -> StartSpeakerEnrollmentJob
forall x.
StartSpeakerEnrollmentJob -> Rep StartSpeakerEnrollmentJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartSpeakerEnrollmentJob x -> StartSpeakerEnrollmentJob
$cfrom :: forall x.
StartSpeakerEnrollmentJob -> Rep StartSpeakerEnrollmentJob x
Prelude.Generic)

-- |
-- Create a value of 'StartSpeakerEnrollmentJob' 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:
--
-- 'clientToken', 'startSpeakerEnrollmentJob_clientToken' - The idempotency token for starting a new speaker enrollment Job. If not
-- provided, Amazon Web Services SDK populates this field.
--
-- 'jobName', 'startSpeakerEnrollmentJob_jobName' - A name for your speaker enrollment job.
--
-- 'enrollmentConfig', 'startSpeakerEnrollmentJob_enrollmentConfig' - The enrollment config that contains details such as the action to take
-- when a speaker is already enrolled in the Voice ID system or when a
-- speaker is identified as a fraudster.
--
-- 'dataAccessRoleArn', 'startSpeakerEnrollmentJob_dataAccessRoleArn' - The IAM role Amazon Resource Name (ARN) that grants Voice ID permissions
-- to access customer\'s buckets to read the input manifest file and write
-- the job output file. Refer to
-- <https://docs.aws.amazon.com/connect/latest/adminguide/voiceid-batch-enrollment.html Batch enrollment using audio data from prior calls>
-- documentation for the permissions needed in this role.
--
-- 'domainId', 'startSpeakerEnrollmentJob_domainId' - The identifier of the domain that contains the speaker enrollment job
-- and in which the speakers are enrolled.
--
-- 'inputDataConfig', 'startSpeakerEnrollmentJob_inputDataConfig' - The input data config containing the S3 location for the input manifest
-- file that contains the list of speaker enrollment requests.
--
-- 'outputDataConfig', 'startSpeakerEnrollmentJob_outputDataConfig' - The output data config containing the S3 location where Voice ID writes
-- the job output file; you must also include a KMS Key ID to encrypt the
-- file.
newStartSpeakerEnrollmentJob ::
  -- | 'dataAccessRoleArn'
  Prelude.Text ->
  -- | 'domainId'
  Prelude.Text ->
  -- | 'inputDataConfig'
  InputDataConfig ->
  -- | 'outputDataConfig'
  OutputDataConfig ->
  StartSpeakerEnrollmentJob
newStartSpeakerEnrollmentJob :: Text
-> Text
-> InputDataConfig
-> OutputDataConfig
-> StartSpeakerEnrollmentJob
newStartSpeakerEnrollmentJob
  Text
pDataAccessRoleArn_
  Text
pDomainId_
  InputDataConfig
pInputDataConfig_
  OutputDataConfig
pOutputDataConfig_ =
    StartSpeakerEnrollmentJob' :: Maybe Text
-> Maybe (Sensitive Text)
-> Maybe EnrollmentConfig
-> Text
-> Text
-> InputDataConfig
-> OutputDataConfig
-> StartSpeakerEnrollmentJob
StartSpeakerEnrollmentJob'
      { $sel:clientToken:StartSpeakerEnrollmentJob' :: Maybe Text
clientToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:jobName:StartSpeakerEnrollmentJob' :: Maybe (Sensitive Text)
jobName = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:enrollmentConfig:StartSpeakerEnrollmentJob' :: Maybe EnrollmentConfig
enrollmentConfig = Maybe EnrollmentConfig
forall a. Maybe a
Prelude.Nothing,
        $sel:dataAccessRoleArn:StartSpeakerEnrollmentJob' :: Text
dataAccessRoleArn = Text
pDataAccessRoleArn_,
        $sel:domainId:StartSpeakerEnrollmentJob' :: Text
domainId = Text
pDomainId_,
        $sel:inputDataConfig:StartSpeakerEnrollmentJob' :: InputDataConfig
inputDataConfig = InputDataConfig
pInputDataConfig_,
        $sel:outputDataConfig:StartSpeakerEnrollmentJob' :: OutputDataConfig
outputDataConfig = OutputDataConfig
pOutputDataConfig_
      }

-- | The idempotency token for starting a new speaker enrollment Job. If not
-- provided, Amazon Web Services SDK populates this field.
startSpeakerEnrollmentJob_clientToken :: Lens.Lens' StartSpeakerEnrollmentJob (Prelude.Maybe Prelude.Text)
startSpeakerEnrollmentJob_clientToken :: (Maybe Text -> f (Maybe Text))
-> StartSpeakerEnrollmentJob -> f StartSpeakerEnrollmentJob
startSpeakerEnrollmentJob_clientToken = (StartSpeakerEnrollmentJob -> Maybe Text)
-> (StartSpeakerEnrollmentJob
    -> Maybe Text -> StartSpeakerEnrollmentJob)
-> Lens
     StartSpeakerEnrollmentJob
     StartSpeakerEnrollmentJob
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSpeakerEnrollmentJob' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:StartSpeakerEnrollmentJob' :: StartSpeakerEnrollmentJob -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: StartSpeakerEnrollmentJob
s@StartSpeakerEnrollmentJob' {} Maybe Text
a -> StartSpeakerEnrollmentJob
s {$sel:clientToken:StartSpeakerEnrollmentJob' :: Maybe Text
clientToken = Maybe Text
a} :: StartSpeakerEnrollmentJob)

-- | A name for your speaker enrollment job.
startSpeakerEnrollmentJob_jobName :: Lens.Lens' StartSpeakerEnrollmentJob (Prelude.Maybe Prelude.Text)
startSpeakerEnrollmentJob_jobName :: (Maybe Text -> f (Maybe Text))
-> StartSpeakerEnrollmentJob -> f StartSpeakerEnrollmentJob
startSpeakerEnrollmentJob_jobName = (StartSpeakerEnrollmentJob -> Maybe (Sensitive Text))
-> (StartSpeakerEnrollmentJob
    -> Maybe (Sensitive Text) -> StartSpeakerEnrollmentJob)
-> Lens
     StartSpeakerEnrollmentJob
     StartSpeakerEnrollmentJob
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSpeakerEnrollmentJob' {Maybe (Sensitive Text)
jobName :: Maybe (Sensitive Text)
$sel:jobName:StartSpeakerEnrollmentJob' :: StartSpeakerEnrollmentJob -> Maybe (Sensitive Text)
jobName} -> Maybe (Sensitive Text)
jobName) (\s :: StartSpeakerEnrollmentJob
s@StartSpeakerEnrollmentJob' {} Maybe (Sensitive Text)
a -> StartSpeakerEnrollmentJob
s {$sel:jobName:StartSpeakerEnrollmentJob' :: Maybe (Sensitive Text)
jobName = Maybe (Sensitive Text)
a} :: StartSpeakerEnrollmentJob) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> StartSpeakerEnrollmentJob -> f StartSpeakerEnrollmentJob)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> StartSpeakerEnrollmentJob
-> f StartSpeakerEnrollmentJob
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive 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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The enrollment config that contains details such as the action to take
-- when a speaker is already enrolled in the Voice ID system or when a
-- speaker is identified as a fraudster.
startSpeakerEnrollmentJob_enrollmentConfig :: Lens.Lens' StartSpeakerEnrollmentJob (Prelude.Maybe EnrollmentConfig)
startSpeakerEnrollmentJob_enrollmentConfig :: (Maybe EnrollmentConfig -> f (Maybe EnrollmentConfig))
-> StartSpeakerEnrollmentJob -> f StartSpeakerEnrollmentJob
startSpeakerEnrollmentJob_enrollmentConfig = (StartSpeakerEnrollmentJob -> Maybe EnrollmentConfig)
-> (StartSpeakerEnrollmentJob
    -> Maybe EnrollmentConfig -> StartSpeakerEnrollmentJob)
-> Lens
     StartSpeakerEnrollmentJob
     StartSpeakerEnrollmentJob
     (Maybe EnrollmentConfig)
     (Maybe EnrollmentConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSpeakerEnrollmentJob' {Maybe EnrollmentConfig
enrollmentConfig :: Maybe EnrollmentConfig
$sel:enrollmentConfig:StartSpeakerEnrollmentJob' :: StartSpeakerEnrollmentJob -> Maybe EnrollmentConfig
enrollmentConfig} -> Maybe EnrollmentConfig
enrollmentConfig) (\s :: StartSpeakerEnrollmentJob
s@StartSpeakerEnrollmentJob' {} Maybe EnrollmentConfig
a -> StartSpeakerEnrollmentJob
s {$sel:enrollmentConfig:StartSpeakerEnrollmentJob' :: Maybe EnrollmentConfig
enrollmentConfig = Maybe EnrollmentConfig
a} :: StartSpeakerEnrollmentJob)

-- | The IAM role Amazon Resource Name (ARN) that grants Voice ID permissions
-- to access customer\'s buckets to read the input manifest file and write
-- the job output file. Refer to
-- <https://docs.aws.amazon.com/connect/latest/adminguide/voiceid-batch-enrollment.html Batch enrollment using audio data from prior calls>
-- documentation for the permissions needed in this role.
startSpeakerEnrollmentJob_dataAccessRoleArn :: Lens.Lens' StartSpeakerEnrollmentJob Prelude.Text
startSpeakerEnrollmentJob_dataAccessRoleArn :: (Text -> f Text)
-> StartSpeakerEnrollmentJob -> f StartSpeakerEnrollmentJob
startSpeakerEnrollmentJob_dataAccessRoleArn = (StartSpeakerEnrollmentJob -> Text)
-> (StartSpeakerEnrollmentJob -> Text -> StartSpeakerEnrollmentJob)
-> Lens
     StartSpeakerEnrollmentJob StartSpeakerEnrollmentJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSpeakerEnrollmentJob' {Text
dataAccessRoleArn :: Text
$sel:dataAccessRoleArn:StartSpeakerEnrollmentJob' :: StartSpeakerEnrollmentJob -> Text
dataAccessRoleArn} -> Text
dataAccessRoleArn) (\s :: StartSpeakerEnrollmentJob
s@StartSpeakerEnrollmentJob' {} Text
a -> StartSpeakerEnrollmentJob
s {$sel:dataAccessRoleArn:StartSpeakerEnrollmentJob' :: Text
dataAccessRoleArn = Text
a} :: StartSpeakerEnrollmentJob)

-- | The identifier of the domain that contains the speaker enrollment job
-- and in which the speakers are enrolled.
startSpeakerEnrollmentJob_domainId :: Lens.Lens' StartSpeakerEnrollmentJob Prelude.Text
startSpeakerEnrollmentJob_domainId :: (Text -> f Text)
-> StartSpeakerEnrollmentJob -> f StartSpeakerEnrollmentJob
startSpeakerEnrollmentJob_domainId = (StartSpeakerEnrollmentJob -> Text)
-> (StartSpeakerEnrollmentJob -> Text -> StartSpeakerEnrollmentJob)
-> Lens
     StartSpeakerEnrollmentJob StartSpeakerEnrollmentJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSpeakerEnrollmentJob' {Text
domainId :: Text
$sel:domainId:StartSpeakerEnrollmentJob' :: StartSpeakerEnrollmentJob -> Text
domainId} -> Text
domainId) (\s :: StartSpeakerEnrollmentJob
s@StartSpeakerEnrollmentJob' {} Text
a -> StartSpeakerEnrollmentJob
s {$sel:domainId:StartSpeakerEnrollmentJob' :: Text
domainId = Text
a} :: StartSpeakerEnrollmentJob)

-- | The input data config containing the S3 location for the input manifest
-- file that contains the list of speaker enrollment requests.
startSpeakerEnrollmentJob_inputDataConfig :: Lens.Lens' StartSpeakerEnrollmentJob InputDataConfig
startSpeakerEnrollmentJob_inputDataConfig :: (InputDataConfig -> f InputDataConfig)
-> StartSpeakerEnrollmentJob -> f StartSpeakerEnrollmentJob
startSpeakerEnrollmentJob_inputDataConfig = (StartSpeakerEnrollmentJob -> InputDataConfig)
-> (StartSpeakerEnrollmentJob
    -> InputDataConfig -> StartSpeakerEnrollmentJob)
-> Lens
     StartSpeakerEnrollmentJob
     StartSpeakerEnrollmentJob
     InputDataConfig
     InputDataConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSpeakerEnrollmentJob' {InputDataConfig
inputDataConfig :: InputDataConfig
$sel:inputDataConfig:StartSpeakerEnrollmentJob' :: StartSpeakerEnrollmentJob -> InputDataConfig
inputDataConfig} -> InputDataConfig
inputDataConfig) (\s :: StartSpeakerEnrollmentJob
s@StartSpeakerEnrollmentJob' {} InputDataConfig
a -> StartSpeakerEnrollmentJob
s {$sel:inputDataConfig:StartSpeakerEnrollmentJob' :: InputDataConfig
inputDataConfig = InputDataConfig
a} :: StartSpeakerEnrollmentJob)

-- | The output data config containing the S3 location where Voice ID writes
-- the job output file; you must also include a KMS Key ID to encrypt the
-- file.
startSpeakerEnrollmentJob_outputDataConfig :: Lens.Lens' StartSpeakerEnrollmentJob OutputDataConfig
startSpeakerEnrollmentJob_outputDataConfig :: (OutputDataConfig -> f OutputDataConfig)
-> StartSpeakerEnrollmentJob -> f StartSpeakerEnrollmentJob
startSpeakerEnrollmentJob_outputDataConfig = (StartSpeakerEnrollmentJob -> OutputDataConfig)
-> (StartSpeakerEnrollmentJob
    -> OutputDataConfig -> StartSpeakerEnrollmentJob)
-> Lens
     StartSpeakerEnrollmentJob
     StartSpeakerEnrollmentJob
     OutputDataConfig
     OutputDataConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSpeakerEnrollmentJob' {OutputDataConfig
outputDataConfig :: OutputDataConfig
$sel:outputDataConfig:StartSpeakerEnrollmentJob' :: StartSpeakerEnrollmentJob -> OutputDataConfig
outputDataConfig} -> OutputDataConfig
outputDataConfig) (\s :: StartSpeakerEnrollmentJob
s@StartSpeakerEnrollmentJob' {} OutputDataConfig
a -> StartSpeakerEnrollmentJob
s {$sel:outputDataConfig:StartSpeakerEnrollmentJob' :: OutputDataConfig
outputDataConfig = OutputDataConfig
a} :: StartSpeakerEnrollmentJob)

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

instance Prelude.NFData StartSpeakerEnrollmentJob

instance Core.ToHeaders StartSpeakerEnrollmentJob where
  toHeaders :: StartSpeakerEnrollmentJob -> ResponseHeaders
toHeaders =
    ResponseHeaders -> StartSpeakerEnrollmentJob -> 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
"VoiceID.StartSpeakerEnrollmentJob" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON StartSpeakerEnrollmentJob where
  toJSON :: StartSpeakerEnrollmentJob -> Value
toJSON StartSpeakerEnrollmentJob' {Maybe Text
Maybe (Sensitive Text)
Maybe EnrollmentConfig
Text
InputDataConfig
OutputDataConfig
outputDataConfig :: OutputDataConfig
inputDataConfig :: InputDataConfig
domainId :: Text
dataAccessRoleArn :: Text
enrollmentConfig :: Maybe EnrollmentConfig
jobName :: Maybe (Sensitive Text)
clientToken :: Maybe Text
$sel:outputDataConfig:StartSpeakerEnrollmentJob' :: StartSpeakerEnrollmentJob -> OutputDataConfig
$sel:inputDataConfig:StartSpeakerEnrollmentJob' :: StartSpeakerEnrollmentJob -> InputDataConfig
$sel:domainId:StartSpeakerEnrollmentJob' :: StartSpeakerEnrollmentJob -> Text
$sel:dataAccessRoleArn:StartSpeakerEnrollmentJob' :: StartSpeakerEnrollmentJob -> Text
$sel:enrollmentConfig:StartSpeakerEnrollmentJob' :: StartSpeakerEnrollmentJob -> Maybe EnrollmentConfig
$sel:jobName:StartSpeakerEnrollmentJob' :: StartSpeakerEnrollmentJob -> Maybe (Sensitive Text)
$sel:clientToken:StartSpeakerEnrollmentJob' :: StartSpeakerEnrollmentJob -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ClientToken" 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
clientToken,
            (Text
"JobName" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
jobName,
            (Text
"EnrollmentConfig" Text -> EnrollmentConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (EnrollmentConfig -> Pair) -> Maybe EnrollmentConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EnrollmentConfig
enrollmentConfig,
            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),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DomainId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
domainId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"InputDataConfig" Text -> InputDataConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= InputDataConfig
inputDataConfig),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"OutputDataConfig" Text -> OutputDataConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= OutputDataConfig
outputDataConfig)
          ]
      )

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

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

-- | /See:/ 'newStartSpeakerEnrollmentJobResponse' smart constructor.
data StartSpeakerEnrollmentJobResponse = StartSpeakerEnrollmentJobResponse'
  { -- | Details about the started speaker enrollment job.
    StartSpeakerEnrollmentJobResponse -> Maybe SpeakerEnrollmentJob
job :: Prelude.Maybe SpeakerEnrollmentJob,
    -- | The response's http status code.
    StartSpeakerEnrollmentJobResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (StartSpeakerEnrollmentJobResponse
-> StartSpeakerEnrollmentJobResponse -> Bool
(StartSpeakerEnrollmentJobResponse
 -> StartSpeakerEnrollmentJobResponse -> Bool)
-> (StartSpeakerEnrollmentJobResponse
    -> StartSpeakerEnrollmentJobResponse -> Bool)
-> Eq StartSpeakerEnrollmentJobResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartSpeakerEnrollmentJobResponse
-> StartSpeakerEnrollmentJobResponse -> Bool
$c/= :: StartSpeakerEnrollmentJobResponse
-> StartSpeakerEnrollmentJobResponse -> Bool
== :: StartSpeakerEnrollmentJobResponse
-> StartSpeakerEnrollmentJobResponse -> Bool
$c== :: StartSpeakerEnrollmentJobResponse
-> StartSpeakerEnrollmentJobResponse -> Bool
Prelude.Eq, Int -> StartSpeakerEnrollmentJobResponse -> ShowS
[StartSpeakerEnrollmentJobResponse] -> ShowS
StartSpeakerEnrollmentJobResponse -> String
(Int -> StartSpeakerEnrollmentJobResponse -> ShowS)
-> (StartSpeakerEnrollmentJobResponse -> String)
-> ([StartSpeakerEnrollmentJobResponse] -> ShowS)
-> Show StartSpeakerEnrollmentJobResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartSpeakerEnrollmentJobResponse] -> ShowS
$cshowList :: [StartSpeakerEnrollmentJobResponse] -> ShowS
show :: StartSpeakerEnrollmentJobResponse -> String
$cshow :: StartSpeakerEnrollmentJobResponse -> String
showsPrec :: Int -> StartSpeakerEnrollmentJobResponse -> ShowS
$cshowsPrec :: Int -> StartSpeakerEnrollmentJobResponse -> ShowS
Prelude.Show, (forall x.
 StartSpeakerEnrollmentJobResponse
 -> Rep StartSpeakerEnrollmentJobResponse x)
-> (forall x.
    Rep StartSpeakerEnrollmentJobResponse x
    -> StartSpeakerEnrollmentJobResponse)
-> Generic StartSpeakerEnrollmentJobResponse
forall x.
Rep StartSpeakerEnrollmentJobResponse x
-> StartSpeakerEnrollmentJobResponse
forall x.
StartSpeakerEnrollmentJobResponse
-> Rep StartSpeakerEnrollmentJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartSpeakerEnrollmentJobResponse x
-> StartSpeakerEnrollmentJobResponse
$cfrom :: forall x.
StartSpeakerEnrollmentJobResponse
-> Rep StartSpeakerEnrollmentJobResponse x
Prelude.Generic)

-- |
-- Create a value of 'StartSpeakerEnrollmentJobResponse' 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:
--
-- 'job', 'startSpeakerEnrollmentJobResponse_job' - Details about the started speaker enrollment job.
--
-- 'httpStatus', 'startSpeakerEnrollmentJobResponse_httpStatus' - The response's http status code.
newStartSpeakerEnrollmentJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StartSpeakerEnrollmentJobResponse
newStartSpeakerEnrollmentJobResponse :: Int -> StartSpeakerEnrollmentJobResponse
newStartSpeakerEnrollmentJobResponse Int
pHttpStatus_ =
  StartSpeakerEnrollmentJobResponse' :: Maybe SpeakerEnrollmentJob
-> Int -> StartSpeakerEnrollmentJobResponse
StartSpeakerEnrollmentJobResponse'
    { $sel:job:StartSpeakerEnrollmentJobResponse' :: Maybe SpeakerEnrollmentJob
job =
        Maybe SpeakerEnrollmentJob
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:StartSpeakerEnrollmentJobResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Details about the started speaker enrollment job.
startSpeakerEnrollmentJobResponse_job :: Lens.Lens' StartSpeakerEnrollmentJobResponse (Prelude.Maybe SpeakerEnrollmentJob)
startSpeakerEnrollmentJobResponse_job :: (Maybe SpeakerEnrollmentJob -> f (Maybe SpeakerEnrollmentJob))
-> StartSpeakerEnrollmentJobResponse
-> f StartSpeakerEnrollmentJobResponse
startSpeakerEnrollmentJobResponse_job = (StartSpeakerEnrollmentJobResponse -> Maybe SpeakerEnrollmentJob)
-> (StartSpeakerEnrollmentJobResponse
    -> Maybe SpeakerEnrollmentJob -> StartSpeakerEnrollmentJobResponse)
-> Lens
     StartSpeakerEnrollmentJobResponse
     StartSpeakerEnrollmentJobResponse
     (Maybe SpeakerEnrollmentJob)
     (Maybe SpeakerEnrollmentJob)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSpeakerEnrollmentJobResponse' {Maybe SpeakerEnrollmentJob
job :: Maybe SpeakerEnrollmentJob
$sel:job:StartSpeakerEnrollmentJobResponse' :: StartSpeakerEnrollmentJobResponse -> Maybe SpeakerEnrollmentJob
job} -> Maybe SpeakerEnrollmentJob
job) (\s :: StartSpeakerEnrollmentJobResponse
s@StartSpeakerEnrollmentJobResponse' {} Maybe SpeakerEnrollmentJob
a -> StartSpeakerEnrollmentJobResponse
s {$sel:job:StartSpeakerEnrollmentJobResponse' :: Maybe SpeakerEnrollmentJob
job = Maybe SpeakerEnrollmentJob
a} :: StartSpeakerEnrollmentJobResponse)

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

instance
  Prelude.NFData
    StartSpeakerEnrollmentJobResponse