{-# 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.CreateMedicalVocabulary
-- 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 custom vocabulary that you can use to modify how Amazon
-- Transcribe Medical transcribes your audio file.
module Amazonka.Transcribe.CreateMedicalVocabulary
  ( -- * Creating a Request
    CreateMedicalVocabulary (..),
    newCreateMedicalVocabulary,

    -- * Request Lenses
    createMedicalVocabulary_tags,
    createMedicalVocabulary_vocabularyName,
    createMedicalVocabulary_languageCode,
    createMedicalVocabulary_vocabularyFileUri,

    -- * Destructuring the Response
    CreateMedicalVocabularyResponse (..),
    newCreateMedicalVocabularyResponse,

    -- * Response Lenses
    createMedicalVocabularyResponse_failureReason,
    createMedicalVocabularyResponse_languageCode,
    createMedicalVocabularyResponse_vocabularyName,
    createMedicalVocabularyResponse_lastModifiedTime,
    createMedicalVocabularyResponse_vocabularyState,
    createMedicalVocabularyResponse_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:/ 'newCreateMedicalVocabulary' smart constructor.
data CreateMedicalVocabulary = CreateMedicalVocabulary'
  { -- | Adds one or more tags, each in the form of a key:value pair, to a new
    -- medical vocabulary at the time you create this new vocabulary.
    CreateMedicalVocabulary -> Maybe (NonEmpty Tag)
tags :: Prelude.Maybe (Prelude.NonEmpty Tag),
    -- | The name of the custom vocabulary. This case-sensitive name must be
    -- unique within an Amazon Web Services account. If you try to create a
    -- vocabulary with the same name as a previous vocabulary, you get a
    -- @ConflictException@ error.
    CreateMedicalVocabulary -> Text
vocabularyName :: Prelude.Text,
    -- | The language code for the language used for the entries in your custom
    -- vocabulary. The language code of your custom vocabulary must match the
    -- language code of your transcription job. US English (en-US) is the only
    -- language code available for Amazon Transcribe Medical.
    CreateMedicalVocabulary -> LanguageCode
languageCode :: LanguageCode,
    -- | The location in Amazon S3 of the text file you use to define your custom
    -- vocabulary. The URI must be in the same Amazon Web Services Region as
    -- the resource that you\'re calling. Enter information about your
    -- @VocabularyFileUri@ in the following format:
    --
    -- @ https:\/\/s3.\<aws-region>.amazonaws.com\/\<bucket-name>\/\<keyprefix>\/\<objectkey> @
    --
    -- The following is an example URI for a vocabulary file that is stored in
    -- Amazon S3:
    --
    -- @https:\/\/s3.us-east-1.amazonaws.com\/AWSDOC-EXAMPLE-BUCKET\/vocab.txt@
    --
    -- For more information about Amazon S3 object names, see
    -- <https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html#object-keys Object Keys>
    -- in the /Amazon S3 Developer Guide/.
    --
    -- For more information about custom vocabularies, see
    -- <https://docs.aws.amazon.com/transcribe/latest/dg/how-it-works.html#how-vocabulary-med Medical Custom Vocabularies>.
    CreateMedicalVocabulary -> Text
vocabularyFileUri :: Prelude.Text
  }
  deriving (CreateMedicalVocabulary -> CreateMedicalVocabulary -> Bool
(CreateMedicalVocabulary -> CreateMedicalVocabulary -> Bool)
-> (CreateMedicalVocabulary -> CreateMedicalVocabulary -> Bool)
-> Eq CreateMedicalVocabulary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateMedicalVocabulary -> CreateMedicalVocabulary -> Bool
$c/= :: CreateMedicalVocabulary -> CreateMedicalVocabulary -> Bool
== :: CreateMedicalVocabulary -> CreateMedicalVocabulary -> Bool
$c== :: CreateMedicalVocabulary -> CreateMedicalVocabulary -> Bool
Prelude.Eq, ReadPrec [CreateMedicalVocabulary]
ReadPrec CreateMedicalVocabulary
Int -> ReadS CreateMedicalVocabulary
ReadS [CreateMedicalVocabulary]
(Int -> ReadS CreateMedicalVocabulary)
-> ReadS [CreateMedicalVocabulary]
-> ReadPrec CreateMedicalVocabulary
-> ReadPrec [CreateMedicalVocabulary]
-> Read CreateMedicalVocabulary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateMedicalVocabulary]
$creadListPrec :: ReadPrec [CreateMedicalVocabulary]
readPrec :: ReadPrec CreateMedicalVocabulary
$creadPrec :: ReadPrec CreateMedicalVocabulary
readList :: ReadS [CreateMedicalVocabulary]
$creadList :: ReadS [CreateMedicalVocabulary]
readsPrec :: Int -> ReadS CreateMedicalVocabulary
$creadsPrec :: Int -> ReadS CreateMedicalVocabulary
Prelude.Read, Int -> CreateMedicalVocabulary -> ShowS
[CreateMedicalVocabulary] -> ShowS
CreateMedicalVocabulary -> String
(Int -> CreateMedicalVocabulary -> ShowS)
-> (CreateMedicalVocabulary -> String)
-> ([CreateMedicalVocabulary] -> ShowS)
-> Show CreateMedicalVocabulary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateMedicalVocabulary] -> ShowS
$cshowList :: [CreateMedicalVocabulary] -> ShowS
show :: CreateMedicalVocabulary -> String
$cshow :: CreateMedicalVocabulary -> String
showsPrec :: Int -> CreateMedicalVocabulary -> ShowS
$cshowsPrec :: Int -> CreateMedicalVocabulary -> ShowS
Prelude.Show, (forall x.
 CreateMedicalVocabulary -> Rep CreateMedicalVocabulary x)
-> (forall x.
    Rep CreateMedicalVocabulary x -> CreateMedicalVocabulary)
-> Generic CreateMedicalVocabulary
forall x. Rep CreateMedicalVocabulary x -> CreateMedicalVocabulary
forall x. CreateMedicalVocabulary -> Rep CreateMedicalVocabulary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateMedicalVocabulary x -> CreateMedicalVocabulary
$cfrom :: forall x. CreateMedicalVocabulary -> Rep CreateMedicalVocabulary x
Prelude.Generic)

-- |
-- Create a value of 'CreateMedicalVocabulary' 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:
--
-- 'tags', 'createMedicalVocabulary_tags' - Adds one or more tags, each in the form of a key:value pair, to a new
-- medical vocabulary at the time you create this new vocabulary.
--
-- 'vocabularyName', 'createMedicalVocabulary_vocabularyName' - The name of the custom vocabulary. This case-sensitive name must be
-- unique within an Amazon Web Services account. If you try to create a
-- vocabulary with the same name as a previous vocabulary, you get a
-- @ConflictException@ error.
--
-- 'languageCode', 'createMedicalVocabulary_languageCode' - The language code for the language used for the entries in your custom
-- vocabulary. The language code of your custom vocabulary must match the
-- language code of your transcription job. US English (en-US) is the only
-- language code available for Amazon Transcribe Medical.
--
-- 'vocabularyFileUri', 'createMedicalVocabulary_vocabularyFileUri' - The location in Amazon S3 of the text file you use to define your custom
-- vocabulary. The URI must be in the same Amazon Web Services Region as
-- the resource that you\'re calling. Enter information about your
-- @VocabularyFileUri@ in the following format:
--
-- @ https:\/\/s3.\<aws-region>.amazonaws.com\/\<bucket-name>\/\<keyprefix>\/\<objectkey> @
--
-- The following is an example URI for a vocabulary file that is stored in
-- Amazon S3:
--
-- @https:\/\/s3.us-east-1.amazonaws.com\/AWSDOC-EXAMPLE-BUCKET\/vocab.txt@
--
-- For more information about Amazon S3 object names, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html#object-keys Object Keys>
-- in the /Amazon S3 Developer Guide/.
--
-- For more information about custom vocabularies, see
-- <https://docs.aws.amazon.com/transcribe/latest/dg/how-it-works.html#how-vocabulary-med Medical Custom Vocabularies>.
newCreateMedicalVocabulary ::
  -- | 'vocabularyName'
  Prelude.Text ->
  -- | 'languageCode'
  LanguageCode ->
  -- | 'vocabularyFileUri'
  Prelude.Text ->
  CreateMedicalVocabulary
newCreateMedicalVocabulary :: Text -> LanguageCode -> Text -> CreateMedicalVocabulary
newCreateMedicalVocabulary
  Text
pVocabularyName_
  LanguageCode
pLanguageCode_
  Text
pVocabularyFileUri_ =
    CreateMedicalVocabulary' :: Maybe (NonEmpty Tag)
-> Text -> LanguageCode -> Text -> CreateMedicalVocabulary
CreateMedicalVocabulary'
      { $sel:tags:CreateMedicalVocabulary' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
forall a. Maybe a
Prelude.Nothing,
        $sel:vocabularyName:CreateMedicalVocabulary' :: Text
vocabularyName = Text
pVocabularyName_,
        $sel:languageCode:CreateMedicalVocabulary' :: LanguageCode
languageCode = LanguageCode
pLanguageCode_,
        $sel:vocabularyFileUri:CreateMedicalVocabulary' :: Text
vocabularyFileUri = Text
pVocabularyFileUri_
      }

-- | Adds one or more tags, each in the form of a key:value pair, to a new
-- medical vocabulary at the time you create this new vocabulary.
createMedicalVocabulary_tags :: Lens.Lens' CreateMedicalVocabulary (Prelude.Maybe (Prelude.NonEmpty Tag))
createMedicalVocabulary_tags :: (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateMedicalVocabulary -> f CreateMedicalVocabulary
createMedicalVocabulary_tags = (CreateMedicalVocabulary -> Maybe (NonEmpty Tag))
-> (CreateMedicalVocabulary
    -> Maybe (NonEmpty Tag) -> CreateMedicalVocabulary)
-> Lens
     CreateMedicalVocabulary
     CreateMedicalVocabulary
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMedicalVocabulary' {Maybe (NonEmpty Tag)
tags :: Maybe (NonEmpty Tag)
$sel:tags:CreateMedicalVocabulary' :: CreateMedicalVocabulary -> Maybe (NonEmpty Tag)
tags} -> Maybe (NonEmpty Tag)
tags) (\s :: CreateMedicalVocabulary
s@CreateMedicalVocabulary' {} Maybe (NonEmpty Tag)
a -> CreateMedicalVocabulary
s {$sel:tags:CreateMedicalVocabulary' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
a} :: CreateMedicalVocabulary) ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
 -> CreateMedicalVocabulary -> f CreateMedicalVocabulary)
-> ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
    -> Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateMedicalVocabulary
-> f CreateMedicalVocabulary
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 name of the custom vocabulary. This case-sensitive name must be
-- unique within an Amazon Web Services account. If you try to create a
-- vocabulary with the same name as a previous vocabulary, you get a
-- @ConflictException@ error.
createMedicalVocabulary_vocabularyName :: Lens.Lens' CreateMedicalVocabulary Prelude.Text
createMedicalVocabulary_vocabularyName :: (Text -> f Text)
-> CreateMedicalVocabulary -> f CreateMedicalVocabulary
createMedicalVocabulary_vocabularyName = (CreateMedicalVocabulary -> Text)
-> (CreateMedicalVocabulary -> Text -> CreateMedicalVocabulary)
-> Lens CreateMedicalVocabulary CreateMedicalVocabulary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMedicalVocabulary' {Text
vocabularyName :: Text
$sel:vocabularyName:CreateMedicalVocabulary' :: CreateMedicalVocabulary -> Text
vocabularyName} -> Text
vocabularyName) (\s :: CreateMedicalVocabulary
s@CreateMedicalVocabulary' {} Text
a -> CreateMedicalVocabulary
s {$sel:vocabularyName:CreateMedicalVocabulary' :: Text
vocabularyName = Text
a} :: CreateMedicalVocabulary)

-- | The language code for the language used for the entries in your custom
-- vocabulary. The language code of your custom vocabulary must match the
-- language code of your transcription job. US English (en-US) is the only
-- language code available for Amazon Transcribe Medical.
createMedicalVocabulary_languageCode :: Lens.Lens' CreateMedicalVocabulary LanguageCode
createMedicalVocabulary_languageCode :: (LanguageCode -> f LanguageCode)
-> CreateMedicalVocabulary -> f CreateMedicalVocabulary
createMedicalVocabulary_languageCode = (CreateMedicalVocabulary -> LanguageCode)
-> (CreateMedicalVocabulary
    -> LanguageCode -> CreateMedicalVocabulary)
-> Lens
     CreateMedicalVocabulary
     CreateMedicalVocabulary
     LanguageCode
     LanguageCode
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMedicalVocabulary' {LanguageCode
languageCode :: LanguageCode
$sel:languageCode:CreateMedicalVocabulary' :: CreateMedicalVocabulary -> LanguageCode
languageCode} -> LanguageCode
languageCode) (\s :: CreateMedicalVocabulary
s@CreateMedicalVocabulary' {} LanguageCode
a -> CreateMedicalVocabulary
s {$sel:languageCode:CreateMedicalVocabulary' :: LanguageCode
languageCode = LanguageCode
a} :: CreateMedicalVocabulary)

-- | The location in Amazon S3 of the text file you use to define your custom
-- vocabulary. The URI must be in the same Amazon Web Services Region as
-- the resource that you\'re calling. Enter information about your
-- @VocabularyFileUri@ in the following format:
--
-- @ https:\/\/s3.\<aws-region>.amazonaws.com\/\<bucket-name>\/\<keyprefix>\/\<objectkey> @
--
-- The following is an example URI for a vocabulary file that is stored in
-- Amazon S3:
--
-- @https:\/\/s3.us-east-1.amazonaws.com\/AWSDOC-EXAMPLE-BUCKET\/vocab.txt@
--
-- For more information about Amazon S3 object names, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html#object-keys Object Keys>
-- in the /Amazon S3 Developer Guide/.
--
-- For more information about custom vocabularies, see
-- <https://docs.aws.amazon.com/transcribe/latest/dg/how-it-works.html#how-vocabulary-med Medical Custom Vocabularies>.
createMedicalVocabulary_vocabularyFileUri :: Lens.Lens' CreateMedicalVocabulary Prelude.Text
createMedicalVocabulary_vocabularyFileUri :: (Text -> f Text)
-> CreateMedicalVocabulary -> f CreateMedicalVocabulary
createMedicalVocabulary_vocabularyFileUri = (CreateMedicalVocabulary -> Text)
-> (CreateMedicalVocabulary -> Text -> CreateMedicalVocabulary)
-> Lens CreateMedicalVocabulary CreateMedicalVocabulary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMedicalVocabulary' {Text
vocabularyFileUri :: Text
$sel:vocabularyFileUri:CreateMedicalVocabulary' :: CreateMedicalVocabulary -> Text
vocabularyFileUri} -> Text
vocabularyFileUri) (\s :: CreateMedicalVocabulary
s@CreateMedicalVocabulary' {} Text
a -> CreateMedicalVocabulary
s {$sel:vocabularyFileUri:CreateMedicalVocabulary' :: Text
vocabularyFileUri = Text
a} :: CreateMedicalVocabulary)

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

instance Prelude.NFData CreateMedicalVocabulary

instance Core.ToHeaders CreateMedicalVocabulary where
  toHeaders :: CreateMedicalVocabulary -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateMedicalVocabulary -> 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.CreateMedicalVocabulary" ::
                          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 CreateMedicalVocabulary where
  toJSON :: CreateMedicalVocabulary -> Value
toJSON CreateMedicalVocabulary' {Maybe (NonEmpty Tag)
Text
LanguageCode
vocabularyFileUri :: Text
languageCode :: LanguageCode
vocabularyName :: Text
tags :: Maybe (NonEmpty Tag)
$sel:vocabularyFileUri:CreateMedicalVocabulary' :: CreateMedicalVocabulary -> Text
$sel:languageCode:CreateMedicalVocabulary' :: CreateMedicalVocabulary -> LanguageCode
$sel:vocabularyName:CreateMedicalVocabulary' :: CreateMedicalVocabulary -> Text
$sel:tags:CreateMedicalVocabulary' :: CreateMedicalVocabulary -> Maybe (NonEmpty Tag)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (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
"VocabularyName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
vocabularyName),
            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),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"VocabularyFileUri" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
vocabularyFileUri)
          ]
      )

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

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

-- | /See:/ 'newCreateMedicalVocabularyResponse' smart constructor.
data CreateMedicalVocabularyResponse = CreateMedicalVocabularyResponse'
  { -- | If the @VocabularyState@ field is @FAILED@, this field contains
    -- information about why the job failed.
    CreateMedicalVocabularyResponse -> Maybe Text
failureReason :: Prelude.Maybe Prelude.Text,
    -- | The language code for the entries in your custom vocabulary. US English
    -- (en-US) is the only valid language code for Amazon Transcribe Medical.
    CreateMedicalVocabularyResponse -> Maybe LanguageCode
languageCode :: Prelude.Maybe LanguageCode,
    -- | The name of the vocabulary. The name must be unique within an Amazon Web
    -- Services account and is case sensitive.
    CreateMedicalVocabularyResponse -> Maybe Text
vocabularyName :: Prelude.Maybe Prelude.Text,
    -- | The date and time that you created the vocabulary.
    CreateMedicalVocabularyResponse -> Maybe POSIX
lastModifiedTime :: Prelude.Maybe Core.POSIX,
    -- | The processing state of your custom vocabulary in Amazon Transcribe
    -- Medical. If the state is @READY@, you can use the vocabulary in a
    -- @StartMedicalTranscriptionJob@ request.
    CreateMedicalVocabularyResponse -> Maybe VocabularyState
vocabularyState :: Prelude.Maybe VocabularyState,
    -- | The response's http status code.
    CreateMedicalVocabularyResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateMedicalVocabularyResponse
-> CreateMedicalVocabularyResponse -> Bool
(CreateMedicalVocabularyResponse
 -> CreateMedicalVocabularyResponse -> Bool)
-> (CreateMedicalVocabularyResponse
    -> CreateMedicalVocabularyResponse -> Bool)
-> Eq CreateMedicalVocabularyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateMedicalVocabularyResponse
-> CreateMedicalVocabularyResponse -> Bool
$c/= :: CreateMedicalVocabularyResponse
-> CreateMedicalVocabularyResponse -> Bool
== :: CreateMedicalVocabularyResponse
-> CreateMedicalVocabularyResponse -> Bool
$c== :: CreateMedicalVocabularyResponse
-> CreateMedicalVocabularyResponse -> Bool
Prelude.Eq, ReadPrec [CreateMedicalVocabularyResponse]
ReadPrec CreateMedicalVocabularyResponse
Int -> ReadS CreateMedicalVocabularyResponse
ReadS [CreateMedicalVocabularyResponse]
(Int -> ReadS CreateMedicalVocabularyResponse)
-> ReadS [CreateMedicalVocabularyResponse]
-> ReadPrec CreateMedicalVocabularyResponse
-> ReadPrec [CreateMedicalVocabularyResponse]
-> Read CreateMedicalVocabularyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateMedicalVocabularyResponse]
$creadListPrec :: ReadPrec [CreateMedicalVocabularyResponse]
readPrec :: ReadPrec CreateMedicalVocabularyResponse
$creadPrec :: ReadPrec CreateMedicalVocabularyResponse
readList :: ReadS [CreateMedicalVocabularyResponse]
$creadList :: ReadS [CreateMedicalVocabularyResponse]
readsPrec :: Int -> ReadS CreateMedicalVocabularyResponse
$creadsPrec :: Int -> ReadS CreateMedicalVocabularyResponse
Prelude.Read, Int -> CreateMedicalVocabularyResponse -> ShowS
[CreateMedicalVocabularyResponse] -> ShowS
CreateMedicalVocabularyResponse -> String
(Int -> CreateMedicalVocabularyResponse -> ShowS)
-> (CreateMedicalVocabularyResponse -> String)
-> ([CreateMedicalVocabularyResponse] -> ShowS)
-> Show CreateMedicalVocabularyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateMedicalVocabularyResponse] -> ShowS
$cshowList :: [CreateMedicalVocabularyResponse] -> ShowS
show :: CreateMedicalVocabularyResponse -> String
$cshow :: CreateMedicalVocabularyResponse -> String
showsPrec :: Int -> CreateMedicalVocabularyResponse -> ShowS
$cshowsPrec :: Int -> CreateMedicalVocabularyResponse -> ShowS
Prelude.Show, (forall x.
 CreateMedicalVocabularyResponse
 -> Rep CreateMedicalVocabularyResponse x)
-> (forall x.
    Rep CreateMedicalVocabularyResponse x
    -> CreateMedicalVocabularyResponse)
-> Generic CreateMedicalVocabularyResponse
forall x.
Rep CreateMedicalVocabularyResponse x
-> CreateMedicalVocabularyResponse
forall x.
CreateMedicalVocabularyResponse
-> Rep CreateMedicalVocabularyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateMedicalVocabularyResponse x
-> CreateMedicalVocabularyResponse
$cfrom :: forall x.
CreateMedicalVocabularyResponse
-> Rep CreateMedicalVocabularyResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateMedicalVocabularyResponse' 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', 'createMedicalVocabularyResponse_failureReason' - If the @VocabularyState@ field is @FAILED@, this field contains
-- information about why the job failed.
--
-- 'languageCode', 'createMedicalVocabularyResponse_languageCode' - The language code for the entries in your custom vocabulary. US English
-- (en-US) is the only valid language code for Amazon Transcribe Medical.
--
-- 'vocabularyName', 'createMedicalVocabularyResponse_vocabularyName' - The name of the vocabulary. The name must be unique within an Amazon Web
-- Services account and is case sensitive.
--
-- 'lastModifiedTime', 'createMedicalVocabularyResponse_lastModifiedTime' - The date and time that you created the vocabulary.
--
-- 'vocabularyState', 'createMedicalVocabularyResponse_vocabularyState' - The processing state of your custom vocabulary in Amazon Transcribe
-- Medical. If the state is @READY@, you can use the vocabulary in a
-- @StartMedicalTranscriptionJob@ request.
--
-- 'httpStatus', 'createMedicalVocabularyResponse_httpStatus' - The response's http status code.
newCreateMedicalVocabularyResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateMedicalVocabularyResponse
newCreateMedicalVocabularyResponse :: Int -> CreateMedicalVocabularyResponse
newCreateMedicalVocabularyResponse Int
pHttpStatus_ =
  CreateMedicalVocabularyResponse' :: Maybe Text
-> Maybe LanguageCode
-> Maybe Text
-> Maybe POSIX
-> Maybe VocabularyState
-> Int
-> CreateMedicalVocabularyResponse
CreateMedicalVocabularyResponse'
    { $sel:failureReason:CreateMedicalVocabularyResponse' :: Maybe Text
failureReason =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:languageCode:CreateMedicalVocabularyResponse' :: Maybe LanguageCode
languageCode = Maybe LanguageCode
forall a. Maybe a
Prelude.Nothing,
      $sel:vocabularyName:CreateMedicalVocabularyResponse' :: Maybe Text
vocabularyName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastModifiedTime:CreateMedicalVocabularyResponse' :: Maybe POSIX
lastModifiedTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:vocabularyState:CreateMedicalVocabularyResponse' :: Maybe VocabularyState
vocabularyState = Maybe VocabularyState
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateMedicalVocabularyResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | If the @VocabularyState@ field is @FAILED@, this field contains
-- information about why the job failed.
createMedicalVocabularyResponse_failureReason :: Lens.Lens' CreateMedicalVocabularyResponse (Prelude.Maybe Prelude.Text)
createMedicalVocabularyResponse_failureReason :: (Maybe Text -> f (Maybe Text))
-> CreateMedicalVocabularyResponse
-> f CreateMedicalVocabularyResponse
createMedicalVocabularyResponse_failureReason = (CreateMedicalVocabularyResponse -> Maybe Text)
-> (CreateMedicalVocabularyResponse
    -> Maybe Text -> CreateMedicalVocabularyResponse)
-> Lens
     CreateMedicalVocabularyResponse
     CreateMedicalVocabularyResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMedicalVocabularyResponse' {Maybe Text
failureReason :: Maybe Text
$sel:failureReason:CreateMedicalVocabularyResponse' :: CreateMedicalVocabularyResponse -> Maybe Text
failureReason} -> Maybe Text
failureReason) (\s :: CreateMedicalVocabularyResponse
s@CreateMedicalVocabularyResponse' {} Maybe Text
a -> CreateMedicalVocabularyResponse
s {$sel:failureReason:CreateMedicalVocabularyResponse' :: Maybe Text
failureReason = Maybe Text
a} :: CreateMedicalVocabularyResponse)

-- | The language code for the entries in your custom vocabulary. US English
-- (en-US) is the only valid language code for Amazon Transcribe Medical.
createMedicalVocabularyResponse_languageCode :: Lens.Lens' CreateMedicalVocabularyResponse (Prelude.Maybe LanguageCode)
createMedicalVocabularyResponse_languageCode :: (Maybe LanguageCode -> f (Maybe LanguageCode))
-> CreateMedicalVocabularyResponse
-> f CreateMedicalVocabularyResponse
createMedicalVocabularyResponse_languageCode = (CreateMedicalVocabularyResponse -> Maybe LanguageCode)
-> (CreateMedicalVocabularyResponse
    -> Maybe LanguageCode -> CreateMedicalVocabularyResponse)
-> Lens
     CreateMedicalVocabularyResponse
     CreateMedicalVocabularyResponse
     (Maybe LanguageCode)
     (Maybe LanguageCode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMedicalVocabularyResponse' {Maybe LanguageCode
languageCode :: Maybe LanguageCode
$sel:languageCode:CreateMedicalVocabularyResponse' :: CreateMedicalVocabularyResponse -> Maybe LanguageCode
languageCode} -> Maybe LanguageCode
languageCode) (\s :: CreateMedicalVocabularyResponse
s@CreateMedicalVocabularyResponse' {} Maybe LanguageCode
a -> CreateMedicalVocabularyResponse
s {$sel:languageCode:CreateMedicalVocabularyResponse' :: Maybe LanguageCode
languageCode = Maybe LanguageCode
a} :: CreateMedicalVocabularyResponse)

-- | The name of the vocabulary. The name must be unique within an Amazon Web
-- Services account and is case sensitive.
createMedicalVocabularyResponse_vocabularyName :: Lens.Lens' CreateMedicalVocabularyResponse (Prelude.Maybe Prelude.Text)
createMedicalVocabularyResponse_vocabularyName :: (Maybe Text -> f (Maybe Text))
-> CreateMedicalVocabularyResponse
-> f CreateMedicalVocabularyResponse
createMedicalVocabularyResponse_vocabularyName = (CreateMedicalVocabularyResponse -> Maybe Text)
-> (CreateMedicalVocabularyResponse
    -> Maybe Text -> CreateMedicalVocabularyResponse)
-> Lens
     CreateMedicalVocabularyResponse
     CreateMedicalVocabularyResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMedicalVocabularyResponse' {Maybe Text
vocabularyName :: Maybe Text
$sel:vocabularyName:CreateMedicalVocabularyResponse' :: CreateMedicalVocabularyResponse -> Maybe Text
vocabularyName} -> Maybe Text
vocabularyName) (\s :: CreateMedicalVocabularyResponse
s@CreateMedicalVocabularyResponse' {} Maybe Text
a -> CreateMedicalVocabularyResponse
s {$sel:vocabularyName:CreateMedicalVocabularyResponse' :: Maybe Text
vocabularyName = Maybe Text
a} :: CreateMedicalVocabularyResponse)

-- | The date and time that you created the vocabulary.
createMedicalVocabularyResponse_lastModifiedTime :: Lens.Lens' CreateMedicalVocabularyResponse (Prelude.Maybe Prelude.UTCTime)
createMedicalVocabularyResponse_lastModifiedTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateMedicalVocabularyResponse
-> f CreateMedicalVocabularyResponse
createMedicalVocabularyResponse_lastModifiedTime = (CreateMedicalVocabularyResponse -> Maybe POSIX)
-> (CreateMedicalVocabularyResponse
    -> Maybe POSIX -> CreateMedicalVocabularyResponse)
-> Lens
     CreateMedicalVocabularyResponse
     CreateMedicalVocabularyResponse
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMedicalVocabularyResponse' {Maybe POSIX
lastModifiedTime :: Maybe POSIX
$sel:lastModifiedTime:CreateMedicalVocabularyResponse' :: CreateMedicalVocabularyResponse -> Maybe POSIX
lastModifiedTime} -> Maybe POSIX
lastModifiedTime) (\s :: CreateMedicalVocabularyResponse
s@CreateMedicalVocabularyResponse' {} Maybe POSIX
a -> CreateMedicalVocabularyResponse
s {$sel:lastModifiedTime:CreateMedicalVocabularyResponse' :: Maybe POSIX
lastModifiedTime = Maybe POSIX
a} :: CreateMedicalVocabularyResponse) ((Maybe POSIX -> f (Maybe POSIX))
 -> CreateMedicalVocabularyResponse
 -> f CreateMedicalVocabularyResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateMedicalVocabularyResponse
-> f CreateMedicalVocabularyResponse
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 processing state of your custom vocabulary in Amazon Transcribe
-- Medical. If the state is @READY@, you can use the vocabulary in a
-- @StartMedicalTranscriptionJob@ request.
createMedicalVocabularyResponse_vocabularyState :: Lens.Lens' CreateMedicalVocabularyResponse (Prelude.Maybe VocabularyState)
createMedicalVocabularyResponse_vocabularyState :: (Maybe VocabularyState -> f (Maybe VocabularyState))
-> CreateMedicalVocabularyResponse
-> f CreateMedicalVocabularyResponse
createMedicalVocabularyResponse_vocabularyState = (CreateMedicalVocabularyResponse -> Maybe VocabularyState)
-> (CreateMedicalVocabularyResponse
    -> Maybe VocabularyState -> CreateMedicalVocabularyResponse)
-> Lens
     CreateMedicalVocabularyResponse
     CreateMedicalVocabularyResponse
     (Maybe VocabularyState)
     (Maybe VocabularyState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMedicalVocabularyResponse' {Maybe VocabularyState
vocabularyState :: Maybe VocabularyState
$sel:vocabularyState:CreateMedicalVocabularyResponse' :: CreateMedicalVocabularyResponse -> Maybe VocabularyState
vocabularyState} -> Maybe VocabularyState
vocabularyState) (\s :: CreateMedicalVocabularyResponse
s@CreateMedicalVocabularyResponse' {} Maybe VocabularyState
a -> CreateMedicalVocabularyResponse
s {$sel:vocabularyState:CreateMedicalVocabularyResponse' :: Maybe VocabularyState
vocabularyState = Maybe VocabularyState
a} :: CreateMedicalVocabularyResponse)

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

instance
  Prelude.NFData
    CreateMedicalVocabularyResponse