{-# 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.LexModels.GetBotChannelAssociations
-- 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)
--
-- Returns a list of all of the channels associated with the specified bot.
--
-- The @GetBotChannelAssociations@ operation requires permissions for the
-- @lex:GetBotChannelAssociations@ action.
--
-- This operation returns paginated results.
module Amazonka.LexModels.GetBotChannelAssociations
  ( -- * Creating a Request
    GetBotChannelAssociations (..),
    newGetBotChannelAssociations,

    -- * Request Lenses
    getBotChannelAssociations_nameContains,
    getBotChannelAssociations_nextToken,
    getBotChannelAssociations_maxResults,
    getBotChannelAssociations_botName,
    getBotChannelAssociations_botAlias,

    -- * Destructuring the Response
    GetBotChannelAssociationsResponse (..),
    newGetBotChannelAssociationsResponse,

    -- * Response Lenses
    getBotChannelAssociationsResponse_botChannelAssociations,
    getBotChannelAssociationsResponse_nextToken,
    getBotChannelAssociationsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.LexModels.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newGetBotChannelAssociations' smart constructor.
data GetBotChannelAssociations = GetBotChannelAssociations'
  { -- | Substring to match in channel association names. An association will be
    -- returned if any part of its name matches the substring. For example,
    -- \"xyz\" matches both \"xyzabc\" and \"abcxyz.\" To return all bot
    -- channel associations, use a hyphen (\"-\") as the @nameContains@
    -- parameter.
    GetBotChannelAssociations -> Maybe Text
nameContains :: Prelude.Maybe Prelude.Text,
    -- | A pagination token for fetching the next page of associations. If the
    -- response to this call is truncated, Amazon Lex returns a pagination
    -- token in the response. To fetch the next page of associations, specify
    -- the pagination token in the next request.
    GetBotChannelAssociations -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of associations to return in the response. The
    -- default is 50.
    GetBotChannelAssociations -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The name of the Amazon Lex bot in the association.
    GetBotChannelAssociations -> Text
botName :: Prelude.Text,
    -- | An alias pointing to the specific version of the Amazon Lex bot to which
    -- this association is being made.
    GetBotChannelAssociations -> Text
botAlias :: Prelude.Text
  }
  deriving (GetBotChannelAssociations -> GetBotChannelAssociations -> Bool
(GetBotChannelAssociations -> GetBotChannelAssociations -> Bool)
-> (GetBotChannelAssociations -> GetBotChannelAssociations -> Bool)
-> Eq GetBotChannelAssociations
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBotChannelAssociations -> GetBotChannelAssociations -> Bool
$c/= :: GetBotChannelAssociations -> GetBotChannelAssociations -> Bool
== :: GetBotChannelAssociations -> GetBotChannelAssociations -> Bool
$c== :: GetBotChannelAssociations -> GetBotChannelAssociations -> Bool
Prelude.Eq, ReadPrec [GetBotChannelAssociations]
ReadPrec GetBotChannelAssociations
Int -> ReadS GetBotChannelAssociations
ReadS [GetBotChannelAssociations]
(Int -> ReadS GetBotChannelAssociations)
-> ReadS [GetBotChannelAssociations]
-> ReadPrec GetBotChannelAssociations
-> ReadPrec [GetBotChannelAssociations]
-> Read GetBotChannelAssociations
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetBotChannelAssociations]
$creadListPrec :: ReadPrec [GetBotChannelAssociations]
readPrec :: ReadPrec GetBotChannelAssociations
$creadPrec :: ReadPrec GetBotChannelAssociations
readList :: ReadS [GetBotChannelAssociations]
$creadList :: ReadS [GetBotChannelAssociations]
readsPrec :: Int -> ReadS GetBotChannelAssociations
$creadsPrec :: Int -> ReadS GetBotChannelAssociations
Prelude.Read, Int -> GetBotChannelAssociations -> ShowS
[GetBotChannelAssociations] -> ShowS
GetBotChannelAssociations -> String
(Int -> GetBotChannelAssociations -> ShowS)
-> (GetBotChannelAssociations -> String)
-> ([GetBotChannelAssociations] -> ShowS)
-> Show GetBotChannelAssociations
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBotChannelAssociations] -> ShowS
$cshowList :: [GetBotChannelAssociations] -> ShowS
show :: GetBotChannelAssociations -> String
$cshow :: GetBotChannelAssociations -> String
showsPrec :: Int -> GetBotChannelAssociations -> ShowS
$cshowsPrec :: Int -> GetBotChannelAssociations -> ShowS
Prelude.Show, (forall x.
 GetBotChannelAssociations -> Rep GetBotChannelAssociations x)
-> (forall x.
    Rep GetBotChannelAssociations x -> GetBotChannelAssociations)
-> Generic GetBotChannelAssociations
forall x.
Rep GetBotChannelAssociations x -> GetBotChannelAssociations
forall x.
GetBotChannelAssociations -> Rep GetBotChannelAssociations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetBotChannelAssociations x -> GetBotChannelAssociations
$cfrom :: forall x.
GetBotChannelAssociations -> Rep GetBotChannelAssociations x
Prelude.Generic)

