{-# 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.TestGridSessionAction
-- 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.TestGridSessionAction where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | An action taken by a TestGridSession browser instance.
--
-- /See:/ 'newTestGridSessionAction' smart constructor.
data TestGridSessionAction = TestGridSessionAction'
  { -- | The action taken by the session.
    TestGridSessionAction -> Maybe Text
action :: Prelude.Maybe Prelude.Text,
    -- | The time, in milliseconds, that the action took to complete in the
    -- browser.
    TestGridSessionAction -> Maybe Integer
duration :: Prelude.Maybe Prelude.Integer,
    -- | HTTP method that the browser used to make the request.
    TestGridSessionAction -> Maybe Text
requestMethod :: Prelude.Maybe Prelude.Text,
    -- | The time that the session invoked the action.
    TestGridSessionAction -> Maybe POSIX
started :: Prelude.Maybe Data.POSIX,
    -- | HTTP status code returned to the browser when the action was taken.
    TestGridSessionAction -> Maybe Text
statusCode :: Prelude.Maybe Prelude.Text
  }
  deriving (TestGridSessionAction -> TestGridSessionAction -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TestGridSessionAction -> TestGridSessionAction -> Bool
$c/= :: TestGridSessionAction -> TestGridSessionAction -> Bool
== :: TestGridSessionAction -> TestGridSessionAction -> Bool
$c== :: TestGridSessionAction -> TestGridSessionAction -> Bool
Prelude.Eq, ReadPrec [TestGridSessionAction]
ReadPrec TestGridSessionAction
Int -> ReadS TestGridSessionAction
ReadS [TestGridSessionAction]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TestGridSessionAction]
$creadListPrec :: ReadPrec [TestGridSessionAction]
readPrec :: ReadPrec TestGridSessionAction
$creadPrec :: ReadPrec TestGridSessionAction
readList :: ReadS [TestGridSessionAction]
$creadList :: ReadS [TestGridSessionAction]
readsPrec :: Int -> ReadS TestGridSessionAction
$creadsPrec :: Int -> ReadS TestGridSessionAction
Prelude.Read, Int -> TestGridSessionAction -> ShowS
[TestGridSessionAction] -> ShowS
TestGridSessionAction -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TestGridSessionAction] -> ShowS
$cshowList :: [TestGridSessionAction] -> ShowS
show :: TestGridSessionAction -> String
$cshow :: TestGridSessionAction -> String
showsPrec :: Int -> TestGridSessionAction -> ShowS
$cshowsPrec :: Int -> TestGridSessionAction -> ShowS
Prelude.Show, forall x. Rep TestGridSessionAction x -> TestGridSessionAction
forall x. TestGridSessionAction -> Rep TestGridSessionAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TestGridSessionAction x -> TestGridSessionAction
$cfrom :: forall x. TestGridSessionAction -> Rep TestGridSessionAction x
Prelude.Generic)

-- |
-- Create a value of 'TestGridSessionAction' 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:
--
-- 'action', 'testGridSessionAction_action' - The action taken by the session.
--
-- 'duration', 'testGridSessionAction_duration' - The time, in milliseconds, that the action took to complete in the
-- browser.
--
-- 'requestMethod', 'testGridSessionAction_requestMethod' - HTTP method that the browser used to make the request.
--
-- 'started', 'testGridSessionAction_started' - The time that the session invoked the action.
--
-- 'statusCode', 'testGridSessionAction_statusCode' - HTTP status code returned to the browser when the action was taken.
newTestGridSessionAction ::
  TestGridSessionAction
newTestGridSessionAction :: TestGridSessionAction
newTestGridSessionAction =
  TestGridSessionAction'
    { $sel:action:TestGridSessionAction' :: Maybe Text
action = forall a. Maybe a
Prelude.Nothing,
      $sel:duration:TestGridSessionAction' :: Maybe Integer
duration = forall a. Maybe a
Prelude.Nothing,
      $sel:requestMethod:TestGridSessionAction' :: Maybe Text
requestMethod = forall a. Maybe a
Prelude.Nothing,
      $sel:started:TestGridSessionAction' :: Maybe POSIX
started = forall a. Maybe a
Prelude.Nothing,
      $sel:statusCode:TestGridSessionAction' :: Maybe Text
statusCode = forall a. Maybe a
Prelude.Nothing
    }

-- | The action taken by the session.
testGridSessionAction_action :: Lens.Lens' TestGridSessionAction (Prelude.Maybe Prelude.Text)
testGridSessionAction_action :: Lens' TestGridSessionAction (Maybe Text)
testGridSessionAction_action = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestGridSessionAction' {Maybe Text
action :: Maybe Text
$sel:action:TestGridSessionAction' :: TestGridSessionAction -> Maybe Text
action} -> Maybe Text
action) (\s :: TestGridSessionAction
s@TestGridSessionAction' {} Maybe Text
a -> TestGridSessionAction
s {$sel:action:TestGridSessionAction' :: Maybe Text
action = Maybe Text
a} :: TestGridSessionAction)

-- | The time, in milliseconds, that the action took to complete in the
-- browser.
testGridSessionAction_duration :: Lens.Lens' TestGridSessionAction (Prelude.Maybe Prelude.Integer)
testGridSessionAction_duration :: Lens' TestGridSessionAction (Maybe Integer)
testGridSessionAction_duration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestGridSessionAction' {Maybe Integer
duration :: Maybe Integer
$sel:duration:TestGridSessionAction' :: TestGridSessionAction -> Maybe Integer
duration} -> Maybe Integer
duration) (\s :: TestGridSessionAction
s@TestGridSessionAction' {} Maybe Integer
a -> TestGridSessionAction
s {$sel:duration:TestGridSessionAction' :: Maybe Integer
duration = Maybe Integer
a} :: TestGridSessionAction)

-- | HTTP method that the browser used to make the request.
testGridSessionAction_requestMethod :: Lens.Lens' TestGridSessionAction (Prelude.Maybe Prelude.Text)
testGridSessionAction_requestMethod :: Lens' TestGridSessionAction (Maybe Text)
testGridSessionAction_requestMethod = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestGridSessionAction' {Maybe Text
requestMethod :: Maybe Text
$sel:requestMethod:TestGridSessionAction' :: TestGridSessionAction -> Maybe Text
requestMethod} -> Maybe Text
requestMethod) (\s :: TestGridSessionAction
s@TestGridSessionAction' {} Maybe Text
a -> TestGridSessionAction
s {$sel:requestMethod:TestGridSessionAction' :: Maybe Text
requestMethod = Maybe Text
a} :: TestGridSessionAction)

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

-- | HTTP status code returned to the browser when the action was taken.
testGridSessionAction_statusCode :: Lens.Lens' TestGridSessionAction (Prelude.Maybe Prelude.Text)
testGridSessionAction_statusCode :: Lens' TestGridSessionAction (Maybe Text)
testGridSessionAction_statusCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestGridSessionAction' {Maybe Text
statusCode :: Maybe Text
$sel:statusCode:TestGridSessionAction' :: TestGridSessionAction -> Maybe Text
statusCode} -> Maybe Text
statusCode) (\s :: TestGridSessionAction
s@TestGridSessionAction' {} Maybe Text
a -> TestGridSessionAction
s {$sel:statusCode:TestGridSessionAction' :: Maybe Text
statusCode = Maybe Text
a} :: TestGridSessionAction)

instance Data.FromJSON TestGridSessionAction where
  parseJSON :: Value -> Parser TestGridSessionAction
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TestGridSessionAction"
      ( \Object
x ->
          Maybe Text
-> Maybe Integer
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> TestGridSessionAction
TestGridSessionAction'
            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
"action")
            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
"duration")
            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
"requestMethod")
            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
"started")
            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
"statusCode")
      )

instance Prelude.Hashable TestGridSessionAction where
  hashWithSalt :: Int -> TestGridSessionAction -> Int
hashWithSalt Int
_salt TestGridSessionAction' {Maybe Integer
Maybe Text
Maybe POSIX
statusCode :: Maybe Text
started :: Maybe POSIX
requestMethod :: Maybe Text
duration :: Maybe Integer
action :: Maybe Text
$sel:statusCode:TestGridSessionAction' :: TestGridSessionAction -> Maybe Text
$sel:started:TestGridSessionAction' :: TestGridSessionAction -> Maybe POSIX
$sel:requestMethod:TestGridSessionAction' :: TestGridSessionAction -> Maybe Text
$sel:duration:TestGridSessionAction' :: TestGridSessionAction -> Maybe Integer
$sel:action:TestGridSessionAction' :: TestGridSessionAction -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
action
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
duration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
requestMethod
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
started
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
statusCode

instance Prelude.NFData TestGridSessionAction where
  rnf :: TestGridSessionAction -> ()
rnf TestGridSessionAction' {Maybe Integer
Maybe Text
Maybe POSIX
statusCode :: Maybe Text
started :: Maybe POSIX
requestMethod :: Maybe Text
duration :: Maybe Integer
action :: Maybe Text
$sel:statusCode:TestGridSessionAction' :: TestGridSessionAction -> Maybe Text
$sel:started:TestGridSessionAction' :: TestGridSessionAction -> Maybe POSIX
$sel:requestMethod:TestGridSessionAction' :: TestGridSessionAction -> Maybe Text
$sel:duration:TestGridSessionAction' :: TestGridSessionAction -> Maybe Integer
$sel:action:TestGridSessionAction' :: TestGridSessionAction -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
action
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
duration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
requestMethod
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
started
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
statusCode