{-# 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.AssociateLexBot
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- This API is in preview release for Amazon Connect and is subject to
-- change.
--
-- Allows the specified Amazon Connect instance to access the specified
-- Amazon Lex bot.
module Amazonka.Connect.AssociateLexBot
  ( -- * Creating a Request
    AssociateLexBot (..),
    newAssociateLexBot,

    -- * Request Lenses
    associateLexBot_instanceId,
    associateLexBot_lexBot,

    -- * Destructuring the Response
    AssociateLexBotResponse (..),
    newAssociateLexBotResponse,
  )
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:/ 'newAssociateLexBot' smart constructor.
data AssociateLexBot = AssociateLexBot'
  { -- | The identifier of the Amazon Connect instance. You can find the
    -- instanceId in the ARN of the instance.
    AssociateLexBot -> Text
instanceId :: Prelude.Text,
    -- | The Amazon Lex bot to associate with the instance.
    AssociateLexBot -> LexBot
lexBot :: LexBot
  }
  deriving (AssociateLexBot -> AssociateLexBot -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateLexBot -> AssociateLexBot -> Bool
$c/= :: AssociateLexBot -> AssociateLexBot -> Bool
== :: AssociateLexBot -> AssociateLexBot -> Bool
$c== :: AssociateLexBot -> AssociateLexBot -> Bool
Prelude.Eq, ReadPrec [AssociateLexBot]
ReadPrec AssociateLexBot
Int -> ReadS AssociateLexBot
ReadS [AssociateLexBot]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateLexBot]
$creadListPrec :: ReadPrec [AssociateLexBot]
readPrec :: ReadPrec AssociateLexBot
$creadPrec :: ReadPrec AssociateLexBot
readList :: ReadS [AssociateLexBot]
$creadList :: ReadS [AssociateLexBot]
readsPrec :: Int -> ReadS AssociateLexBot
$creadsPrec :: Int -> ReadS AssociateLexBot
Prelude.Read, Int -> AssociateLexBot -> ShowS
[AssociateLexBot] -> ShowS
AssociateLexBot -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateLexBot] -> ShowS
$cshowList :: [AssociateLexBot] -> ShowS
show :: AssociateLexBot -> String
$cshow :: AssociateLexBot -> String
showsPrec :: Int -> AssociateLexBot -> ShowS
$cshowsPrec :: Int -> AssociateLexBot -> ShowS
Prelude.Show, forall x. Rep AssociateLexBot x -> AssociateLexBot
forall x. AssociateLexBot -> Rep AssociateLexBot x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssociateLexBot x -> AssociateLexBot
$cfrom :: forall x. AssociateLexBot -> Rep AssociateLexBot x
Prelude.Generic)

-- |
-- Create a value of 'AssociateLexBot' 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:
--
-- 'instanceId', 'associateLexBot_instanceId' - The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
--
-- 'lexBot', 'associateLexBot_lexBot' - The Amazon Lex bot to associate with the instance.
newAssociateLexBot ::
  -- | 'instanceId'
  Prelude.Text ->
  -- | 'lexBot'
  LexBot ->
  AssociateLexBot
newAssociateLexBot :: Text -> LexBot -> AssociateLexBot
newAssociateLexBot Text
pInstanceId_ LexBot
pLexBot_ =
  AssociateLexBot'
    { $sel:instanceId:AssociateLexBot' :: Text
instanceId = Text
pInstanceId_,
      $sel:lexBot:AssociateLexBot' :: LexBot
lexBot = LexBot
pLexBot_
    }

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

-- | The Amazon Lex bot to associate with the instance.
associateLexBot_lexBot :: Lens.Lens' AssociateLexBot LexBot
associateLexBot_lexBot :: Lens' AssociateLexBot LexBot
associateLexBot_lexBot = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateLexBot' {LexBot
lexBot :: LexBot
$sel:lexBot:AssociateLexBot' :: AssociateLexBot -> LexBot
lexBot} -> LexBot
lexBot) (\s :: AssociateLexBot
s@AssociateLexBot' {} LexBot
a -> AssociateLexBot
s {$sel:lexBot:AssociateLexBot' :: LexBot
lexBot = LexBot
a} :: AssociateLexBot)

instance Core.AWSRequest AssociateLexBot where
  type
    AWSResponse AssociateLexBot =
      AssociateLexBotResponse
  request :: (Service -> Service) -> AssociateLexBot -> Request AssociateLexBot
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy AssociateLexBot
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AssociateLexBot)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AssociateLexBotResponse
AssociateLexBotResponse'

