{-# 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.CreateVocabularyFilter
-- 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)
--
-- Creates a new vocabulary filter that you can use to filter words, such
-- as profane words, from the output of a transcription job.
module Amazonka.Transcribe.CreateVocabularyFilter
  ( -- * Creating a Request
    CreateVocabularyFilter (..),
    newCreateVocabularyFilter,

    -- * Request Lenses
    createVocabularyFilter_vocabularyFilterFileUri,
    createVocabularyFilter_words,
    createVocabularyFilter_tags,
    createVocabularyFilter_vocabularyFilterName,
    createVocabularyFilter_languageCode,

    -- * Destructuring the Response
    CreateVocabularyFilterResponse (..),
    newCreateVocabularyFilterResponse,

    -- * Response Lenses
    createVocabularyFilterResponse_languageCode,
    createVocabularyFilterResponse_lastModifiedTime,
    createVocabularyFilterResponse_vocabularyFilterName,
    createVocabularyFilterResponse_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:/ 'newCreateVocabularyFilter' smart constructor.
data CreateVocabularyFilter = CreateVocabularyFilter'
  { -- | The Amazon S3 location of a text file used as input to create the
    -- vocabulary filter. Only use characters from the character set defined
    -- for custom vocabularies. For a list of character sets, see
    -- <https://docs.aws.amazon.com/transcribe/latest/dg/how-vocabulary.html#charsets Character Sets for Custom Vocabularies>.
    --
    -- The specified file must be less than 50 KB of UTF-8 characters.
    --
    -- If you provide the location of a list of words in the
    -- @VocabularyFilterFileUri@ parameter, you can\'t use the @Words@
    -- parameter.
    CreateVocabularyFilter -> Maybe Text
vocabularyFilterFileUri :: Prelude.Maybe Prelude.Text,
    -- | The words to use in the vocabulary filter. Only use characters from the
    -- character set defined for custom vocabularies. For a list of character
    -- sets, see
    -- <https://docs.aws.amazon.com/transcribe/latest/dg/how-vocabulary.html#charsets Character Sets for Custom Vocabularies>.
    --
    -- If you provide a list of words in the @Words@ parameter, you can\'t use
    -- the @VocabularyFilterFileUri@ parameter.
    CreateVocabularyFilter -> Maybe (NonEmpty Text)
words :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | Adds one or more tags, each in the form of a key:value pair, to a new
    -- Amazon Transcribe vocabulary filter at the time you create this new
    -- vocabulary filter.
    CreateVocabularyFilter -> Maybe (NonEmpty Tag)
tags :: Prelude.Maybe (Prelude.NonEmpty Tag),
    -- | The vocabulary filter name. The name must be unique within the account
    -- that contains it. If you try to create a vocabulary filter with the same
    -- name as another vocabulary filter, you get a @ConflictException@ error.
    CreateVocabularyFilter -> Text
vocabularyFilterName :: Prelude.Text,
    -- | The language code of the words in the vocabulary filter. All words in
    -- the filter must be in the same language. The vocabulary filter can only
    -- be used with transcription jobs in the specified language.
    CreateVocabularyFilter -> LanguageCode
languageCode :: LanguageCode
  }
  deriving (CreateVocabularyFilter -> CreateVocabularyFilter -> Bool
(CreateVocabularyFilter -> CreateVocabularyFilter -> Bool)
-> (CreateVocabularyFilter -> CreateVocabularyFilter -> Bool)
-> Eq CreateVocabularyFilter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateVocabularyFilter -> CreateVocabularyFilter -> Bool
$c/= :: CreateVocabularyFilter -> CreateVocabularyFilter -> Bool
== :: CreateVocabularyFilter -> CreateVocabularyFilter -> Bool
$c== :: CreateVocabularyFilter -> CreateVocabularyFilter -> Bool
Prelude.Eq, ReadPrec [CreateVocabularyFilter]
ReadPrec CreateVocabularyFilter
Int -> ReadS CreateVocabularyFilter
ReadS [CreateVocabularyFilter]
(Int -> ReadS CreateVocabularyFilter)
-> ReadS [CreateVocabularyFilter]
-> ReadPrec CreateVocabularyFilter
-> ReadPrec [CreateVocabularyFilter]
-> Read CreateVocabularyFilter
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateVocabularyFilter]
$creadListPrec :: ReadPrec [CreateVocabularyFilter]
readPrec :: ReadPrec CreateVocabularyFilter
$creadPrec :: ReadPrec CreateVocabularyFilter
readList :: ReadS [CreateVocabularyFilter]
$creadList :: ReadS [CreateVocabularyFilter]
readsPrec :: Int -> ReadS CreateVocabularyFilter
$creadsPrec :: Int -> ReadS CreateVocabularyFilter
Prelude.Read, Int -> CreateVocabularyFilter -> ShowS
[CreateVocabularyFilter] -> ShowS
CreateVocabularyFilter -> String
(Int -> CreateVocabularyFilter -> ShowS)
-> (CreateVocabularyFilter -> String)
-> ([CreateVocabularyFilter] -> ShowS)
-> Show CreateVocabularyFilter
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateVocabularyFilter] -> ShowS
$cshowList :: [CreateVocabularyFilter] -> ShowS
show :: CreateVocabularyFilter -> String
$cshow :: CreateVocabularyFilter -> String
showsPrec :: Int -> CreateVocabularyFilter -> ShowS
$cshowsPrec :: Int -> CreateVocabularyFilter -> ShowS
Prelude.Show, (forall x. CreateVocabularyFilter -> Rep CreateVocabularyFilter x)
-> (forall x.
    Rep CreateVocabularyFilter x -> CreateVocabularyFilter)
-> Generic CreateVocabularyFilter
forall x. Rep CreateVocabularyFilter x -> CreateVocabularyFilter
forall x. CreateVocabularyFilter -> Rep CreateVocabularyFilter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateVocabularyFilter x -> CreateVocabularyFilter
$cfrom :: forall x. CreateVocabularyFilter -> Rep CreateVocabularyFilter x
Prelude.Generic)

-- |
-- Create a value of 'CreateVocabularyFilter' 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:
--
-- 'vocabularyFilterFileUri', 'createVocabularyFilter_vocabularyFilterFileUri' - The Amazon S3 location of a text file used as input to create the
-- vocabulary filter. Only use characters from the character set defined
-- for custom vocabularies. For a list of character sets, see
-- <https://docs.aws.amazon.com/transcribe/latest/dg/how-vocabulary.html#charsets Character Sets for Custom Vocabularies>.
--
-- The specified file must be less than 50 KB of UTF-8 characters.
--
-- If you provide the location of a list of words in the
-- @VocabularyFilterFileUri@ parameter, you can\'t use the @Words@
-- parameter.
--
-- 'words', 'createVocabularyFilter_words' - The words to use in the vocabulary filter. Only use characters from the
-- character set defined for custom vocabularies. For a list of character
-- sets, see
-- <https://docs.aws.amazon.com/transcribe/latest/dg/how-vocabulary.html#charsets Character Sets for Custom Vocabularies>.
--
-- If you provide a list of words in the @Words@ parameter, you can\'t use
-- the @VocabularyFilterFileUri@ parameter.
--
-- 'tags', 'createVocabularyFilter_tags' - Adds one or more tags, each in the form of a key:value pair, to a new
-- Amazon Transcribe vocabulary filter at the time you create this new
-- vocabulary filter.
--
-- 'vocabularyFilterName', 'createVocabularyFilter_vocabularyFilterName' - The vocabulary filter name. The name must be unique within the account
-- that contains it. If you try to create a vocabulary filter with the same
-- name as another vocabulary filter, you get a @ConflictException@ error.
--
-- 'languageCode', 'createVocabularyFilter_languageCode' - The language code of the words in the vocabulary filter. All words in
-- the filter must be in the same language. The vocabulary filter can only
-- be used with transcription jobs in the specified language.
newCreateVocabularyFilter ::
  -- | 'vocabularyFilterName'
  Prelude.Text ->
  -- | 'languageCode'
  LanguageCode ->
  CreateVocabularyFilter
