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

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

-- | Represents the output of a test. Examples of artifacts include logs and
-- screenshots.
--
-- /See:/ 'newArtifact' smart constructor.
data Artifact = Artifact'
  { -- | The artifact\'s ARN.
    Artifact -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The presigned Amazon S3 URL that can be used with a GET request to
    -- download the artifact\'s file.
    Artifact -> Maybe Text
url :: Prelude.Maybe Prelude.Text,
    -- | The artifact\'s file extension.
    Artifact -> Maybe Text
extension :: Prelude.Maybe Prelude.Text,
    -- | The artifact\'s name.
    Artifact -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The artifact\'s type.
    --
    -- Allowed values include the following:
    --
    -- -   UNKNOWN
    --
    -- -   SCREENSHOT
    --
    -- -   DEVICE_LOG
    --
    -- -   MESSAGE_LOG
    --
    -- -   VIDEO_LOG
    --
    -- -   RESULT_LOG
    --
    -- -   SERVICE_LOG
    --
    -- -   WEBKIT_LOG
    --
    -- -   INSTRUMENTATION_OUTPUT
    --
    -- -   EXERCISER_MONKEY_OUTPUT: the artifact (log) generated by an Android
    --     fuzz test.
    --
    -- -   CALABASH_JSON_OUTPUT
    --
    -- -   CALABASH_PRETTY_OUTPUT
    --
    -- -   CALABASH_STANDARD_OUTPUT
    --
    -- -   CALABASH_JAVA_XML_OUTPUT
    --
    -- -   AUTOMATION_OUTPUT
    --
    -- -   APPIUM_SERVER_OUTPUT
    --
    -- -   APPIUM_JAVA_OUTPUT
    --
    -- -   APPIUM_JAVA_XML_OUTPUT
    --
    -- -   APPIUM_PYTHON_OUTPUT
    --
    -- -   APPIUM_PYTHON_XML_OUTPUT
    --
    -- -   EXPLORER_EVENT_LOG
    --
    -- -   EXPLORER_SUMMARY_LOG
    --
    -- -   APPLICATION_CRASH_REPORT
    --
    -- -   XCTEST_LOG
    --
    -- -   VIDEO
    --
    -- -   CUSTOMER_ARTIFACT
    --
    -- -   CUSTOMER_ARTIFACT_LOG
    --
    -- -   TESTSPEC_OUTPUT
    Artifact -> Maybe ArtifactType
type' :: Prelude.Maybe ArtifactType
  }
  deriving (Artifact -> Artifact -> Bool
(Artifact -> Artifact -> Bool)
-> (Artifact -> Artifact -> Bool) -> Eq Artifact
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Artifact -> Artifact -> Bool
$c/= :: Artifact -> Artifact -> Bool
== :: Artifact -> Artifact -> Bool
$c== :: Artifact -> Artifact -> Bool
Prelude.Eq, ReadPrec [Artifact]
ReadPrec Artifact
Int -> ReadS Artifact
ReadS [Artifact]
(Int -> ReadS Artifact)
-> ReadS [Artifact]
-> ReadPrec Artifact
-> ReadPrec [Artifact]
-> Read Artifact
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Artifact]
$creadListPrec :: ReadPrec [Artifact]
readPrec :: ReadPrec Artifact
$creadPrec :: ReadPrec Artifact
readList :: ReadS [Artifact]
$creadList :: ReadS [Artifact]
readsPrec :: Int -> ReadS Artifact
$creadsPrec :: Int -> ReadS Artifact
Prelude.Read, Int -> Artifact -> ShowS
[Artifact] -> ShowS
Artifact -> String
(Int -> Artifact -> ShowS)
-> (Artifact -> String) -> ([Artifact] -> ShowS) -> Show Artifact
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Artifact] -> ShowS
$cshowList :: [Artifact] -> ShowS
show :: Artifact -> String
$cshow :: Artifact -> String
showsPrec :: Int -> Artifact -> ShowS
$cshowsPrec :: Int -> Artifact -> ShowS
Prelude.Show, (forall x. Artifact -> Rep Artifact x)
-> (forall x. Rep Artifact x -> Artifact) -> Generic Artifact
forall x. Rep Artifact x -> Artifact
forall x. Artifact -> Rep Artifact x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Artifact x -> Artifact
$cfrom :: forall x. Artifact -> Rep Artifact x
Prelude.Generic)

-- |
-- Create a value of 'Artifact' 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', 'artifact_arn' - The artifact\'s ARN.
--
-- 'url', 'artifact_url' - The presigned Amazon S3 URL that can be used with a GET request to
-- download the artifact\'s file.
--
-- 'extension', 'artifact_extension' - The artifact\'s file extension.
--
-- 'name', 'artifact_name' - The artifact\'s name.
--
-- 'type'', 'artifact_type' - The artifact\'s type.
--
-- Allowed values include the following:
--
-- -   UNKNOWN
--
-- -   SCREENSHOT
--
-- -   DEVICE_LOG
--
-- -   MESSAGE_LOG
--
-- -   VIDEO_LOG
--
-- -   RESULT_LOG
--
-- -   SERVICE_LOG
--
-- -   WEBKIT_LOG
--
-- -   INSTRUMENTATION_OUTPUT
--
-- -   EXERCISER_MONKEY_OUTPUT: the artifact (log) generated by an Android
--     fuzz test.
--
-- -   CALABASH_JSON_OUTPUT
--
-- -   CALABASH_PRETTY_OUTPUT
--
-- -   CALABASH_STANDARD_OUTPUT
--
-- -   CALABASH_JAVA_XML_OUTPUT
--
-- -   AUTOMATION_OUTPUT
--
-- -   APPIUM_SERVER_OUTPUT
--
-- -   APPIUM_JAVA_OUTPUT
--
-- -   APPIUM_JAVA_XML_OUTPUT
--
-- -   APPIUM_PYTHON_OUTPUT
--
-- -   APPIUM_PYTHON_XML_OUTPUT
--
-- -   EXPLORER_EVENT_LOG
--
-- -   EXPLORER_SUMMARY_LOG
--
-- -   APPLICATION_CRASH_REPORT
--
-- -   XCTEST_LOG
--
-- -   VIDEO
--
-- -   CUSTOMER_ARTIFACT
--
-- -   CUSTOMER_ARTIFACT_LOG
--
-- -   TESTSPEC_OUTPUT
newArtifact ::
  Artifact
newArtifact :: Artifact
newArtifact =
  Artifact' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe ArtifactType
-> Artifact
Artifact'
    { $sel:arn:Artifact' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:url:Artifact' :: Maybe Text
url = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:extension:Artifact' :: Maybe Text
extension = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:Artifact' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':Artifact' :: Maybe ArtifactType
type' = Maybe ArtifactType
forall a. Maybe a
Prelude.Nothing
    }

-- | The artifact\'s ARN.
artifact_arn :: Lens.Lens' Artifact (Prelude.Maybe Prelude.Text)
artifact_arn :: (Maybe Text -> f (Maybe Text)) -> Artifact -> f Artifact
artifact_arn = (Artifact -> Maybe Text)
-> (Artifact -> Maybe Text -> Artifact)
-> Lens Artifact Artifact (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Artifact' {Maybe Text
arn :: Maybe Text
$sel:arn:Artifact' :: Artifact -> Maybe Text
arn} -> Maybe Text
arn) (\s :: Artifact
s@Artifact' {} Maybe Text
a -> Artifact
s {$sel:arn:Artifact' :: Maybe Text
arn = Maybe Text
a} :: Artifact)

-- | The presigned Amazon S3 URL that can be used with a GET request to
-- download the artifact\'s file.
artifact_url :: Lens.Lens' Artifact (Prelude.Maybe Prelude.Text)
artifact_url :: (Maybe Text -> f (Maybe Text)) -> Artifact -> f Artifact
artifact_url = (Artifact -> Maybe Text)
-> (Artifact -> Maybe Text -> Artifact)
-> Lens Artifact Artifact (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Artifact' {Maybe Text
url :: Maybe Text
$sel:url:Artifact' :: Artifact -> Maybe Text
url} -> Maybe Text
url) (\s :: Artifact
s@Artifact' {} Maybe Text
a -> Artifact
s {$sel:url:Artifact' :: Maybe Text
url = Maybe Text
a} :: Artifact)

-- | The artifact\'s file extension.
artifact_extension :: Lens.Lens' Artifact (Prelude.Maybe Prelude.Text)
artifact_extension :: (Maybe Text -> f (Maybe Text)) -> Artifact -> f Artifact
artifact_extension = (Artifact -> Maybe Text)
-> (Artifact -> Maybe Text -> Artifact)
-> Lens Artifact Artifact (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Artifact' {Maybe Text
extension :: Maybe Text
$sel:extension:Artifact' :: Artifact -> Maybe Text
extension} -> Maybe Text
extension) (\s :: Artifact
s@Artifact' {} Maybe Text
a -> Artifact
s {$sel:extension:Artifact' :: Maybe Text
extension = Maybe Text
a} :: Artifact)

-- | The artifact\'s name.
artifact_name :: Lens.Lens' Artifact (Prelude.Maybe Prelude.Text)
artifact_name :: (Maybe Text -> f (Maybe Text)) -> Artifact -> f Artifact
artifact_name = (Artifact -> Maybe Text)
-> (Artifact -> Maybe Text -> Artifact)
-> Lens Artifact Artifact (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Artifact' {Maybe Text
name :: Maybe Text
$sel:name:Artifact' :: Artifact -> Maybe Text
name} -> Maybe Text
name) (\s :: Artifact
s@Artifact' {} Maybe Text
a -> Artifact
s {$sel:name:Artifact' :: Maybe Text
name = Maybe Text
a} :: Artifact)

-- | The artifact\'s type.
--
-- Allowed values include the following:
--
-- -   UNKNOWN
--
-- -   SCREENSHOT
--
-- -   DEVICE_LOG
--
-- -   MESSAGE_LOG
--
-- -   VIDEO_LOG
--
-- -   RESULT_LOG
--
-- -   SERVICE_LOG
--
-- -   WEBKIT_LOG
--
-- -   INSTRUMENTATION_OUTPUT
--
-- -   EXERCISER_MONKEY_OUTPUT: the artifact (log) generated by an Android
--     fuzz test.
--
-- -   CALABASH_JSON_OUTPUT
--
-- -   CALABASH_PRETTY_OUTPUT
--
-- -   CALABASH_STANDARD_OUTPUT
--
-- -   CALABASH_JAVA_XML_OUTPUT
--
-- -   AUTOMATION_OUTPUT
--
-- -   APPIUM_SERVER_OUTPUT
--
-- -   APPIUM_JAVA_OUTPUT
--
-- -   APPIUM_JAVA_XML_OUTPUT
--
-- -   APPIUM_PYTHON_OUTPUT
--
-- -   APPIUM_PYTHON_XML_OUTPUT
--
-- -   EXPLORER_EVENT_LOG
--
-- -   EXPLORER_SUMMARY_LOG
--
-- -   APPLICATION_CRASH_REPORT
--
-- -   XCTEST_LOG
--
-- -   VIDEO
--
-- -   CUSTOMER_ARTIFACT
--
-- -   CUSTOMER_ARTIFACT_LOG
--
-- -   TESTSPEC_OUTPUT
artifact_type :: Lens.Lens' Artifact (Prelude.Maybe ArtifactType)
artifact_type :: (Maybe ArtifactType -> f (Maybe ArtifactType))
-> Artifact -> f Artifact
artifact_type = (Artifact -> Maybe ArtifactType)
-> (Artifact -> Maybe ArtifactType -> Artifact)
-> Lens Artifact Artifact (Maybe ArtifactType) (Maybe ArtifactType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Artifact' {Maybe ArtifactType
type' :: Maybe ArtifactType
$sel:type':Artifact' :: Artifact -> Maybe ArtifactType
type'} -> Maybe ArtifactType
type') (\s :: Artifact
s@Artifact' {} Maybe ArtifactType
a -> Artifact
s {$sel:type':Artifact' :: Maybe ArtifactType
type' = Maybe ArtifactType
a} :: Artifact)

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

instance Prelude.Hashable Artifact

instance Prelude.NFData Artifact