{-# 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.DeviceFarm.ListTestGridSessions
-- 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 list of sessions for a TestGridProject.
module Amazonka.DeviceFarm.ListTestGridSessions
  ( -- * Creating a Request
    ListTestGridSessions (..),
    newListTestGridSessions,

    -- * Request Lenses
    listTestGridSessions_creationTimeAfter,
    listTestGridSessions_creationTimeBefore,
    listTestGridSessions_endTimeAfter,
    listTestGridSessions_endTimeBefore,
    listTestGridSessions_maxResult,
    listTestGridSessions_nextToken,
    listTestGridSessions_status,
    listTestGridSessions_projectArn,

    -- * Destructuring the Response
    ListTestGridSessionsResponse (..),
    newListTestGridSessionsResponse,

    -- * Response Lenses
    listTestGridSessionsResponse_nextToken,
    listTestGridSessionsResponse_testGridSessions,
    listTestGridSessionsResponse_httpStatus,
  )
where

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

-- | /See:/ 'newListTestGridSessions' smart constructor.
data ListTestGridSessions = ListTestGridSessions'
  { -- | Return only sessions created after this time.
    ListTestGridSessions -> Maybe POSIX
creationTimeAfter :: Prelude.Maybe Data.POSIX,
    -- | Return only sessions created before this time.
    ListTestGridSessions -> Maybe POSIX
creationTimeBefore :: Prelude.Maybe Data.POSIX,
    -- | Return only sessions that ended after this time.
    ListTestGridSessions -> Maybe POSIX
endTimeAfter :: Prelude.Maybe Data.POSIX,
    -- | Return only sessions that ended before this time.
    ListTestGridSessions -> Maybe POSIX
endTimeBefore :: Prelude.Maybe Data.POSIX,
    -- | Return only this many results at a time.
    ListTestGridSessions -> Maybe Natural
maxResult :: Prelude.Maybe Prelude.Natural,
    -- | Pagination token.
    ListTestGridSessions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Return only sessions in this state.
    ListTestGridSessions -> Maybe TestGridSessionStatus
status :: Prelude.Maybe TestGridSessionStatus,
    -- | ARN of a TestGridProject.
    ListTestGridSessions -> Text
projectArn :: Prelude.Text
  }
  deriving (ListTestGridSessions -> ListTestGridSessions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListTestGridSessions -> ListTestGridSessions -> Bool
$c/= :: ListTestGridSessions -> ListTestGridSessions -> Bool
== :: ListTestGridSessions -> ListTestGridSessions -> Bool
$c== :: ListTestGridSessions -> ListTestGridSessions -> Bool
Prelude.Eq, ReadPrec [ListTestGridSessions]
ReadPrec ListTestGridSessions
Int -> ReadS ListTestGridSessions
ReadS [ListTestGridSessions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListTestGridSessions]
$creadListPrec :: ReadPrec [ListTestGridSessions]
readPrec :: ReadPrec ListTestGridSessions
$creadPrec :: ReadPrec ListTestGridSessions
readList :: ReadS [ListTestGridSessions]
$creadList :: ReadS [ListTestGridSessions]
readsPrec :: Int -> ReadS ListTestGridSessions
$creadsPrec :: Int -> ReadS ListTestGridSessions
Prelude.Read, Int -> ListTestGridSessions -> ShowS
[ListTestGridSessions] -> ShowS
ListTestGridSessions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListTestGridSessions] -> ShowS
$cshowList :: [ListTestGridSessions] -> ShowS
show :: ListTestGridSessions -> String
$cshow :: ListTestGridSessions -> String
showsPrec :: Int -> ListTestGridSessions -> ShowS
$cshowsPrec :: Int -> ListTestGridSessions -> ShowS
Prelude.Show, forall x. Rep ListTestGridSessions x -> ListTestGridSessions
forall x. ListTestGridSessions -> Rep ListTestGridSessions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListTestGridSessions x -> ListTestGridSessions
$cfrom :: forall x. ListTestGridSessions -> Rep ListTestGridSessions x
Prelude.Generic)