-- |
-- Create a value of 'GetBotChannelAssociations' 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:
--
-- 'nameContains', 'getBotChannelAssociations_nameContains' - Substring to match in channel association names. An association will be
-- returned if any part of its name matches the substring. For example,
-- \"xyz\" matches both \"xyzabc\" and \"abcxyz.\" To return all bot
-- channel associations, use a hyphen (\"-\") as the @nameContains@
-- parameter.
--
-- 'nextToken', 'getBotChannelAssociations_nextToken' - A pagination token for fetching the next page of associations. If the
-- response to this call is truncated, Amazon Lex returns a pagination
-- token in the response. To fetch the next page of associations, specify
-- the pagination token in the next request.
--
-- 'maxResults', 'getBotChannelAssociations_maxResults' - The maximum number of associations to return in the response. The
-- default is 50.
--
-- 'botName', 'getBotChannelAssociations_botName' - The name of the Amazon Lex bot in the association.
--
-- 'botAlias', 'getBotChannelAssociations_botAlias' - An alias pointing to the specific version of the Amazon Lex bot to which
-- this association is being made.
newGetBotChannelAssociations ::
  -- | 'botName'
  Prelude.Text ->
  -- | 'botAlias'
  Prelude.Text ->
  GetBotChannelAssociations
newGetBotChannelAssociations :: Text -> Text -> GetBotChannelAssociations
newGetBotChannelAssociations Text
pBotName_ Text
pBotAlias_ =
  GetBotChannelAssociations' :: Maybe Text
-> Maybe Text
-> Maybe Natural
-> Text
-> Text
-> GetBotChannelAssociations
GetBotChannelAssociations'
    { $sel:nameContains:GetBotChannelAssociations' :: Maybe Text
nameContains =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetBotChannelAssociations' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:GetBotChannelAssociations' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:botName:GetBotChannelAssociations' :: Text
botName = Text
pBotName_,
      $sel:botAlias:GetBotChannelAssociations' :: Text
botAlias = Text
pBotAlias_
    }

-- | Substring to match in channel association names. An association will be
-- returned if any part of its name matches the substring. For example,
-- \"xyz\" matches both \"xyzabc\" and \"abcxyz.\" To return all bot
-- channel associations, use a hyphen (\"-\") as the @nameContains@
-- parameter.
getBotChannelAssociations_nameContains :: Lens.Lens' GetBotChannelAssociations (Prelude.Maybe Prelude.Text)
getBotChannelAssociations_nameContains :: (Maybe Text -> f (Maybe Text))
-> GetBotChannelAssociations -> f GetBotChannelAssociations
getBotChannelAssociations_nameContains = (GetBotChannelAssociations -> Maybe Text)
-> (GetBotChannelAssociations
    -> Maybe Text -> GetBotChannelAssociations)
-> Lens
     GetBotChannelAssociations
     GetBotChannelAssociations
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBotChannelAssociations' {Maybe Text
nameContains :: Maybe Text
$sel:nameContains:GetBotChannelAssociations' :: GetBotChannelAssociations -> Maybe Text
nameContains} -> Maybe Text
nameContains) (\s :: GetBotChannelAssociations
s@GetBotChannelAssociations' {} Maybe Text
a -> GetBotChannelAssociations
s {$sel:nameContains:GetBotChannelAssociations' :: Maybe Text
nameContains = Maybe Text
a} :: GetBotChannelAssociations)

