{-# 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.GetBotVersions
-- 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)
--
-- Gets information about all of the versions of a bot.
--
-- The @GetBotVersions@ operation returns a @BotMetadata@ object for each
-- version of a bot. For example, if a bot has three numbered versions, the
-- @GetBotVersions@ operation returns four @BotMetadata@ objects in the
-- response, one for each numbered version and one for the @$LATEST@
-- version.
--
-- The @GetBotVersions@ operation always returns at least one version, the
-- @$LATEST@ version.
--
-- This operation requires permissions for the @lex:GetBotVersions@ action.
--
-- This operation returns paginated results.
module Amazonka.LexModels.GetBotVersions
  ( -- * Creating a Request
    GetBotVersions (..),
    newGetBotVersions,

    -- * Request Lenses
    getBotVersions_nextToken,
    getBotVersions_maxResults,
    getBotVersions_name,

    -- * Destructuring the Response
    GetBotVersionsResponse (..),
    newGetBotVersionsResponse,

    -- * Response Lenses
    getBotVersionsResponse_bots,
    getBotVersionsResponse_nextToken,
    getBotVersionsResponse_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:/ 'newGetBotVersions' smart constructor.
data GetBotVersions = GetBotVersions'
  { -- | A pagination token for fetching the next page of bot versions. If the
    -- response to this call is truncated, Amazon Lex returns a pagination
    -- token in the response. To fetch the next page of versions, specify the
    -- pagination token in the next request.
    GetBotVersions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of bot versions to return in the response. The
    -- default is 10.
    GetBotVersions -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The name of the bot for which versions should be returned.
    GetBotVersions -> Text
name :: Prelude.Text
  }
  deriving (GetBotVersions -> GetBotVersions -> Bool
(GetBotVersions -> GetBotVersions -> Bool)
-> (GetBotVersions -> GetBotVersions -> Bool) -> Eq GetBotVersions
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]
(Int -> ReadS GetBotVersions)
-> ReadS [GetBotVersions]
-> ReadPrec GetBotVersions
-> ReadPrec [GetBotVersions]
-> Read 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
(Int -> GetBotVersions -> ShowS)
-> (GetBotVersions -> String)
-> ([GetBotVersions] -> ShowS)
-> Show GetBotVersions
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. GetBotVersions -> Rep GetBotVersions x)
-> (forall x. Rep GetBotVersions x -> GetBotVersions)
-> Generic GetBotVersions
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)

-- |
-- Create a value of 'GetBotVersions' 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:
--
-- 'nextToken', 'getBotVersions_nextToken' - A pagination token for fetching the next page of bot versions. If the
-- response to this call is truncated, Amazon Lex returns a pagination
-- token in the response. To fetch the next page of versions, specify the
-- pagination token in the next request.
--
-- 'maxResults', 'getBotVersions_maxResults' - The maximum number of bot versions to return in the response. The
-- default is 10.
--
-- 'name', 'getBotVersions_name' - The name of the bot for which versions should be returned.
newGetBotVersions ::
  -- | 'name'
  Prelude.Text ->
  GetBotVersions
newGetBotVersions :: Text -> GetBotVersions
newGetBotVersions Text
pName_ =
  GetBotVersions' :: Maybe Text -> Maybe Natural -> Text -> GetBotVersions
GetBotVersions'
    { $sel:nextToken:GetBotVersions' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:GetBotVersions' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:name:GetBotVersions' :: Text
name = Text
pName_
    }

-- | A pagination token for fetching the next page of bot versions. If the
-- response to this call is truncated, Amazon Lex returns a pagination
-- token in the response. To fetch the next page of versions, specify the
-- pagination token in the next request.
getBotVersions_nextToken :: Lens.Lens' GetBotVersions (Prelude.Maybe Prelude.Text)
getBotVersions_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetBotVersions -> f GetBotVersions
getBotVersions_nextToken = (GetBotVersions -> Maybe Text)
-> (GetBotVersions -> Maybe Text -> GetBotVersions)
-> Lens GetBotVersions GetBotVersions (Maybe Text) (Maybe Text)
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)

-- | The maximum number of bot versions to return in the response. The
-- default is 10.
getBotVersions_maxResults :: Lens.Lens' GetBotVersions (Prelude.Maybe Prelude.Natural)
getBotVersions_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> GetBotVersions -> f GetBotVersions
getBotVersions_maxResults = (GetBotVersions -> Maybe Natural)
-> (GetBotVersions -> Maybe Natural -> GetBotVersions)
-> Lens
     GetBotVersions GetBotVersions (Maybe Natural) (Maybe Natural)
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)

-- | The name of the bot for which versions should be returned.
getBotVersions_name :: Lens.Lens' GetBotVersions Prelude.Text
getBotVersions_name :: (Text -> f Text) -> GetBotVersions -> f GetBotVersions
getBotVersions_name = (GetBotVersions -> Text)
-> (GetBotVersions -> Text -> GetBotVersions)
-> Lens GetBotVersions GetBotVersions Text Text
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
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetBotVersions
GetBotVersionsResponse
rs
            GetBotVersionsResponse
-> Getting (First Text) GetBotVersionsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetBotVersionsResponse
-> Const (First Text) GetBotVersionsResponse
Lens' GetBotVersionsResponse (Maybe Text)
getBotVersionsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> GetBotVersionsResponse
 -> Const (First Text) GetBotVersionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetBotVersionsResponse 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 GetBotVersions
forall a. Maybe a
Prelude.Nothing
    | Maybe [BotMetadata] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetBotVersions
GetBotVersionsResponse
rs
            GetBotVersionsResponse
-> Getting
     (First [BotMetadata]) GetBotVersionsResponse [BotMetadata]
-> Maybe [BotMetadata]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [BotMetadata]
 -> Const (First [BotMetadata]) (Maybe [BotMetadata]))
-> GetBotVersionsResponse
-> Const (First [BotMetadata]) GetBotVersionsResponse
Lens' GetBotVersionsResponse (Maybe [BotMetadata])
getBotVersionsResponse_bots ((Maybe [BotMetadata]
  -> Const (First [BotMetadata]) (Maybe [BotMetadata]))
 -> GetBotVersionsResponse
 -> Const (First [BotMetadata]) GetBotVersionsResponse)
-> (([BotMetadata] -> Const (First [BotMetadata]) [BotMetadata])
    -> Maybe [BotMetadata]
    -> Const (First [BotMetadata]) (Maybe [BotMetadata]))
-> Getting
     (First [BotMetadata]) GetBotVersionsResponse [BotMetadata]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([BotMetadata] -> Const (First [BotMetadata]) [BotMetadata])
-> Maybe [BotMetadata]
-> Const (First [BotMetadata]) (Maybe [BotMetadata])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe GetBotVersions
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      GetBotVersions -> Maybe GetBotVersions
forall a. a -> Maybe a
Prelude.Just (GetBotVersions -> Maybe GetBotVersions)
-> GetBotVersions -> Maybe GetBotVersions
forall a b. (a -> b) -> a -> b
Prelude.$
        GetBotVersions
rq
          GetBotVersions
-> (GetBotVersions -> GetBotVersions) -> GetBotVersions
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> GetBotVersions -> Identity GetBotVersions
Lens GetBotVersions GetBotVersions (Maybe Text) (Maybe Text)
getBotVersions_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> GetBotVersions -> Identity GetBotVersions)
-> Maybe Text -> GetBotVersions -> GetBotVersions
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetBotVersions
GetBotVersionsResponse
rs
          GetBotVersionsResponse
-> Getting (First Text) GetBotVersionsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetBotVersionsResponse
-> Const (First Text) GetBotVersionsResponse
Lens' GetBotVersionsResponse (Maybe Text)
getBotVersionsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
 -> GetBotVersionsResponse
 -> Const (First Text) GetBotVersionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetBotVersionsResponse 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 GetBotVersions where
  type
    AWSResponse GetBotVersions =
      GetBotVersionsResponse
  request :: GetBotVersions -> Request GetBotVersions
request = Service -> GetBotVersions -> Request GetBotVersions
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetBotVersions
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetBotVersions)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetBotVersions))
-> Logger
-> Service
-> Proxy GetBotVersions
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetBotVersions)))
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 [BotMetadata] -> Maybe Text -> Int -> GetBotVersionsResponse
GetBotVersionsResponse'
            (Maybe [BotMetadata]
 -> Maybe Text -> Int -> GetBotVersionsResponse)
-> Either String (Maybe [BotMetadata])
-> Either String (Maybe Text -> Int -> GetBotVersionsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [BotMetadata]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"bots" Either String (Maybe (Maybe [BotMetadata]))
-> Maybe [BotMetadata] -> Either String (Maybe [BotMetadata])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [BotMetadata]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Maybe Text -> Int -> GetBotVersionsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetBotVersionsResponse)
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 -> GetBotVersionsResponse)
-> Either String Int -> Either String GetBotVersionsResponse
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 GetBotVersions

instance Prelude.NFData GetBotVersions

instance Core.ToHeaders GetBotVersions where
  toHeaders :: GetBotVersions -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetBotVersions -> 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 GetBotVersions where
  toPath :: GetBotVersions -> ByteString
toPath GetBotVersions' {Maybe Natural
Maybe Text
Text
name :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:name:GetBotVersions' :: GetBotVersions -> Text
$sel:maxResults:GetBotVersions' :: GetBotVersions -> Maybe Natural
$sel:nextToken:GetBotVersions' :: GetBotVersions -> 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
name, ByteString
"/versions/"]

instance Core.ToQuery GetBotVersions where
  toQuery :: GetBotVersions -> QueryString
toQuery GetBotVersions' {Maybe Natural
Maybe Text
Text
name :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:name:GetBotVersions' :: GetBotVersions -> Text
$sel:maxResults:GetBotVersions' :: GetBotVersions -> Maybe Natural
$sel:nextToken:GetBotVersions' :: GetBotVersions -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ 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:/ 'newGetBotVersionsResponse' smart constructor.
data GetBotVersionsResponse = GetBotVersionsResponse'
  { -- | An array of @BotMetadata@ objects, one for each numbered version of the
    -- bot plus one for the @$LATEST@ version.
    GetBotVersionsResponse -> Maybe [BotMetadata]
bots :: Prelude.Maybe [BotMetadata],
    -- | A pagination token for fetching the next page of bot versions. If the
    -- response to this call is truncated, Amazon Lex returns a pagination
    -- token in the response. To fetch the next page of versions, specify the
    -- pagination token in the next request.
    GetBotVersionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetBotVersionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetBotVersionsResponse -> GetBotVersionsResponse -> Bool
(GetBotVersionsResponse -> GetBotVersionsResponse -> Bool)
-> (GetBotVersionsResponse -> GetBotVersionsResponse -> Bool)
-> Eq GetBotVersionsResponse
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]
(Int -> ReadS GetBotVersionsResponse)
-> ReadS [GetBotVersionsResponse]
-> ReadPrec GetBotVersionsResponse
-> ReadPrec [GetBotVersionsResponse]
-> Read 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
(Int -> GetBotVersionsResponse -> ShowS)
-> (GetBotVersionsResponse -> String)
-> ([GetBotVersionsResponse] -> ShowS)
-> Show GetBotVersionsResponse
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. GetBotVersionsResponse -> Rep GetBotVersionsResponse x)
-> (forall x.
    Rep GetBotVersionsResponse x -> GetBotVersionsResponse)
-> Generic GetBotVersionsResponse
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)