-- |
-- Create a value of 'ListTestGridSessions' 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:
--
-- 'creationTimeAfter', 'listTestGridSessions_creationTimeAfter' - Return only sessions created after this time.
--
-- 'creationTimeBefore', 'listTestGridSessions_creationTimeBefore' - Return only sessions created before this time.
--
-- 'endTimeAfter', 'listTestGridSessions_endTimeAfter' - Return only sessions that ended after this time.
--
-- 'endTimeBefore', 'listTestGridSessions_endTimeBefore' - Return only sessions that ended before this time.
--
-- 'maxResult', 'listTestGridSessions_maxResult' - Return only this many results at a time.
--
-- 'nextToken', 'listTestGridSessions_nextToken' - Pagination token.
--
-- 'status', 'listTestGridSessions_status' - Return only sessions in this state.
--
-- 'projectArn', 'listTestGridSessions_projectArn' - ARN of a TestGridProject.
newListTestGridSessions ::
  -- | 'projectArn'
  Prelude.Text ->
  ListTestGridSessions
newListTestGridSessions :: Text -> ListTestGridSessions
newListTestGridSessions Text
pProjectArn_ =
  ListTestGridSessions'
    { $sel:creationTimeAfter:ListTestGridSessions' :: Maybe POSIX
creationTimeAfter =
        forall a. Maybe a
Prelude.Nothing,
      $sel:creationTimeBefore:ListTestGridSessions' :: Maybe POSIX
creationTimeBefore = forall a. Maybe a
Prelude.Nothing,
      $sel:endTimeAfter:ListTestGridSessions' :: Maybe POSIX
endTimeAfter = forall a. Maybe a
Prelude.Nothing,
      $sel:endTimeBefore:ListTestGridSessions' :: Maybe POSIX
endTimeBefore = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResult:ListTestGridSessions' :: Maybe Natural
maxResult = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListTestGridSessions' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:status:ListTestGridSessions' :: Maybe TestGridSessionStatus
status = forall a. Maybe a
Prelude.Nothing,
      $sel:projectArn:ListTestGridSessions' :: Text
projectArn = Text
pProjectArn_
    }