-- | A pagination token for fetching the next page of associations. If the
-- response to this call is truncated, Amazon Lex returns a pagination
-- token in the response. To fetch the next page of associations, specify
-- the pagination token in the next request.
getBotChannelAssociations_nextToken :: Lens.Lens' GetBotChannelAssociations (Prelude.Maybe Prelude.Text)
getBotChannelAssociations_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetBotChannelAssociations -> f GetBotChannelAssociations
getBotChannelAssociations_nextToken = (GetBotChannelAssociations -> Maybe Text)
-> (GetBotChannelAssociations
    -> Maybe Text -> GetBotChannelAssociations)
-> Lens
     GetBotChannelAssociations
     GetBotChannelAssociations
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBotChannelAssociations' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetBotChannelAssociations' :: GetBotChannelAssociations -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetBotChannelAssociations
s@GetBotChannelAssociations' {} Maybe Text
a -> GetBotChannelAssociations
s {$sel:nextToken:GetBotChannelAssociations' :: Maybe Text
nextToken = Maybe Text
a} :: GetBotChannelAssociations)

-- | The maximum number of associations to return in the response. The
-- default is 50.
getBotChannelAssociations_maxResults :: Lens.Lens' GetBotChannelAssociations (Prelude.Maybe Prelude.Natural)
getBotChannelAssociations_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> GetBotChannelAssociations -> f GetBotChannelAssociations
getBotChannelAssociations_maxResults = (GetBotChannelAssociations -> Maybe Natural)
-> (GetBotChannelAssociations
    -> Maybe Natural -> GetBotChannelAssociations)
-> Lens
     GetBotChannelAssociations
     GetBotChannelAssociations
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBotChannelAssociations' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetBotChannelAssociations' :: GetBotChannelAssociations -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetBotChannelAssociations
s@GetBotChannelAssociations' {} Maybe Natural
a -> GetBotChannelAssociations
s {$sel:maxResults:GetBotChannelAssociations' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetBotChannelAssociations)

-- | The name of the Amazon Lex bot in the association.
getBotChannelAssociations_botName :: Lens.Lens' GetBotChannelAssociations Prelude.Text
getBotChannelAssociations_botName :: (Text -> f Text)
-> GetBotChannelAssociations -> f GetBotChannelAssociations
getBotChannelAssociations_botName = (GetBotChannelAssociations -> Text)
-> (GetBotChannelAssociations -> Text -> GetBotChannelAssociations)
-> Lens
     GetBotChannelAssociations GetBotChannelAssociations Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBotChannelAssociations' {Text
botName :: Text
$sel:botName:GetBotChannelAssociations' :: GetBotChannelAssociations -> Text
botName} -> Text
botName) (\s :: GetBotChannelAssociations
s@GetBotChannelAssociations' {} Text
a -> GetBotChannelAssociations
s {$sel:botName:GetBotChannelAssociations' :: Text
botName = Text
a} :: GetBotChannelAssociations)

-- | An alias pointing to the specific version of the Amazon Lex bot to which
-- this association is being made.
getBotChannelAssociations_botAlias :: Lens.Lens' GetBotChannelAssociations Prelude.Text
getBotChannelAssociations_botAlias :: (Text -> f Text)
-> GetBotChannelAssociations -> f GetBotChannelAssociations
getBotChannelAssociations_botAlias = (GetBotChannelAssociations -> Text)
-> (GetBotChannelAssociations -> Text -> GetBotChannelAssociations)
-> Lens
     GetBotChannelAssociations GetBotChannelAssociations Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBotChannelAssociations' {Text
