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

import qualified Amazonka.Core as Core
import Amazonka.DeviceFarm.Types.TestGridSessionArtifactType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Artifacts are video and other files that are produced in the process of
-- running a browser in an automated context.
--
-- Video elements might be broken up into multiple artifacts as they grow
-- in size during creation.
--
-- /See:/ 'newTestGridSessionArtifact' smart constructor.
data TestGridSessionArtifact = TestGridSessionArtifact'
  { -- | A semi-stable URL to the content of the object.
    TestGridSessionArtifact -> Maybe (Sensitive Text)
url :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The kind of artifact.
    TestGridSessionArtifact -> Maybe TestGridSessionArtifactType
type' :: Prelude.Maybe TestGridSessionArtifactType,
    -- | The file name of the artifact.
    TestGridSessionArtifact -> Maybe Text
filename :: Prelude.Maybe Prelude.Text
  }
  deriving (TestGridSessionArtifact -> TestGridSessionArtifact -> Bool
(TestGridSessionArtifact -> TestGridSessionArtifact -> Bool)
-> (TestGridSessionArtifact -> TestGridSessionArtifact -> Bool)
-> Eq TestGridSessionArtifact
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TestGridSessionArtifact -> TestGridSessionArtifact -> Bool
$c/= :: TestGridSessionArtifact -> TestGridSessionArtifact -> Bool
== :: TestGridSessionArtifact -> TestGridSessionArtifact -> Bool
$c== :: TestGridSessionArtifact -> TestGridSessionArtifact -> Bool
Prelude.Eq, Int -> TestGridSessionArtifact -> ShowS
[TestGridSessionArtifact] -> ShowS
TestGridSessionArtifact -> String
(Int -> TestGridSessionArtifact -> ShowS)
-> (TestGridSessionArtifact -> String)
-> ([TestGridSessionArtifact] -> ShowS)
-> Show TestGridSessionArtifact
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TestGridSessionArtifact] -> ShowS
$cshowList :: [TestGridSessionArtifact] -> ShowS
show :: TestGridSessionArtifact -> String
$cshow :: TestGridSessionArtifact -> String
showsPrec :: Int -> TestGridSessionArtifact -> ShowS
$cshowsPrec :: Int -> TestGridSessionArtifact -> ShowS
Prelude.Show, (forall x.
 TestGridSessionArtifact -> Rep TestGridSessionArtifact x)
-> (forall x.
    Rep TestGridSessionArtifact x -> TestGridSessionArtifact)
-> Generic TestGridSessionArtifact
forall x. Rep TestGridSessionArtifact x -> TestGridSessionArtifact
forall x. TestGridSessionArtifact -> Rep TestGridSessionArtifact x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TestGridSessionArtifact x -> TestGridSessionArtifact
$cfrom :: forall x. TestGridSessionArtifact -> Rep TestGridSessionArtifact x
Prelude.Generic)

-- |
-- Create a value of 'TestGridSessionArtifact' 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:
--
-- 'url', 'testGridSessionArtifact_url' - A semi-stable URL to the content of the object.
--
-- 'type'', 'testGridSessionArtifact_type' - The kind of artifact.
--
-- 'filename', 'testGridSessionArtifact_filename' - The file name of the artifact.
newTestGridSessionArtifact ::
  TestGridSessionArtifact
newTestGridSessionArtifact :: TestGridSessionArtifact
newTestGridSessionArtifact =
  TestGridSessionArtifact' :: Maybe (Sensitive Text)
-> Maybe TestGridSessionArtifactType
-> Maybe Text
-> TestGridSessionArtifact
TestGridSessionArtifact'
    { $sel:url:TestGridSessionArtifact' :: Maybe (Sensitive Text)
url = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:type':TestGridSessionArtifact' :: Maybe TestGridSessionArtifactType
type' = Maybe TestGridSessionArtifactType
forall a. Maybe a
Prelude.Nothing,
      $sel:filename:TestGridSessionArtifact' :: Maybe Text
filename = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | A semi-stable URL to the content of the object.
testGridSessionArtifact_url :: Lens.Lens' TestGridSessionArtifact (Prelude.Maybe Prelude.Text)
testGridSessionArtifact_url :: (Maybe Text -> f (Maybe Text))
-> TestGridSessionArtifact -> f TestGridSessionArtifact
testGridSessionArtifact_url = (TestGridSessionArtifact -> Maybe (Sensitive Text))
-> (TestGridSessionArtifact
    -> Maybe (Sensitive Text) -> TestGridSessionArtifact)
-> Lens
     TestGridSessionArtifact
     TestGridSessionArtifact
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestGridSessionArtifact' {Maybe (Sensitive Text)
url :: Maybe (Sensitive Text)
$sel:url:TestGridSessionArtifact' :: TestGridSessionArtifact -> Maybe (Sensitive Text)
url} -> Maybe (Sensitive Text)
url) (\s :: TestGridSessionArtifact
s@TestGridSessionArtifact' {} Maybe (Sensitive Text)
a -> TestGridSessionArtifact
s {$sel:url:TestGridSessionArtifact' :: Maybe (Sensitive Text)
url = Maybe (Sensitive Text)
a} :: TestGridSessionArtifact) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> TestGridSessionArtifact -> f TestGridSessionArtifact)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> TestGridSessionArtifact
-> f TestGridSessionArtifact
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The kind of artifact.
testGridSessionArtifact_type :: Lens.Lens' TestGridSessionArtifact (Prelude.Maybe TestGridSessionArtifactType)
testGridSessionArtifact_type :: (Maybe TestGridSessionArtifactType
 -> f (Maybe TestGridSessionArtifactType))
-> TestGridSessionArtifact -> f TestGridSessionArtifact
testGridSessionArtifact_type = (TestGridSessionArtifact -> Maybe TestGridSessionArtifactType)
-> (TestGridSessionArtifact
    -> Maybe TestGridSessionArtifactType -> TestGridSessionArtifact)
-> Lens
     TestGridSessionArtifact
     TestGridSessionArtifact
     (Maybe TestGridSessionArtifactType)
     (Maybe TestGridSessionArtifactType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestGridSessionArtifact' {Maybe TestGridSessionArtifactType
type' :: Maybe TestGridSessionArtifactType
$sel:type':TestGridSessionArtifact' :: TestGridSessionArtifact -> Maybe TestGridSessionArtifactType
type'} -> Maybe TestGridSessionArtifactType
type') (\s :: TestGridSessionArtifact
s@TestGridSessionArtifact' {} Maybe TestGridSessionArtifactType
a -> TestGridSessionArtifact
s {$sel:type':TestGridSessionArtifact' :: Maybe TestGridSessionArtifactType
type' = Maybe TestGridSessionArtifactType
a} :: TestGridSessionArtifact)

-- | The file name of the artifact.
testGridSessionArtifact_filename :: Lens.Lens' TestGridSessionArtifact (Prelude.Maybe Prelude.Text)
testGridSessionArtifact_filename :: (Maybe Text -> f (Maybe Text))
-> TestGridSessionArtifact -> f TestGridSessionArtifact
testGridSessionArtifact_filename = (TestGridSessionArtifact -> Maybe Text)
-> (TestGridSessionArtifact
    -> Maybe Text -> TestGridSessionArtifact)
-> Lens
     TestGridSessionArtifact
     TestGridSessionArtifact
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestGridSessionArtifact' {Maybe Text
filename :: Maybe Text
$sel:filename:TestGridSessionArtifact' :: TestGridSessionArtifact -> Maybe Text
filename} -> Maybe Text
filename) (\s :: TestGridSessionArtifact
s@TestGridSessionArtifact' {} Maybe Text
a -> TestGridSessionArtifact
s {$sel:filename:TestGridSessionArtifact' :: Maybe Text
filename = Maybe Text
a} :: TestGridSessionArtifact)

instance Core.FromJSON TestGridSessionArtifact where
  parseJSON :: Value -> Parser TestGridSessionArtifact
parseJSON =
    String
-> (Object -> Parser TestGridSessionArtifact)
-> Value
-> Parser TestGridSessionArtifact
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TestGridSessionArtifact"
      ( \Object
x ->
          Maybe (Sensitive Text)
-> Maybe TestGridSessionArtifactType
-> Maybe Text
-> TestGridSessionArtifact
TestGridSessionArtifact'
            (Maybe (Sensitive Text)
 -> Maybe TestGridSessionArtifactType
 -> Maybe Text
 -> TestGridSessionArtifact)
-> Parser (Maybe (Sensitive Text))
-> Parser
     (Maybe TestGridSessionArtifactType
      -> Maybe Text -> TestGridSessionArtifact)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"url")
            Parser
  (Maybe TestGridSessionArtifactType
   -> Maybe Text -> TestGridSessionArtifact)
-> Parser (Maybe TestGridSessionArtifactType)
-> Parser (Maybe Text -> TestGridSessionArtifact)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe TestGridSessionArtifactType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"type")
            Parser (Maybe Text -> TestGridSessionArtifact)
-> Parser (Maybe Text) -> Parser TestGridSessionArtifact
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
"filename")
      )

instance Prelude.Hashable TestGridSessionArtifact

instance Prelude.NFData TestGridSessionArtifact