{-# 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-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)
--
-- 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.Lens as Lens
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
(AssociateLexBot -> AssociateLexBot -> Bool)
-> (AssociateLexBot -> AssociateLexBot -> Bool)
-> Eq AssociateLexBot
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]
(Int -> ReadS AssociateLexBot)
-> ReadS [AssociateLexBot]
-> ReadPrec AssociateLexBot
-> ReadPrec [AssociateLexBot]
-> Read 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
(Int -> AssociateLexBot -> ShowS)
-> (AssociateLexBot -> String)
-> ([AssociateLexBot] -> ShowS)
-> Show AssociateLexBot
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. AssociateLexBot -> Rep AssociateLexBot x)
-> (forall x. Rep AssociateLexBot x -> AssociateLexBot)
-> Generic AssociateLexBot
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' :: Text -> LexBot -> AssociateLexBot
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 :: (Text -> f Text) -> AssociateLexBot -> f AssociateLexBot
associateLexBot_instanceId = (AssociateLexBot -> Text)
-> (AssociateLexBot -> Text -> AssociateLexBot)
-> Lens AssociateLexBot AssociateLexBot Text Text
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 :: (LexBot -> f LexBot) -> AssociateLexBot -> f AssociateLexBot
associateLexBot_lexBot = (AssociateLexBot -> LexBot)
-> (AssociateLexBot -> LexBot -> AssociateLexBot)
-> Lens AssociateLexBot AssociateLexBot LexBot 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 :: AssociateLexBot -> Request AssociateLexBot
request = Service -> AssociateLexBot -> Request AssociateLexBot
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy AssociateLexBot
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AssociateLexBot)))
response =
    AWSResponse AssociateLexBot
-> Logger
-> Service
-> Proxy AssociateLexBot
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AssociateLexBot)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse AssociateLexBot
AssociateLexBotResponse
AssociateLexBotResponse'

instance Prelude.Hashable AssociateLexBot

instance Prelude.NFData AssociateLexBot

instance Core.ToHeaders AssociateLexBot where
  toHeaders :: AssociateLexBot -> [Header]
toHeaders =
    [Header] -> AssociateLexBot -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"LexBot" Text -> LexBot -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= LexBot
lexBot)]
      )

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

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

-- | /See:/ 'newAssociateLexBotResponse' smart constructor.
data AssociateLexBotResponse = AssociateLexBotResponse'
  {
  }
  deriving (AssociateLexBotResponse -> AssociateLexBotResponse -> Bool
(AssociateLexBotResponse -> AssociateLexBotResponse -> Bool)
-> (AssociateLexBotResponse -> AssociateLexBotResponse -> Bool)
-> Eq AssociateLexBotResponse
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]
(Int -> ReadS AssociateLexBotResponse)
-> ReadS [AssociateLexBotResponse]
-> ReadPrec AssociateLexBotResponse
-> ReadPrec [AssociateLexBotResponse]
-> Read 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
(Int -> AssociateLexBotResponse -> ShowS)
-> (AssociateLexBotResponse -> String)
-> ([AssociateLexBotResponse] -> ShowS)
-> Show AssociateLexBotResponse
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.
 AssociateLexBotResponse -> Rep AssociateLexBotResponse x)
-> (forall x.
    Rep AssociateLexBotResponse x -> AssociateLexBotResponse)
-> Generic AssociateLexBotResponse
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