botAlias :: Text
$sel:botAlias:GetBotChannelAssociations' :: GetBotChannelAssociations -> Text
botAlias} -> Text
botAlias) (\s :: GetBotChannelAssociations
s@GetBotChannelAssociations' {} Text
a -> GetBotChannelAssociations
s {$sel:botAlias:GetBotChannelAssociations' :: Text
botAlias = Text
a} :: GetBotChannelAssociations)

instance Core.AWSPager GetBotChannelAssociations where
  page :: GetBotChannelAssociations
-> AWSResponse GetBotChannelAssociations
-> Maybe GetBotChannelAssociations
page GetBotChannelAssociations
rq AWSResponse GetBotChannelAssociations
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetBotChannelAssociations
GetBotChannelAssociationsResponse
rs
            GetBotChannelAssociationsResponse
-> Getting (First Text) GetBotChannelAssociationsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetBotChannelAssociationsResponse
-> Const (First Text) GetBotChannelAssociationsResponse
Lens' GetBotChannelAssociationsResponse (Maybe Text)
getBotChannelAssociationsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> GetBotChannelAssociationsResponse
 -> Const (First Text) GetBotChannelAssociationsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetBotChannelAssociationsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe GetBotChannelAssociations
forall a. Maybe a
Prelude.Nothing
    | Maybe [BotChannelAssociation] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetBotChannelAssociations
GetBotChannelAssociationsResponse
rs
            GetBotChannelAssociationsResponse
-> Getting
     (First [BotChannelAssociation])
     GetBotChannelAssociationsResponse
     [BotChannelAssociation]
-> Maybe [BotChannelAssociation]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [BotChannelAssociation]
 -> Const
      (First [BotChannelAssociation]) (Maybe [BotChannelAssociation]))
-> GetBotChannelAssociationsResponse
-> Const
     (First [BotChannelAssociation]) GetBotChannelAssociationsResponse
Lens'
  GetBotChannelAssociationsResponse (Maybe [BotChannelAssociation])
getBotChannelAssociationsResponse_botChannelAssociations
              ((Maybe [BotChannelAssociation]
  -> Const
       (First [BotChannelAssociation]) (Maybe [BotChannelAssociation]))
 -> GetBotChannelAssociationsResponse
 -> Const
      (First [BotChannelAssociation]) GetBotChannelAssociationsResponse)
-> (([BotChannelAssociation]
     -> Const (First [BotChannelAssociation]) [BotChannelAssociation])
    -> Maybe [BotChannelAssociation]
    -> Const
         (First [BotChannelAssociation]) (Maybe [BotChannelAssociation]))
-> Getting
     (First [BotChannelAssociation])
     GetBotChannelAssociationsResponse
     [BotChannelAssociation]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([BotChannelAssociation]
 -> Const (First [BotChannelAssociation]) [BotChannelAssociation])
-> Maybe [BotChannelAssociation]
-> Const
     (First [BotChannelAssociation]) (Maybe [BotChannelAssociation])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe GetBotChannelAssociations
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      GetBotChannelAssociations -> Maybe GetBotChannelAssociations
forall a. a -> Maybe a
Prelude.Just (GetBotChannelAssociations -> Maybe GetBotChannelAssociations)
-> GetBotChannelAssociations -> Maybe GetBotChannelAssociations
forall a b. (a -> b) -> a -> b
Prelude.$
        GetBotChannelAssociations
rq
          GetBotChannelAssociations
-> (GetBotChannelAssociations -> GetBotChannelAssociations)
-> GetBotChannelAssociations
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> GetBotChannelAssociations -> Identity GetBotChannelAssociations
Lens
  GetBotChannelAssociations
  GetBotChannelAssociations
  (Maybe Text)
  (Maybe Text)
getBotChannelAssociations_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> GetBotChannelAssociations -> Identity GetBotChannelAssociations)
-> Maybe Text
-> GetBotChannelAssociations
-> GetBotChannelAssociations
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetBotChannelAssociations
GetBotChannelAssociationsResponse
rs
          GetBotChannelAssociationsResponse
-> Getting (First Text) GetBotChannelAssociationsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetBotChannelAssociationsResponse
-> Const (First Text) GetBotChannelAssociationsResponse
Lens' GetBotChannelAssociationsResponse (Maybe Text)
getBotChannelAssociationsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> GetBotChannelAssociationsResponse
 -> Const (First Text) GetBotChannelAssociationsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetBotChannelAssociationsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest GetBotChannelAssociations where
  type
    AWSResponse GetBotChannelAssociations =
      GetBotChannelAssociationsResponse
  request :: GetBotChannelAssociations -> Request GetBotChannelAssociations
request = Service
-> GetBotChannelAssociations -> Request GetBotChannelAssociations
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetBotChannelAssociations
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetBotChannelAssociations)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetBotChannelAssociations))
-> Logger
-> Service
-> Proxy GetBotChannelAssociations
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetBotChannelAssociations)))
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 [BotChannelAssociation]
-> Maybe Text -> Int -> GetBotChannelAssociationsResponse
GetBotChannelAssociationsResponse'
            (Maybe [BotChannelAssociation]
 -> Maybe Text -> Int -> GetBotChannelAssociationsResponse)
-> Either String (Maybe [BotChannelAssociation])
-> Either
     String (Maybe Text -> Int -> GetBotChannelAssociationsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Text -> Either String (Maybe (Maybe [BotChannelAssociation]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"botChannelAssociations"
                            Either String (Maybe (Maybe [BotChannelAssociation]))
-> Maybe [BotChannelAssociation]
-> Either String (Maybe [BotChannelAssociation])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [BotChannelAssociation]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either
  String (Maybe Text -> Int -> GetBotChannelAssociationsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetBotChannelAssociationsResponse)
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
"nextToken")
            Either String (Int -> GetBotChannelAssociationsResponse)
-> Either String Int
-> Either String GetBotChannelAssociationsResponse
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 GetBotChannelAssociations

instance Prelude.NFData GetBotChannelAssociations

instance Core.ToHeaders GetBotChannelAssociations where
  toHeaders :: GetBotChannelAssociations -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetBotChannelAssociations -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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.ToPath GetBotChannelAssociations where
  toPath :: GetBotChannelAssociations -> ByteString
toPath GetBotChannelAssociations' {Maybe Natural
Maybe Text
Text
botAlias :: Text
botName :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
nameContains :: Maybe Text
$sel:botAlias:GetBotChannelAssociations' :: GetBotChannelAssociations -> Text
$sel:botName:GetBotChannelAssociations' :: GetBotChannelAssociations -> Text
$sel:maxResults:GetBotChannelAssociations' :: GetBotChannelAssociations -> Maybe Natural
$sel:nextToken:GetBotChannelAssociations' :: GetBotChannelAssociations -> Maybe Text
$sel:nameContains:GetBotChannelAssociations' :: GetBotChannelAssociations -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/bots/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
botName,
        ByteString
"/aliases/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
botAlias,
        ByteString
"/channels/"
      ]

instance Core.ToQuery GetBotChannelAssociations where
  toQuery :: GetBotChannelAssociations -> QueryString
toQuery GetBotChannelAssociations' {Maybe Natural
Maybe Text
Text
botAlias :: Text
botName :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
nameContains :: Maybe Text
$sel:botAlias:GetBotChannelAssociations' :: GetBotChannelAssociations -> Text
$sel:botName:GetBotChannelAssociations' :: GetBotChannelAssociations -> Text
$sel:maxResults:GetBotChannelAssociations' :: GetBotChannelAssociations -> Maybe Natural
$sel:nextToken:GetBotChannelAssociations' :: GetBotChannelAssociations -> Maybe Text
$sel:nameContains:GetBotChannelAssociations' :: GetBotChannelAssociations -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"nameContains" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nameContains,
        ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
      ]

