{-# 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-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)
module Amazonka.DeviceFarm.Types.TestGridSession where

import qualified Amazonka.Core as Core
import Amazonka.DeviceFarm.Types.TestGridSessionStatus
import qualified Amazonka.Lens as Lens
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 state of the session.
    TestGridSession -> Maybe TestGridSessionStatus
status :: Prelude.Maybe TestGridSessionStatus,
    -- | The ARN of the session.
    TestGridSession -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The time that the session was started.
    TestGridSession -> Maybe POSIX
created :: Prelude.Maybe Core.POSIX,
    -- | The number of billed minutes that were used for this session.
    TestGridSession -> Maybe Double
billingMinutes :: Prelude.Maybe Prelude.Double,
    -- | The time the session ended.
    TestGridSession -> Maybe POSIX
ended :: Prelude.Maybe Core.POSIX,
    -- | A JSON object of options and parameters passed to the Selenium
    -- WebDriver.
    TestGridSession -> Maybe Text
seleniumProperties :: Prelude.Maybe Prelude.Text
  }
  deriving (TestGridSession -> TestGridSession -> Bool
(TestGridSession -> TestGridSession -> Bool)
-> (TestGridSession -> TestGridSession -> Bool)
-> Eq TestGridSession
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]
(Int -> ReadS TestGridSession)
-> ReadS [TestGridSession]
-> ReadPrec TestGridSession
-> ReadPrec [TestGridSession]
-> Read 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
(Int -> TestGridSession -> ShowS)
-> (TestGridSession -> String)
-> ([TestGridSession] -> ShowS)
-> Show TestGridSession
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. TestGridSession -> Rep TestGridSession x)
-> (forall x. Rep TestGridSession x -> TestGridSession)
-> Generic TestGridSession
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:
--
-- 'status', 'testGridSession_status' - The state of the session.
--
-- 'arn', 'testGridSession_arn' - The ARN of the session.
--
-- 'created', 'testGridSession_created' - The time that the session was started.
--
-- 'billingMinutes', 'testGridSession_billingMinutes' - The number of billed minutes that were used for this session.
--
-- 'ended', 'testGridSession_ended' - The time the session ended.
--
-- 'seleniumProperties', 'testGridSession_seleniumProperties' - A JSON object of options and parameters passed to the Selenium
-- WebDriver.
newTestGridSession ::
  TestGridSession
newTestGridSession :: TestGridSession
newTestGridSession =
  TestGridSession' :: Maybe TestGridSessionStatus
-> Maybe Text
-> Maybe POSIX
-> Maybe Double
-> Maybe POSIX
-> Maybe Text
-> TestGridSession
TestGridSession'
    { $sel:status:TestGridSession' :: Maybe TestGridSessionStatus
status = Maybe TestGridSessionStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:TestGridSession' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:created:TestGridSession' :: Maybe POSIX
created = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:billingMinutes:TestGridSession' :: Maybe Double
billingMinutes = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:ended:TestGridSession' :: Maybe POSIX
ended = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:seleniumProperties:TestGridSession' :: Maybe Text
seleniumProperties = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The state of the session.
testGridSession_status :: Lens.Lens' TestGridSession (Prelude.Maybe TestGridSessionStatus)
testGridSession_status :: (Maybe TestGridSessionStatus -> f (Maybe TestGridSessionStatus))
-> TestGridSession -> f TestGridSession
testGridSession_status = (TestGridSession -> Maybe TestGridSessionStatus)
-> (TestGridSession
    -> Maybe TestGridSessionStatus -> TestGridSession)
-> Lens
     TestGridSession
     TestGridSession
     (Maybe TestGridSessionStatus)
     (Maybe TestGridSessionStatus)
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)

-- | The ARN of the session.
testGridSession_arn :: Lens.Lens' TestGridSession (Prelude.Maybe Prelude.Text)
testGridSession_arn :: (Maybe Text -> f (Maybe Text))
-> TestGridSession -> f TestGridSession
testGridSession_arn = (TestGridSession -> Maybe Text)
-> (TestGridSession -> Maybe Text -> TestGridSession)
-> Lens TestGridSession TestGridSession (Maybe Text) (Maybe Text)
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 time that the session was started.
testGridSession_created :: Lens.Lens' TestGridSession (Prelude.Maybe Prelude.UTCTime)
testGridSession_created :: (Maybe UTCTime -> f (Maybe UTCTime))
-> TestGridSession -> f TestGridSession
testGridSession_created = (TestGridSession -> Maybe POSIX)
-> (TestGridSession -> Maybe POSIX -> TestGridSession)
-> Lens TestGridSession TestGridSession (Maybe POSIX) (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> TestGridSession -> f TestGridSession)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> TestGridSession
-> f TestGridSession
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The number of billed minutes that were used for this session.
testGridSession_billingMinutes :: Lens.Lens' TestGridSession (Prelude.Maybe Prelude.Double)
testGridSession_billingMinutes :: (Maybe Double -> f (Maybe Double))
-> TestGridSession -> f TestGridSession
testGridSession_billingMinutes = (TestGridSession -> Maybe Double)
-> (TestGridSession -> Maybe Double -> TestGridSession)
-> Lens
     TestGridSession TestGridSession (Maybe Double) (Maybe Double)
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 the session ended.
testGridSession_ended :: Lens.Lens' TestGridSession (Prelude.Maybe Prelude.UTCTime)
testGridSession_ended :: (Maybe UTCTime -> f (Maybe UTCTime))
-> TestGridSession -> f TestGridSession
testGridSession_ended = (TestGridSession -> Maybe POSIX)
-> (TestGridSession -> Maybe POSIX -> TestGridSession)
-> Lens TestGridSession TestGridSession (Maybe POSIX) (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> TestGridSession -> f TestGridSession)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> TestGridSession
-> f TestGridSession
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | A JSON object of options and parameters passed to the Selenium
-- WebDriver.
testGridSession_seleniumProperties :: Lens.Lens' TestGridSession (Prelude.Maybe Prelude.Text)
testGridSession_seleniumProperties :: (Maybe Text -> f (Maybe Text))
-> TestGridSession -> f TestGridSession
testGridSession_seleniumProperties = (TestGridSession -> Maybe Text)
-> (TestGridSession -> Maybe Text -> TestGridSession)
-> Lens TestGridSession TestGridSession (Maybe Text) (Maybe Text)
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)

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

instance Prelude.Hashable TestGridSession

instance Prelude.NFData TestGridSession