{-# 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.DescribeGameSessions
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves a set of one or more game sessions in a specific fleet
-- location. You can optionally filter the results by current game session
-- status.
--
-- This operation can be used in the following ways:
--
-- -   To retrieve all game sessions that are currently running on all
--     locations in a fleet, provide a fleet or alias ID, with an optional
--     status filter. This approach returns all game sessions in the
--     fleet\'s home Region and all remote locations.
--
-- -   To retrieve all game sessions that are currently running on a
--     specific fleet location, provide a fleet or alias ID and a location
--     name, with optional status filter. The location can be the fleet\'s
--     home Region or any remote location.
--
-- -   To retrieve a specific game session, provide the game session ID.
--     This approach looks for the game session ID in all fleets that
--     reside in the Amazon Web Services Region defined in the request.
--
-- Use the pagination parameters to retrieve results as a set of sequential
-- pages.
--
-- If successful, a @GameSession@ object is returned for each game session
-- that matches the request.
--
-- This operation is not designed to be continually called to track game
-- session status. This practice can cause you to exceed your API limit,
-- which results in errors. Instead, you must configure an Amazon Simple
-- Notification Service (SNS) topic to receive notifications from FlexMatch
-- or queues. Continuously polling with @DescribeGameSessions@ should only
-- be used for games in development with low game session usage.
--
-- /Available in Amazon GameLift Local./
--
-- __Learn more__
--
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-sdk-client-api.html#gamelift-sdk-client-api-find Find a game session>
--
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/reference-awssdk.html#reference-awssdk-resources-fleets All APIs by task>
--
-- This operation returns paginated results.
module Amazonka.GameLift.DescribeGameSessions
  ( -- * Creating a Request
    DescribeGameSessions (..),
    newDescribeGameSessions,

    -- * Request Lenses
    describeGameSessions_aliasId,
    describeGameSessions_fleetId,
    describeGameSessions_gameSessionId,
    describeGameSessions_limit,
    describeGameSessions_location,
    describeGameSessions_nextToken,
    describeGameSessions_statusFilter,

    -- * Destructuring the Response
    DescribeGameSessionsResponse (..),
    newDescribeGameSessionsResponse,

    -- * Response Lenses
    describeGameSessionsResponse_gameSessions,
    describeGameSessionsResponse_nextToken,
    describeGameSessionsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.GameLift.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDescribeGameSessions' smart constructor.
data DescribeGameSessions = DescribeGameSessions'
  { -- | A unique identifier for the alias associated with the fleet to retrieve
    -- game sessions for. You can use either the alias ID or ARN value.
    DescribeGameSessions -> Maybe Text
aliasId :: Prelude.Maybe Prelude.Text,
    -- | A unique identifier for the fleet to retrieve game sessions for. You can
    -- use either the fleet ID or ARN value.
    DescribeGameSessions -> Maybe Text
fleetId :: Prelude.Maybe Prelude.Text,
    -- | A unique identifier for the game session to retrieve.
    DescribeGameSessions -> Maybe Text
gameSessionId :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return. Use this parameter with
    -- @NextToken@ to get results as a set of sequential pages.
    DescribeGameSessions -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural,
    -- | A fleet location to get game sessions for. You can specify a fleet\'s
    -- home Region or a remote location. Use the Amazon Web Services Region
    -- code format, such as @us-west-2@.
    DescribeGameSessions -> Maybe Text
location :: Prelude.Maybe Prelude.Text,
    -- | 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.
    DescribeGameSessions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Game session status to filter results on. You can filter on the
    -- following states: @ACTIVE@, @TERMINATED@, @ACTIVATING@, and
    -- @TERMINATING@. The last two are transitory and used for only very brief
    -- periods of time.
    DescribeGameSessions -> Maybe Text
statusFilter :: Prelude.Maybe Prelude.Text
  }
  deriving (DescribeGameSessions -> DescribeGameSessions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeGameSessions -> DescribeGameSessions -> Bool
$c/= :: DescribeGameSessions -> DescribeGameSessions -> Bool
== :: DescribeGameSessions -> DescribeGameSessions -> Bool
$c== :: DescribeGameSessions -> DescribeGameSessions -> Bool
Prelude.Eq, ReadPrec [DescribeGameSessions]
ReadPrec DescribeGameSessions
Int -> ReadS DescribeGameSessions
ReadS [DescribeGameSessions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeGameSessions]
$creadListPrec :: ReadPrec [DescribeGameSessions]
readPrec :: ReadPrec DescribeGameSessions
$creadPrec :: ReadPrec DescribeGameSessions
readList :: ReadS [DescribeGameSessions]
$creadList :: ReadS [DescribeGameSessions]
readsPrec :: Int -> ReadS DescribeGameSessions
$creadsPrec :: Int -> ReadS DescribeGameSessions
Prelude.Read, Int -> DescribeGameSessions -> ShowS
[DescribeGameSessions] -> ShowS
DescribeGameSessions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeGameSessions] -> ShowS
$cshowList :: [DescribeGameSessions] -> ShowS
show :: DescribeGameSessions -> String
$cshow :: DescribeGameSessions -> String
showsPrec :: Int -> DescribeGameSessions -> ShowS
$cshowsPrec :: Int -> DescribeGameSessions -> ShowS
Prelude.Show, forall x. Rep DescribeGameSessions x -> DescribeGameSessions
forall x. DescribeGameSessions -> Rep DescribeGameSessions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeGameSessions x -> DescribeGameSessions
$cfrom :: forall x. DescribeGameSessions -> Rep DescribeGameSessions x
Prelude.Generic)

-- |
-- Create a value of 'DescribeGameSessions' 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:
--
-- 'aliasId', 'describeGameSessions_aliasId' - A unique identifier for the alias associated with the fleet to retrieve
-- game sessions for. You can use either the alias ID or ARN value.
--
-- 'fleetId', 'describeGameSessions_fleetId' - A unique identifier for the fleet to retrieve game sessions for. You can
-- use either the fleet ID or ARN value.
--
-- 'gameSessionId', 'describeGameSessions_gameSessionId' - A unique identifier for the game session to retrieve.
--
-- 'limit', 'describeGameSessions_limit' - The maximum number of results to return. Use this parameter with
-- @NextToken@ to get results as a set of sequential pages.
--
-- 'location', 'describeGameSessions_location' - A fleet location to get game sessions for. You can specify a fleet\'s
-- home Region or a remote location. Use the Amazon Web Services Region
-- code format, such as @us-west-2@.
--
-- 'nextToken', 'describeGameSessions_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.
--
-- 'statusFilter', 'describeGameSessions_statusFilter' - Game session status to filter results on. You can filter on the
-- following states: @ACTIVE@, @TERMINATED@, @ACTIVATING@, and
-- @TERMINATING@. The last two are transitory and used for only very brief
-- periods of time.
newDescribeGameSessions ::
  DescribeGameSessions
newDescribeGameSessions :: DescribeGameSessions
newDescribeGameSessions =
  DescribeGameSessions'
    { $sel:aliasId:DescribeGameSessions' :: Maybe Text
aliasId = forall a. Maybe a
Prelude.Nothing,
      $sel:fleetId:DescribeGameSessions' :: Maybe Text
fleetId = forall a. Maybe a
Prelude.Nothing,
      $sel:gameSessionId:DescribeGameSessions' :: Maybe Text
gameSessionId = forall a. Maybe a
Prelude.Nothing,
      $sel:limit:DescribeGameSessions' :: Maybe Natural
limit = forall a. Maybe a
Prelude.Nothing,
      $sel:location:DescribeGameSessions' :: Maybe Text
location = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeGameSessions' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:statusFilter:DescribeGameSessions' :: Maybe Text
statusFilter = forall a. Maybe a
Prelude.Nothing
    }

-- | A unique identifier for the alias associated with the fleet to retrieve
-- game sessions for. You can use either the alias ID or ARN value.
describeGameSessions_aliasId :: Lens.Lens' DescribeGameSessions (Prelude.Maybe Prelude.Text)
describeGameSessions_aliasId :: Lens' DescribeGameSessions (Maybe Text)
describeGameSessions_aliasId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGameSessions' {Maybe Text
aliasId :: Maybe Text
$sel:aliasId:DescribeGameSessions' :: DescribeGameSessions -> Maybe Text
aliasId} -> Maybe Text
aliasId) (\s :: DescribeGameSessions
s@DescribeGameSessions' {} Maybe Text
a -> DescribeGameSessions
s {$sel:aliasId:DescribeGameSessions' :: Maybe Text
aliasId = Maybe Text
a} :: DescribeGameSessions)

-- | A unique identifier for the fleet to retrieve game sessions for. You can
-- use either the fleet ID or ARN value.
describeGameSessions_fleetId :: Lens.Lens' DescribeGameSessions (Prelude.Maybe Prelude.Text)
describeGameSessions_fleetId :: Lens' DescribeGameSessions (Maybe Text)
describeGameSessions_fleetId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGameSessions' {Maybe Text
fleetId :: Maybe Text
$sel:fleetId:DescribeGameSessions' :: DescribeGameSessions -> Maybe Text
fleetId} -> Maybe Text
fleetId) (\s :: DescribeGameSessions
s@DescribeGameSessions' {} Maybe Text
a -> DescribeGameSessions
s {$sel:fleetId:DescribeGameSessions' :: Maybe Text
fleetId = Maybe Text
a} :: DescribeGameSessions)

-- | A unique identifier for the game session to retrieve.
describeGameSessions_gameSessionId :: Lens.Lens' DescribeGameSessions (Prelude.Maybe Prelude.Text)
describeGameSessions_gameSessionId :: Lens' DescribeGameSessions (Maybe Text)
describeGameSessions_gameSessionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGameSessions' {Maybe Text
gameSessionId :: Maybe Text
$sel:gameSessionId:DescribeGameSessions' :: DescribeGameSessions -> Maybe Text
gameSessionId} -> Maybe Text
gameSessionId) (\s :: DescribeGameSessions
s@DescribeGameSessions' {} Maybe Text
a -> DescribeGameSessions
s {$sel:gameSessionId:DescribeGameSessions' :: Maybe Text
gameSessionId = Maybe Text
a} :: DescribeGameSessions)

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

-- | A fleet location to get game sessions for. You can specify a fleet\'s
-- home Region or a remote location. Use the Amazon Web Services Region
-- code format, such as @us-west-2@.
describeGameSessions_location :: Lens.Lens' DescribeGameSessions (Prelude.Maybe Prelude.Text)
describeGameSessions_location :: Lens' DescribeGameSessions (Maybe Text)
describeGameSessions_location = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGameSessions' {Maybe Text
location :: Maybe Text
$sel:location:DescribeGameSessions' :: DescribeGameSessions -> Maybe Text
location} -> Maybe Text
location) (\s :: DescribeGameSessions
s@DescribeGameSessions' {} Maybe Text
a -> DescribeGameSessions
s {$sel:location:DescribeGameSessions' :: Maybe Text
location = Maybe Text
a} :: DescribeGameSessions)

-- | 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.
describeGameSessions_nextToken :: Lens.Lens' DescribeGameSessions (Prelude.Maybe Prelude.Text)
describeGameSessions_nextToken :: Lens' DescribeGameSessions (Maybe Text)
describeGameSessions_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGameSessions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeGameSessions' :: DescribeGameSessions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeGameSessions
s@DescribeGameSessions' {} Maybe Text
a -> DescribeGameSessions
s {$sel:nextToken:DescribeGameSessions' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeGameSessions)

-- | Game session status to filter results on. You can filter on the
-- following states: @ACTIVE@, @TERMINATED@, @ACTIVATING@, and
-- @TERMINATING@. The last two are transitory and used for only very brief
-- periods of time.
describeGameSessions_statusFilter :: Lens.Lens' DescribeGameSessions (Prelude.Maybe Prelude.Text)
describeGameSessions_statusFilter :: Lens' DescribeGameSessions (Maybe Text)
describeGameSessions_statusFilter = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGameSessions' {Maybe Text
statusFilter :: Maybe Text
$sel:statusFilter:DescribeGameSessions' :: DescribeGameSessions -> Maybe Text
statusFilter} -> Maybe Text
statusFilter) (\s :: DescribeGameSessions
s@DescribeGameSessions' {} Maybe Text
a -> DescribeGameSessions
s {$sel:statusFilter:DescribeGameSessions' :: Maybe Text
statusFilter = Maybe Text
a} :: DescribeGameSessions)

instance Core.AWSPager DescribeGameSessions where
  page :: DescribeGameSessions
-> AWSResponse DescribeGameSessions -> Maybe DescribeGameSessions
page DescribeGameSessions
rq AWSResponse DescribeGameSessions
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeGameSessions
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeGameSessionsResponse (Maybe Text)
describeGameSessionsResponse_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 DescribeGameSessions
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeGameSessionsResponse (Maybe [GameSession])
describeGameSessionsResponse_gameSessions
            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.$ DescribeGameSessions
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' DescribeGameSessions (Maybe Text)
describeGameSessions_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeGameSessions
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeGameSessionsResponse (Maybe Text)
describeGameSessionsResponse_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 DescribeGameSessions where
  type
    AWSResponse DescribeGameSessions =
      DescribeGameSessionsResponse
  request :: (Service -> Service)
-> DescribeGameSessions -> Request DescribeGameSessions
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DescribeGameSessions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeGameSessions)))
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 [GameSession]
-> Maybe Text -> Int -> DescribeGameSessionsResponse
DescribeGameSessionsResponse'
            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
"GameSessions" 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 DescribeGameSessions where
  hashWithSalt :: Int -> DescribeGameSessions -> Int
hashWithSalt Int
_salt DescribeGameSessions' {Maybe Natural
Maybe Text
statusFilter :: Maybe Text
nextToken :: Maybe Text
location :: Maybe Text
limit :: Maybe Natural
gameSessionId :: Maybe Text
fleetId :: Maybe Text
aliasId :: Maybe Text
$sel:statusFilter:DescribeGameSessions' :: DescribeGameSessions -> Maybe Text
$sel:nextToken:DescribeGameSessions' :: DescribeGameSessions -> Maybe Text
$sel:location:DescribeGameSessions' :: DescribeGameSessions -> Maybe Text
$sel:limit:DescribeGameSessions' :: DescribeGameSessions -> Maybe Natural
$sel:gameSessionId:DescribeGameSessions' :: DescribeGameSessions -> Maybe Text
$sel:fleetId:DescribeGameSessions' :: DescribeGameSessions -> Maybe Text
$sel:aliasId:DescribeGameSessions' :: DescribeGameSessions -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
aliasId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
fleetId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
gameSessionId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
limit
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
location
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
statusFilter

instance Prelude.NFData DescribeGameSessions where
  rnf :: DescribeGameSessions -> ()
rnf DescribeGameSessions' {Maybe Natural
Maybe Text
statusFilter :: Maybe Text
nextToken :: Maybe Text
location :: Maybe Text
limit :: Maybe Natural
gameSessionId :: Maybe Text
fleetId :: Maybe Text
aliasId :: Maybe Text
$sel:statusFilter:DescribeGameSessions' :: DescribeGameSessions -> Maybe Text
$sel:nextToken:DescribeGameSessions' :: DescribeGameSessions -> Maybe Text
$sel:location:DescribeGameSessions' :: DescribeGameSessions -> Maybe Text
$sel:limit:DescribeGameSessions' :: DescribeGameSessions -> Maybe Natural
$sel:gameSessionId:DescribeGameSessions' :: DescribeGameSessions -> Maybe Text
$sel:fleetId:DescribeGameSessions' :: DescribeGameSessions -> Maybe Text
$sel:aliasId:DescribeGameSessions' :: DescribeGameSessions -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
aliasId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
fleetId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
gameSessionId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
limit
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
location
      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 Maybe Text
statusFilter

instance Data.ToHeaders DescribeGameSessions where
  toHeaders :: DescribeGameSessions -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"GameLift.DescribeGameSessions" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON DescribeGameSessions where
  toJSON :: DescribeGameSessions -> Value
toJSON DescribeGameSessions' {Maybe Natural
Maybe Text
statusFilter :: Maybe Text
nextToken :: Maybe Text
location :: Maybe Text
limit :: Maybe Natural
gameSessionId :: Maybe Text
fleetId :: Maybe Text
aliasId :: Maybe Text
$sel:statusFilter:DescribeGameSessions' :: DescribeGameSessions -> Maybe Text
$sel:nextToken:DescribeGameSessions' :: DescribeGameSessions -> Maybe Text
$sel:location:DescribeGameSessions' :: DescribeGameSessions -> Maybe Text
$sel:limit:DescribeGameSessions' :: DescribeGameSessions -> Maybe Natural
$sel:gameSessionId:DescribeGameSessions' :: DescribeGameSessions -> Maybe Text
$sel:fleetId:DescribeGameSessions' :: DescribeGameSessions -> Maybe Text
$sel:aliasId:DescribeGameSessions' :: DescribeGameSessions -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AliasId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
aliasId,
            (Key
"FleetId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
fleetId,
            (Key
"GameSessionId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
gameSessionId,
            (Key
"Limit" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
limit,
            (Key
"Location" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
location,
            (Key
"NextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Key
"StatusFilter" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
statusFilter
          ]
      )

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

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

-- | /See:/ 'newDescribeGameSessionsResponse' smart constructor.
data DescribeGameSessionsResponse = DescribeGameSessionsResponse'
  { -- | A collection of properties for each game session that matches the
    -- request.
    DescribeGameSessionsResponse -> Maybe [GameSession]
gameSessions :: Prelude.Maybe [GameSession],
    -- | 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.
    DescribeGameSessionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeGameSessionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeGameSessionsResponse
-> DescribeGameSessionsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeGameSessionsResponse
-> DescribeGameSessionsResponse -> Bool
$c/= :: DescribeGameSessionsResponse
-> DescribeGameSessionsResponse -> Bool
== :: DescribeGameSessionsResponse
-> DescribeGameSessionsResponse -> Bool
$c== :: DescribeGameSessionsResponse
-> DescribeGameSessionsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeGameSessionsResponse]
ReadPrec DescribeGameSessionsResponse
Int -> ReadS DescribeGameSessionsResponse
ReadS [DescribeGameSessionsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeGameSessionsResponse]
$creadListPrec :: ReadPrec [DescribeGameSessionsResponse]
readPrec :: ReadPrec DescribeGameSessionsResponse
$creadPrec :: ReadPrec DescribeGameSessionsResponse
readList :: ReadS [DescribeGameSessionsResponse]
$creadList :: ReadS [DescribeGameSessionsResponse]
readsPrec :: Int -> ReadS DescribeGameSessionsResponse
$creadsPrec :: Int -> ReadS DescribeGameSessionsResponse
Prelude.Read, Int -> DescribeGameSessionsResponse -> ShowS
[DescribeGameSessionsResponse] -> ShowS
DescribeGameSessionsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeGameSessionsResponse] -> ShowS
$cshowList :: [DescribeGameSessionsResponse] -> ShowS
show :: DescribeGameSessionsResponse -> String
$cshow :: DescribeGameSessionsResponse -> String
showsPrec :: Int -> DescribeGameSessionsResponse -> ShowS
$cshowsPrec :: Int -> DescribeGameSessionsResponse -> ShowS
Prelude.Show, forall x.
Rep DescribeGameSessionsResponse x -> DescribeGameSessionsResponse
forall x.
DescribeGameSessionsResponse -> Rep DescribeGameSessionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeGameSessionsResponse x -> DescribeGameSessionsResponse
$cfrom :: forall x.
DescribeGameSessionsResponse -> Rep DescribeGameSessionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeGameSessionsResponse' 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:
--
-- 'gameSessions', 'describeGameSessionsResponse_gameSessions' - A collection of properties for each game session that matches the
-- request.
--
-- 'nextToken', 'describeGameSessionsResponse_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', 'describeGameSessionsResponse_httpStatus' - The response's http status code.
newDescribeGameSessionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeGameSessionsResponse
newDescribeGameSessionsResponse :: Int -> DescribeGameSessionsResponse
newDescribeGameSessionsResponse Int
pHttpStatus_ =
  DescribeGameSessionsResponse'
    { $sel:gameSessions:DescribeGameSessionsResponse' :: Maybe [GameSession]
gameSessions =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeGameSessionsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeGameSessionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A collection of properties for each game session that matches the
-- request.
describeGameSessionsResponse_gameSessions :: Lens.Lens' DescribeGameSessionsResponse (Prelude.Maybe [GameSession])
describeGameSessionsResponse_gameSessions :: Lens' DescribeGameSessionsResponse (Maybe [GameSession])
describeGameSessionsResponse_gameSessions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGameSessionsResponse' {Maybe [GameSession]
gameSessions :: Maybe [GameSession]
$sel:gameSessions:DescribeGameSessionsResponse' :: DescribeGameSessionsResponse -> Maybe [GameSession]
gameSessions} -> Maybe [GameSession]
gameSessions) (\s :: DescribeGameSessionsResponse
s@DescribeGameSessionsResponse' {} Maybe [GameSession]
a -> DescribeGameSessionsResponse
s {$sel:gameSessions:DescribeGameSessionsResponse' :: Maybe [GameSession]
gameSessions = Maybe [GameSession]
a} :: DescribeGameSessionsResponse) 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

-- | 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.
describeGameSessionsResponse_nextToken :: Lens.Lens' DescribeGameSessionsResponse (Prelude.Maybe Prelude.Text)
describeGameSessionsResponse_nextToken :: Lens' DescribeGameSessionsResponse (Maybe Text)
describeGameSessionsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGameSessionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeGameSessionsResponse' :: DescribeGameSessionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeGameSessionsResponse
s@DescribeGameSessionsResponse' {} Maybe Text
a -> DescribeGameSessionsResponse
s {$sel:nextToken:DescribeGameSessionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeGameSessionsResponse)

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

instance Prelude.NFData DescribeGameSessionsResponse where
  rnf :: DescribeGameSessionsResponse -> ()
rnf DescribeGameSessionsResponse' {Int
Maybe [GameSession]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
gameSessions :: Maybe [GameSession]
$sel:httpStatus:DescribeGameSessionsResponse' :: DescribeGameSessionsResponse -> Int
$sel:nextToken:DescribeGameSessionsResponse' :: DescribeGameSessionsResponse -> Maybe Text
$sel:gameSessions:DescribeGameSessionsResponse' :: DescribeGameSessionsResponse -> Maybe [GameSession]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [GameSession]
gameSessions
      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