{-# 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.Connect.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 custom vocabulary associated with your Amazon Connect
-- instance. You can set a custom vocabulary to be your default vocabulary
-- for a given language. Contact Lens for Amazon Connect uses the default
-- vocabulary in post-call and real-time contact analysis sessions for that
-- language.
module Amazonka.Connect.CreateVocabulary
  ( -- * Creating a Request
    CreateVocabulary (..),
    newCreateVocabulary,

    -- * Request Lenses
    createVocabulary_clientToken,
    createVocabulary_tags,
    createVocabulary_instanceId,
    createVocabulary_vocabularyName,
    createVocabulary_languageCode,
    createVocabulary_content,

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

    -- * Response Lenses
    createVocabularyResponse_httpStatus,
    createVocabularyResponse_vocabularyArn,
    createVocabularyResponse_vocabularyId,
    createVocabularyResponse_state,
  )
where

import Amazonka.Connect.Types
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

-- | /See:/ 'newCreateVocabulary' smart constructor.
data CreateVocabulary = CreateVocabulary'
  { -- | A unique, case-sensitive identifier that you provide to ensure the
    -- idempotency of the request. If not provided, the Amazon Web Services SDK
    -- populates this field. For more information about idempotency, see
    -- <https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/ Making retries safe with idempotent APIs>.
    -- If a create request is received more than once with same client token,
    -- subsequent requests return the previous response without creating a
    -- vocabulary again.
    CreateVocabulary -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | The tags used to organize, track, or control access for this resource.
    -- For example, { \"tags\": {\"key1\":\"value1\", \"key2\":\"value2\"} }.
    CreateVocabulary -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The identifier of the Amazon Connect instance. You can find the
    -- instanceId in the ARN of the instance.
    CreateVocabulary -> Text
instanceId :: Prelude.Text,
    -- | A unique name of the custom vocabulary.
    CreateVocabulary -> Text
vocabularyName :: Prelude.Text,
    -- | The language code of the vocabulary entries. For a list of languages and
    -- their corresponding language codes, see
    -- <https://docs.aws.amazon.com/transcribe/latest/dg/transcribe-whatis.html What is Amazon Transcribe?>
    CreateVocabulary -> VocabularyLanguageCode
languageCode :: VocabularyLanguageCode,
    -- | The content of the custom vocabulary in plain-text format with a table
    -- of values. Each row in the table represents a word or a phrase,
    -- described with @Phrase@, @IPA@, @SoundsLike@, and @DisplayAs@ fields.
    -- Separate the fields with TAB characters. The size limit is 50KB. For
    -- more information, see
    -- <https://docs.aws.amazon.com/transcribe/latest/dg/custom-vocabulary.html#create-vocabulary-table Create a custom vocabulary using a table>.
    CreateVocabulary -> Text
content :: Prelude.Text
  }
  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:
--
-- 'clientToken', 'createVocabulary_clientToken' - A unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request. If not provided, the Amazon Web Services SDK
-- populates this field. For more information about idempotency, see
-- <https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/ Making retries safe with idempotent APIs>.
-- If a create request is received more than once with same client token,
-- subsequent requests return the previous response without creating a
-- vocabulary again.
--
-- 'tags', 'createVocabulary_tags' - The tags used to organize, track, or control access for this resource.
-- For example, { \"tags\": {\"key1\":\"value1\", \"key2\":\"value2\"} }.
--
-- 'instanceId', 'createVocabulary_instanceId' - The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
--
-- 'vocabularyName', 'createVocabulary_vocabularyName' - A unique name of the custom vocabulary.
--
-- 'languageCode', 'createVocabulary_languageCode' - The language code of the vocabulary entries. For a list of languages and
-- their corresponding language codes, see
-- <https://docs.aws.amazon.com/transcribe/latest/dg/transcribe-whatis.html What is Amazon Transcribe?>
--
-- 'content', 'createVocabulary_content' - The content of the custom vocabulary in plain-text format with a table
-- of values. Each row in the table represents a word or a phrase,
-- described with @Phrase@, @IPA@, @SoundsLike@, and @DisplayAs@ fields.
-- Separate the fields with TAB characters. The size limit is 50KB. For
-- more information, see
-- <https://docs.aws.amazon.com/transcribe/latest/dg/custom-vocabulary.html#create-vocabulary-table Create a custom vocabulary using a table>.
newCreateVocabulary ::
  -- | 'instanceId'
  Prelude.Text ->
  -- | 'vocabularyName'
  Prelude.Text ->
  -- | 'languageCode'
  VocabularyLanguageCode ->
  -- | 'content'
  Prelude.Text ->
  CreateVocabulary
newCreateVocabulary :: Text -> Text -> VocabularyLanguageCode -> Text -> CreateVocabulary
newCreateVocabulary
  Text
pInstanceId_
  Text
pVocabularyName_
  VocabularyLanguageCode
pLanguageCode_
  Text
pContent_ =
    CreateVocabulary'
      { $sel:clientToken:CreateVocabulary' :: Maybe Text
clientToken = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateVocabulary' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:instanceId:CreateVocabulary' :: Text
instanceId = Text
pInstanceId_,
        $sel:vocabularyName:CreateVocabulary' :: Text
vocabularyName = Text
pVocabularyName_,
        $sel:languageCode:CreateVocabulary' :: VocabularyLanguageCode
languageCode = VocabularyLanguageCode
pLanguageCode_,
        $sel:content:CreateVocabulary' :: Text
content = Text
pContent_
      }

-- | A unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request. If not provided, the Amazon Web Services SDK
-- populates this field. For more information about idempotency, see
-- <https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/ Making retries safe with idempotent APIs>.
-- If a create request is received more than once with same client token,
-- subsequent requests return the previous response without creating a
-- vocabulary again.
createVocabulary_clientToken :: Lens.Lens' CreateVocabulary (Prelude.Maybe Prelude.Text)
createVocabulary_clientToken :: Lens' CreateVocabulary (Maybe Text)
createVocabulary_clientToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVocabulary' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateVocabulary' :: CreateVocabulary -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateVocabulary
s@CreateVocabulary' {} Maybe Text
a -> CreateVocabulary
s {$sel:clientToken:CreateVocabulary' :: Maybe Text
clientToken = Maybe Text
a} :: CreateVocabulary)

-- | The tags used to organize, track, or control access for this resource.
-- For example, { \"tags\": {\"key1\":\"value1\", \"key2\":\"value2\"} }.
createVocabulary_tags :: Lens.Lens' CreateVocabulary (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createVocabulary_tags :: Lens' CreateVocabulary (Maybe (HashMap Text Text))
createVocabulary_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVocabulary' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateVocabulary' :: CreateVocabulary -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateVocabulary
s@CreateVocabulary' {} Maybe (HashMap Text Text)
a -> CreateVocabulary
s {$sel:tags:CreateVocabulary' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text 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

-- | The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
createVocabulary_instanceId :: Lens.Lens' CreateVocabulary Prelude.Text
createVocabulary_instanceId :: Lens' CreateVocabulary Text
createVocabulary_instanceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVocabulary' {Text
instanceId :: Text
$sel:instanceId:CreateVocabulary' :: CreateVocabulary -> Text
instanceId} -> Text
instanceId) (\s :: CreateVocabulary
s@CreateVocabulary' {} Text
a -> CreateVocabulary
s {$sel:instanceId:CreateVocabulary' :: Text
instanceId = Text
a} :: CreateVocabulary)

-- | A unique name of the custom vocabulary.
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 of the vocabulary entries. For a list of languages and
-- their corresponding language codes, see
-- <https://docs.aws.amazon.com/transcribe/latest/dg/transcribe-whatis.html What is Amazon Transcribe?>
createVocabulary_languageCode :: Lens.Lens' CreateVocabulary VocabularyLanguageCode
createVocabulary_languageCode :: Lens' CreateVocabulary VocabularyLanguageCode
createVocabulary_languageCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVocabulary' {VocabularyLanguageCode
languageCode :: VocabularyLanguageCode
$sel:languageCode:CreateVocabulary' :: CreateVocabulary -> VocabularyLanguageCode
languageCode} -> VocabularyLanguageCode
languageCode) (\s :: CreateVocabulary
s@CreateVocabulary' {} VocabularyLanguageCode
a -> CreateVocabulary
s {$sel:languageCode:CreateVocabulary' :: VocabularyLanguageCode
languageCode = VocabularyLanguageCode
a} :: CreateVocabulary)

-- | The content of the custom vocabulary in plain-text format with a table
-- of values. Each row in the table represents a word or a phrase,
-- described with @Phrase@, @IPA@, @SoundsLike@, and @DisplayAs@ fields.
-- Separate the fields with TAB characters. The size limit is 50KB. For
-- more information, see
-- <https://docs.aws.amazon.com/transcribe/latest/dg/custom-vocabulary.html#create-vocabulary-table Create a custom vocabulary using a table>.
createVocabulary_content :: Lens.Lens' CreateVocabulary Prelude.Text
createVocabulary_content :: Lens' CreateVocabulary Text
createVocabulary_content = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVocabulary' {Text
content :: Text
$sel:content:CreateVocabulary' :: CreateVocabulary -> Text
content} -> Text
content) (\s :: CreateVocabulary
s@CreateVocabulary' {} Text
a -> CreateVocabulary
s {$sel:content:CreateVocabulary' :: Text
content = Text
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 ->
          Int -> Text -> Text -> VocabularyState -> CreateVocabularyResponse
CreateVocabularyResponse'
            forall (f :: * -> *) a b. Functor 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))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"VocabularyArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"VocabularyId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"State")
      )

instance Prelude.Hashable CreateVocabulary where
  hashWithSalt :: Int -> CreateVocabulary -> Int
hashWithSalt Int
_salt CreateVocabulary' {Maybe Text
Maybe (HashMap Text Text)
Text
VocabularyLanguageCode
content :: Text
languageCode :: VocabularyLanguageCode
vocabularyName :: Text
instanceId :: Text
tags :: Maybe (HashMap Text Text)
clientToken :: Maybe Text
$sel:content:CreateVocabulary' :: CreateVocabulary -> Text
$sel:languageCode:CreateVocabulary' :: CreateVocabulary -> VocabularyLanguageCode
$sel:vocabularyName:CreateVocabulary' :: CreateVocabulary -> Text
$sel:instanceId:CreateVocabulary' :: CreateVocabulary -> Text
$sel:tags:CreateVocabulary' :: CreateVocabulary -> Maybe (HashMap Text Text)
$sel:clientToken:CreateVocabulary' :: CreateVocabulary -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
instanceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
vocabularyName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` VocabularyLanguageCode
languageCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
content

instance Prelude.NFData CreateVocabulary where
  rnf :: CreateVocabulary -> ()
rnf CreateVocabulary' {Maybe Text
Maybe (HashMap Text Text)
Text
VocabularyLanguageCode
content :: Text
languageCode :: VocabularyLanguageCode
vocabularyName :: Text
instanceId :: Text
tags :: Maybe (HashMap Text Text)
clientToken :: Maybe Text
$sel:content:CreateVocabulary' :: CreateVocabulary -> Text
$sel:languageCode:CreateVocabulary' :: CreateVocabulary -> VocabularyLanguageCode
$sel:vocabularyName:CreateVocabulary' :: CreateVocabulary -> Text
$sel:instanceId:CreateVocabulary' :: CreateVocabulary -> Text
$sel:tags:CreateVocabulary' :: CreateVocabulary -> Maybe (HashMap Text Text)
$sel:clientToken:CreateVocabulary' :: CreateVocabulary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
instanceId
      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 VocabularyLanguageCode
languageCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
content

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
"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 (HashMap Text Text)
Text
VocabularyLanguageCode
content :: Text
languageCode :: VocabularyLanguageCode
vocabularyName :: Text
instanceId :: Text
tags :: Maybe (HashMap Text Text)
clientToken :: Maybe Text
$sel:content:CreateVocabulary' :: CreateVocabulary -> Text
$sel:languageCode:CreateVocabulary' :: CreateVocabulary -> VocabularyLanguageCode
$sel:vocabularyName:CreateVocabulary' :: CreateVocabulary -> Text
$sel:instanceId:CreateVocabulary' :: CreateVocabulary -> Text
$sel:tags:CreateVocabulary' :: CreateVocabulary -> Maybe (HashMap Text Text)
$sel:clientToken:CreateVocabulary' :: CreateVocabulary -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ClientToken" 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
clientToken,
            (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 (HashMap Text Text)
tags,
            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..= VocabularyLanguageCode
languageCode),
            forall a. a -> Maybe a
Prelude.Just (Key
"Content" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
content)
          ]
      )

instance Data.ToPath CreateVocabulary where
  toPath :: CreateVocabulary -> ByteString
toPath CreateVocabulary' {Maybe Text
Maybe (HashMap Text Text)
Text
VocabularyLanguageCode
content :: Text
languageCode :: VocabularyLanguageCode
vocabularyName :: Text
instanceId :: Text
tags :: Maybe (HashMap Text Text)
clientToken :: Maybe Text
$sel:content:CreateVocabulary' :: CreateVocabulary -> Text
$sel:languageCode:CreateVocabulary' :: CreateVocabulary -> VocabularyLanguageCode
$sel:vocabularyName:CreateVocabulary' :: CreateVocabulary -> Text
$sel:instanceId:CreateVocabulary' :: CreateVocabulary -> Text
$sel:tags:CreateVocabulary' :: CreateVocabulary -> Maybe (HashMap Text Text)
$sel:clientToken:CreateVocabulary' :: CreateVocabulary -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/vocabulary/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
instanceId]

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'
  { -- | The response's http status code.
    CreateVocabularyResponse -> Int
httpStatus :: Prelude.Int,
    -- | The Amazon Resource Name (ARN) of the custom vocabulary.
    CreateVocabularyResponse -> Text
vocabularyArn :: Prelude.Text,
    -- | The identifier of the custom vocabulary.
    CreateVocabularyResponse -> Text
vocabularyId :: Prelude.Text,
    -- | The current state of the custom vocabulary.
    CreateVocabularyResponse -> VocabularyState
state :: VocabularyState
  }
  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:
--
-- 'httpStatus', 'createVocabularyResponse_httpStatus' - The response's http status code.
--
-- 'vocabularyArn', 'createVocabularyResponse_vocabularyArn' - The Amazon Resource Name (ARN) of the custom vocabulary.
--
-- 'vocabularyId', 'createVocabularyResponse_vocabularyId' - The identifier of the custom vocabulary.
--
-- 'state', 'createVocabularyResponse_state' - The current state of the custom vocabulary.
newCreateVocabularyResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'vocabularyArn'
  Prelude.Text ->
  -- | 'vocabularyId'
  Prelude.Text ->
  -- | 'state'
  VocabularyState ->
  CreateVocabularyResponse
newCreateVocabularyResponse :: Int -> Text -> Text -> VocabularyState -> CreateVocabularyResponse
newCreateVocabularyResponse
  Int
pHttpStatus_
  Text
pVocabularyArn_
  Text
pVocabularyId_
  VocabularyState
pState_ =
    CreateVocabularyResponse'
      { $sel:httpStatus:CreateVocabularyResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:vocabularyArn:CreateVocabularyResponse' :: Text
vocabularyArn = Text
pVocabularyArn_,
        $sel:vocabularyId:CreateVocabularyResponse' :: Text
vocabularyId = Text
pVocabularyId_,
        $sel:state:CreateVocabularyResponse' :: VocabularyState
state = VocabularyState
pState_
      }

-- | 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)

-- | The Amazon Resource Name (ARN) of the custom vocabulary.
createVocabularyResponse_vocabularyArn :: Lens.Lens' CreateVocabularyResponse Prelude.Text
createVocabularyResponse_vocabularyArn :: Lens' CreateVocabularyResponse Text
createVocabularyResponse_vocabularyArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVocabularyResponse' {Text
vocabularyArn :: Text
$sel:vocabularyArn:CreateVocabularyResponse' :: CreateVocabularyResponse -> Text
vocabularyArn} -> Text
vocabularyArn) (\s :: CreateVocabularyResponse
s@CreateVocabularyResponse' {} Text
a -> CreateVocabularyResponse
s {$sel:vocabularyArn:CreateVocabularyResponse' :: Text
vocabularyArn = Text
a} :: CreateVocabularyResponse)

-- | The identifier of the custom vocabulary.
createVocabularyResponse_vocabularyId :: Lens.Lens' CreateVocabularyResponse Prelude.Text
createVocabularyResponse_vocabularyId :: Lens' CreateVocabularyResponse Text
createVocabularyResponse_vocabularyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVocabularyResponse' {Text
vocabularyId :: Text
$sel:vocabularyId:CreateVocabularyResponse' :: CreateVocabularyResponse -> Text
vocabularyId} -> Text
vocabularyId) (\s :: CreateVocabularyResponse
s@CreateVocabularyResponse' {} Text
a -> CreateVocabularyResponse
s {$sel:vocabularyId:CreateVocabularyResponse' :: Text
vocabularyId = Text
a} :: CreateVocabularyResponse)

-- | The current state of the custom vocabulary.
createVocabularyResponse_state :: Lens.Lens' CreateVocabularyResponse VocabularyState
createVocabularyResponse_state :: Lens' CreateVocabularyResponse VocabularyState
createVocabularyResponse_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVocabularyResponse' {VocabularyState
state :: VocabularyState
$sel:state:CreateVocabularyResponse' :: CreateVocabularyResponse -> VocabularyState
state} -> VocabularyState
state) (\s :: CreateVocabularyResponse
s@CreateVocabularyResponse' {} VocabularyState
a -> CreateVocabularyResponse
s {$sel:state:CreateVocabularyResponse' :: VocabularyState
state = VocabularyState
a} :: CreateVocabularyResponse)

instance Prelude.NFData CreateVocabularyResponse where
  rnf :: CreateVocabularyResponse -> ()
rnf CreateVocabularyResponse' {Int
Text
VocabularyState
state :: VocabularyState
vocabularyId :: Text
vocabularyArn :: Text
httpStatus :: Int
$sel:state:CreateVocabularyResponse' :: CreateVocabularyResponse -> VocabularyState
$sel:vocabularyId:CreateVocabularyResponse' :: CreateVocabularyResponse -> Text
$sel:vocabularyArn:CreateVocabularyResponse' :: CreateVocabularyResponse -> Text
$sel:httpStatus:CreateVocabularyResponse' :: CreateVocabularyResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
vocabularyArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
vocabularyId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf VocabularyState
state