{-# 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.SSM.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 of all active sessions (both connected and
-- disconnected) or terminated sessions from the past 30 days.
--
-- This operation returns paginated results.
module Amazonka.SSM.DescribeSessions
  ( -- * Creating a Request
    DescribeSessions (..),
    newDescribeSessions,

    -- * Request Lenses
    describeSessions_filters,
    describeSessions_nextToken,
    describeSessions_maxResults,
    describeSessions_state,

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

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

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
import Amazonka.SSM.Types

-- | /See:/ 'newDescribeSessions' smart constructor.
data DescribeSessions = DescribeSessions'
  { -- | One or more filters to limit the type of sessions returned by the
    -- request.
    DescribeSessions -> Maybe (NonEmpty SessionFilter)
filters :: Prelude.Maybe (Prelude.NonEmpty SessionFilter),
    -- | The token for the next set of items to return. (You received this token
    -- from a previous call.)
    DescribeSessions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of items to return for this call. The call also
    -- returns a token that you can specify in a subsequent call to get the
    -- next set of results.
    DescribeSessions -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The session status to retrieve a list of sessions for. For example,
    -- \"Active\".
    DescribeSessions -> SessionState
state :: SessionState
  }
  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:
--
-- 'filters', 'describeSessions_filters' - One or more filters to limit the type of sessions returned by the
-- request.
--
-- 'nextToken', 'describeSessions_nextToken' - The token for the next set of items to return. (You received this token
-- from a previous call.)
--
-- 'maxResults', 'describeSessions_maxResults' - The maximum number of items to return for this call. The call also
-- returns a token that you can specify in a subsequent call to get the
-- next set of results.
--
-- 'state', 'describeSessions_state' - The session status to retrieve a list of sessions for. For example,
-- \"Active\".
newDescribeSessions ::
  -- | 'state'
  SessionState ->
  DescribeSessions
newDescribeSessions :: SessionState -> DescribeSessions
newDescribeSessions SessionState
pState_ =
  DescribeSessions' :: Maybe (NonEmpty SessionFilter)
-> Maybe Text -> Maybe Natural -> SessionState -> DescribeSessions
DescribeSessions'
    { $sel:filters:DescribeSessions' :: Maybe (NonEmpty SessionFilter)
filters = Maybe (NonEmpty SessionFilter)
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeSessions' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeSessions' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:state:DescribeSessions' :: SessionState
state = SessionState
pState_
    }

-- | One or more filters to limit the type of sessions returned by the
-- request.
describeSessions_filters :: Lens.Lens' DescribeSessions (Prelude.Maybe (Prelude.NonEmpty SessionFilter))
describeSessions_filters :: (Maybe (NonEmpty SessionFilter)
 -> f (Maybe (NonEmpty SessionFilter)))
-> DescribeSessions -> f DescribeSessions
describeSessions_filters = (DescribeSessions -> Maybe (NonEmpty SessionFilter))
-> (DescribeSessions
    -> Maybe (NonEmpty SessionFilter) -> DescribeSessions)
-> Lens
     DescribeSessions
     DescribeSessions
     (Maybe (NonEmpty SessionFilter))
     (Maybe (NonEmpty SessionFilter))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSessions' {Maybe (NonEmpty SessionFilter)
filters :: Maybe (NonEmpty SessionFilter)
$sel:filters:DescribeSessions' :: DescribeSessions -> Maybe (NonEmpty SessionFilter)
filters} -> Maybe (NonEmpty SessionFilter)
filters) (\s :: DescribeSessions
s@DescribeSessions' {} Maybe (NonEmpty SessionFilter)
a -> DescribeSessions
s {$sel:filters:DescribeSessions' :: Maybe (NonEmpty SessionFilter)
filters = Maybe (NonEmpty SessionFilter)
a} :: DescribeSessions) ((Maybe (NonEmpty SessionFilter)
  -> f (Maybe (NonEmpty SessionFilter)))
 -> DescribeSessions -> f DescribeSessions)
-> ((Maybe (NonEmpty SessionFilter)
     -> f (Maybe (NonEmpty SessionFilter)))
    -> Maybe (NonEmpty SessionFilter)
    -> f (Maybe (NonEmpty SessionFilter)))
-> (Maybe (NonEmpty SessionFilter)
    -> f (Maybe (NonEmpty SessionFilter)))
-> DescribeSessions
-> f DescribeSessions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty SessionFilter)
  (NonEmpty SessionFilter)
  (NonEmpty SessionFilter)
  (NonEmpty SessionFilter)
-> Iso
     (Maybe (NonEmpty SessionFilter))
     (Maybe (NonEmpty SessionFilter))
     (Maybe (NonEmpty SessionFilter))
     (Maybe (NonEmpty SessionFilter))
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
  (NonEmpty SessionFilter)
  (NonEmpty SessionFilter)
  (NonEmpty SessionFilter)
  (NonEmpty SessionFilter)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The token for the next set of items to return. (You received this token
-- from a previous call.)
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 maximum number of items to return for this call. The call also
-- returns a token that you can specify in a subsequent call to get the
-- next set of results.
describeSessions_maxResults :: Lens.Lens' DescribeSessions (Prelude.Maybe Prelude.Natural)
describeSessions_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> DescribeSessions -> f DescribeSessions
describeSessions_maxResults = (DescribeSessions -> Maybe Natural)
-> (DescribeSessions -> Maybe Natural -> DescribeSessions)
-> Lens
     DescribeSessions DescribeSessions (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSessions' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:DescribeSessions' :: DescribeSessions -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: DescribeSessions
s@DescribeSessions' {} Maybe Natural
a -> DescribeSessions
s {$sel:maxResults:DescribeSessions' :: Maybe Natural
maxResults = Maybe Natural
a} :: DescribeSessions)

-- | The session status to retrieve a list of sessions for. For example,
-- \"Active\".
describeSessions_state :: Lens.Lens' DescribeSessions SessionState
describeSessions_state :: (SessionState -> f SessionState)
-> DescribeSessions -> f DescribeSessions
describeSessions_state = (DescribeSessions -> SessionState)
-> (DescribeSessions -> SessionState -> DescribeSessions)
-> Lens DescribeSessions DescribeSessions SessionState SessionState
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSessions' {SessionState
state :: SessionState
$sel:state:DescribeSessions' :: DescribeSessions -> SessionState
state} -> SessionState
state) (\s :: DescribeSessions
s@DescribeSessions' {} SessionState
a -> DescribeSessions
s {$sel:state:DescribeSessions' :: SessionState
state = SessionState
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
"AmazonSSM.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 Natural
Maybe (NonEmpty SessionFilter)
Maybe Text
SessionState
state :: SessionState
maxResults :: Maybe Natural
nextToken :: Maybe Text
filters :: Maybe (NonEmpty SessionFilter)
$sel:state:DescribeSessions' :: DescribeSessions -> SessionState
$sel:maxResults:DescribeSessions' :: DescribeSessions -> Maybe Natural
$sel:nextToken:DescribeSessions' :: DescribeSessions -> Maybe Text
$sel:filters:DescribeSessions' :: DescribeSessions -> Maybe (NonEmpty SessionFilter)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Filters" Text -> NonEmpty SessionFilter -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty SessionFilter -> Pair)
-> Maybe (NonEmpty SessionFilter) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty SessionFilter)
filters,
            (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
"MaxResults" 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
maxResults,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"State" Text -> SessionState -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= SessionState
state)
          ]
      )

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 token for the next set of items to return. (You received this token
    -- from a previous call.)
    DescribeSessionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A list of sessions meeting the request parameters.
    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 token for the next set of items to return. (You received this token
-- from a previous call.)
--
-- 'sessions', 'describeSessionsResponse_sessions' - A list of sessions meeting the request parameters.
--
-- '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 token for the next set of items to return. (You received this token
-- from a previous call.)
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)

-- | A list of sessions meeting the request parameters.
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