-- |
-- Create a value of 'GetBotVersionsResponse' 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:
--
-- 'bots', 'getBotVersionsResponse_bots' - An array of @BotMetadata@ objects, one for each numbered version of the
-- bot plus one for the @$LATEST@ version.
--
-- 'nextToken', 'getBotVersionsResponse_nextToken' - A pagination token for fetching the next page of bot versions. If the
-- response to this call is truncated, Amazon Lex returns a pagination
-- token in the response. To fetch the next page of versions, specify the
-- pagination token in the next request.
--
-- 'httpStatus', 'getBotVersionsResponse_httpStatus' - The response's http status code.
newGetBotVersionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetBotVersionsResponse
newGetBotVersionsResponse :: Int -> GetBotVersionsResponse
newGetBotVersionsResponse Int
pHttpStatus_ =
  GetBotVersionsResponse' :: Maybe [BotMetadata] -> Maybe Text -> Int -> GetBotVersionsResponse
GetBotVersionsResponse'
    { $sel:bots:GetBotVersionsResponse' :: Maybe [BotMetadata]
bots = Maybe [BotMetadata]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetBotVersionsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetBotVersionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An array of @BotMetadata@ objects, one for each numbered version of the
-- bot plus one for the @$LATEST@ version.
getBotVersionsResponse_bots :: Lens.Lens' GetBotVersionsResponse (Prelude.Maybe [BotMetadata])
getBotVersionsResponse_bots :: (Maybe [BotMetadata] -> f (Maybe [BotMetadata]))
-> GetBotVersionsResponse -> f GetBotVersionsResponse
getBotVersionsResponse_bots = (GetBotVersionsResponse -> Maybe [BotMetadata])
-> (GetBotVersionsResponse
    -> Maybe [BotMetadata] -> GetBotVersionsResponse)
-> Lens' GetBotVersionsResponse (Maybe [BotMetadata])
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) ((Maybe [BotMetadata] -> f (Maybe [BotMetadata]))
 -> GetBotVersionsResponse -> f GetBotVersionsResponse)
-> ((Maybe [BotMetadata] -> f (Maybe [BotMetadata]))
    -> Maybe [BotMetadata] -> f (Maybe [BotMetadata]))
-> (Maybe [BotMetadata] -> f (Maybe [BotMetadata]))
-> GetBotVersionsResponse
-> f GetBotVersionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [BotMetadata] [BotMetadata] [BotMetadata] [BotMetadata]
-> Iso
     (Maybe [BotMetadata])
     (Maybe [BotMetadata])
     (Maybe [BotMetadata])
     (Maybe [BotMetadata])
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 [BotMetadata] [BotMetadata] [BotMetadata] [BotMetadata]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A pagination token for fetching the next page of bot versions. If the
-- response to this call is truncated, Amazon Lex returns a pagination
-- token in the response. To fetch the next page of versions, specify the
-- pagination token in the next request.
getBotVersionsResponse_nextToken :: Lens.Lens' GetBotVersionsResponse (Prelude.Maybe Prelude.Text)
getBotVersionsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetBotVersionsResponse -> f GetBotVersionsResponse
getBotVersionsResponse_nextToken = (GetBotVersionsResponse -> Maybe Text)
-> (GetBotVersionsResponse -> Maybe Text -> GetBotVersionsResponse)
-> Lens' GetBotVersionsResponse (Maybe Text)
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)

-- | The response's http status code.
getBotVersionsResponse_httpStatus :: Lens.Lens' GetBotVersionsResponse Prelude.Int
getBotVersionsResponse_httpStatus :: (Int -> f Int)
-> GetBotVersionsResponse -> f GetBotVersionsResponse
getBotVersionsResponse_httpStatus = (GetBotVersionsResponse -> Int)
-> (GetBotVersionsResponse -> Int -> GetBotVersionsResponse)
-> Lens GetBotVersionsResponse GetBotVersionsResponse Int Int
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