{-# 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.GameLift.ListGameServers
-- 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 operation is used with the GameLift FleetIQ solution and game
-- server groups.__
--
-- Retrieves information on all game servers that are currently active in a
-- specified game server group. You can opt to sort the list by game server
-- age. Use the pagination parameters to retrieve results in a set of
-- sequential segments.
--
-- __Learn more__
--
-- <https://docs.aws.amazon.com/gamelift/latest/fleetiqguide/gsg-intro.html GameLift FleetIQ Guide>
--
-- __Related actions__
--
-- RegisterGameServer | ListGameServers | ClaimGameServer |
-- DescribeGameServer | UpdateGameServer | DeregisterGameServer |
-- <https://docs.aws.amazon.com/gamelift/latest/fleetiqguide/reference-awssdk-fleetiq.html All APIs by task>
--
-- This operation returns paginated results.
module Amazonka.GameLift.ListGameServers
  ( -- * Creating a Request
    ListGameServers (..),
    newListGameServers,

    -- * Request Lenses
    listGameServers_nextToken,
    listGameServers_sortOrder,
    listGameServers_limit,
    listGameServers_gameServerGroupName,

    -- * Destructuring the Response
    ListGameServersResponse (..),
    newListGameServersResponse,

    -- * Response Lenses
    listGameServersResponse_gameServers,
    listGameServersResponse_nextToken,
    listGameServersResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.GameLift.Types
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:/ 'newListGameServers' smart constructor.
data ListGameServers = ListGameServers'
  { -- | A token that indicates the start of the next sequential page of results.
    -- Use the token that is returned with a previous call to this operation.
    -- To start at the beginning of the result set, do not specify a value.
    ListGameServers -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Indicates how to sort the returned data based on game server
    -- registration timestamp. Use @ASCENDING@ to retrieve oldest game servers
    -- first, or use @DESCENDING@ to retrieve newest game servers first. If
    -- this parameter is left empty, game servers are returned in no particular
    -- order.
    ListGameServers -> Maybe SortOrder
sortOrder :: Prelude.Maybe SortOrder,
    -- | The maximum number of results to return. Use this parameter with
    -- @NextToken@ to get results as a set of sequential pages.
    ListGameServers -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural,
    -- | An identifier for the game server group to retrieve a list of game
    -- servers from. Use either the GameServerGroup name or ARN value.
    ListGameServers -> Text
gameServerGroupName :: Prelude.Text
  }
  deriving (ListGameServers -> ListGameServers -> Bool
(ListGameServers -> ListGameServers -> Bool)
-> (ListGameServers -> ListGameServers -> Bool)
-> Eq ListGameServers
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListGameServers -> ListGameServers -> Bool
$c/= :: ListGameServers -> ListGameServers -> Bool
== :: ListGameServers -> ListGameServers -> Bool
$c== :: ListGameServers -> ListGameServers -> Bool
Prelude.Eq, ReadPrec [ListGameServers]
ReadPrec ListGameServers
Int -> ReadS ListGameServers
ReadS [ListGameServers]
(Int -> ReadS ListGameServers)
-> ReadS [ListGameServers]
-> ReadPrec ListGameServers
-> ReadPrec [ListGameServers]
-> Read ListGameServers
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListGameServers]
$creadListPrec :: ReadPrec [ListGameServers]
readPrec :: ReadPrec ListGameServers
$creadPrec :: ReadPrec ListGameServers
readList :: ReadS [ListGameServers]
$creadList :: ReadS [ListGameServers]
readsPrec :: Int -> ReadS ListGameServers
$creadsPrec :: Int -> ReadS ListGameServers
Prelude.Read, Int -> ListGameServers -> ShowS
[ListGameServers] -> ShowS
ListGameServers -> String
(Int -> ListGameServers -> ShowS)
-> (ListGameServers -> String)
-> ([ListGameServers] -> ShowS)
-> Show ListGameServers
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListGameServers] -> ShowS
$cshowList :: [ListGameServers] -> ShowS
show :: ListGameServers -> String
$cshow :: ListGameServers -> String
showsPrec :: Int -> ListGameServers -> ShowS
$cshowsPrec :: Int -> ListGameServers -> ShowS
Prelude.Show, (forall x. ListGameServers -> Rep ListGameServers x)
-> (forall x. Rep ListGameServers x -> ListGameServers)
-> Generic ListGameServers
forall x. Rep ListGameServers x -> ListGameServers
forall x. ListGameServers -> Rep ListGameServers x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListGameServers x -> ListGameServers
$cfrom :: forall x. ListGameServers -> Rep ListGameServers x
Prelude.Generic)

-- |
-- Create a value of 'ListGameServers' 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', 'listGameServers_nextToken' - A token that indicates the start of the next sequential page of results.
-- Use the token that is returned with a previous call to this operation.
-- To start at the beginning of the result set, do not specify a value.
--
-- 'sortOrder', 'listGameServers_sortOrder' - Indicates how to sort the returned data based on game server
-- registration timestamp. Use @ASCENDING@ to retrieve oldest game servers
-- first, or use @DESCENDING@ to retrieve newest game servers first. If
-- this parameter is left empty, game servers are returned in no particular
-- order.
--
-- 'limit', 'listGameServers_limit' - The maximum number of results to return. Use this parameter with
-- @NextToken@ to get results as a set of sequential pages.
--
-- 'gameServerGroupName', 'listGameServers_gameServerGroupName' - An identifier for the game server group to retrieve a list of game
-- servers from. Use either the GameServerGroup name or ARN value.
newListGameServers ::
  -- | 'gameServerGroupName'
  Prelude.Text ->
  ListGameServers
newListGameServers :: Text -> ListGameServers
newListGameServers Text
pGameServerGroupName_ =
  ListGameServers' :: Maybe Text
-> Maybe SortOrder -> Maybe Natural -> Text -> ListGameServers
ListGameServers'
    { $sel:nextToken:ListGameServers' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sortOrder:ListGameServers' :: Maybe SortOrder
sortOrder = Maybe SortOrder
forall a. Maybe a
Prelude.Nothing,
      $sel:limit:ListGameServers' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:gameServerGroupName:ListGameServers' :: Text
gameServerGroupName = Text
pGameServerGroupName_
    }

-- | A token that indicates the start of the next sequential page of results.
-- Use the token that is returned with a previous call to this operation.
-- To start at the beginning of the result set, do not specify a value.
listGameServers_nextToken :: Lens.Lens' ListGameServers (Prelude.Maybe Prelude.Text)
listGameServers_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListGameServers -> f ListGameServers
listGameServers_nextToken = (ListGameServers -> Maybe Text)
-> (ListGameServers -> Maybe Text -> ListGameServers)
-> Lens ListGameServers ListGameServers (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGameServers' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListGameServers' :: ListGameServers -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListGameServers
s@ListGameServers' {} Maybe Text
a -> ListGameServers
s {$sel:nextToken:ListGameServers' :: Maybe Text
nextToken = Maybe Text
a} :: ListGameServers)

-- | Indicates how to sort the returned data based on game server
-- registration timestamp. Use @ASCENDING@ to retrieve oldest game servers
-- first, or use @DESCENDING@ to retrieve newest game servers first. If
-- this parameter is left empty, game servers are returned in no particular
-- order.
listGameServers_sortOrder :: Lens.Lens' ListGameServers (Prelude.Maybe SortOrder)
listGameServers_sortOrder :: (Maybe SortOrder -> f (Maybe SortOrder))
-> ListGameServers -> f ListGameServers
listGameServers_sortOrder = (ListGameServers -> Maybe SortOrder)
-> (ListGameServers -> Maybe SortOrder -> ListGameServers)
-> Lens
     ListGameServers ListGameServers (Maybe SortOrder) (Maybe SortOrder)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGameServers' {Maybe SortOrder
sortOrder :: Maybe SortOrder
$sel:sortOrder:ListGameServers' :: ListGameServers -> Maybe SortOrder
sortOrder} -> Maybe SortOrder
sortOrder) (\s :: ListGameServers
s@ListGameServers' {} Maybe SortOrder
a -> ListGameServers
s {$sel:sortOrder:ListGameServers' :: Maybe SortOrder
sortOrder = Maybe SortOrder
a} :: ListGameServers)

-- | The maximum number of results to return. Use this parameter with
-- @NextToken@ to get results as a set of sequential pages.
listGameServers_limit :: Lens.Lens' ListGameServers (Prelude.Maybe Prelude.Natural)
listGameServers_limit :: (Maybe Natural -> f (Maybe Natural))
-> ListGameServers -> f ListGameServers
listGameServers_limit = (ListGameServers -> Maybe Natural)
-> (ListGameServers -> Maybe Natural -> ListGameServers)
-> Lens
     ListGameServers ListGameServers (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGameServers' {Maybe Natural
limit :: Maybe Natural
$sel:limit:ListGameServers' :: ListGameServers -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: ListGameServers
s@ListGameServers' {} Maybe Natural
a -> ListGameServers
s {$sel:limit:ListGameServers' :: Maybe Natural
limit = Maybe Natural
a} :: ListGameServers)

-- | An identifier for the game server group to retrieve a list of game
-- servers from. Use either the GameServerGroup name or ARN value.
listGameServers_gameServerGroupName :: Lens.Lens' ListGameServers Prelude.Text
listGameServers_gameServerGroupName :: (Text -> f Text) -> ListGameServers -> f ListGameServers
listGameServers_gameServerGroupName = (ListGameServers -> Text)
-> (ListGameServers -> Text -> ListGameServers)
-> Lens ListGameServers ListGameServers Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGameServers' {Text
gameServerGroupName :: Text
$sel:gameServerGroupName:ListGameServers' :: ListGameServers -> Text
gameServerGroupName} -> Text
gameServerGroupName) (\s :: ListGameServers
s@ListGameServers' {} Text
a -> ListGameServers
s {$sel:gameServerGroupName:ListGameServers' :: Text
gameServerGroupName = Text
a} :: ListGameServers)

instance Core.AWSPager ListGameServers where
  page :: ListGameServers
-> AWSResponse ListGameServers -> Maybe ListGameServers
page ListGameServers
rq AWSResponse ListGameServers
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListGameServers
ListGameServersResponse
rs
            ListGameServersResponse
-> Getting (First Text) ListGameServersResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListGameServersResponse
-> Const (First Text) ListGameServersResponse
Lens' ListGameServersResponse (Maybe Text)
listGameServersResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListGameServersResponse
 -> Const (First Text) ListGameServersResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListGameServersResponse 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 ListGameServers
forall a. Maybe a
Prelude.Nothing
    | Maybe [GameServer] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListGameServers
ListGameServersResponse
rs
            ListGameServersResponse
-> Getting
     (First [GameServer]) ListGameServersResponse [GameServer]
-> Maybe [GameServer]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [GameServer]
 -> Const (First [GameServer]) (Maybe [GameServer]))
-> ListGameServersResponse
-> Const (First [GameServer]) ListGameServersResponse
Lens' ListGameServersResponse (Maybe [GameServer])
listGameServersResponse_gameServers
              ((Maybe [GameServer]
  -> Const (First [GameServer]) (Maybe [GameServer]))
 -> ListGameServersResponse
 -> Const (First [GameServer]) ListGameServersResponse)
-> (([GameServer] -> Const (First [GameServer]) [GameServer])
    -> Maybe [GameServer]
    -> Const (First [GameServer]) (Maybe [GameServer]))
-> Getting
     (First [GameServer]) ListGameServersResponse [GameServer]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([GameServer] -> Const (First [GameServer]) [GameServer])
-> Maybe [GameServer]
-> Const (First [GameServer]) (Maybe [GameServer])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListGameServers
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListGameServers -> Maybe ListGameServers
forall a. a -> Maybe a
Prelude.Just (ListGameServers -> Maybe ListGameServers)
-> ListGameServers -> Maybe ListGameServers
forall a b. (a -> b) -> a -> b
Prelude.$
        ListGameServers
rq
          ListGameServers
-> (ListGameServers -> ListGameServers) -> ListGameServers
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListGameServers -> Identity ListGameServers
Lens ListGameServers ListGameServers (Maybe Text) (Maybe Text)
listGameServers_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListGameServers -> Identity ListGameServers)
-> Maybe Text -> ListGameServers -> ListGameServers
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListGameServers
ListGameServersResponse
rs
          ListGameServersResponse
-> Getting (First Text) ListGameServersResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListGameServersResponse
-> Const (First Text) ListGameServersResponse
Lens' ListGameServersResponse (Maybe Text)
listGameServersResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListGameServersResponse
 -> Const (First Text) ListGameServersResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListGameServersResponse 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 ListGameServers where
  type
    AWSResponse ListGameServers =
      ListGameServersResponse
  request :: ListGameServers -> Request ListGameServers
request = Service -> ListGameServers -> Request ListGameServers
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListGameServers
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListGameServers)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListGameServers))
-> Logger
-> Service
-> Proxy ListGameServers
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListGameServers)))
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 [GameServer] -> Maybe Text -> Int -> ListGameServersResponse
ListGameServersResponse'
            (Maybe [GameServer]
 -> Maybe Text -> Int -> ListGameServersResponse)
-> Either String (Maybe [GameServer])
-> Either String (Maybe Text -> Int -> ListGameServersResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [GameServer]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"GameServers" Either String (Maybe (Maybe [GameServer]))
-> Maybe [GameServer] -> Either String (Maybe [GameServer])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [GameServer]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Maybe Text -> Int -> ListGameServersResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListGameServersResponse)
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 -> ListGameServersResponse)
-> Either String Int -> Either String ListGameServersResponse
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 ListGameServers

instance Prelude.NFData ListGameServers

instance Core.ToHeaders ListGameServers where
  toHeaders :: ListGameServers -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListGameServers -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"GameLift.ListGameServers" :: Prelude.ByteString),
            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.ToJSON ListGameServers where
  toJSON :: ListGameServers -> Value
toJSON ListGameServers' {Maybe Natural
Maybe Text
Maybe SortOrder
Text
gameServerGroupName :: Text
limit :: Maybe Natural
sortOrder :: Maybe SortOrder
nextToken :: Maybe Text
$sel:gameServerGroupName:ListGameServers' :: ListGameServers -> Text
$sel:limit:ListGameServers' :: ListGameServers -> Maybe Natural
$sel:sortOrder:ListGameServers' :: ListGameServers -> Maybe SortOrder
$sel:nextToken:ListGameServers' :: ListGameServers -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"SortOrder" Text -> SortOrder -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SortOrder -> Pair) -> Maybe SortOrder -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SortOrder
sortOrder,
            (Text
"Limit" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
limit,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"GameServerGroupName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
gameServerGroupName)
          ]
      )

instance Core.ToPath ListGameServers where
  toPath :: ListGameServers -> ByteString
toPath = ByteString -> ListGameServers -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newListGameServersResponse' smart constructor.
data ListGameServersResponse = ListGameServersResponse'
  { -- | A collection of game server objects that match the request.
    ListGameServersResponse -> Maybe [GameServer]
gameServers :: Prelude.Maybe [GameServer],
    -- | A token that indicates where to resume retrieving results on the next
    -- call to this operation. If no token is returned, these results represent
    -- the end of the list.
    ListGameServersResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListGameServersResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListGameServersResponse -> ListGameServersResponse -> Bool
(ListGameServersResponse -> ListGameServersResponse -> Bool)
-> (ListGameServersResponse -> ListGameServersResponse -> Bool)
-> Eq ListGameServersResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListGameServersResponse -> ListGameServersResponse -> Bool
$c/= :: ListGameServersResponse -> ListGameServersResponse -> Bool
== :: ListGameServersResponse -> ListGameServersResponse -> Bool
$c== :: ListGameServersResponse -> ListGameServersResponse -> Bool
Prelude.Eq, ReadPrec [ListGameServersResponse]
ReadPrec ListGameServersResponse
Int -> ReadS ListGameServersResponse
ReadS [ListGameServersResponse]
(Int -> ReadS ListGameServersResponse)
-> ReadS [ListGameServersResponse]
-> ReadPrec ListGameServersResponse
-> ReadPrec [ListGameServersResponse]
-> Read ListGameServersResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListGameServersResponse]
$creadListPrec :: ReadPrec [ListGameServersResponse]
readPrec :: ReadPrec ListGameServersResponse
$creadPrec :: ReadPrec ListGameServersResponse
readList :: ReadS [ListGameServersResponse]
$creadList :: ReadS [ListGameServersResponse]
readsPrec :: Int -> ReadS ListGameServersResponse
$creadsPrec :: Int -> ReadS ListGameServersResponse
Prelude.Read, Int -> ListGameServersResponse -> ShowS
[ListGameServersResponse] -> ShowS
ListGameServersResponse -> String
(Int -> ListGameServersResponse -> ShowS)
-> (ListGameServersResponse -> String)
-> ([ListGameServersResponse] -> ShowS)
-> Show ListGameServersResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListGameServersResponse] -> ShowS
$cshowList :: [ListGameServersResponse] -> ShowS
show :: ListGameServersResponse -> String
$cshow :: ListGameServersResponse -> String
showsPrec :: Int -> ListGameServersResponse -> ShowS
$cshowsPrec :: Int -> ListGameServersResponse -> ShowS
Prelude.Show, (forall x.
 ListGameServersResponse -> Rep ListGameServersResponse x)
