{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.TestGridSession
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.DeviceFarm.Types.TestGridSession 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.TestGridSessionStatus
import qualified Amazonka.Prelude as Prelude

-- | A TestGridSession is a single instance of a browser launched from the
-- URL provided by a call to CreateTestGridUrl.
--
-- /See:/ 'newTestGridSession' smart constructor.
data TestGridSession = TestGridSession'
  { -- | The ARN of the session.
    TestGridSession -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The number of billed minutes that were used for this session.
    TestGridSession -> Maybe Double
billingMinutes :: Prelude.Maybe Prelude.Double,
    -- | The time that the session was started.
    TestGridSession -> Maybe POSIX
created :: Prelude.Maybe Data.POSIX,
    -- | The time the session ended.
    TestGridSession -> Maybe POSIX
ended :: Prelude.Maybe Data.POSIX,
    -- | A JSON object of options and parameters passed to the Selenium
    -- WebDriver.
    TestGridSession -> Maybe Text
seleniumProperties :: Prelude.Maybe Prelude.Text,
    -- | The state of the session.
    TestGridSession -> Maybe TestGridSessionStatus
status :: Prelude.Maybe TestGridSessionStatus
  }
  deriving (TestGridSession -> TestGridSession -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TestGridSession -> TestGridSession -> Bool
$c/= :: TestGridSession -> TestGridSession -> Bool
== :: TestGridSession -> TestGridSession -> Bool
$c== :: TestGridSession -> TestGridSession -> Bool
Prelude.Eq, ReadPrec [TestGridSession]
ReadPrec TestGridSession
Int -> ReadS TestGridSession
ReadS [TestGridSession]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TestGridSession]
$creadListPrec :: ReadPrec [TestGridSession]
readPrec :: ReadPrec TestGridSession
$creadPrec :: ReadPrec TestGridSession
readList :: ReadS [TestGridSession]
$creadList :: ReadS [TestGridSession]
readsPrec :: Int -> ReadS TestGridSession
$creadsPrec :: Int -> ReadS TestGridSession
Prelude.Read, Int -> TestGridSession -> ShowS
[TestGridSession] -> ShowS
TestGridSession -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TestGridSession] -> ShowS
$cshowList :: [TestGridSession] -> ShowS
show :: TestGridSession -> String
$cshow :: TestGridSession -> String
showsPrec :: Int -> TestGridSession -> ShowS
$cshowsPrec :: Int -> TestGridSession -> ShowS
Prelude.Show, forall x. Rep TestGridSession x -> TestGridSession
forall x. TestGridSession -> Rep TestGridSession x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TestGridSession x -> TestGridSession
$cfrom :: forall x. TestGridSession -> Rep TestGridSession x
Prelude.Generic)

-- |
-- Create a value of 'TestGridSession' 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:
--
-- 'arn', 'testGridSession_arn' - The ARN of the session.
--
-- 'billingMinutes', 'testGridSession_billingMinutes' - The number of billed minutes that were used for this session.
--
-- 'created', 'testGridSession_created' - The time that the session was started.
--
-- 'ended', 'testGridSession_ended' - The time the session ended.
--
-- 'seleniumProperties', 'testGridSession_seleniumProperties' - A JSON object of options and parameters passed to the Selenium
-- WebDriver.
--
-- 'status', 'testGridSession_status' - The state of the session.
newTestGridSession ::
  TestGridSession
newTestGridSession :: TestGridSession
newTestGridSession =
  TestGridSession'
    { $sel:arn:TestGridSession' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:billingMinutes:TestGridSession' :: Maybe Double
billingMinutes = forall a. Maybe a
Prelude.Nothing,
      $sel:created:TestGridSession' :: Maybe POSIX
created = forall a. Maybe a
Prelude.Nothing,
      $sel:ended:TestGridSession' :: Maybe POSIX
ended = forall a. Maybe a
Prelude.Nothing,
      $sel:seleniumProperties:TestGridSession' :: Maybe Text
seleniumProperties = forall a. Maybe a
Prelude.Nothing,
      $sel:status:TestGridSession' :: Maybe TestGridSessionStatus
status = forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN of the session.
testGridSession_arn :: Lens.Lens' TestGridSession (Prelude.Maybe Prelude.Text)
testGridSession_arn :: Lens' TestGridSession (Maybe Text)
testGridSession_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestGridSession' {Maybe Text
arn :: Maybe Text
$sel:arn:TestGridSession' :: TestGridSession -> Maybe Text
arn} -> Maybe Text
arn) (\s :: TestGridSession
s@TestGridSession' {} Maybe Text
a -> TestGridSession
s {$sel:arn:TestGridSession' :: Maybe Text
arn = Maybe Text
a} :: TestGridSession)

-- | The number of billed minutes that were used for this session.
testGridSession_billingMinutes :: Lens.Lens' TestGridSession (Prelude.Maybe Prelude.Double)
testGridSession_billingMinutes :: Lens' TestGridSession (Maybe Double)
testGridSession_billingMinutes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestGridSession' {Maybe Double
billingMinutes :: Maybe Double
$sel:billingMinutes:TestGridSession' :: TestGridSession -> Maybe Double
billingMinutes} -> Maybe Double
billingMinutes) (\s :: TestGridSession
s@TestGridSession' {} Maybe Double
a -> TestGridSession
s {$sel:billingMinutes:TestGridSession' :: Maybe Double
billingMinutes = Maybe Double
a} :: TestGridSession)

-- | The time that the session was started.
testGridSession_created :: Lens.Lens' TestGridSession (Prelude.Maybe Prelude.UTCTime)
testGridSession_created :: Lens' TestGridSession (Maybe UTCTime)
testGridSession_created = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestGridSession' {Maybe POSIX
created :: Maybe POSIX
$sel:created:TestGridSession' :: TestGridSession -> Maybe POSIX
created} -> Maybe POSIX
created) (\s :: TestGridSession
s@TestGridSession' {} Maybe POSIX
a -> TestGridSession
s {$sel:created:TestGridSession' :: Maybe POSIX
created = Maybe POSIX
a} :: TestGridSession) 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

-- | The time the session ended.
testGridSession_ended :: Lens.Lens' TestGridSession (Prelude.Maybe Prelude.UTCTime)
testGridSession_ended :: Lens' TestGridSession (Maybe UTCTime)
testGridSession_ended = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestGridSession' {Maybe POSIX
ended :: Maybe POSIX
$sel:ended:TestGridSession' :: TestGridSession -> Maybe POSIX
ended} -> Maybe POSIX
ended) (\s :: TestGridSession
s@TestGridSession' {} Maybe POSIX
a -> TestGridSession
s {$sel:ended:TestGridSession' :: Maybe POSIX
ended = Maybe POSIX
a} :: TestGridSession) 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

-- | A JSON object of options and parameters passed to the Selenium
-- WebDriver.
testGridSession_seleniumProperties :: Lens.Lens' TestGridSession (Prelude.Maybe Prelude.Text)
testGridSession_seleniumProperties :: Lens' TestGridSession (Maybe Text)
testGridSession_seleniumProperties = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestGridSession' {Maybe Text
seleniumProperties :: Maybe Text
$sel:seleniumProperties:TestGridSession' :: TestGridSession -> Maybe Text
seleniumProperties} -> Maybe Text
seleniumProperties) (\s :: TestGridSession
s@TestGridSession' {} Maybe Text
a -> TestGridSession
s {$sel:seleniumProperties:TestGridSession' :: Maybe Text
seleniumProperties = Maybe Text
a} :: TestGridSession)

-- | The state of the session.
testGridSession_status :: Lens.Lens' TestGridSession (Prelude.Maybe TestGridSessionStatus)
testGridSession_status :: Lens' TestGridSession (Maybe TestGridSessionStatus)
testGridSession_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestGridSession' {Maybe TestGridSessionStatus
status :: Maybe TestGridSessionStatus
$sel:status:TestGridSession' :: TestGridSession -> Maybe TestGridSessionStatus
status} -> Maybe TestGridSessionStatus
status) (\s :: TestGridSession
s@TestGridSession' {} Maybe TestGridSessionStatus
a -> TestGridSession
s {$sel:status:TestGridSession' :: Maybe TestGridSessionStatus
status = Maybe TestGridSessionStatus
a} :: TestGridSession)

instance Data.FromJSON TestGridSession where
  parseJSON :: Value -> Parser TestGridSession
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TestGridSession"
      ( \Object
x ->
          Maybe Text
-> Maybe Double
-> Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Maybe TestGridSessionStatus
-> TestGridSession
TestGridSession'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"arn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"billingMinutes")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"created")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ended")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"seleniumProperties")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"status")
      )

instance Prelude.Hashable TestGridSession where
  hashWithSalt :: Int -> TestGridSession -> Int
hashWithSalt Int
_salt TestGridSession' {Maybe Double
Maybe Text
Maybe POSIX
Maybe TestGridSessionStatus
status :: Maybe TestGridSessionStatus
seleniumProperties :: Maybe Text
ended :: Maybe POSIX
created :: Maybe POSIX
billingMinutes :: Maybe Double
arn :: Maybe Text
$sel:status:TestGridSession' :: TestGridSession -> Maybe TestGridSessionStatus
$sel:seleniumProperties:TestGridSession' :: TestGridSession -> Maybe Text
$sel:ended:TestGridSession' :: TestGridSession -> Maybe POSIX
$sel:created:TestGridSession' :: TestGridSession -> Maybe POSIX
$sel:billingMinutes:TestGridSession' :: TestGridSession -> Maybe Double
$sel:arn:TestGridSession' :: TestGridSession -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
billingMinutes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
created
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
ended
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
seleniumProperties
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TestGridSessionStatus
status

instance Prelude.NFData TestGridSession where
  rnf :: TestGridSession -> ()
rnf TestGridSession' {Maybe Double
Maybe Text
Maybe POSIX
Maybe TestGridSessionStatus
status :: Maybe TestGridSessionStatus
seleniumProperties :: Maybe Text
ended :: Maybe POSIX
created :: Maybe POSIX
billingMinutes :: Maybe Double
arn :: Maybe Text
$sel:status:TestGridSession' :: TestGridSession -> Maybe TestGridSessionStatus
$sel:seleniumProperties:TestGridSession' :: TestGridSession -> Maybe Text
$sel:ended:TestGridSession' :: TestGridSession -> Maybe POSIX
$sel:created:TestGridSession' :: TestGridSession -> Maybe POSIX
$sel:billingMinutes:TestGridSession' :: TestGridSession -> Maybe Double
$sel:arn:TestGridSession' :: TestGridSession -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
billingMinutes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
created
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
ended
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
seleniumProperties
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TestGridSessionStatus
status