-- | /See:/ 'newGetBotChannelAssociationsResponse' smart constructor.
data GetBotChannelAssociationsResponse = GetBotChannelAssociationsResponse'
  { -- | An array of objects, one for each association, that provides information
    -- about the Amazon Lex bot and its association with the channel.
    GetBotChannelAssociationsResponse -> Maybe [BotChannelAssociation]
botChannelAssociations :: Prelude.Maybe [BotChannelAssociation],
    -- | A pagination token that fetches the next page of associations. If the
    -- response to this call is truncated, Amazon Lex returns a pagination
    -- token in the response. To fetch the next page of associations, specify
    -- the pagination token in the next request.
    GetBotChannelAssociationsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetBotChannelAssociationsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetBotChannelAssociationsResponse
-> GetBotChannelAssociationsResponse -> Bool
(GetBotChannelAssociationsResponse
 -> GetBotChannelAssociationsResponse -> Bool)
-> (GetBotChannelAssociationsResponse
    -> GetBotChannelAssociationsResponse -> Bool)
-> Eq GetBotChannelAssociationsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBotChannelAssociationsResponse
-> GetBotChannelAssociationsResponse -> Bool
$c/= :: GetBotChannelAssociationsResponse
-> GetBotChannelAssociationsResponse -> Bool
== :: GetBotChannelAssociationsResponse
-> GetBotChannelAssociationsResponse -> Bool
$c== :: GetBotChannelAssociationsResponse
-> GetBotChannelAssociationsResponse -> Bool
Prelude.Eq, Int -> GetBotChannelAssociationsResponse -> ShowS
[GetBotChannelAssociationsResponse] -> ShowS
GetBotChannelAssociationsResponse -> String
(Int -> GetBotChannelAssociationsResponse -> ShowS)
-> (GetBotChannelAssociationsResponse -> String)
-> ([GetBotChannelAssociationsResponse] -> ShowS)
-> Show GetBotChannelAssociationsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBotChannelAssociationsResponse] -> ShowS
$cshowList :: [GetBotChannelAssociationsResponse] -> ShowS
show :: GetBotChannelAssociationsResponse -> String
$cshow :: GetBotChannelAssociationsResponse -> String
showsPrec :: Int -> GetBotChannelAssociationsResponse -> ShowS
$cshowsPrec :: Int -> GetBotChannelAssociationsResponse -> ShowS
Prelude.Show, (forall x.
 GetBotChannelAssociationsResponse
 -> Rep GetBotChannelAssociationsResponse x)
-> (forall x.
    Rep GetBotChannelAssociationsResponse x
    -> GetBotChannelAssociationsResponse)
-> Generic GetBotChannelAssociationsResponse
forall x.
Rep GetBotChannelAssociationsResponse x
-> GetBotChannelAssociationsResponse
forall x.
GetBotChannelAssociationsResponse
-> Rep GetBotChannelAssociationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetBotChannelAssociationsResponse x
-> GetBotChannelAssociationsResponse
$cfrom :: forall x.
GetBotChannelAssociationsResponse
-> Rep GetBotChannelAssociationsResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetBotChannelAssociationsResponse' 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:
--
-- 'botChannelAssociations', 'getBotChannelAssociationsResponse_botChannelAssociations' - An array of objects, one for each association, that provides information
-- about the Amazon Lex bot and its association with the channel.
--
-- 'nextToken', 'getBotChannelAssociationsResponse_nextToken' - A pagination token that fetches the next page of associations. If the
-- response to this call is truncated, Amazon Lex returns a pagination
-- token in the response. To fetch the next page of associations, specify
-- the pagination token in the next request.
--
-- 'httpStatus', 'getBotChannelAssociationsResponse_httpStatus' - The response's http status code.
newGetBotChannelAssociationsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetBotChannelAssociationsResponse
newGetBotChannelAssociationsResponse :: Int -> GetBotChannelAssociationsResponse
newGetBotChannelAssociationsResponse Int
pHttpStatus_ =
  GetBotChannelAssociationsResponse' :: Maybe [BotChannelAssociation]