-> (forall x.
    Rep ListGameServersResponse x -> ListGameServersResponse)
-> Generic ListGameServersResponse
forall x. Rep ListGameServersResponse x -> ListGameServersResponse
forall x. ListGameServersResponse -> Rep ListGameServersResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListGameServersResponse x -> ListGameServersResponse
$cfrom :: forall x. ListGameServersResponse -> Rep ListGameServersResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListGameServersResponse' 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:
--
-- 'gameServers', 'listGameServersResponse_gameServers' - A collection of game server objects that match the request.
--
-- 'nextToken', 'listGameServersResponse_nextToken' - A token that indicates where to resume retrieving results on the next
-- call to this operation. If no token is returned, these results represent
-- the end of the list.
--
-- 'httpStatus', 'listGameServersResponse_httpStatus' - The response's http status code.
newListGameServersResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListGameServersResponse
newListGameServersResponse :: Int -> ListGameServersResponse
newListGameServersResponse Int
pHttpStatus_ =
  ListGameServersResponse' :: Maybe [GameServer] -> Maybe Text -> Int -> ListGameServersResponse
ListGameServersResponse'
    { $sel:gameServers:ListGameServersResponse' :: Maybe [GameServer]
gameServers =
        Maybe [GameServer]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListGameServersResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListGameServersResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A collection of game server objects that match the request.
listGameServersResponse_gameServers :: Lens.Lens' ListGameServersResponse (Prelude.Maybe [GameServer])
listGameServersResponse_gameServers :: (Maybe [GameServer] -> f (Maybe [GameServer]))
-> ListGameServersResponse -> f ListGameServersResponse
listGameServersResponse_gameServers = (ListGameServersResponse -> Maybe [GameServer])
-> (ListGameServersResponse
    -> Maybe [GameServer] -> ListGameServersResponse)
-> Lens' ListGameServersResponse (Maybe [GameServer])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGameServersResponse' {Maybe [GameServer]
gameServers :: Maybe [GameServer]
$sel:gameServers:ListGameServersResponse' :: ListGameServersResponse -> Maybe [GameServer]
gameServers} -> Maybe [GameServer]
gameServers) (\s :: ListGameServersResponse
s@ListGameServersResponse' {} Maybe [GameServer]
a -> ListGameServersResponse
s {$sel:gameServers:ListGameServersResponse' :: Maybe [GameServer]
gameServers = Maybe [GameServer]
a} :: ListGameServersResponse) ((Maybe [GameServer] -> f (Maybe [GameServer]))
 -> ListGameServersResponse -> f ListGameServersResponse)
-> ((Maybe [GameServer] -> f (Maybe [GameServer]))
    -> Maybe [GameServer] -> f (Maybe [GameServer]))
-> (Maybe [GameServer] -> f (Maybe [GameServer]))
-> ListGameServersResponse
-> f ListGameServersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [GameServer] [GameServer] [GameServer] [GameServer]
-> Iso
     (Maybe [GameServer])
     (Maybe [GameServer])
     (Maybe [GameServer])
     (Maybe [GameServer])
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 [GameServer] [GameServer] [GameServer] [GameServer]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A token that indicates where to resume retrieving results on the next
-- call to this operation. If no token is returned, these results represent
-- the end of the list.
listGameServersResponse_nextToken :: Lens.Lens' ListGameServersResponse (Prelude.Maybe Prelude.Text)
listGameServersResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListGameServersResponse -> f ListGameServersResponse
listGameServersResponse_nextToken = (ListGameServersResponse -> Maybe Text)
-> (ListGameServersResponse
    -> Maybe Text -> ListGameServersResponse)
-> Lens' ListGameServersResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGameServersResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListGameServersResponse' :: ListGameServersResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListGameServersResponse
s@ListGameServersResponse' {} Maybe Text
a -> ListGameServersResponse
s {$sel:nextToken:ListGameServersResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListGameServersResponse)

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

instance Prelude.NFData ListGameServersResponse