instance Prelude.Hashable AssociateLexBot where
  hashWithSalt :: Int -> AssociateLexBot -> Int
hashWithSalt Int
_salt AssociateLexBot' {Text
LexBot
lexBot :: LexBot
instanceId :: Text
$sel:lexBot:AssociateLexBot' :: AssociateLexBot -> LexBot
$sel:instanceId:AssociateLexBot' :: AssociateLexBot -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
instanceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` LexBot
lexBot

instance Prelude.NFData AssociateLexBot where
  rnf :: AssociateLexBot -> ()
rnf AssociateLexBot' {Text
LexBot
lexBot :: LexBot
instanceId :: Text
$sel:lexBot:AssociateLexBot' :: AssociateLexBot -> LexBot
$sel:instanceId:AssociateLexBot' :: AssociateLexBot -> Text
..} =
    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 LexBot
lexBot

instance Data.ToHeaders AssociateLexBot where
  toHeaders :: AssociateLexBot -> [Header]
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 -> [Header]
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON AssociateLexBot where
  toJSON :: AssociateLexBot -> Value
toJSON AssociateLexBot' {Text
LexBot
lexBot :: LexBot
instanceId :: Text
$sel:lexBot:AssociateLexBot' :: AssociateLexBot -> LexBot
$sel:instanceId:AssociateLexBot' :: AssociateLexBot -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"LexBot" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= LexBot
lexBot)]
      )

instance Data.ToPath AssociateLexBot where
  toPath :: AssociateLexBot -> ByteString
toPath AssociateLexBot' {Text
LexBot
lexBot :: LexBot
instanceId :: Text
$sel:lexBot:AssociateLexBot' :: AssociateLexBot -> LexBot
$sel:instanceId:AssociateLexBot' :: AssociateLexBot -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/instance/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
instanceId, ByteString
"/lex-bot"]

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

-- | /See:/ 'newAssociateLexBotResponse' smart constructor.
data AssociateLexBotResponse = AssociateLexBotResponse'
  {
  }
  deriving (AssociateLexBotResponse -> AssociateLexBotResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateLexBotResponse -> AssociateLexBotResponse -> Bool
$c/= :: AssociateLexBotResponse -> AssociateLexBotResponse -> Bool
== :: AssociateLexBotResponse -> AssociateLexBotResponse -> Bool
$c== :: AssociateLexBotResponse -> AssociateLexBotResponse -> Bool
Prelude.Eq, ReadPrec [AssociateLexBotResponse]
ReadPrec AssociateLexBotResponse
Int -> ReadS AssociateLexBotResponse
ReadS [AssociateLexBotResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateLexBotResponse]
$creadListPrec :: ReadPrec [AssociateLexBotResponse]
readPrec :: ReadPrec AssociateLexBotResponse
$creadPrec :: ReadPrec AssociateLexBotResponse
readList :: ReadS [AssociateLexBotResponse]
$creadList :: ReadS [AssociateLexBotResponse]
readsPrec :: Int -> ReadS AssociateLexBotResponse
$creadsPrec :: Int -> ReadS AssociateLexBotResponse
Prelude.Read, Int -> AssociateLexBotResponse -> ShowS
[AssociateLexBotResponse] -> ShowS
AssociateLexBotResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateLexBotResponse] -> ShowS
$cshowList :: [AssociateLexBotResponse] -> ShowS
show :: AssociateLexBotResponse -> String
$cshow :: AssociateLexBotResponse -> String
showsPrec :: Int -> AssociateLexBotResponse -> ShowS
$cshowsPrec :: Int -> AssociateLexBotResponse -> ShowS
Prelude.Show, forall x. Rep AssociateLexBotResponse x -> AssociateLexBotResponse
forall x. AssociateLexBotResponse -> Rep AssociateLexBotResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssociateLexBotResponse x -> AssociateLexBotResponse
$cfrom :: forall x. AssociateLexBotResponse -> Rep AssociateLexBotResponse x
Prelude.Generic)

-- |
-- Create a value of 'AssociateLexBotResponse' 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.
newAssociateLexBotResponse ::
  AssociateLexBotResponse
newAssociateLexBotResponse :: AssociateLexBotResponse
newAssociateLexBotResponse = AssociateLexBotResponse
AssociateLexBotResponse'

instance Prelude.NFData AssociateLexBotResponse where
  rnf :: AssociateLexBotResponse -> ()
rnf AssociateLexBotResponse
_ = ()