-> Maybe Text -> Int -> GetBotChannelAssociationsResponse
GetBotChannelAssociationsResponse'
    { $sel:botChannelAssociations:GetBotChannelAssociationsResponse' :: Maybe [BotChannelAssociation]
botChannelAssociations =
        Maybe [BotChannelAssociation]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetBotChannelAssociationsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetBotChannelAssociationsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An array of objects, one for each association, that provides information
-- about the Amazon Lex bot and its association with the channel.
getBotChannelAssociationsResponse_botChannelAssociations :: Lens.Lens' GetBotChannelAssociationsResponse (Prelude.Maybe [BotChannelAssociation])
getBotChannelAssociationsResponse_botChannelAssociations :: (Maybe [BotChannelAssociation]
 -> f (Maybe [BotChannelAssociation]))
-> GetBotChannelAssociationsResponse
-> f GetBotChannelAssociationsResponse
getBotChannelAssociationsResponse_botChannelAssociations = (GetBotChannelAssociationsResponse
 -> Maybe [BotChannelAssociation])
-> (GetBotChannelAssociationsResponse
    -> Maybe [BotChannelAssociation]
    -> GetBotChannelAssociationsResponse)
-> Lens'
     GetBotChannelAssociationsResponse (Maybe [BotChannelAssociation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBotChannelAssociationsResponse' {Maybe [BotChannelAssociation]
botChannelAssociations :: Maybe [BotChannelAssociation]
$sel:botChannelAssociations:GetBotChannelAssociationsResponse' :: GetBotChannelAssociationsResponse -> Maybe [BotChannelAssociation]
botChannelAssociations} -> Maybe [BotChannelAssociation]
botChannelAssociations) (\s :: GetBotChannelAssociationsResponse
s@GetBotChannelAssociationsResponse' {} Maybe [BotChannelAssociation]
a -> GetBotChannelAssociationsResponse
s {$sel:botChannelAssociations:GetBotChannelAssociationsResponse' :: Maybe [BotChannelAssociation]
botChannelAssociations = Maybe [BotChannelAssociation]
a} :: GetBotChannelAssociationsResponse) ((Maybe [BotChannelAssociation]
  -> f (Maybe [BotChannelAssociation]))
 -> GetBotChannelAssociationsResponse
 -> f GetBotChannelAssociationsResponse)
-> ((Maybe [BotChannelAssociation]
     -> f (Maybe [BotChannelAssociation]))
    -> Maybe [BotChannelAssociation]
    -> f (Maybe [BotChannelAssociation]))
-> (Maybe [BotChannelAssociation]
    -> f (Maybe [BotChannelAssociation]))
-> GetBotChannelAssociationsResponse
-> f GetBotChannelAssociationsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [BotChannelAssociation]
  [BotChannelAssociation]
  [BotChannelAssociation]
  [BotChannelAssociation]
-> Iso
     (Maybe [BotChannelAssociation])
     (Maybe [BotChannelAssociation])
     (Maybe [BotChannelAssociation])
     (Maybe [BotChannelAssociation])
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
  [BotChannelAssociation]
  [BotChannelAssociation]
  [BotChannelAssociation]
  [BotChannelAssociation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A pagination token that fetches the next page of associations. If the
-- response to this call is truncated, Amazon Lex returns a pagination
-- token in the response. To fetch the next page of associations, specify
-- the pagination token in the next request.
getBotChannelAssociationsResponse_nextToken :: Lens.Lens' GetBotChannelAssociationsResponse (Prelude.Maybe Prelude.Text)
getBotChannelAssociationsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetBotChannelAssociationsResponse
-> f GetBotChannelAssociationsResponse
getBotChannelAssociationsResponse_nextToken = (GetBotChannelAssociationsResponse -> Maybe Text)
-> (GetBotChannelAssociationsResponse
    -> Maybe Text -> GetBotChannelAssociationsResponse)
-> Lens' GetBotChannelAssociationsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBotChannelAssociationsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetBotChannelAssociationsResponse' :: GetBotChannelAssociationsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetBotChannelAssociationsResponse
s@GetBotChannelAssociationsResponse' {} Maybe Text
a -> GetBotChannelAssociationsResponse
s {$sel:nextToken:GetBotChannelAssociationsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetBotChannelAssociationsResponse)

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

instance
  Prelude.NFData
    GetBotChannelAssociationsResponse