{-# 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 #-}
module Amazonka.LexModels.GetBotVersions
(
GetBotVersions (..),
newGetBotVersions,
getBotVersions_maxResults,
getBotVersions_nextToken,
getBotVersions_name,
GetBotVersionsResponse (..),
newGetBotVersionsResponse,
getBotVersionsResponse_bots,
getBotVersionsResponse_nextToken,
getBotVersionsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.LexModels.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetBotVersions = GetBotVersions'
{
GetBotVersions -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
GetBotVersions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetBotVersions -> Text
name :: Prelude.Text
}
deriving (GetBotVersions -> GetBotVersions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBotVersions -> GetBotVersions -> Bool
$c/= :: GetBotVersions -> GetBotVersions -> Bool
== :: GetBotVersions -> GetBotVersions -> Bool
$c== :: GetBotVersions -> GetBotVersions -> Bool
Prelude.Eq, ReadPrec [GetBotVersions]
ReadPrec GetBotVersions
Int -> ReadS GetBotVersions
ReadS [GetBotVersions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetBotVersions]
$creadListPrec :: ReadPrec [GetBotVersions]
readPrec :: ReadPrec GetBotVersions
$creadPrec :: ReadPrec GetBotVersions
readList :: ReadS [GetBotVersions]
$creadList :: ReadS [GetBotVersions]
readsPrec :: Int -> ReadS GetBotVersions
$creadsPrec :: Int -> ReadS GetBotVersions
Prelude.Read, Int -> GetBotVersions -> ShowS
[GetBotVersions] -> ShowS
GetBotVersions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBotVersions] -> ShowS
$cshowList :: [GetBotVersions] -> ShowS
show :: GetBotVersions -> String
$cshow :: GetBotVersions -> String
showsPrec :: Int -> GetBotVersions -> ShowS
$cshowsPrec :: Int -> GetBotVersions -> ShowS
Prelude.Show, forall x. Rep GetBotVersions x -> GetBotVersions
forall x. GetBotVersions -> Rep GetBotVersions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetBotVersions x -> GetBotVersions
$cfrom :: forall x. GetBotVersions -> Rep GetBotVersions x
Prelude.Generic)
newGetBotVersions ::
Prelude.Text ->
GetBotVersions
newGetBotVersions :: Text -> GetBotVersions
newGetBotVersions Text
pName_ =
GetBotVersions'
{ $sel:maxResults:GetBotVersions' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:GetBotVersions' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:name:GetBotVersions' :: Text
name = Text
pName_
}
getBotVersions_maxResults :: Lens.Lens' GetBotVersions (Prelude.Maybe Prelude.Natural)
getBotVersions_maxResults :: Lens' GetBotVersions (Maybe Natural)
getBotVersions_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBotVersions' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetBotVersions' :: GetBotVersions -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetBotVersions
s@GetBotVersions' {} Maybe Natural
a -> GetBotVersions
s {$sel:maxResults:GetBotVersions' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetBotVersions)
getBotVersions_nextToken :: Lens.Lens' GetBotVersions (Prelude.Maybe Prelude.Text)
getBotVersions_nextToken :: Lens' GetBotVersions (Maybe Text)
getBotVersions_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBotVersions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetBotVersions' :: GetBotVersions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetBotVersions
s@GetBotVersions' {} Maybe Text
a -> GetBotVersions
s {$sel:nextToken:GetBotVersions' :: Maybe Text
nextToken = Maybe Text
a} :: GetBotVersions)
getBotVersions_name :: Lens.Lens' GetBotVersions Prelude.Text
getBotVersions_name :: Lens' GetBotVersions Text
getBotVersions_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBotVersions' {Text
name :: Text
$sel:name:GetBotVersions' :: GetBotVersions -> Text
name} -> Text
name) (\s :: GetBotVersions
s@GetBotVersions' {} Text
a -> GetBotVersions
s {$sel:name:GetBotVersions' :: Text
name = Text
a} :: GetBotVersions)
instance Core.AWSPager GetBotVersions where
page :: GetBotVersions
-> AWSResponse GetBotVersions -> Maybe GetBotVersions
page GetBotVersions
rq AWSResponse GetBotVersions
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetBotVersions
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetBotVersionsResponse (Maybe Text)
getBotVersionsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetBotVersions
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetBotVersionsResponse (Maybe [BotMetadata])
getBotVersionsResponse_bots
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ GetBotVersions
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' GetBotVersions (Maybe Text)
getBotVersions_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetBotVersions
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetBotVersionsResponse (Maybe Text)
getBotVersionsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest GetBotVersions where
type
AWSResponse GetBotVersions =
GetBotVersionsResponse
request :: (Service -> Service) -> GetBotVersions -> Request GetBotVersions
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetBotVersions
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetBotVersions)))
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 ->
Maybe [BotMetadata] -> Maybe Text -> Int -> GetBotVersionsResponse
GetBotVersionsResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"bots" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"nextToken")
forall (f :: * -> *) a b. Applicative f => 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))
)
instance Prelude.Hashable GetBotVersions where
hashWithSalt :: Int -> GetBotVersions -> Int
hashWithSalt Int
_salt GetBotVersions' {Maybe Natural
Maybe Text
Text
name :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:name:GetBotVersions' :: GetBotVersions -> Text
$sel:nextToken:GetBotVersions' :: GetBotVersions -> Maybe Text
$sel:maxResults:GetBotVersions' :: GetBotVersions -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
instance Prelude.NFData GetBotVersions where
rnf :: GetBotVersions -> ()
rnf GetBotVersions' {Maybe Natural
Maybe Text
Text
name :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:name:GetBotVersions' :: GetBotVersions -> Text
$sel:nextToken:GetBotVersions' :: GetBotVersions -> Maybe Text
$sel:maxResults:GetBotVersions' :: GetBotVersions -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
instance Data.ToHeaders GetBotVersions where
toHeaders :: GetBotVersions -> 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.ToPath GetBotVersions where
toPath :: GetBotVersions -> ByteString
toPath GetBotVersions' {Maybe Natural
Maybe Text
Text
name :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:name:GetBotVersions' :: GetBotVersions -> Text
$sel:nextToken:GetBotVersions' :: GetBotVersions -> Maybe Text
$sel:maxResults:GetBotVersions' :: GetBotVersions -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/bots/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
name, ByteString
"/versions/"]
instance Data.ToQuery GetBotVersions where
toQuery :: GetBotVersions -> QueryString
toQuery GetBotVersions' {Maybe Natural
Maybe Text
Text
name :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:name:GetBotVersions' :: GetBotVersions -> Text
$sel:nextToken:GetBotVersions' :: GetBotVersions -> Maybe Text
$sel:maxResults:GetBotVersions' :: GetBotVersions -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"maxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
ByteString
"nextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken
]
data GetBotVersionsResponse = GetBotVersionsResponse'
{
GetBotVersionsResponse -> Maybe [BotMetadata]
bots :: Prelude.Maybe [BotMetadata],
GetBotVersionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetBotVersionsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetBotVersionsResponse -> GetBotVersionsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBotVersionsResponse -> GetBotVersionsResponse -> Bool
$c/= :: GetBotVersionsResponse -> GetBotVersionsResponse -> Bool
== :: GetBotVersionsResponse -> GetBotVersionsResponse -> Bool
$c== :: GetBotVersionsResponse -> GetBotVersionsResponse -> Bool
Prelude.Eq, ReadPrec [GetBotVersionsResponse]
ReadPrec GetBotVersionsResponse
Int -> ReadS GetBotVersionsResponse
ReadS [GetBotVersionsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetBotVersionsResponse]
$creadListPrec :: ReadPrec [GetBotVersionsResponse]
readPrec :: ReadPrec GetBotVersionsResponse
$creadPrec :: ReadPrec GetBotVersionsResponse
readList :: ReadS [GetBotVersionsResponse]
$creadList :: ReadS [GetBotVersionsResponse]
readsPrec :: Int -> ReadS GetBotVersionsResponse
$creadsPrec :: Int -> ReadS GetBotVersionsResponse
Prelude.Read, Int -> GetBotVersionsResponse -> ShowS
[GetBotVersionsResponse] -> ShowS
GetBotVersionsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBotVersionsResponse] -> ShowS
$cshowList :: [GetBotVersionsResponse] -> ShowS
show :: GetBotVersionsResponse -> String
$cshow :: GetBotVersionsResponse -> String
showsPrec :: Int -> GetBotVersionsResponse -> ShowS
$cshowsPrec :: Int -> GetBotVersionsResponse -> ShowS
Prelude.Show, forall x. Rep GetBotVersionsResponse x -> GetBotVersionsResponse
forall x. GetBotVersionsResponse -> Rep GetBotVersionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetBotVersionsResponse x -> GetBotVersionsResponse
$cfrom :: forall x. GetBotVersionsResponse -> Rep GetBotVersionsResponse x
Prelude.Generic)
newGetBotVersionsResponse ::
Prelude.Int ->
GetBotVersionsResponse
newGetBotVersionsResponse :: Int -> GetBotVersionsResponse
newGetBotVersionsResponse Int
pHttpStatus_ =
GetBotVersionsResponse'
{ $sel:bots:GetBotVersionsResponse' :: Maybe [BotMetadata]
bots = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:GetBotVersionsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetBotVersionsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getBotVersionsResponse_bots :: Lens.Lens' GetBotVersionsResponse (Prelude.Maybe [BotMetadata])
getBotVersionsResponse_bots :: Lens' GetBotVersionsResponse (Maybe [BotMetadata])
getBotVersionsResponse_bots = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBotVersionsResponse' {Maybe [BotMetadata]
bots :: Maybe [BotMetadata]
$sel:bots:GetBotVersionsResponse' :: GetBotVersionsResponse -> Maybe [BotMetadata]
bots} -> Maybe [BotMetadata]
bots) (\s :: GetBotVersionsResponse
s@GetBotVersionsResponse' {} Maybe [BotMetadata]
a -> GetBotVersionsResponse
s {$sel:bots:GetBotVersionsResponse' :: Maybe [BotMetadata]
bots = Maybe [BotMetadata]
a} :: GetBotVersionsResponse) 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
getBotVersionsResponse_nextToken :: Lens.Lens' GetBotVersionsResponse (Prelude.Maybe Prelude.Text)
getBotVersionsResponse_nextToken :: Lens' GetBotVersionsResponse (Maybe Text)
getBotVersionsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBotVersionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetBotVersionsResponse' :: GetBotVersionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetBotVersionsResponse
s@GetBotVersionsResponse' {} Maybe Text
a -> GetBotVersionsResponse
s {$sel:nextToken:GetBotVersionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetBotVersionsResponse)
getBotVersionsResponse_httpStatus :: Lens.Lens' GetBotVersionsResponse Prelude.Int
getBotVersionsResponse_httpStatus :: Lens' GetBotVersionsResponse Int
getBotVersionsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBotVersionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetBotVersionsResponse' :: GetBotVersionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetBotVersionsResponse
s@GetBotVersionsResponse' {} Int
a -> GetBotVersionsResponse
s {$sel:httpStatus:GetBotVersionsResponse' :: Int
httpStatus = Int
a} :: GetBotVersionsResponse)
instance Prelude.NFData GetBotVersionsResponse where
rnf :: GetBotVersionsResponse -> ()
rnf GetBotVersionsResponse' {Int
Maybe [BotMetadata]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
bots :: Maybe [BotMetadata]
$sel:httpStatus:GetBotVersionsResponse' :: GetBotVersionsResponse -> Int
$sel:nextToken:GetBotVersionsResponse' :: GetBotVersionsResponse -> Maybe Text
$sel:bots:GetBotVersionsResponse' :: GetBotVersionsResponse -> Maybe [BotMetadata]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [BotMetadata]
bots
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus