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

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

-- | A JSON object that specifies the paths where the artifacts generated by
-- the customer\'s tests, on the device or in the test environment, are
-- pulled from.
--
-- Specify @deviceHostPaths@ and optionally specify either @iosPaths@ or
-- @androidPaths@.
--
-- For web app tests, you can specify both @iosPaths@ and @androidPaths@.
--
-- /See:/ 'newCustomerArtifactPaths' smart constructor.
data CustomerArtifactPaths = CustomerArtifactPaths'
  { -- | Comma-separated list of paths on the Android device where the artifacts
    -- generated by the customer\'s tests are pulled from.
    CustomerArtifactPaths -> Maybe [Text]
androidPaths :: Prelude.Maybe [Prelude.Text],
    -- | Comma-separated list of paths in the test execution environment where
    -- the artifacts generated by the customer\'s tests are pulled from.
    CustomerArtifactPaths -> Maybe [Text]
deviceHostPaths :: Prelude.Maybe [Prelude.Text],
    -- | Comma-separated list of paths on the iOS device where the artifacts
    -- generated by the customer\'s tests are pulled from.
    CustomerArtifactPaths -> Maybe [Text]
iosPaths :: Prelude.Maybe [Prelude.Text]
  }
  deriving (CustomerArtifactPaths -> CustomerArtifactPaths -> Bool
(CustomerArtifactPaths -> CustomerArtifactPaths -> Bool)
-> (CustomerArtifactPaths -> CustomerArtifactPaths -> Bool)
-> Eq CustomerArtifactPaths
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CustomerArtifactPaths -> CustomerArtifactPaths -> Bool
$c/= :: CustomerArtifactPaths -> CustomerArtifactPaths -> Bool
== :: CustomerArtifactPaths -> CustomerArtifactPaths -> Bool
$c== :: CustomerArtifactPaths -> CustomerArtifactPaths -> Bool
Prelude.Eq, ReadPrec [CustomerArtifactPaths]
ReadPrec CustomerArtifactPaths
Int -> ReadS CustomerArtifactPaths
ReadS [CustomerArtifactPaths]
(Int -> ReadS CustomerArtifactPaths)
-> ReadS [CustomerArtifactPaths]
-> ReadPrec CustomerArtifactPaths
-> ReadPrec [CustomerArtifactPaths]
-> Read CustomerArtifactPaths
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CustomerArtifactPaths]
$creadListPrec :: ReadPrec [CustomerArtifactPaths]
readPrec :: ReadPrec CustomerArtifactPaths
$creadPrec :: ReadPrec CustomerArtifactPaths
readList :: ReadS [CustomerArtifactPaths]
$creadList :: ReadS [CustomerArtifactPaths]
readsPrec :: Int -> ReadS CustomerArtifactPaths
$creadsPrec :: Int -> ReadS CustomerArtifactPaths
Prelude.Read, Int -> CustomerArtifactPaths -> ShowS
[CustomerArtifactPaths] -> ShowS
CustomerArtifactPaths -> String
(Int -> CustomerArtifactPaths -> ShowS)
-> (CustomerArtifactPaths -> String)
-> ([CustomerArtifactPaths] -> ShowS)
-> Show CustomerArtifactPaths
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CustomerArtifactPaths] -> ShowS
$cshowList :: [CustomerArtifactPaths] -> ShowS
show :: CustomerArtifactPaths -> String
$cshow :: CustomerArtifactPaths -> String
showsPrec :: Int -> CustomerArtifactPaths -> ShowS
$cshowsPrec :: Int -> CustomerArtifactPaths -> ShowS
Prelude.Show, (forall x. CustomerArtifactPaths -> Rep CustomerArtifactPaths x)
-> (forall x. Rep CustomerArtifactPaths x -> CustomerArtifactPaths)
-> Generic CustomerArtifactPaths
forall x. Rep CustomerArtifactPaths x -> CustomerArtifactPaths
forall x. CustomerArtifactPaths -> Rep CustomerArtifactPaths x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CustomerArtifactPaths x -> CustomerArtifactPaths
$cfrom :: forall x. CustomerArtifactPaths -> Rep CustomerArtifactPaths x
Prelude.Generic)

-- |
-- Create a value of 'CustomerArtifactPaths' 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:
--
-- 'androidPaths', 'customerArtifactPaths_androidPaths' - Comma-separated list of paths on the Android device where the artifacts
-- generated by the customer\'s tests are pulled from.
--
-- 'deviceHostPaths', 'customerArtifactPaths_deviceHostPaths' - Comma-separated list of paths in the test execution environment where
-- the artifacts generated by the customer\'s tests are pulled from.
--
-- 'iosPaths', 'customerArtifactPaths_iosPaths' - Comma-separated list of paths on the iOS device where the artifacts
-- generated by the customer\'s tests are pulled from.
newCustomerArtifactPaths ::
  CustomerArtifactPaths
newCustomerArtifactPaths :: CustomerArtifactPaths
newCustomerArtifactPaths =
  CustomerArtifactPaths' :: Maybe [Text]
-> Maybe [Text] -> Maybe [Text] -> CustomerArtifactPaths
CustomerArtifactPaths'
    { $sel:androidPaths:CustomerArtifactPaths' :: Maybe [Text]
androidPaths =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:deviceHostPaths:CustomerArtifactPaths' :: Maybe [Text]
deviceHostPaths = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:iosPaths:CustomerArtifactPaths' :: Maybe [Text]
iosPaths = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

-- | Comma-separated list of paths on the Android device where the artifacts
-- generated by the customer\'s tests are pulled from.
customerArtifactPaths_androidPaths :: Lens.Lens' CustomerArtifactPaths (Prelude.Maybe [Prelude.Text])
customerArtifactPaths_androidPaths :: (Maybe [Text] -> f (Maybe [Text]))
-> CustomerArtifactPaths -> f CustomerArtifactPaths
customerArtifactPaths_androidPaths = (CustomerArtifactPaths -> Maybe [Text])
-> (CustomerArtifactPaths -> Maybe [Text] -> CustomerArtifactPaths)
-> Lens
     CustomerArtifactPaths
     CustomerArtifactPaths
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomerArtifactPaths' {Maybe [Text]
androidPaths :: Maybe [Text]
$sel:androidPaths:CustomerArtifactPaths' :: CustomerArtifactPaths -> Maybe [Text]
androidPaths} -> Maybe [Text]
androidPaths) (\s :: CustomerArtifactPaths
s@CustomerArtifactPaths' {} Maybe [Text]
a -> CustomerArtifactPaths
s {$sel:androidPaths:CustomerArtifactPaths' :: Maybe [Text]
androidPaths = Maybe [Text]
a} :: CustomerArtifactPaths) ((Maybe [Text] -> f (Maybe [Text]))
 -> CustomerArtifactPaths -> f CustomerArtifactPaths)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> CustomerArtifactPaths
-> f CustomerArtifactPaths
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Comma-separated list of paths in the test execution environment where
-- the artifacts generated by the customer\'s tests are pulled from.
customerArtifactPaths_deviceHostPaths :: Lens.Lens' CustomerArtifactPaths (Prelude.Maybe [Prelude.Text])
customerArtifactPaths_deviceHostPaths :: (Maybe [Text] -> f (Maybe [Text]))
-> CustomerArtifactPaths -> f CustomerArtifactPaths
customerArtifactPaths_deviceHostPaths = (CustomerArtifactPaths -> Maybe [Text])
-> (CustomerArtifactPaths -> Maybe [Text] -> CustomerArtifactPaths)
-> Lens
     CustomerArtifactPaths
     CustomerArtifactPaths
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomerArtifactPaths' {Maybe [Text]
deviceHostPaths :: Maybe [Text]
$sel:deviceHostPaths:CustomerArtifactPaths' :: CustomerArtifactPaths -> Maybe [Text]
deviceHostPaths} -> Maybe [Text]
deviceHostPaths) (\s :: CustomerArtifactPaths
s@CustomerArtifactPaths' {} Maybe [Text]
a -> CustomerArtifactPaths
s {$sel:deviceHostPaths:CustomerArtifactPaths' :: Maybe [Text]
deviceHostPaths = Maybe [Text]
a} :: CustomerArtifactPaths) ((Maybe [Text] -> f (Maybe [Text]))
 -> CustomerArtifactPaths -> f CustomerArtifactPaths)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> CustomerArtifactPaths
-> f CustomerArtifactPaths
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Comma-separated list of paths on the iOS device where the artifacts
-- generated by the customer\'s tests are pulled from.
customerArtifactPaths_iosPaths :: Lens.Lens' CustomerArtifactPaths (Prelude.Maybe [Prelude.Text])
customerArtifactPaths_iosPaths :: (Maybe [Text] -> f (Maybe [Text]))
-> CustomerArtifactPaths -> f CustomerArtifactPaths
customerArtifactPaths_iosPaths = (CustomerArtifactPaths -> Maybe [Text])
-> (CustomerArtifactPaths -> Maybe [Text] -> CustomerArtifactPaths)
-> Lens
     CustomerArtifactPaths
     CustomerArtifactPaths
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomerArtifactPaths' {Maybe [Text]
iosPaths :: Maybe [Text]
$sel:iosPaths:CustomerArtifactPaths' :: CustomerArtifactPaths -> Maybe [Text]
iosPaths} -> Maybe [Text]
iosPaths) (\s :: CustomerArtifactPaths
s@CustomerArtifactPaths' {} Maybe [Text]
a -> CustomerArtifactPaths
s {$sel:iosPaths:CustomerArtifactPaths' :: Maybe [Text]
iosPaths = Maybe [Text]
a} :: CustomerArtifactPaths) ((Maybe [Text] -> f (Maybe [Text]))
 -> CustomerArtifactPaths -> f CustomerArtifactPaths)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> CustomerArtifactPaths
-> f CustomerArtifactPaths
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON CustomerArtifactPaths where
  parseJSON :: Value -> Parser CustomerArtifactPaths
parseJSON =
    String
-> (Object -> Parser CustomerArtifactPaths)
-> Value
-> Parser CustomerArtifactPaths
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CustomerArtifactPaths"
      ( \Object
x ->
          Maybe [Text]
-> Maybe [Text] -> Maybe [Text] -> CustomerArtifactPaths
CustomerArtifactPaths'
            (Maybe [Text]
 -> Maybe [Text] -> Maybe [Text] -> CustomerArtifactPaths)
-> Parser (Maybe [Text])
-> Parser (Maybe [Text] -> Maybe [Text] -> CustomerArtifactPaths)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"androidPaths" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe [Text] -> Maybe [Text] -> CustomerArtifactPaths)
-> Parser (Maybe [Text])
-> Parser (Maybe [Text] -> CustomerArtifactPaths)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"deviceHostPaths"
                            Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Maybe [Text] -> CustomerArtifactPaths)
-> Parser (Maybe [Text]) -> Parser CustomerArtifactPaths
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"iosPaths" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable CustomerArtifactPaths

instance Prelude.NFData CustomerArtifactPaths

instance Core.ToJSON CustomerArtifactPaths where
  toJSON :: CustomerArtifactPaths -> Value
toJSON CustomerArtifactPaths' {Maybe [Text]
iosPaths :: Maybe [Text]
deviceHostPaths :: Maybe [Text]
androidPaths :: Maybe [Text]
$sel:iosPaths:CustomerArtifactPaths' :: CustomerArtifactPaths -> Maybe [Text]
$sel:deviceHostPaths:CustomerArtifactPaths' :: CustomerArtifactPaths -> Maybe [Text]
$sel:androidPaths:CustomerArtifactPaths' :: CustomerArtifactPaths -> Maybe [Text]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"androidPaths" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
androidPaths,
            (Text
"deviceHostPaths" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
deviceHostPaths,
            (Text
"iosPaths" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
iosPaths
          ]
      )