{-# 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.CreateVocabulary
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a new custom vocabulary.
--
-- When creating a new custom vocabulary, you can either upload a text file
-- that contains your new entries, phrases, and terms into an Amazon S3
-- bucket and include the URI in your request. Or you can include a list of
-- terms directly in your request using the @Phrases@ flag.
--
-- Each language has a character set that contains all allowed characters
-- for that specific language. If you use unsupported characters, your
-- custom vocabulary request fails. Refer to
-- <https://docs.aws.amazon.com/transcribe/latest/dg/charsets.html Character Sets for Custom Vocabularies>
-- to get the character set for your language.
--
-- For more information, see
-- <https://docs.aws.amazon.com/transcribe/latest/dg/custom-vocabulary.html Custom vocabularies>.
module Amazonka.Transcribe.CreateVocabulary
  ( -- * Creating a Request
    CreateVocabulary (..),
    newCreateVocabulary,

    -- * Request Lenses
    createVocabulary_phrases,
    createVocabulary_tags,
    createVocabulary_vocabularyFileUri,
    createVocabulary_vocabularyName,
    createVocabulary_languageCode,

    -- * Destructuring the Response
    CreateVocabularyResponse (..),
    newCreateVocabularyResponse,

    -- * Response Lenses
    createVocabularyResponse_failureReason,
    createVocabularyResponse_languageCode,
    createVocabularyResponse_lastModifiedTime,
    createVocabularyResponse_vocabularyName,
    createVocabularyResponse_vocabularyState,
    createVocabularyResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Transcribe.Types

-- | /See:/ 'newCreateVocabulary' smart constructor.
data CreateVocabulary = CreateVocabulary'
  { -- | Use this parameter if you want to create your custom vocabulary by
    -- including all desired terms, as comma-separated values, within your
    -- request. The other option for creating your custom vocabulary is to save
    -- your entries in a text file and upload them to an Amazon S3 bucket, then
    -- specify the location of your file using the @VocabularyFileUri@
    -- parameter.
    --
    -- Note that if you include @Phrases@ in your request, you cannot use
    -- @VocabularyFileUri@; you must choose one or the other.
    --
    -- Each language has a character set that contains all allowed characters
    -- for that specific language. If you use unsupported characters, your
    -- custom vocabulary filter request fails. Refer to
    -- <https://docs.aws.amazon.com/transcribe/latest/dg/charsets.html Character Sets for Custom Vocabularies>
    -- to get the character set for your language.
    CreateVocabulary -> Maybe [Text]
phrases :: Prelude.Maybe [Prelude.Text],
    -- | Adds one or more custom tags, each in the form of a key:value pair, to a
    -- new custom vocabulary at the time you create this new custom vocabulary.
    --
    -- To learn more about using tags with Amazon Transcribe, refer to
    -- <https://docs.aws.amazon.com/transcribe/latest/dg/tagging.html Tagging resources>.
    CreateVocabulary -> Maybe (NonEmpty Tag)
tags :: Prelude.Maybe (Prelude.NonEmpty Tag),
    -- | The Amazon S3 location of the text file that contains your custom
    -- vocabulary. The URI must be located in the same Amazon Web Services
    -- Region as the resource you\'re calling.
    --
    -- Here\'s an example URI path:
    -- @s3:\/\/DOC-EXAMPLE-BUCKET\/my-vocab-file.txt@
    --
    -- Note that if you include @VocabularyFileUri@ in your request, you cannot
    -- use the @Phrases@ flag; you must choose one or the other.
    CreateVocabulary -> Maybe Text
vocabularyFileUri :: Prelude.Maybe Prelude.Text,
    -- | A unique name, chosen by you, for your new custom vocabulary.
    --
    -- This name is case sensitive, cannot contain spaces, and must be unique
    -- within an Amazon Web Services account. If you try to create a new custom
    -- vocabulary with the same name as an existing custom vocabulary, you get
    -- a @ConflictException@ error.
    CreateVocabulary -> Text
vocabularyName :: Prelude.Text,
    -- | The language code that represents the language of the entries in your
    -- custom vocabulary. Each custom vocabulary must contain terms in only one
    -- language.
    --
    -- A custom vocabulary can only be used to transcribe files in the same
    -- language as the custom vocabulary. For example, if you create a custom
    -- vocabulary using US English (@en-US@), you can only apply this custom
    -- vocabulary to files that contain English audio.
    --
    -- For a list of supported languages and their associated language codes,
    -- refer to the
    -- <https://docs.aws.amazon.com/transcribe/latest/dg/supported-languages.html Supported languages>
    -- table.
    CreateVocabulary -> LanguageCode
languageCode :: LanguageCode
  }
  deriving (CreateVocabulary -> CreateVocabulary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateVocabulary -> CreateVocabulary -> Bool
$c/= :: CreateVocabulary -> CreateVocabulary -> Bool
== :: CreateVocabulary -> CreateVocabulary -> Bool
$c== :: CreateVocabulary -> CreateVocabulary -> Bool
Prelude.Eq, ReadPrec [CreateVocabulary]
ReadPrec CreateVocabulary
Int -> ReadS CreateVocabulary
ReadS [CreateVocabulary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateVocabulary]
$creadListPrec :: ReadPrec [CreateVocabulary]
readPrec :: ReadPrec CreateVocabulary
$creadPrec :: ReadPrec CreateVocabulary
readList :: ReadS [CreateVocabulary]
$creadList :: ReadS [CreateVocabulary]
readsPrec :: Int -> ReadS CreateVocabulary
$creadsPrec :: Int -> ReadS CreateVocabulary
Prelude.Read, Int -> CreateVocabulary -> ShowS
[CreateVocabulary] -> ShowS
CreateVocabulary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateVocabulary] -> ShowS
$cshowList :: [CreateVocabulary] -> ShowS
show :: CreateVocabulary -> String
$cshow :: CreateVocabulary -> String
showsPrec :: Int -> CreateVocabulary -> ShowS
$cshowsPrec :: Int -> CreateVocabulary -> ShowS
Prelude.Show, forall x. Rep CreateVocabulary x -> CreateVocabulary
forall x. CreateVocabulary -> Rep CreateVocabulary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateVocabulary x -> CreateVocabulary
$cfrom :: forall x. CreateVocabulary -> Rep CreateVocabulary x
Prelude.Generic)

-- |
-- Create a value of 'CreateVocabulary' 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:
--
-- 'phrases', 'createVocabulary_phrases' - Use this parameter if you want to create your custom vocabulary by
-- including all desired terms, as comma-separated values, within your
-- request. The other option for creating your custom vocabulary is to save
-- your entries in a text file and upload them to an Amazon S3 bucket, then
-- specify the location of your file using the @VocabularyFileUri@
-- parameter.
--
-- Note that if you include @Phrases@ in your request, you cannot use
-- @VocabularyFileUri@; you must choose one or the other.
--
-- Each language has a character set that contains all allowed characters
-- for that specific language. If you use unsupported characters, your
-- custom vocabulary filter request fails. Refer to
-- <https://docs.aws.amazon.com/transcribe/latest/dg/charsets.html Character Sets for Custom Vocabularies>
-- to get the character set for your language.
--
-- 'tags', 'createVocabulary_tags' - Adds one or more custom tags, each in the form of a key:value pair, to a
-- new custom vocabulary at the time you create this new custom vocabulary.
--
-- To learn more about using tags with Amazon Transcribe, refer to
-- <https://docs.aws.amazon.com/transcribe/latest/dg/tagging.html Tagging resources>.
--
-- 'vocabularyFileUri', 'createVocabulary_vocabularyFileUri' - The Amazon S3 location of the text file that contains your custom
-- vocabulary. The URI must be located in the same Amazon Web Services
-- Region as the resource you\'re calling.
--
-- Here\'s an example URI path:
-- @s3:\/\/DOC-EXAMPLE-BUCKET\/my-vocab-file.txt@
--
-- Note that if you include @VocabularyFileUri@ in your request, you cannot
-- use the @Phrases@ flag; you must choose one or the other.
--
-- 'vocabularyName', 'createVocabulary_vocabularyName' - A unique name, chosen by you, for your new custom vocabulary.
--
-- This name is case sensitive, cannot contain spaces, and must be unique
-- within an Amazon Web Services account. If you try to create a new custom
-- vocabulary with the same name as an existing custom vocabulary, you get
-- a @ConflictException@ error.
--
-- 'languageCode', 'createVocabulary_languageCode' - The language code that represents the language of the entries in your
-- custom vocabulary. Each custom vocabulary must contain terms in only one
-- language.
--
-- A custom vocabulary can only be used to transcribe files in the same
-- language as the custom vocabulary. For example, if you create a custom
-- vocabulary using US English (@en-US@), you can only apply this custom
-- vocabulary to files that contain English audio.
--
-- For a list of supported languages and their associated language codes,
-- refer to the
-- <https://docs.aws.amazon.com/transcribe/latest/dg/supported-languages.html Supported languages>
-- table.
newCreateVocabulary ::
  -- | 'vocabularyName'
  Prelude.Text ->
  -- | 'languageCode'
  LanguageCode ->
  CreateVocabulary
newCreateVocabulary :: Text -> LanguageCode -> CreateVocabulary
newCreateVocabulary Text
pVocabularyName_ LanguageCode
pLanguageCode_ =
  CreateVocabulary'
    { $sel:phrases:CreateVocabulary' :: Maybe [Text]
phrases = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateVocabulary' :: Maybe (NonEmpty Tag)
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:vocabularyFileUri:CreateVocabulary' :: Maybe Text
vocabularyFileUri = forall a. Maybe a
Prelude.Nothing,
      $sel:vocabularyName:CreateVocabulary' :: Text
vocabularyName = Text
pVocabularyName_,
      $sel:languageCode:CreateVocabulary' :: LanguageCode
languageCode = LanguageCode
pLanguageCode_
    }

-- | Use this parameter if you want to create your custom vocabulary by
-- including all desired terms, as comma-separated values, within your
-- request. The other option for creating your custom vocabulary is to save
-- your entries in a text file and upload them to an Amazon S3 bucket, then
-- specify the location of your file using the @VocabularyFileUri@
-- parameter.
--
-- Note that if you include @Phrases@ in your request, you cannot use
-- @VocabularyFileUri@; you must choose one or the other.
--
-- Each language has a character set that contains all allowed characters
-- for that specific language. If you use unsupported characters, your
-- custom vocabulary filter request fails. Refer to
-- <https://docs.aws.amazon.com/transcribe/latest/dg/charsets.html Character Sets for Custom Vocabularies>
-- to get the character set for your language.
createVocabulary_phrases :: Lens.Lens' CreateVocabulary (Prelude.Maybe [Prelude.Text])
createVocabulary_phrases :: Lens' CreateVocabulary (Maybe [Text])
createVocabulary_phrases = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVocabulary' {Maybe [Text]
phrases :: Maybe [Text]
$sel:phrases:CreateVocabulary' :: CreateVocabulary -> Maybe [Text]
phrases} -> Maybe [Text]
phrases) (\s :: CreateVocabulary
s@CreateVocabulary' {} Maybe [Text]
a -> CreateVocabulary
s {$sel:phrases:CreateVocabulary' :: Maybe [Text]
phrases = Maybe [Text]
a} :: CreateVocabulary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Adds one or more custom tags, each in the form of a key:value pair, to a
-- new custom vocabulary at the time you create this new custom vocabulary.
--
-- To learn more about using tags with Amazon Transcribe, refer to
-- <https://docs.aws.amazon.com/transcribe/latest/dg/tagging.html Tagging resources>.
createVocabulary_tags :: Lens.Lens' CreateVocabulary (Prelude.Maybe (Prelude.NonEmpty Tag))
createVocabulary_tags :: Lens' CreateVocabulary (Maybe (NonEmpty Tag))
createVocabulary_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVocabulary' {Maybe (NonEmpty Tag)
tags :: Maybe (NonEmpty Tag)
$sel:tags:CreateVocabulary' :: CreateVocabulary -> Maybe (NonEmpty Tag)
tags} -> Maybe (NonEmpty Tag)
tags) (\s :: CreateVocabulary
s@CreateVocabulary' {} Maybe (NonEmpty Tag)
a -> CreateVocabulary
s {$sel:tags:CreateVocabulary' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
a} :: CreateVocabulary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Amazon S3 location of the text file that contains your custom
-- vocabulary. The URI must be located in the same Amazon Web Services
-- Region as the resource you\'re calling.
--
-- Here\'s an example URI path:
-- @s3:\/\/DOC-EXAMPLE-BUCKET\/my-vocab-file.txt@
--
-- Note that if you include @VocabularyFileUri@ in your request, you cannot
-- use the @Phrases@ flag; you must choose one or the other.
createVocabulary_vocabularyFileUri :: Lens.Lens' CreateVocabulary (Prelude.Maybe Prelude.Text)
createVocabulary_vocabularyFileUri :: Lens' CreateVocabulary (Maybe Text)
createVocabulary_vocabularyFileUri = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVocabulary' {Maybe Text
vocabularyFileUri :: Maybe Text
$sel:vocabularyFileUri:CreateVocabulary' :: CreateVocabulary -> Maybe Text
vocabularyFileUri} -> Maybe Text
vocabularyFileUri) (\s :: CreateVocabulary
s@CreateVocabulary' {} Maybe Text
a -> CreateVocabulary
s {$sel:vocabularyFileUri:CreateVocabulary' :: Maybe Text
vocabularyFileUri = Maybe Text
a} :: CreateVocabulary)

-- | A unique name, chosen by you, for your new custom vocabulary.
--
-- This name is case sensitive, cannot contain spaces, and must be unique
-- within an Amazon Web Services account. If you try to create a new custom
-- vocabulary with the same name as an existing custom vocabulary, you get
-- a @ConflictException@ error.
createVocabulary_vocabularyName :: Lens.Lens' CreateVocabulary Prelude.Text
createVocabulary_vocabularyName :: Lens' CreateVocabulary Text
createVocabulary_vocabularyName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVocabulary' {Text
vocabularyName :: Text
$sel:vocabularyName:CreateVocabulary' :: CreateVocabulary -> Text
vocabularyName} -> Text
vocabularyName) (\s :: CreateVocabulary
s@CreateVocabulary' {} Text
a -> CreateVocabulary
s {$sel:vocabularyName:CreateVocabulary' :: Text
vocabularyName = Text
a} :: CreateVocabulary)

-- | The language code that represents the language of the entries in your
-- custom vocabulary. Each custom vocabulary must contain terms in only one
-- language.
--
-- A custom vocabulary can only be used to transcribe files in the same
-- language as the custom vocabulary. For example, if you create a custom
-- vocabulary using US English (@en-US@), you can only apply this custom
-- vocabulary to files that contain English audio.
--
-- For a list of supported languages and their associated language codes,
-- refer to the
-- <https://docs.aws.amazon.com/transcribe/latest/dg/supported-languages.html Supported languages>
-- table.
createVocabulary_languageCode :: Lens.Lens' CreateVocabulary LanguageCode
createVocabulary_languageCode :: Lens' CreateVocabulary LanguageCode
createVocabulary_languageCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVocabulary' {LanguageCode
languageCode :: LanguageCode
$sel:languageCode:CreateVocabulary' :: CreateVocabulary -> LanguageCode
languageCode} -> LanguageCode
languageCode) (\s :: CreateVocabulary
s@CreateVocabulary' {} LanguageCode
a -> CreateVocabulary
s {$sel:languageCode:CreateVocabulary' :: LanguageCode
languageCode = LanguageCode
a} :: CreateVocabulary)

instance Core.AWSRequest CreateVocabulary where
  type
    AWSResponse CreateVocabulary =
      CreateVocabularyResponse
  request :: (Service -> Service)
-> CreateVocabulary -> Request CreateVocabulary
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateVocabulary
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateVocabulary)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe LanguageCode
-> Maybe POSIX
-> Maybe Text
-> Maybe VocabularyState
-> Int
-> CreateVocabularyResponse
CreateVocabularyResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"FailureReason")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"LanguageCode")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"LastModifiedTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"VocabularyName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"VocabularyState")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreateVocabulary where
  hashWithSalt :: Int -> CreateVocabulary -> Int
hashWithSalt Int
_salt CreateVocabulary' {Maybe [Text]
Maybe (NonEmpty Tag)
Maybe Text
Text
LanguageCode
languageCode :: LanguageCode
vocabularyName :: Text
vocabularyFileUri :: Maybe Text
tags :: Maybe (NonEmpty Tag)
phrases :: Maybe [Text]
$sel:languageCode:CreateVocabulary' :: CreateVocabulary -> LanguageCode
$sel:vocabularyName:CreateVocabulary' :: CreateVocabulary -> Text
$sel:vocabularyFileUri:CreateVocabulary' :: CreateVocabulary -> Maybe Text
$sel:tags:CreateVocabulary' :: CreateVocabulary -> Maybe (NonEmpty Tag)
$sel:phrases:CreateVocabulary' :: CreateVocabulary -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
phrases
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Tag)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
vocabularyFileUri
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
vocabularyName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` LanguageCode
languageCode

instance Prelude.NFData CreateVocabulary where
  rnf :: CreateVocabulary -> ()
rnf CreateVocabulary' {Maybe [Text]
Maybe (NonEmpty Tag)
Maybe Text
Text
LanguageCode
languageCode :: LanguageCode
vocabularyName :: Text
vocabularyFileUri :: Maybe Text
tags :: Maybe (NonEmpty Tag)
phrases :: Maybe [Text]
$sel:languageCode:CreateVocabulary' :: CreateVocabulary -> LanguageCode
$sel:vocabularyName:CreateVocabulary' :: CreateVocabulary -> Text
$sel:vocabularyFileUri:CreateVocabulary' :: CreateVocabulary -> Maybe Text
$sel:tags:CreateVocabulary' :: CreateVocabulary -> Maybe (NonEmpty Tag)
$sel:phrases:CreateVocabulary' :: CreateVocabulary -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
phrases
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Tag)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
vocabularyFileUri
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
vocabularyName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf LanguageCode
languageCode

instance Data.ToHeaders CreateVocabulary where
  toHeaders :: CreateVocabulary -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"Transcribe.CreateVocabulary" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON CreateVocabulary where
  toJSON :: CreateVocabulary -> Value
toJSON CreateVocabulary' {Maybe [Text]
Maybe (NonEmpty Tag)
Maybe Text
Text
LanguageCode
languageCode :: LanguageCode
vocabularyName :: Text
vocabularyFileUri :: Maybe Text
tags :: Maybe (NonEmpty Tag)
phrases :: Maybe [Text]
$sel:languageCode:CreateVocabulary' :: CreateVocabulary -> LanguageCode
$sel:vocabularyName:CreateVocabulary' :: CreateVocabulary -> Text
$sel:vocabularyFileUri:CreateVocabulary' :: CreateVocabulary -> Maybe Text
$sel:tags:CreateVocabulary' :: CreateVocabulary -> Maybe (NonEmpty Tag)
$sel:phrases:CreateVocabulary' :: CreateVocabulary -> Maybe [Text]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Phrases" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
phrases,
            (Key
"Tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Tag)
tags,
            (Key
"VocabularyFileUri" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
vocabularyFileUri,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"VocabularyName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
vocabularyName),
            forall a. a -> Maybe a
Prelude.Just (Key
"LanguageCode" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= LanguageCode
languageCode)
          ]
      )

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

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

-- | /See:/ 'newCreateVocabularyResponse' smart constructor.
data CreateVocabularyResponse = CreateVocabularyResponse'
  { -- | If @VocabularyState@ is @FAILED@, @FailureReason@ contains information
    -- about why the custom vocabulary request failed. See also:
    -- <https://docs.aws.amazon.com/transcribe/latest/APIReference/CommonErrors.html Common Errors>.
    CreateVocabularyResponse -> Maybe Text
failureReason :: Prelude.Maybe Prelude.Text,
    -- | The language code you selected for your custom vocabulary.
    CreateVocabularyResponse -> Maybe LanguageCode
languageCode :: Prelude.Maybe LanguageCode,
    -- | The date and time you created your custom vocabulary.
    --
    -- Timestamps are in the format @YYYY-MM-DD\'T\'HH:MM:SS.SSSSSS-UTC@. For
    -- example, @2022-05-04T12:32:58.761000-07:00@ represents 12:32 PM UTC-7 on
    -- May 4, 2022.
    CreateVocabularyResponse -> Maybe POSIX
lastModifiedTime :: Prelude.Maybe Data.POSIX,
    -- | The name you chose for your custom vocabulary.
    CreateVocabularyResponse -> Maybe Text
vocabularyName :: Prelude.Maybe Prelude.Text,
    -- | The processing state of your custom vocabulary. If the state is @READY@,
    -- you can use the custom vocabulary in a @StartTranscriptionJob@ request.
    CreateVocabularyResponse -> Maybe VocabularyState
vocabularyState :: Prelude.Maybe VocabularyState,
    -- | The response's http status code.
    CreateVocabularyResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateVocabularyResponse -> CreateVocabularyResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateVocabularyResponse -> CreateVocabularyResponse -> Bool
$c/= :: CreateVocabularyResponse -> CreateVocabularyResponse -> Bool
== :: CreateVocabularyResponse -> CreateVocabularyResponse -> Bool
$c== :: CreateVocabularyResponse -> CreateVocabularyResponse -> Bool
Prelude.Eq, ReadPrec [CreateVocabularyResponse]
ReadPrec CreateVocabularyResponse
Int -> ReadS CreateVocabularyResponse
ReadS [CreateVocabularyResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateVocabularyResponse]
$creadListPrec :: ReadPrec [CreateVocabularyResponse]
readPrec :: ReadPrec CreateVocabularyResponse
$creadPrec :: ReadPrec CreateVocabularyResponse
readList :: ReadS [CreateVocabularyResponse]
$creadList :: ReadS [CreateVocabularyResponse]
readsPrec :: Int -> ReadS CreateVocabularyResponse
$creadsPrec :: Int -> ReadS CreateVocabularyResponse
Prelude.Read, Int -> CreateVocabularyResponse -> ShowS
[CreateVocabularyResponse] -> ShowS
CreateVocabularyResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateVocabularyResponse] -> ShowS
$cshowList :: [CreateVocabularyResponse] -> ShowS
show :: CreateVocabularyResponse -> String
$cshow :: CreateVocabularyResponse -> String
showsPrec :: Int -> CreateVocabularyResponse -> ShowS
$cshowsPrec :: Int -> CreateVocabularyResponse -> ShowS
Prelude.Show, forall x.
Rep CreateVocabularyResponse x -> CreateVocabularyResponse
forall x.
CreateVocabularyResponse -> Rep CreateVocabularyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateVocabularyResponse x -> CreateVocabularyResponse
$cfrom :: forall x.
CreateVocabularyResponse -> Rep CreateVocabularyResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateVocabularyResponse' 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:
--
-- 'failureReason', 'createVocabularyResponse_failureReason' - If @VocabularyState@ is @FAILED@, @FailureReason@ contains information
-- about why the custom vocabulary request failed. See also:
-- <https://docs.aws.amazon.com/transcribe/latest/APIReference/CommonErrors.html Common Errors>.
--
-- 'languageCode', 'createVocabularyResponse_languageCode' - The language code you selected for your custom vocabulary.
--
-- 'lastModifiedTime', 'createVocabularyResponse_lastModifiedTime' - The date and time you created your custom vocabulary.
--
-- Timestamps are in the format @YYYY-MM-DD\'T\'HH:MM:SS.SSSSSS-UTC@. For
-- example, @2022-05-04T12:32:58.761000-07:00@ represents 12:32 PM UTC-7 on
-- May 4, 2022.
--
-- 'vocabularyName', 'createVocabularyResponse_vocabularyName' - The name you chose for your custom vocabulary.
--
-- 'vocabularyState', 'createVocabularyResponse_vocabularyState' - The processing state of your custom vocabulary. If the state is @READY@,
-- you can use the custom vocabulary in a @StartTranscriptionJob@ request.
--
-- 'httpStatus', 'createVocabularyResponse_httpStatus' - The response's http status code.
newCreateVocabularyResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateVocabularyResponse
newCreateVocabularyResponse :: Int -> CreateVocabularyResponse
newCreateVocabularyResponse Int
pHttpStatus_ =
  CreateVocabularyResponse'
    { $sel:failureReason:CreateVocabularyResponse' :: Maybe Text
failureReason =
        forall a. Maybe a
Prelude.Nothing,
      $sel:languageCode:CreateVocabularyResponse' :: Maybe LanguageCode
languageCode = forall a. Maybe a
Prelude.Nothing,
      $sel:lastModifiedTime:CreateVocabularyResponse' :: Maybe POSIX
lastModifiedTime = forall a. Maybe a
Prelude.Nothing,
      $sel:vocabularyName:CreateVocabularyResponse' :: Maybe Text
vocabularyName = forall a. Maybe a
Prelude.Nothing,
      $sel:vocabularyState:CreateVocabularyResponse' :: Maybe VocabularyState
vocabularyState = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateVocabularyResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | If @VocabularyState@ is @FAILED@, @FailureReason@ contains information
-- about why the custom vocabulary request failed. See also:
-- <https://docs.aws.amazon.com/transcribe/latest/APIReference/CommonErrors.html Common Errors>.
createVocabularyResponse_failureReason :: Lens.Lens' CreateVocabularyResponse (Prelude.Maybe Prelude.Text)
createVocabularyResponse_failureReason :: Lens' CreateVocabularyResponse (Maybe Text)
createVocabularyResponse_failureReason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVocabularyResponse' {Maybe Text
failureReason :: Maybe Text
$sel:failureReason:CreateVocabularyResponse' :: CreateVocabularyResponse -> Maybe Text
failureReason} -> Maybe Text
failureReason) (\s :: CreateVocabularyResponse
s@CreateVocabularyResponse' {} Maybe Text
a -> CreateVocabularyResponse
s {$sel:failureReason:CreateVocabularyResponse' :: Maybe Text
failureReason = Maybe Text
a} :: CreateVocabularyResponse)

-- | The language code you selected for your custom vocabulary.
createVocabularyResponse_languageCode :: Lens.Lens' CreateVocabularyResponse (Prelude.Maybe LanguageCode)
createVocabularyResponse_languageCode :: Lens' CreateVocabularyResponse (Maybe LanguageCode)
createVocabularyResponse_languageCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVocabularyResponse' {Maybe LanguageCode
languageCode :: Maybe LanguageCode
$sel:languageCode:CreateVocabularyResponse' :: CreateVocabularyResponse -> Maybe LanguageCode
languageCode} -> Maybe LanguageCode
languageCode) (\s :: CreateVocabularyResponse
s@CreateVocabularyResponse' {} Maybe LanguageCode
a -> CreateVocabularyResponse
s {$sel:languageCode:CreateVocabularyResponse' :: Maybe LanguageCode
languageCode = Maybe LanguageCode
a} :: CreateVocabularyResponse)

-- | The date and time you created your custom vocabulary.
--
-- Timestamps are in the format @YYYY-MM-DD\'T\'HH:MM:SS.SSSSSS-UTC@. For
-- example, @2022-05-04T12:32:58.761000-07:00@ represents 12:32 PM UTC-7 on
-- May 4, 2022.
createVocabularyResponse_lastModifiedTime :: Lens.Lens' CreateVocabularyResponse (Prelude.Maybe Prelude.UTCTime)
createVocabularyResponse_lastModifiedTime :: Lens' CreateVocabularyResponse (Maybe UTCTime)
createVocabularyResponse_lastModifiedTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVocabularyResponse' {Maybe POSIX
lastModifiedTime :: Maybe POSIX
$sel:lastModifiedTime:CreateVocabularyResponse' :: CreateVocabularyResponse -> Maybe POSIX
lastModifiedTime} -> Maybe POSIX
lastModifiedTime) (\s :: CreateVocabularyResponse
s@CreateVocabularyResponse' {} Maybe POSIX
a -> CreateVocabularyResponse
s {$sel:lastModifiedTime:CreateVocabularyResponse' :: Maybe POSIX
lastModifiedTime = Maybe POSIX
a} :: CreateVocabularyResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The name you chose for your custom vocabulary.
createVocabularyResponse_vocabularyName :: Lens.Lens' CreateVocabularyResponse (Prelude.Maybe Prelude.Text)
createVocabularyResponse_vocabularyName :: Lens' CreateVocabularyResponse (Maybe Text)
createVocabularyResponse_vocabularyName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVocabularyResponse' {Maybe Text
vocabularyName :: Maybe Text
$sel:vocabularyName:CreateVocabularyResponse' :: CreateVocabularyResponse -> Maybe Text
vocabularyName} -> Maybe Text
vocabularyName) (\s :: CreateVocabularyResponse
s@CreateVocabularyResponse' {} Maybe Text
a -> CreateVocabularyResponse
s {$sel:vocabularyName:CreateVocabularyResponse' :: Maybe Text
vocabularyName = Maybe Text
a} :: CreateVocabularyResponse)

-- | The processing state of your custom vocabulary. If the state is @READY@,
-- you can use the custom vocabulary in a @StartTranscriptionJob@ request.
createVocabularyResponse_vocabularyState :: Lens.Lens' CreateVocabularyResponse (Prelude.Maybe VocabularyState)
createVocabularyResponse_vocabularyState :: Lens' CreateVocabularyResponse (Maybe VocabularyState)
createVocabularyResponse_vocabularyState = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVocabularyResponse' {Maybe VocabularyState
vocabularyState :: Maybe VocabularyState
$sel:vocabularyState:CreateVocabularyResponse' :: CreateVocabularyResponse -> Maybe VocabularyState
vocabularyState} -> Maybe VocabularyState
vocabularyState) (\s :: CreateVocabularyResponse
s@CreateVocabularyResponse' {} Maybe VocabularyState
a -> CreateVocabularyResponse
s {$sel:vocabularyState:CreateVocabularyResponse' :: Maybe VocabularyState
vocabularyState = Maybe VocabularyState
a} :: CreateVocabularyResponse)

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

instance Prelude.NFData CreateVocabularyResponse where
  rnf :: CreateVocabularyResponse -> ()
rnf CreateVocabularyResponse' {Int
Maybe Text
Maybe POSIX
Maybe LanguageCode
Maybe VocabularyState
httpStatus :: Int
vocabularyState :: Maybe VocabularyState
vocabularyName :: Maybe Text
lastModifiedTime :: Maybe POSIX
languageCode :: Maybe LanguageCode
failureReason :: Maybe Text
$sel:httpStatus:CreateVocabularyResponse' :: CreateVocabularyResponse -> Int
$sel:vocabularyState:CreateVocabularyResponse' :: CreateVocabularyResponse -> Maybe VocabularyState
$sel:vocabularyName:CreateVocabularyResponse' :: CreateVocabularyResponse -> Maybe Text
$sel:lastModifiedTime:CreateVocabularyResponse' :: CreateVocabularyResponse -> Maybe POSIX
$sel:languageCode:CreateVocabularyResponse' :: CreateVocabularyResponse -> Maybe LanguageCode
$sel:failureReason:CreateVocabularyResponse' :: CreateVocabularyResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
failureReason
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe LanguageCode
languageCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastModifiedTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
vocabularyName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VocabularyState
vocabularyState
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus