{-# 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.AppStream.DescribeSessions
-- 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)
--
-- Retrieves a list that describes the streaming sessions for a specified
-- stack and fleet. If a UserId is provided for the stack and fleet, only
-- streaming sessions for that user are described. If an authentication
-- type is not provided, the default is to authenticate users using a
-- streaming URL.
--
-- This operation returns paginated results.
module Amazonka.AppStream.DescribeSessions
  ( -- * Creating a Request
    DescribeSessions (..),
    newDescribeSessions,

    -- * Request Lenses
    describeSessions_userId,
    describeSessions_nextToken,
    describeSessions_limit,
    describeSessions_authenticationType,
    describeSessions_stackName,
    describeSessions_fleetName,

    -- * Destructuring the Response
    DescribeSessionsResponse (..),
    newDescribeSessionsResponse,

    -- * Response Lenses
    describeSessionsResponse_nextToken,
    describeSessionsResponse_sessions,
    describeSessionsResponse_httpStatus,
  )
where

import Amazonka.AppStream.Types
import qualified Amazonka.Core as Core
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:/ 'newDescribeSessions' smart constructor.
data DescribeSessions = DescribeSessions'
  { -- | The user identifier (ID). If you specify a user ID, you must also
    -- specify the authentication type.
    DescribeSessions -> Maybe Text
userId :: Prelude.Maybe Prelude.Text,
    -- | The pagination token to use to retrieve the next page of results for
    -- this operation. If this value is null, it retrieves the first page.
    DescribeSessions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The size of each page of results. The default value is 20 and the
    -- maximum value is 50.
    DescribeSessions -> Maybe Int
limit :: Prelude.Maybe Prelude.Int,
    -- | The authentication method. Specify @API@ for a user authenticated using
    -- a streaming URL or @SAML@ for a SAML federated user. The default is to
    -- authenticate users using a streaming URL.
    DescribeSessions -> Maybe AuthenticationType
authenticationType :: Prelude.Maybe AuthenticationType,
    -- | The name of the stack. This value is case-sensitive.
    DescribeSessions -> Text
stackName :: Prelude.Text,
    -- | The name of the fleet. This value is case-sensitive.
    DescribeSessions -> Text
fleetName :: Prelude.Text
  }
  deriving (DescribeSessions -> DescribeSessions -> Bool
(DescribeSessions -> DescribeSessions -> Bool)
-> (DescribeSessions -> DescribeSessions -> Bool)
-> Eq DescribeSessions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeSessions -> DescribeSessions -> Bool
$c/= :: DescribeSessions -> DescribeSessions -> Bool
== :: DescribeSessions -> DescribeSessions -> Bool
$c== :: DescribeSessions -> DescribeSessions -> Bool
Prelude.Eq, ReadPrec [DescribeSessions]
ReadPrec DescribeSessions
Int -> ReadS DescribeSessions
ReadS [DescribeSessions]
(Int -> ReadS DescribeSessions)
-> ReadS [DescribeSessions]
-> ReadPrec DescribeSessions
-> ReadPrec [DescribeSessions]
-> Read DescribeSessions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeSessions]
$creadListPrec :: ReadPrec [DescribeSessions]
readPrec :: ReadPrec DescribeSessions
$creadPrec :: ReadPrec DescribeSessions
readList :: ReadS [DescribeSessions]
$creadList :: ReadS [DescribeSessions]
readsPrec :: Int -> ReadS DescribeSessions
$creadsPrec :: Int -> ReadS DescribeSessions
Prelude.Read, Int -> DescribeSessions -> ShowS
[DescribeSessions] -> ShowS
DescribeSessions -> String
(Int -> DescribeSessions -> ShowS)
-> (DescribeSessions -> String)
-> ([DescribeSessions] -> ShowS)
-> Show DescribeSessions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeSessions] -> ShowS
$cshowList :: [DescribeSessions] -> ShowS
show :: DescribeSessions -> String
$cshow :: DescribeSessions -> String
showsPrec :: Int -> DescribeSessions -> ShowS
$cshowsPrec :: Int -> DescribeSessions -> ShowS
Prelude.Show, (forall x. DescribeSessions -> Rep DescribeSessions x)
-> (forall x. Rep DescribeSessions x -> DescribeSessions)
-> Generic DescribeSessions
forall x. Rep DescribeSessions x -> DescribeSessions
forall x. DescribeSessions -> Rep DescribeSessions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeSessions x -> DescribeSessions
$cfrom :: forall x. DescribeSessions -> Rep DescribeSessions x
Prelude.Generic)

-- |
-- Create a value of 'DescribeSessions' 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:
--
-- 'userId', 'describeSessions_userId' - The user identifier (ID). If you specify a user ID, you must also
-- specify the authentication type.
--
-- 'nextToken', 'describeSessions_nextToken' - The pagination token to use to retrieve the next page of results for
-- this operation. If this value is null, it retrieves the first page.
--
-- 'limit', 'describeSessions_limit' - The size of each page of results. The default value is 20 and the
-- maximum value is 50.
--
-- 'authenticationType', 'describeSessions_authenticationType' - The authentication method. Specify @API@ for a user authenticated using
-- a streaming URL or @SAML@ for a SAML federated user. The default is to
-- authenticate users using a streaming URL.
--
-- 'stackName', 'describeSessions_stackName' - The name of the stack. This value is case-sensitive.
--
-- 'fleetName', 'describeSessions_fleetName' - The name of the fleet. This value is case-sensitive.
newDescribeSessions ::
  -- | 'stackName'
  Prelude.Text ->
  -- | 'fleetName'
  Prelude.Text ->
  DescribeSessions
newDescribeSessions :: Text -> Text -> DescribeSessions
newDescribeSessions Text
pStackName_ Text
pFleetName_ =
  DescribeSessions' :: Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe AuthenticationType
-> Text
-> Text
-> DescribeSessions
DescribeSessions'
    { $sel:userId:DescribeSessions' :: Maybe Text
userId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeSessions' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:limit:DescribeSessions' :: Maybe Int
limit = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:authenticationType:DescribeSessions' :: Maybe AuthenticationType
authenticationType = Maybe AuthenticationType
forall a. Maybe a
Prelude.Nothing,
      $sel:stackName:DescribeSessions' :: Text
stackName = Text
pStackName_,
      $sel:fleetName:DescribeSessions' :: Text
fleetName = Text
pFleetName_
    }

-- | The user identifier (ID). If you specify a user ID, you must also
-- specify the authentication type.
describeSessions_userId :: Lens.Lens' DescribeSessions (Prelude.Maybe Prelude.Text)
describeSessions_userId :: (Maybe Text -> f (Maybe Text))
-> DescribeSessions -> f DescribeSessions
describeSessions_userId = (DescribeSessions -> Maybe Text)
-> (DescribeSessions -> Maybe Text -> DescribeSessions)
-> Lens DescribeSessions DescribeSessions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSessions' {Maybe Text
userId :: Maybe Text
$sel:userId:DescribeSessions' :: DescribeSessions -> Maybe Text
userId} -> Maybe Text
userId) (\s :: DescribeSessions
s@DescribeSessions' {} Maybe Text
a -> DescribeSessions
s {$sel:userId:DescribeSessions' :: Maybe Text
userId = Maybe Text
a} :: DescribeSessions)

-- | The pagination token to use to retrieve the next page of results for
-- this operation. If this value is null, it retrieves the first page.
describeSessions_nextToken :: Lens.Lens' DescribeSessions (Prelude.Maybe Prelude.Text)
describeSessions_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeSessions -> f DescribeSessions
describeSessions_nextToken = (DescribeSessions -> Maybe Text)
-> (DescribeSessions -> Maybe Text -> DescribeSessions)
-> Lens DescribeSessions DescribeSessions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSessions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeSessions' :: DescribeSessions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeSessions
s@DescribeSessions' {} Maybe Text
a -> DescribeSessions
s {$sel:nextToken:DescribeSessions' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeSessions)

-- | The size of each page of results. The default value is 20 and the
-- maximum value is 50.
describeSessions_limit :: Lens.Lens' DescribeSessions (Prelude.Maybe Prelude.Int)
describeSessions_limit :: (Maybe Int -> f (Maybe Int))
-> DescribeSessions -> f DescribeSessions
describeSessions_limit = (DescribeSessions -> Maybe Int)
-> (DescribeSessions -> Maybe Int -> DescribeSessions)
-> Lens DescribeSessions DescribeSessions (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSessions' {Maybe Int
limit :: Maybe Int
$sel:limit:DescribeSessions' :: DescribeSessions -> Maybe Int
limit} -> Maybe Int
limit) (\s :: DescribeSessions
s@DescribeSessions' {} Maybe Int
a -> DescribeSessions
s {$sel:limit:DescribeSessions' :: Maybe Int
limit = Maybe Int
a} :: DescribeSessions)

-- | The authentication method. Specify @API@ for a user authenticated using
-- a streaming URL or @SAML@ for a SAML federated user. The default is to
-- authenticate users using a streaming URL.
describeSessions_authenticationType :: Lens.Lens' DescribeSessions (Prelude.Maybe AuthenticationType)
describeSessions_authenticationType :: (Maybe AuthenticationType -> f (Maybe AuthenticationType))
-> DescribeSessions -> f DescribeSessions
describeSessions_authenticationType = (DescribeSessions -> Maybe AuthenticationType)
-> (DescribeSessions
    -> Maybe AuthenticationType -> DescribeSessions)
-> Lens
     DescribeSessions
     DescribeSessions
     (Maybe AuthenticationType)
     (Maybe AuthenticationType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSessions' {Maybe AuthenticationType
authenticationType :: Maybe AuthenticationType
$sel:authenticationType:DescribeSessions' :: DescribeSessions -> Maybe AuthenticationType
authenticationType} -> Maybe AuthenticationType
authenticationType) (\s :: DescribeSessions
s@DescribeSessions' {} Maybe AuthenticationType
a -> DescribeSessions
s {$sel:authenticationType:DescribeSessions' :: Maybe AuthenticationType
authenticationType = Maybe AuthenticationType
a} :: DescribeSessions)

-- | The name of the stack. This value is case-sensitive.
describeSessions_stackName :: Lens.Lens' DescribeSessions Prelude.Text
describeSessions_stackName :: (Text -> f Text) -> DescribeSessions -> f DescribeSessions
describeSessions_stackName = (DescribeSessions -> Text)
-> (DescribeSessions -> Text -> DescribeSessions)
-> Lens DescribeSessions DescribeSessions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSessions' {Text
stackName :: Text
$sel:stackName:DescribeSessions' :: DescribeSessions -> Text
stackName} -> Text
stackName) (\s :: DescribeSessions
s@DescribeSessions' {} Text
a -> DescribeSessions
s {$sel:stackName:DescribeSessions' :: Text
stackName = Text
a} :: DescribeSessions)

-- | The name of the fleet. This value is case-sensitive.
describeSessions_fleetName :: Lens.Lens' DescribeSessions Prelude.Text
describeSessions_fleetName :: (Text -> f Text) -> DescribeSessions -> f DescribeSessions
describeSessions_fleetName = (DescribeSessions -> Text)
-> (DescribeSessions -> Text -> DescribeSessions)
-> Lens DescribeSessions DescribeSessions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSessions' {Text
fleetName :: Text
$sel:fleetName:DescribeSessions' :: DescribeSessions -> Text
fleetName} -> Text
fleetName) (\s :: DescribeSessions
s@DescribeSessions' {} Text
a -> DescribeSessions
s {$sel:fleetName:DescribeSessions' :: Text
fleetName = Text
a} :: DescribeSessions)

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

instance Prelude.NFData DescribeSessions

instance Core.ToHeaders DescribeSessions where
  toHeaders :: DescribeSessions -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeSessions -> 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
"PhotonAdminProxyService.DescribeSessions" ::
                          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 DescribeSessions where
  toJSON :: DescribeSessions -> Value
toJSON DescribeSessions' {Maybe Int
Maybe Text
Maybe AuthenticationType
Text
fleetName :: Text
stackName :: Text
authenticationType :: Maybe AuthenticationType
limit :: Maybe Int
nextToken :: Maybe Text
userId :: Maybe Text
$sel:fleetName:DescribeSessions' :: DescribeSessions -> Text
$sel:stackName:DescribeSessions' :: DescribeSessions -> Text
$sel:authenticationType:DescribeSessions' :: DescribeSessions -> Maybe AuthenticationType
$sel:limit:DescribeSessions' :: DescribeSessions -> Maybe Int
$sel:nextToken:DescribeSessions' :: DescribeSessions -> Maybe Text
$sel:userId:DescribeSessions' :: DescribeSessions -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"UserId" 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
userId,
            (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
"Limit" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
limit,
            (Text
"AuthenticationType" Text -> AuthenticationType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AuthenticationType -> Pair)
-> Maybe AuthenticationType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AuthenticationType
authenticationType,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"StackName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
stackName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"FleetName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
fleetName)
          ]
      )

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

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

-- | /See:/ 'newDescribeSessionsResponse' smart constructor.
data DescribeSessionsResponse = DescribeSessionsResponse'
  { -- | The pagination token to use to retrieve the next page of results for
    -- this operation. If there are no more pages, this value is null.
    DescribeSessionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Information about the streaming sessions.
    DescribeSessionsResponse -> Maybe [Session]
sessions :: Prelude.Maybe [Session],
    -- | The response's http status code.
    DescribeSessionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeSessionsResponse -> DescribeSessionsResponse -> Bool
(DescribeSessionsResponse -> DescribeSessionsResponse -> Bool)
-> (DescribeSessionsResponse -> DescribeSessionsResponse -> Bool)
-> Eq DescribeSessionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeSessionsResponse -> DescribeSessionsResponse -> Bool
$c/= :: DescribeSessionsResponse -> DescribeSessionsResponse -> Bool
== :: DescribeSessionsResponse -> DescribeSessionsResponse -> Bool
$c== :: DescribeSessionsResponse -> DescribeSessionsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeSessionsResponse]
ReadPrec DescribeSessionsResponse
Int -> ReadS DescribeSessionsResponse
ReadS [DescribeSessionsResponse]
(Int -> ReadS DescribeSessionsResponse)
-> ReadS [DescribeSessionsResponse]
-> ReadPrec DescribeSessionsResponse
-> ReadPrec [DescribeSessionsResponse]
-> Read DescribeSessionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeSessionsResponse]
$creadListPrec :: ReadPrec [DescribeSessionsResponse]
readPrec :: ReadPrec DescribeSessionsResponse
$creadPrec :: ReadPrec DescribeSessionsResponse
readList :: ReadS [DescribeSessionsResponse]
$creadList :: ReadS [DescribeSessionsResponse]
readsPrec :: Int -> ReadS DescribeSessionsResponse
$creadsPrec :: Int -> ReadS DescribeSessionsResponse
Prelude.Read, Int -> DescribeSessionsResponse -> ShowS
[DescribeSessionsResponse] -> ShowS
DescribeSessionsResponse -> String
(Int -> DescribeSessionsResponse -> ShowS)
-> (DescribeSessionsResponse -> String)
-> ([DescribeSessionsResponse] -> ShowS)
-> Show DescribeSessionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeSessionsResponse] -> ShowS
$cshowList :: [DescribeSessionsResponse] -> ShowS
show :: DescribeSessionsResponse -> String
$cshow :: DescribeSessionsResponse -> String
showsPrec :: Int -> DescribeSessionsResponse -> ShowS
$cshowsPrec :: Int -> DescribeSessionsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeSessionsResponse -> Rep DescribeSessionsResponse x)
-> (forall x.
    Rep DescribeSessionsResponse x -> DescribeSessionsResponse)
-> Generic DescribeSessionsResponse
forall x.
Rep DescribeSessionsResponse x -> DescribeSessionsResponse
forall x.
DescribeSessionsResponse -> Rep DescribeSessionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeSessionsResponse x -> DescribeSessionsResponse
$cfrom :: forall x.
DescribeSessionsResponse -> Rep DescribeSessionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeSessionsResponse' 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', 'describeSessionsResponse_nextToken' - The pagination token to use to retrieve the next page of results for
-- this operation. If there are no more pages, this value is null.
--
-- 'sessions', 'describeSessionsResponse_sessions' - Information about the streaming sessions.
--
-- 'httpStatus', 'describeSessionsResponse_httpStatus' - The response's http status code.
newDescribeSessionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeSessionsResponse
newDescribeSessionsResponse :: Int -> DescribeSessionsResponse
newDescribeSessionsResponse Int
pHttpStatus_ =
  DescribeSessionsResponse' :: Maybe Text -> Maybe [Session] -> Int -> DescribeSessionsResponse
DescribeSessionsResponse'
    { $sel:nextToken:DescribeSessionsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sessions:DescribeSessionsResponse' :: Maybe [Session]
sessions = Maybe [Session]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeSessionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The pagination token to use to retrieve the next page of results for
-- this operation. If there are no more pages, this value is null.
describeSessionsResponse_nextToken :: Lens.Lens' DescribeSessionsResponse (Prelude.Maybe Prelude.Text)
describeSessionsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeSessionsResponse -> f DescribeSessionsResponse
describeSessionsResponse_nextToken = (DescribeSessionsResponse -> Maybe Text)
-> (DescribeSessionsResponse
    -> Maybe Text -> DescribeSessionsResponse)
-> Lens' DescribeSessionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSessionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeSessionsResponse' :: DescribeSessionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeSessionsResponse
s@DescribeSessionsResponse' {} Maybe Text
a -> DescribeSessionsResponse
s {$sel:nextToken:DescribeSessionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeSessionsResponse)

-- | Information about the streaming sessions.
describeSessionsResponse_sessions :: Lens.Lens' DescribeSessionsResponse (Prelude.Maybe [Session])
describeSessionsResponse_sessions :: (Maybe [Session] -> f (Maybe [Session]))
-> DescribeSessionsResponse -> f DescribeSessionsResponse
describeSessionsResponse_sessions = (DescribeSessionsResponse -> Maybe [Session])
-> (DescribeSessionsResponse
    -> Maybe [Session] -> DescribeSessionsResponse)
-> Lens' DescribeSessionsResponse (Maybe [Session])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSessionsResponse' {Maybe [Session]
sessions :: Maybe [Session]
$sel:sessions:DescribeSessionsResponse' :: DescribeSessionsResponse -> Maybe [Session]
sessions} -> Maybe [Session]
sessions) (\s :: DescribeSessionsResponse
s@DescribeSessionsResponse' {} Maybe [Session]
a -> DescribeSessionsResponse
s {$sel:sessions:DescribeSessionsResponse' :: Maybe [Session]
sessions = Maybe [Session]
a} :: DescribeSessionsResponse) ((Maybe [Session] -> f (Maybe [Session]))
 -> DescribeSessionsResponse -> f DescribeSessionsResponse)
-> ((Maybe [Session] -> f (Maybe [Session]))
    -> Maybe [Session] -> f (Maybe [Session]))
-> (Maybe [Session] -> f (Maybe [Session]))
-> DescribeSessionsResponse
-> f DescribeSessionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Session] [Session] [Session] [Session]
-> Iso
     (Maybe [Session])
     (Maybe [Session])
     (Maybe [Session])
     (Maybe [Session])
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 [Session] [Session] [Session] [Session]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData DescribeSessionsResponse