newCreateVocabularyFilter :: Text -> LanguageCode -> CreateVocabularyFilter
newCreateVocabularyFilter
  Text
pVocabularyFilterName_
  LanguageCode
pLanguageCode_ =
    CreateVocabularyFilter' :: Maybe Text
-> Maybe (NonEmpty Text)
-> Maybe (NonEmpty Tag)
-> Text
-> LanguageCode
-> CreateVocabularyFilter
CreateVocabularyFilter'
      { $sel:vocabularyFilterFileUri:CreateVocabularyFilter' :: Maybe Text
vocabularyFilterFileUri =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:words:CreateVocabularyFilter' :: Maybe (NonEmpty Text)
words = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateVocabularyFilter' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
forall a. Maybe a
Prelude.Nothing,
        $sel:vocabularyFilterName:CreateVocabularyFilter' :: Text
vocabularyFilterName = Text
pVocabularyFilterName_,
        $sel:languageCode:CreateVocabularyFilter' :: LanguageCode
languageCode = LanguageCode
pLanguageCode_
      }

-- | The Amazon S3 location of a text file used as input to create the
-- vocabulary filter. Only use characters from the character set defined
-- for custom vocabularies. For a list of character sets, see
-- <https://docs.aws.amazon.com/transcribe/latest/dg/how-vocabulary.html#charsets Character Sets for Custom Vocabularies>.
--
-- The specified file must be less than 50 KB of UTF-8 characters.
--
-- If you provide the location of a list of words in the
-- @VocabularyFilterFileUri@ parameter, you can\'t use the @Words@
-- parameter.
createVocabularyFilter_vocabularyFilterFileUri :: Lens.Lens' CreateVocabularyFilter (Prelude.Maybe Prelude.Text)
createVocabularyFilter_vocabularyFilterFileUri :: (Maybe Text -> f (Maybe Text))
-> CreateVocabularyFilter -> f CreateVocabularyFilter
createVocabularyFilter_vocabularyFilterFileUri = (CreateVocabularyFilter -> Maybe Text)
-> (CreateVocabularyFilter -> Maybe Text -> CreateVocabularyFilter)
-> Lens
     CreateVocabularyFilter
     CreateVocabularyFilter
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVocabularyFilter' {Maybe Text
vocabularyFilterFileUri :: Maybe Text
$sel:vocabularyFilterFileUri:CreateVocabularyFilter' :: CreateVocabularyFilter -> Maybe Text
vocabularyFilterFileUri} -> Maybe Text
vocabularyFilterFileUri) (\s :: CreateVocabularyFilter
s@CreateVocabularyFilter' {} Maybe Text
a -> CreateVocabularyFilter
s {$sel:vocabularyFilterFileUri:CreateVocabularyFilter' :: Maybe Text
vocabularyFilterFileUri = Maybe Text
a} :: CreateVocabularyFilter)

-- | The words to use in the vocabulary filter. Only use characters from the
-- character set defined for custom vocabularies. For a list of character
-- sets, see
-- <https://docs.aws.amazon.com/transcribe/latest/dg/how-vocabulary.html#charsets Character Sets for Custom Vocabularies>.
--
-- If you provide a list of words in the @Words@ parameter, you can\'t use
-- the @VocabularyFilterFileUri@ parameter.
createVocabularyFilter_words :: Lens.Lens' CreateVocabularyFilter (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
createVocabularyFilter_words :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateVocabularyFilter -> f CreateVocabularyFilter
createVocabularyFilter_words = (CreateVocabularyFilter -> Maybe (NonEmpty Text))
-> (CreateVocabularyFilter
    -> Maybe (NonEmpty Text) -> CreateVocabularyFilter)
-> Lens
     CreateVocabularyFilter
     CreateVocabularyFilter
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVocabularyFilter' {Maybe (NonEmpty Text)
words :: Maybe (NonEmpty Text)
$sel:words:CreateVocabularyFilter' :: CreateVocabularyFilter -> Maybe (NonEmpty Text)
words} -> Maybe (NonEmpty Text)
words) (\s :: CreateVocabularyFilter
s@CreateVocabularyFilter' {} Maybe (NonEmpty Text)
a -> CreateVocabularyFilter
s {$sel:words:CreateVocabularyFilter' :: Maybe (NonEmpty Text)
words = Maybe (NonEmpty Text)
a} :: CreateVocabularyFilter) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> CreateVocabularyFilter -> f CreateVocabularyFilter)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateVocabularyFilter
-> f CreateVocabularyFilter
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty 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
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Adds one or more tags, each in the form of a key:value pair, to a new
-- Amazon Transcribe vocabulary filter at the time you create this new
-- vocabulary filter.
createVocabularyFilter_tags :: Lens.Lens' CreateVocabularyFilter (Prelude.Maybe (Prelude.NonEmpty Tag))
createVocabularyFilter_tags :: (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateVocabularyFilter -> f CreateVocabularyFilter
createVocabularyFilter_tags = (CreateVocabularyFilter -> Maybe (NonEmpty Tag))
-> (CreateVocabularyFilter
    -> Maybe (NonEmpty Tag) -> CreateVocabularyFilter)
-> Lens
     CreateVocabularyFilter
     CreateVocabularyFilter
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVocabularyFilter' {Maybe (NonEmpty Tag)
tags :: Maybe (NonEmpty Tag)
$sel:tags:CreateVocabularyFilter' :: CreateVocabularyFilter -> Maybe (NonEmpty Tag)
tags} -> Maybe (NonEmpty Tag)
tags) (\s :: CreateVocabularyFilter
s@CreateVocabularyFilter' {} Maybe (NonEmpty Tag)
a -> CreateVocabularyFilter
s {$sel:tags:CreateVocabularyFilter' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
a} :: CreateVocabularyFilter) ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
 -> CreateVocabularyFilter -> f CreateVocabularyFilter)
-> ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
    -> Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateVocabularyFilter
-> f CreateVocabularyFilter
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag)
-> Iso
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
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 Tag) (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The vocabulary filter name. The name must be unique within the account
-- that contains it. If you try to create a vocabulary filter with the same
-- name as another vocabulary filter, you get a @ConflictException@ error.
createVocabularyFilter_vocabularyFilterName :: Lens.Lens' CreateVocabularyFilter Prelude.Text
createVocabularyFilter_vocabularyFilterName :: (Text -> f Text)
-> CreateVocabularyFilter -> f CreateVocabularyFilter
createVocabularyFilter_vocabularyFilterName = (CreateVocabularyFilter -> Text)
-> (CreateVocabularyFilter -> Text -> CreateVocabularyFilter)
-> Lens CreateVocabularyFilter CreateVocabularyFilter Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVocabularyFilter' {Text
vocabularyFilterName :: Text
$sel:vocabularyFilterName:CreateVocabularyFilter' :: CreateVocabularyFilter -> Text
vocabularyFilterName} -> Text
vocabularyFilterName) (\s :: CreateVocabularyFilter
s@CreateVocabularyFilter' {} Text
a -> CreateVocabularyFilter
s {$sel:vocabularyFilterName:CreateVocabularyFilter' :: Text
vocabularyFilterName = Text
a} :: CreateVocabularyFilter)

-- | The language code of the words in the vocabulary filter. All words in
-- the filter must be in the same language. The vocabulary filter can only
-- be used with transcription jobs in the specified language.
createVocabularyFilter_languageCode :: Lens.Lens' CreateVocabularyFilter LanguageCode
createVocabularyFilter_languageCode :: (LanguageCode -> f LanguageCode)
-> CreateVocabularyFilter -> f CreateVocabularyFilter
createVocabularyFilter_languageCode = (CreateVocabularyFilter -> LanguageCode)
-> (CreateVocabularyFilter
    -> LanguageCode -> CreateVocabularyFilter)
-> Lens
     CreateVocabularyFilter
     CreateVocabularyFilter
     LanguageCode
     LanguageCode
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVocabularyFilter' {LanguageCode
languageCode :: LanguageCode
$sel:languageCode:CreateVocabularyFilter' :: CreateVocabularyFilter -> LanguageCode
languageCode} -> LanguageCode
languageCode) (\s :: CreateVocabularyFilter
s@CreateVocabularyFilter' {} LanguageCode
a -> CreateVocabularyFilter
s {$sel:languageCode:CreateVocabularyFilter' :: LanguageCode
languageCode = LanguageCode
a} :: CreateVocabularyFilter)

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

instance Prelude.NFData CreateVocabularyFilter

instance Core.ToHeaders CreateVocabularyFilter where
  toHeaders :: CreateVocabularyFilter -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateVocabularyFilter -> 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.CreateVocabularyFilter" ::
                          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 CreateVocabularyFilter where
  toJSON :: CreateVocabularyFilter -> Value
toJSON CreateVocabularyFilter' {Maybe (NonEmpty Text)
Maybe (NonEmpty Tag)
Maybe Text
Text
LanguageCode
languageCode :: LanguageCode
vocabularyFilterName :: Text
tags :: Maybe (NonEmpty Tag)
words :: Maybe (NonEmpty Text)
vocabularyFilterFileUri :: Maybe Text
$sel:languageCode:CreateVocabularyFilter' :: CreateVocabularyFilter -> LanguageCode
$sel:vocabularyFilterName:CreateVocabularyFilter' :: CreateVocabularyFilter -> Text
$sel:tags:CreateVocabularyFilter' :: CreateVocabularyFilter -> Maybe (NonEmpty Tag)
$sel:words:CreateVocabularyFilter' :: CreateVocabularyFilter -> Maybe (NonEmpty Text)
$sel:vocabularyFilterFileUri:CreateVocabularyFilter' :: CreateVocabularyFilter -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"VocabularyFilterFileUri" 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
vocabularyFilterFileUri,
            (Text
"Words" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
words,
            (Text
"Tags" Text -> NonEmpty Tag -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty Tag -> Pair) -> Maybe (NonEmpty Tag) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Tag)
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"VocabularyFilterName"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
vocabularyFilterName
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"LanguageCode" Text -> LanguageCode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= LanguageCode
languageCode)
          ]
      )

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

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

-- | /See:/ 'newCreateVocabularyFilterResponse' smart constructor.
data CreateVocabularyFilterResponse = CreateVocabularyFilterResponse'
  { -- | The language code of the words in the collection.
    CreateVocabularyFilterResponse -> Maybe LanguageCode
languageCode :: Prelude.Maybe LanguageCode,
    -- | The date and time that the vocabulary filter was modified.
    CreateVocabularyFilterResponse -> Maybe POSIX
lastModifiedTime :: Prelude.Maybe Core.POSIX,
    -- | The name of the vocabulary filter.
    CreateVocabularyFilterResponse -> Maybe Text
vocabularyFilterName :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateVocabularyFilterResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateVocabularyFilterResponse
-> CreateVocabularyFilterResponse -> Bool
(CreateVocabularyFilterResponse
 -> CreateVocabularyFilterResponse -> Bool)
-> (CreateVocabularyFilterResponse
    -> CreateVocabularyFilterResponse -> Bool)
-> Eq CreateVocabularyFilterResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateVocabularyFilterResponse
-> CreateVocabularyFilterResponse -> Bool
$c/= :: CreateVocabularyFilterResponse
-> CreateVocabularyFilterResponse -> Bool
== :: CreateVocabularyFilterResponse
-> CreateVocabularyFilterResponse -> Bool
$c== :: CreateVocabularyFilterResponse
-> CreateVocabularyFilterResponse -> Bool
Prelude.Eq, ReadPrec [CreateVocabularyFilterResponse]
ReadPrec CreateVocabularyFilterResponse
Int -> ReadS CreateVocabularyFilterResponse
ReadS [CreateVocabularyFilterResponse]
(Int -> ReadS CreateVocabularyFilterResponse)
-> ReadS [CreateVocabularyFilterResponse]
-> ReadPrec CreateVocabularyFilterResponse
-> ReadPrec [CreateVocabularyFilterResponse]
-> Read CreateVocabularyFilterResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateVocabularyFilterResponse]
$creadListPrec :: ReadPrec [CreateVocabularyFilterResponse]
readPrec :: ReadPrec CreateVocabularyFilterResponse
$creadPrec :: ReadPrec CreateVocabularyFilterResponse
readList :: ReadS [CreateVocabularyFilterResponse]
$creadList :: ReadS [CreateVocabularyFilterResponse]
readsPrec :: Int -> ReadS CreateVocabularyFilterResponse
$creadsPrec :: Int -> ReadS CreateVocabularyFilterResponse
Prelude.Read, Int -> CreateVocabularyFilterResponse -> ShowS
[CreateVocabularyFilterResponse] -> ShowS
CreateVocabularyFilterResponse -> String
(Int -> CreateVocabularyFilterResponse -> ShowS)
-> (CreateVocabularyFilterResponse -> String)
-> ([CreateVocabularyFilterResponse] -> ShowS)
-> Show CreateVocabularyFilterResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateVocabularyFilterResponse] -> ShowS
$cshowList :: [CreateVocabularyFilterResponse] -> ShowS
show :: CreateVocabularyFilterResponse -> String
$cshow :: CreateVocabularyFilterResponse -> String
showsPrec :: Int -> CreateVocabularyFilterResponse -> ShowS
$cshowsPrec :: Int -> CreateVocabularyFilterResponse -> ShowS
Prelude.Show, (forall x.
 CreateVocabularyFilterResponse
 -> Rep CreateVocabularyFilterResponse x)
-> (forall x.
    Rep CreateVocabularyFilterResponse x
    -> CreateVocabularyFilterResponse)
-> Generic CreateVocabularyFilterResponse
forall x.
Rep CreateVocabularyFilterResponse x
-> CreateVocabularyFilterResponse
forall x.
CreateVocabularyFilterResponse
-> Rep CreateVocabularyFilterResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateVocabularyFilterResponse x
-> CreateVocabularyFilterResponse
$cfrom :: forall x.
CreateVocabularyFilterResponse
-> Rep CreateVocabularyFilterResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateVocabularyFilterResponse' 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:
--
-- 'languageCode', 'createVocabularyFilterResponse_languageCode' - The language code of the words in the collection.
--
-- 'lastModifiedTime', 'createVocabularyFilterResponse_lastModifiedTime' - The date and time that the vocabulary filter was modified.
--
-- 'vocabularyFilterName', 'createVocabularyFilterResponse_vocabularyFilterName' - The name of the vocabulary filter.
--
-- 'httpStatus', 'createVocabularyFilterResponse_httpStatus' - The response's http status code.
newCreateVocabularyFilterResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateVocabularyFilterResponse
newCreateVocabularyFilterResponse :: Int -> CreateVocabularyFilterResponse
newCreateVocabularyFilterResponse Int
pHttpStatus_ =
  CreateVocabularyFilterResponse' :: Maybe LanguageCode
-> Maybe POSIX
-> Maybe Text
-> Int
-> CreateVocabularyFilterResponse
CreateVocabularyFilterResponse'
    { $sel:languageCode:CreateVocabularyFilterResponse' :: Maybe LanguageCode
languageCode =
        Maybe LanguageCode
forall a. Maybe a
Prelude.Nothing,
      $sel:lastModifiedTime:CreateVocabularyFilterResponse' :: Maybe POSIX
lastModifiedTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:vocabularyFilterName:CreateVocabularyFilterResponse' :: Maybe Text
vocabularyFilterName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateVocabularyFilterResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The language code of the words in the collection.
createVocabularyFilterResponse_languageCode :: Lens.Lens' CreateVocabularyFilterResponse (Prelude.Maybe LanguageCode)
createVocabularyFilterResponse_languageCode :: (Maybe LanguageCode -> f (Maybe LanguageCode))
-> CreateVocabularyFilterResponse
-> f CreateVocabularyFilterResponse
createVocabularyFilterResponse_languageCode = (CreateVocabularyFilterResponse -> Maybe LanguageCode)
-> (CreateVocabularyFilterResponse
    -> Maybe LanguageCode -> CreateVocabularyFilterResponse)
-> Lens
     CreateVocabularyFilterResponse
     CreateVocabularyFilterResponse
     (Maybe LanguageCode)
     (Maybe LanguageCode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVocabularyFilterResponse' {Maybe LanguageCode
languageCode :: Maybe LanguageCode
$sel:languageCode:CreateVocabularyFilterResponse' :: CreateVocabularyFilterResponse -> Maybe LanguageCode
languageCode} -> Maybe LanguageCode
languageCode) (\s :: CreateVocabularyFilterResponse
s@CreateVocabularyFilterResponse' {} Maybe LanguageCode
a -> CreateVocabularyFilterResponse
s {$sel:languageCode:CreateVocabularyFilterResponse' :: Maybe LanguageCode
languageCode = Maybe LanguageCode
a} :: CreateVocabularyFilterResponse)

-- | The date and time that the vocabulary filter was modified.
createVocabularyFilterResponse_lastModifiedTime :: Lens.Lens' CreateVocabularyFilterResponse (Prelude.Maybe Prelude.UTCTime)
createVocabularyFilterResponse_lastModifiedTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateVocabularyFilterResponse
-> f CreateVocabularyFilterResponse
createVocabularyFilterResponse_lastModifiedTime = (CreateVocabularyFilterResponse -> Maybe POSIX)
-> (CreateVocabularyFilterResponse
    -> Maybe POSIX -> CreateVocabularyFilterResponse)
-> Lens
     CreateVocabularyFilterResponse
     CreateVocabularyFilterResponse
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVocabularyFilterResponse' {Maybe POSIX
lastModifiedTime :: Maybe POSIX
$sel:lastModifiedTime:CreateVocabularyFilterResponse' :: CreateVocabularyFilterResponse -> Maybe POSIX
lastModifiedTime} -> Maybe POSIX
lastModifiedTime) (\s :: CreateVocabularyFilterResponse
s@CreateVocabularyFilterResponse' {} Maybe POSIX
a -> CreateVocabularyFilterResponse
s {$sel:lastModifiedTime:CreateVocabularyFilterResponse' :: Maybe POSIX
lastModifiedTime = Maybe POSIX
a} :: CreateVocabularyFilterResponse) ((Maybe POSIX -> f (Maybe POSIX))
 -> CreateVocabularyFilterResponse
 -> f CreateVocabularyFilterResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateVocabularyFilterResponse
-> f CreateVocabularyFilterResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The name of the vocabulary filter.
createVocabularyFilterResponse_vocabularyFilterName :: Lens.Lens' CreateVocabularyFilterResponse (Prelude.Maybe Prelude.Text)
createVocabularyFilterResponse_vocabularyFilterName :: (Maybe Text -> f (Maybe Text))
-> CreateVocabularyFilterResponse
-> f CreateVocabularyFilterResponse
createVocabularyFilterResponse_vocabularyFilterName = (CreateVocabularyFilterResponse -> Maybe Text)
-> (CreateVocabularyFilterResponse
    -> Maybe Text -> CreateVocabularyFilterResponse)
-> Lens
     CreateVocabularyFilterResponse
     CreateVocabularyFilterResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVocabularyFilterResponse' {Maybe Text
vocabularyFilterName :: Maybe Text
$sel:vocabularyFilterName:CreateVocabularyFilterResponse' :: CreateVocabularyFilterResponse -> Maybe Text
vocabularyFilterName} -> Maybe Text
vocabularyFilterName) (\s :: CreateVocabularyFilterResponse
s@CreateVocabularyFilterResponse' {} Maybe Text
a -> CreateVocabularyFilterResponse
s {$sel:vocabularyFilterName:CreateVocabularyFilterResponse' :: Maybe Text
vocabularyFilterName = Maybe Text
a} :: CreateVocabularyFilterResponse)

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

instance
  Prelude.NFData
    CreateVocabularyFilterResponse