{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.LexModels.GetBotChannelAssociations
(
getBotChannelAssociations
, GetBotChannelAssociations
, gbcaNameContains
, gbcaNextToken
, gbcaMaxResults
, gbcaBotName
, gbcaBotAlias
, getBotChannelAssociationsResponse
, GetBotChannelAssociationsResponse
, gbcasrsBotChannelAssociations
, gbcasrsNextToken
, gbcasrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.LexModels.Types
import Network.AWS.LexModels.Types.Product
import Network.AWS.Pager
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data GetBotChannelAssociations = GetBotChannelAssociations'
{ _gbcaNameContains :: !(Maybe Text)
, _gbcaNextToken :: !(Maybe Text)
, _gbcaMaxResults :: !(Maybe Nat)
, _gbcaBotName :: !Text
, _gbcaBotAlias :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getBotChannelAssociations
:: Text
-> Text
-> GetBotChannelAssociations
getBotChannelAssociations pBotName_ pBotAlias_ =
GetBotChannelAssociations'
{ _gbcaNameContains = Nothing
, _gbcaNextToken = Nothing
, _gbcaMaxResults = Nothing
, _gbcaBotName = pBotName_
, _gbcaBotAlias = pBotAlias_
}
gbcaNameContains :: Lens' GetBotChannelAssociations (Maybe Text)
gbcaNameContains = lens _gbcaNameContains (\ s a -> s{_gbcaNameContains = a})
gbcaNextToken :: Lens' GetBotChannelAssociations (Maybe Text)
gbcaNextToken = lens _gbcaNextToken (\ s a -> s{_gbcaNextToken = a})
gbcaMaxResults :: Lens' GetBotChannelAssociations (Maybe Natural)
gbcaMaxResults = lens _gbcaMaxResults (\ s a -> s{_gbcaMaxResults = a}) . mapping _Nat
gbcaBotName :: Lens' GetBotChannelAssociations Text
gbcaBotName = lens _gbcaBotName (\ s a -> s{_gbcaBotName = a})
gbcaBotAlias :: Lens' GetBotChannelAssociations Text
gbcaBotAlias = lens _gbcaBotAlias (\ s a -> s{_gbcaBotAlias = a})
instance AWSPager GetBotChannelAssociations where
page rq rs
| stop (rs ^. gbcasrsNextToken) = Nothing
| stop (rs ^. gbcasrsBotChannelAssociations) =
Nothing
| otherwise =
Just $ rq & gbcaNextToken .~ rs ^. gbcasrsNextToken
instance AWSRequest GetBotChannelAssociations where
type Rs GetBotChannelAssociations =
GetBotChannelAssociationsResponse
request = get lexModels
response
= receiveJSON
(\ s h x ->
GetBotChannelAssociationsResponse' <$>
(x .?> "botChannelAssociations" .!@ mempty) <*>
(x .?> "nextToken")
<*> (pure (fromEnum s)))
instance Hashable GetBotChannelAssociations where
instance NFData GetBotChannelAssociations where
instance ToHeaders GetBotChannelAssociations where
toHeaders
= const
(mconcat
["Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToPath GetBotChannelAssociations where
toPath GetBotChannelAssociations'{..}
= mconcat
["/bots/", toBS _gbcaBotName, "/aliases/",
toBS _gbcaBotAlias, "/channels/"]
instance ToQuery GetBotChannelAssociations where
toQuery GetBotChannelAssociations'{..}
= mconcat
["nameContains" =: _gbcaNameContains,
"nextToken" =: _gbcaNextToken,
"maxResults" =: _gbcaMaxResults]
data GetBotChannelAssociationsResponse = GetBotChannelAssociationsResponse'
{ _gbcasrsBotChannelAssociations :: !(Maybe [BotChannelAssociation])
, _gbcasrsNextToken :: !(Maybe Text)
, _gbcasrsResponseStatus :: !Int
} deriving (Eq, Show, Data, Typeable, Generic)
getBotChannelAssociationsResponse
:: Int
-> GetBotChannelAssociationsResponse
getBotChannelAssociationsResponse pResponseStatus_ =
GetBotChannelAssociationsResponse'
{ _gbcasrsBotChannelAssociations = Nothing
, _gbcasrsNextToken = Nothing
, _gbcasrsResponseStatus = pResponseStatus_
}
gbcasrsBotChannelAssociations :: Lens' GetBotChannelAssociationsResponse [BotChannelAssociation]
gbcasrsBotChannelAssociations = lens _gbcasrsBotChannelAssociations (\ s a -> s{_gbcasrsBotChannelAssociations = a}) . _Default . _Coerce
gbcasrsNextToken :: Lens' GetBotChannelAssociationsResponse (Maybe Text)
gbcasrsNextToken = lens _gbcasrsNextToken (\ s a -> s{_gbcasrsNextToken = a})
gbcasrsResponseStatus :: Lens' GetBotChannelAssociationsResponse Int
gbcasrsResponseStatus = lens _gbcasrsResponseStatus (\ s a -> s{_gbcasrsResponseStatus = a})
instance NFData GetBotChannelAssociationsResponse
where