-- | Return only sessions created after this time.
listTestGridSessions_creationTimeAfter :: Lens.Lens' ListTestGridSessions (Prelude.Maybe Prelude.UTCTime)
listTestGridSessions_creationTimeAfter :: Lens' ListTestGridSessions (Maybe UTCTime)
listTestGridSessions_creationTimeAfter = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTestGridSessions' {Maybe POSIX
creationTimeAfter :: Maybe POSIX
$sel:creationTimeAfter:ListTestGridSessions' :: ListTestGridSessions -> Maybe POSIX
creationTimeAfter} -> Maybe POSIX
creationTimeAfter) (\s :: ListTestGridSessions
s@ListTestGridSessions' {} Maybe POSIX
a -> ListTestGridSessions
s {$sel:creationTimeAfter:ListTestGridSessions' :: Maybe POSIX
creationTimeAfter = Maybe POSIX
a} :: ListTestGridSessions) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | Return only sessions created before this time.
listTestGridSessions_creationTimeBefore :: Lens.Lens' ListTestGridSessions (Prelude.Maybe Prelude.UTCTime)
listTestGridSessions_creationTimeBefore :: Lens' ListTestGridSessions (Maybe UTCTime)
listTestGridSessions_creationTimeBefore = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTestGridSessions' {Maybe POSIX
creationTimeBefore :: Maybe POSIX
$sel:creationTimeBefore:ListTestGridSessions' :: ListTestGridSessions -> Maybe POSIX
creationTimeBefore} -> Maybe POSIX
creationTimeBefore) (\s :: ListTestGridSessions
s@ListTestGridSessions' {} Maybe POSIX
a -> ListTestGridSessions
s {$sel:creationTimeBefore:ListTestGridSessions' :: Maybe POSIX
creationTimeBefore = Maybe POSIX
a} :: ListTestGridSessions) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | Return only sessions that ended after this time.
listTestGridSessions_endTimeAfter :: Lens.Lens' ListTestGridSessions (Prelude.Maybe Prelude.UTCTime)
listTestGridSessions_endTimeAfter :: Lens' ListTestGridSessions (Maybe UTCTime)
listTestGridSessions_endTimeAfter = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTestGridSessions' {Maybe POSIX
endTimeAfter :: Maybe POSIX
$sel:endTimeAfter:ListTestGridSessions' :: ListTestGridSessions -> Maybe POSIX
endTimeAfter} -> Maybe POSIX
endTimeAfter) (\s :: ListTestGridSessions
s@ListTestGridSessions' {} Maybe POSIX
a -> ListTestGridSessions
s {$sel:endTimeAfter:ListTestGridSessions' :: Maybe POSIX
endTimeAfter = Maybe POSIX
a} :: ListTestGridSessions) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | Return only sessions that ended before this time.
listTestGridSessions_endTimeBefore :: Lens.Lens' ListTestGridSessions (Prelude.Maybe Prelude.UTCTime)
listTestGridSessions_endTimeBefore :: Lens' ListTestGridSessions (Maybe UTCTime)
listTestGridSessions_endTimeBefore = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTestGridSessions' {Maybe POSIX
endTimeBefore :: Maybe POSIX
$sel:endTimeBefore:ListTestGridSessions' :: ListTestGridSessions -> Maybe POSIX
endTimeBefore} -> Maybe POSIX
endTimeBefore) (\s :: ListTestGridSessions
s@ListTestGridSessions' {} Maybe POSIX
a -> ListTestGridSessions
s {$sel:endTimeBefore:ListTestGridSessions' :: Maybe POSIX
endTimeBefore = Maybe POSIX
a} :: ListTestGridSessions) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | Return only this many results at a time.
listTestGridSessions_maxResult :: Lens.Lens' ListTestGridSessions (Prelude.Maybe Prelude.Natural)
listTestGridSessions_maxResult :: Lens' ListTestGridSessions (Maybe Natural)
listTestGridSessions_maxResult = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTestGridSessions' {Maybe Natural
maxResult :: Maybe Natural
$sel:maxResult:ListTestGridSessions' :: ListTestGridSessions -> Maybe Natural
maxResult} -> Maybe Natural
maxResult) (\s :: ListTestGridSessions
s@ListTestGridSessions' {} Maybe Natural
a -> ListTestGridSessions
s {$sel:maxResult:ListTestGridSessions' :: Maybe Natural
maxResult = Maybe Natural
a} :: ListTestGridSessions)

-- | Pagination token.
listTestGridSessions_nextToken :: Lens.Lens' ListTestGridSessions (Prelude.Maybe Prelude.Text)
listTestGridSessions_nextToken :: Lens' ListTestGridSessions (Maybe Text)
listTestGridSessions_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTestGridSessions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListTestGridSessions' :: ListTestGridSessions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListTestGridSessions
s@ListTestGridSessions' {} Maybe Text
a -> ListTestGridSessions
s {$sel:nextToken:ListTestGridSessions' :: Maybe Text
nextToken = Maybe Text
a} :: ListTestGridSessions)

-- | Return only sessions in this state.
listTestGridSessions_status :: Lens.Lens' ListTestGridSessions (Prelude.Maybe TestGridSessionStatus)
listTestGridSessions_status :: Lens' ListTestGridSessions (Maybe TestGridSessionStatus)
listTestGridSessions_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTestGridSessions' {Maybe TestGridSessionStatus
status :: Maybe TestGridSessionStatus
$sel:status:ListTestGridSessions' :: ListTestGridSessions -> Maybe TestGridSessionStatus
status} -> Maybe TestGridSessionStatus
status) (\s :: ListTestGridSessions
s@ListTestGridSessions' {} Maybe TestGridSessionStatus
a -> ListTestGridSessions
s {$sel:status:ListTestGridSessions' :: Maybe TestGridSessionStatus
status = Maybe TestGridSessionStatus
a} :: ListTestGridSessions)

-- | ARN of a TestGridProject.
listTestGridSessions_projectArn :: Lens.Lens' ListTestGridSessions Prelude.Text
listTestGridSessions_projectArn :: Lens' ListTestGridSessions Text
listTestGridSessions_projectArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTestGridSessions' {Text
projectArn :: Text
$sel:projectArn:ListTestGridSessions' :: ListTestGridSessions -> Text
projectArn} -> Text
projectArn) (\s :: ListTestGridSessions
s@ListTestGridSessions' {} Text
a -> ListTestGridSessions
s {$sel:projectArn:ListTestGridSessions' :: Text
projectArn = Text
a} :: ListTestGridSessions)

instance Core.AWSRequest ListTestGridSessions where
  type
    AWSResponse ListTestGridSessions =
      ListTestGridSessionsResponse
  request :: (Service -> Service)
-> ListTestGridSessions -> Request ListTestGridSessions
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 ListTestGridSessions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListTestGridSessions)))
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 Text
-> Maybe [TestGridSession] -> Int -> ListTestGridSessionsResponse
ListTestGridSessionsResponse'
            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
"nextToken")
            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
"testGridSessions"
                            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.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ListTestGridSessions where
  hashWithSalt :: Int -> ListTestGridSessions -> Int
hashWithSalt Int
_salt ListTestGridSessions' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe TestGridSessionStatus
Text
projectArn :: Text
status :: Maybe TestGridSessionStatus
nextToken :: Maybe Text
maxResult :: Maybe Natural
endTimeBefore :: Maybe POSIX
endTimeAfter :: Maybe POSIX
creationTimeBefore :: Maybe POSIX
creationTimeAfter :: Maybe POSIX
$sel:projectArn:ListTestGridSessions' :: ListTestGridSessions -> Text
$sel:status:ListTestGridSessions' :: ListTestGridSessions -> Maybe TestGridSessionStatus
$sel:nextToken:ListTestGridSessions' :: ListTestGridSessions -> Maybe Text
$sel:maxResult:ListTestGridSessions' :: ListTestGridSessions -> Maybe Natural
$sel:endTimeBefore:ListTestGridSessions' :: ListTestGridSessions -> Maybe POSIX
$sel:endTimeAfter:ListTestGridSessions' :: ListTestGridSessions -> Maybe POSIX
$sel:creationTimeBefore:ListTestGridSessions' :: ListTestGridSessions -> Maybe POSIX
$sel:creationTimeAfter:ListTestGridSessions' :: ListTestGridSessions -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationTimeAfter
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationTimeBefore
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
endTimeAfter
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
endTimeBefore
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResult
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TestGridSessionStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
projectArn

instance Prelude.NFData ListTestGridSessions where
  rnf :: ListTestGridSessions -> ()
rnf ListTestGridSessions' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe TestGridSessionStatus
Text
projectArn :: Text
status :: Maybe TestGridSessionStatus
nextToken :: Maybe Text
maxResult :: Maybe Natural
endTimeBefore :: Maybe POSIX
endTimeAfter :: Maybe POSIX
creationTimeBefore :: Maybe POSIX
creationTimeAfter :: Maybe POSIX
$sel:projectArn:ListTestGridSessions' :: ListTestGridSessions -> Text
$sel:status:ListTestGridSessions' :: ListTestGridSessions -> Maybe TestGridSessionStatus
$sel:nextToken:ListTestGridSessions' :: ListTestGridSessions -> Maybe Text
$sel:maxResult:ListTestGridSessions' :: ListTestGridSessions -> Maybe Natural
$sel:endTimeBefore:ListTestGridSessions' :: ListTestGridSessions -> Maybe POSIX
$sel:endTimeAfter:ListTestGridSessions' :: ListTestGridSessions -> Maybe POSIX
$sel:creationTimeBefore:ListTestGridSessions' :: ListTestGridSessions -> Maybe POSIX
$sel:creationTimeAfter:ListTestGridSessions' :: ListTestGridSessions -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationTimeAfter
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationTimeBefore
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
endTimeAfter
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
endTimeBefore
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResult
      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 TestGridSessionStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
projectArn

instance Data.ToHeaders ListTestGridSessions where
  toHeaders :: ListTestGridSessions -> 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
"DeviceFarm_20150623.ListTestGridSessions" ::
                          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 ListTestGridSessions where
  toJSON :: ListTestGridSessions -> Value
toJSON ListTestGridSessions' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe TestGridSessionStatus
Text
projectArn :: Text
status :: Maybe TestGridSessionStatus
nextToken :: Maybe Text
maxResult :: Maybe Natural
endTimeBefore :: Maybe POSIX
endTimeAfter :: Maybe POSIX
creationTimeBefore :: Maybe POSIX
creationTimeAfter :: Maybe POSIX
$sel:projectArn:ListTestGridSessions' :: ListTestGridSessions -> Text
$sel:status:ListTestGridSessions' :: ListTestGridSessions -> Maybe TestGridSessionStatus
$sel:nextToken:ListTestGridSessions' :: ListTestGridSessions -> Maybe Text
$sel:maxResult:ListTestGridSessions' :: ListTestGridSessions -> Maybe Natural
$sel:endTimeBefore:ListTestGridSessions' :: ListTestGridSessions -> Maybe POSIX
$sel:endTimeAfter:ListTestGridSessions' :: ListTestGridSessions -> Maybe POSIX
$sel:creationTimeBefore:ListTestGridSessions' :: ListTestGridSessions -> Maybe POSIX
$sel:creationTimeAfter:ListTestGridSessions' :: ListTestGridSessions -> Maybe POSIX
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"creationTimeAfter" 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 POSIX
creationTimeAfter,
            (Key
"creationTimeBefore" 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 POSIX
creationTimeBefore,
            (Key
"endTimeAfter" 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 POSIX
endTimeAfter,
            (Key
"endTimeBefore" 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 POSIX
endTimeBefore,
            (Key
"maxResult" 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
maxResult,
            (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
"status" 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 TestGridSessionStatus
status,
            forall a. a -> Maybe a
Prelude.Just (Key
"projectArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
projectArn)
          ]
      )

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

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

-- | /See:/ 'newListTestGridSessionsResponse' smart constructor.
data ListTestGridSessionsResponse = ListTestGridSessionsResponse'
  { -- | Pagination token.
    ListTestGridSessionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The sessions that match the criteria in a ListTestGridSessionsRequest.
    ListTestGridSessionsResponse -> Maybe [TestGridSession]
testGridSessions :: Prelude.Maybe [TestGridSession],
    -- | The response's http status code.
    ListTestGridSessionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListTestGridSessionsResponse
-> ListTestGridSessionsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListTestGridSessionsResponse
-> ListTestGridSessionsResponse -> Bool
$c/= :: ListTestGridSessionsResponse
-> ListTestGridSessionsResponse -> Bool
== :: ListTestGridSessionsResponse
-> ListTestGridSessionsResponse -> Bool
$c== :: ListTestGridSessionsResponse
-> ListTestGridSessionsResponse -> Bool
Prelude.Eq, ReadPrec [ListTestGridSessionsResponse]
ReadPrec ListTestGridSessionsResponse
Int -> ReadS ListTestGridSessionsResponse
ReadS [ListTestGridSessionsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListTestGridSessionsResponse]
$creadListPrec :: ReadPrec [ListTestGridSessionsResponse]
readPrec :: ReadPrec ListTestGridSessionsResponse
$creadPrec :: ReadPrec ListTestGridSessionsResponse
readList :: ReadS [ListTestGridSessionsResponse]
$creadList :: ReadS [ListTestGridSessionsResponse]
readsPrec :: Int -> ReadS ListTestGridSessionsResponse
$creadsPrec :: Int -> ReadS ListTestGridSessionsResponse
Prelude.Read, Int -> ListTestGridSessionsResponse -> ShowS
[ListTestGridSessionsResponse] -> ShowS
ListTestGridSessionsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListTestGridSessionsResponse] -> ShowS
$cshowList :: [ListTestGridSessionsResponse] -> ShowS
show :: ListTestGridSessionsResponse -> String
$cshow :: ListTestGridSessionsResponse -> String
showsPrec :: Int -> ListTestGridSessionsResponse -> ShowS
$cshowsPrec :: Int -> ListTestGridSessionsResponse -> ShowS
Prelude.Show, forall x.
Rep ListTestGridSessionsResponse x -> ListTestGridSessionsResponse
forall x.
ListTestGridSessionsResponse -> Rep ListTestGridSessionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListTestGridSessionsResponse x -> ListTestGridSessionsResponse
$cfrom :: forall x.
ListTestGridSessionsResponse -> Rep ListTestGridSessionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListTestGridSessionsResponse' 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', 'listTestGridSessionsResponse_nextToken' - Pagination token.
--
-- 'testGridSessions', 'listTestGridSessionsResponse_testGridSessions' - The sessions that match the criteria in a ListTestGridSessionsRequest.
--
-- 'httpStatus', 'listTestGridSessionsResponse_httpStatus' - The response's http status code.
newListTestGridSessionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListTestGridSessionsResponse
newListTestGridSessionsResponse :: Int -> ListTestGridSessionsResponse
newListTestGridSessionsResponse Int
pHttpStatus_ =
  ListTestGridSessionsResponse'
    { $sel:nextToken:ListTestGridSessionsResponse' :: Maybe Text
nextToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:testGridSessions:ListTestGridSessionsResponse' :: Maybe [TestGridSession]
testGridSessions = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListTestGridSessionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Pagination token.
listTestGridSessionsResponse_nextToken :: Lens.Lens' ListTestGridSessionsResponse (Prelude.Maybe Prelude.Text)
listTestGridSessionsResponse_nextToken :: Lens' ListTestGridSessionsResponse (Maybe Text)
listTestGridSessionsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTestGridSessionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListTestGridSessionsResponse' :: ListTestGridSessionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListTestGridSessionsResponse
s@ListTestGridSessionsResponse' {} Maybe Text
a -> ListTestGridSessionsResponse
s {$sel:nextToken:ListTestGridSessionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListTestGridSessionsResponse)

-- | The sessions that match the criteria in a ListTestGridSessionsRequest.
listTestGridSessionsResponse_testGridSessions :: Lens.Lens' ListTestGridSessionsResponse (Prelude.Maybe [TestGridSession])
listTestGridSessionsResponse_testGridSessions :: Lens' ListTestGridSessionsResponse (Maybe [TestGridSession])
listTestGridSessionsResponse_testGridSessions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTestGridSessionsResponse' {Maybe [TestGridSession]
testGridSessions :: Maybe [TestGridSession]
$sel:testGridSessions:ListTestGridSessionsResponse' :: ListTestGridSessionsResponse -> Maybe [TestGridSession]
testGridSessions} -> Maybe [TestGridSession]
testGridSessions) (\s :: ListTestGridSessionsResponse
s@ListTestGridSessionsResponse' {} Maybe [TestGridSession]
a -> ListTestGridSessionsResponse
s {$sel:testGridSessions:ListTestGridSessionsResponse' :: Maybe [TestGridSession]
testGridSessions = Maybe [TestGridSession]
a} :: ListTestGridSessionsResponse) 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

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

instance Prelude.NFData ListTestGridSessionsResponse where
  rnf :: ListTestGridSessionsResponse -> ()
rnf ListTestGridSessionsResponse' {Int
Maybe [TestGridSession]
Maybe Text
httpStatus :: Int
testGridSessions :: Maybe [TestGridSession]
nextToken :: Maybe Text
$sel:httpStatus:ListTestGridSessionsResponse' :: ListTestGridSessionsResponse -> Int
$sel:testGridSessions:ListTestGridSessionsResponse' :: ListTestGridSessionsResponse -> Maybe [TestGridSession]
$sel:nextToken:ListTestGridSessionsResponse' :: ListTestGridSessionsResponse -> Maybe Text
..} =
    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 [TestGridSession]
testGridSessions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus