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

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

-- | Represents configuration information about a test run, such as the
-- execution timeout (in minutes).
--
-- /See:/ 'newExecutionConfiguration' smart constructor.
data ExecutionConfiguration = ExecutionConfiguration'
  { -- | When set to @true@, for private devices, Device Farm does not sign your
    -- app again. For public devices, Device Farm always signs your apps again.
    --
    -- For more information about how Device Farm re-signs your apps, see
    -- <https://aws.amazon.com/device-farm/faq/ Do you modify my app?> in the
    -- /AWS Device Farm FAQs/.
    ExecutionConfiguration -> Maybe Bool
skipAppResign :: Prelude.Maybe Prelude.Bool,
    -- | True if account cleanup is enabled at the beginning of the test.
    -- Otherwise, false.
    ExecutionConfiguration -> Maybe Bool
accountsCleanup :: Prelude.Maybe Prelude.Bool,
    -- | True if app package cleanup is enabled at the beginning of the test.
    -- Otherwise, false.
    ExecutionConfiguration -> Maybe Bool
appPackagesCleanup :: Prelude.Maybe Prelude.Bool,
    -- | The number of minutes a test run executes before it times out.
    ExecutionConfiguration -> Maybe Int
jobTimeoutMinutes :: Prelude.Maybe Prelude.Int,
    -- | Set to true to enable video capture. Otherwise, set to false. The
    -- default is true.
    ExecutionConfiguration -> Maybe Bool
videoCapture :: Prelude.Maybe Prelude.Bool
  }
  deriving (ExecutionConfiguration -> ExecutionConfiguration -> Bool
(ExecutionConfiguration -> ExecutionConfiguration -> Bool)
-> (ExecutionConfiguration -> ExecutionConfiguration -> Bool)
-> Eq ExecutionConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExecutionConfiguration -> ExecutionConfiguration -> Bool
$c/= :: ExecutionConfiguration -> ExecutionConfiguration -> Bool
== :: ExecutionConfiguration -> ExecutionConfiguration -> Bool
$c== :: ExecutionConfiguration -> ExecutionConfiguration -> Bool
Prelude.Eq, ReadPrec [ExecutionConfiguration]
ReadPrec ExecutionConfiguration
Int -> ReadS ExecutionConfiguration
ReadS [ExecutionConfiguration]
(Int -> ReadS ExecutionConfiguration)
-> ReadS [ExecutionConfiguration]
-> ReadPrec ExecutionConfiguration
-> ReadPrec [ExecutionConfiguration]
-> Read ExecutionConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExecutionConfiguration]
$creadListPrec :: ReadPrec [ExecutionConfiguration]
readPrec :: ReadPrec ExecutionConfiguration
$creadPrec :: ReadPrec ExecutionConfiguration
readList :: ReadS [ExecutionConfiguration]
$creadList :: ReadS [ExecutionConfiguration]
readsPrec :: Int -> ReadS ExecutionConfiguration
$creadsPrec :: Int -> ReadS ExecutionConfiguration
Prelude.Read, Int -> ExecutionConfiguration -> ShowS
[ExecutionConfiguration] -> ShowS
ExecutionConfiguration -> String
(Int -> ExecutionConfiguration -> ShowS)
-> (ExecutionConfiguration -> String)
-> ([ExecutionConfiguration] -> ShowS)
-> Show ExecutionConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExecutionConfiguration] -> ShowS
$cshowList :: [ExecutionConfiguration] -> ShowS
show :: ExecutionConfiguration -> String
$cshow :: ExecutionConfiguration -> String
showsPrec :: Int -> ExecutionConfiguration -> ShowS
$cshowsPrec :: Int -> ExecutionConfiguration -> ShowS
Prelude.Show, (forall x. ExecutionConfiguration -> Rep ExecutionConfiguration x)
-> (forall x.
    Rep ExecutionConfiguration x -> ExecutionConfiguration)
-> Generic ExecutionConfiguration
forall x. Rep ExecutionConfiguration x -> ExecutionConfiguration
forall x. ExecutionConfiguration -> Rep ExecutionConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExecutionConfiguration x -> ExecutionConfiguration
$cfrom :: forall x. ExecutionConfiguration -> Rep ExecutionConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'ExecutionConfiguration' 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:
--
-- 'skipAppResign', 'executionConfiguration_skipAppResign' - When set to @true@, for private devices, Device Farm does not sign your
-- app again. For public devices, Device Farm always signs your apps again.
--
-- For more information about how Device Farm re-signs your apps, see
-- <https://aws.amazon.com/device-farm/faq/ Do you modify my app?> in the
-- /AWS Device Farm FAQs/.
--
-- 'accountsCleanup', 'executionConfiguration_accountsCleanup' - True if account cleanup is enabled at the beginning of the test.
-- Otherwise, false.
--
-- 'appPackagesCleanup', 'executionConfiguration_appPackagesCleanup' - True if app package cleanup is enabled at the beginning of the test.
-- Otherwise, false.
--
-- 'jobTimeoutMinutes', 'executionConfiguration_jobTimeoutMinutes' - The number of minutes a test run executes before it times out.
--
-- 'videoCapture', 'executionConfiguration_videoCapture' - Set to true to enable video capture. Otherwise, set to false. The
-- default is true.
newExecutionConfiguration ::
  ExecutionConfiguration
newExecutionConfiguration :: ExecutionConfiguration
newExecutionConfiguration =
  ExecutionConfiguration' :: Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Int
-> Maybe Bool
-> ExecutionConfiguration
ExecutionConfiguration'
    { $sel:skipAppResign:ExecutionConfiguration' :: Maybe Bool
skipAppResign =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:accountsCleanup:ExecutionConfiguration' :: Maybe Bool
accountsCleanup = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:appPackagesCleanup:ExecutionConfiguration' :: Maybe Bool
appPackagesCleanup = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:jobTimeoutMinutes:ExecutionConfiguration' :: Maybe Int
jobTimeoutMinutes = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:videoCapture:ExecutionConfiguration' :: Maybe Bool
videoCapture = Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | When set to @true@, for private devices, Device Farm does not sign your
-- app again. For public devices, Device Farm always signs your apps again.
--
-- For more information about how Device Farm re-signs your apps, see
-- <https://aws.amazon.com/device-farm/faq/ Do you modify my app?> in the
-- /AWS Device Farm FAQs/.
executionConfiguration_skipAppResign :: Lens.Lens' ExecutionConfiguration (Prelude.Maybe Prelude.Bool)
executionConfiguration_skipAppResign :: (Maybe Bool -> f (Maybe Bool))
-> ExecutionConfiguration -> f ExecutionConfiguration
executionConfiguration_skipAppResign = (ExecutionConfiguration -> Maybe Bool)
-> (ExecutionConfiguration -> Maybe Bool -> ExecutionConfiguration)
-> Lens
     ExecutionConfiguration
     ExecutionConfiguration
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutionConfiguration' {Maybe Bool
skipAppResign :: Maybe Bool
$sel:skipAppResign:ExecutionConfiguration' :: ExecutionConfiguration -> Maybe Bool
skipAppResign} -> Maybe Bool
skipAppResign) (\s :: ExecutionConfiguration
s@ExecutionConfiguration' {} Maybe Bool
a -> ExecutionConfiguration
s {$sel:skipAppResign:ExecutionConfiguration' :: Maybe Bool
skipAppResign = Maybe Bool
a} :: ExecutionConfiguration)

-- | True if account cleanup is enabled at the beginning of the test.
-- Otherwise, false.
executionConfiguration_accountsCleanup :: Lens.Lens' ExecutionConfiguration (Prelude.Maybe Prelude.Bool)
executionConfiguration_accountsCleanup :: (Maybe Bool -> f (Maybe Bool))
-> ExecutionConfiguration -> f ExecutionConfiguration
executionConfiguration_accountsCleanup = (ExecutionConfiguration -> Maybe Bool)
-> (ExecutionConfiguration -> Maybe Bool -> ExecutionConfiguration)
-> Lens
     ExecutionConfiguration
     ExecutionConfiguration
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutionConfiguration' {Maybe Bool
accountsCleanup :: Maybe Bool
$sel:accountsCleanup:ExecutionConfiguration' :: ExecutionConfiguration -> Maybe Bool
accountsCleanup} -> Maybe Bool
accountsCleanup) (\s :: ExecutionConfiguration
s@ExecutionConfiguration' {} Maybe Bool
a -> ExecutionConfiguration
s {$sel:accountsCleanup:ExecutionConfiguration' :: Maybe Bool
accountsCleanup = Maybe Bool
a} :: ExecutionConfiguration)

-- | True if app package cleanup is enabled at the beginning of the test.
-- Otherwise, false.
executionConfiguration_appPackagesCleanup :: Lens.Lens' ExecutionConfiguration (Prelude.Maybe Prelude.Bool)
executionConfiguration_appPackagesCleanup :: (Maybe Bool -> f (Maybe Bool))
-> ExecutionConfiguration -> f ExecutionConfiguration
executionConfiguration_appPackagesCleanup = (ExecutionConfiguration -> Maybe Bool)
-> (ExecutionConfiguration -> Maybe Bool -> ExecutionConfiguration)
-> Lens
     ExecutionConfiguration
     ExecutionConfiguration
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutionConfiguration' {Maybe Bool
appPackagesCleanup :: Maybe Bool
$sel:appPackagesCleanup:ExecutionConfiguration' :: ExecutionConfiguration -> Maybe Bool
appPackagesCleanup} -> Maybe Bool
appPackagesCleanup) (\s :: ExecutionConfiguration
s@ExecutionConfiguration' {} Maybe Bool
a -> ExecutionConfiguration
s {$sel:appPackagesCleanup:ExecutionConfiguration' :: Maybe Bool
appPackagesCleanup = Maybe Bool
a} :: ExecutionConfiguration)

-- | The number of minutes a test run executes before it times out.
executionConfiguration_jobTimeoutMinutes :: Lens.Lens' ExecutionConfiguration (Prelude.Maybe Prelude.Int)
executionConfiguration_jobTimeoutMinutes :: (Maybe Int -> f (Maybe Int))
-> ExecutionConfiguration -> f ExecutionConfiguration
executionConfiguration_jobTimeoutMinutes = (ExecutionConfiguration -> Maybe Int)
-> (ExecutionConfiguration -> Maybe Int -> ExecutionConfiguration)
-> Lens
     ExecutionConfiguration
     ExecutionConfiguration
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutionConfiguration' {Maybe Int
jobTimeoutMinutes :: Maybe Int
$sel:jobTimeoutMinutes:ExecutionConfiguration' :: ExecutionConfiguration -> Maybe Int
jobTimeoutMinutes} -> Maybe Int
jobTimeoutMinutes) (\s :: ExecutionConfiguration
s@ExecutionConfiguration' {} Maybe Int
a -> ExecutionConfiguration
s {$sel:jobTimeoutMinutes:ExecutionConfiguration' :: Maybe Int
jobTimeoutMinutes = Maybe Int
a} :: ExecutionConfiguration)

-- | Set to true to enable video capture. Otherwise, set to false. The
-- default is true.
executionConfiguration_videoCapture :: Lens.Lens' ExecutionConfiguration (Prelude.Maybe Prelude.Bool)
executionConfiguration_videoCapture :: (Maybe Bool -> f (Maybe Bool))
-> ExecutionConfiguration -> f ExecutionConfiguration
executionConfiguration_videoCapture = (ExecutionConfiguration -> Maybe Bool)
-> (ExecutionConfiguration -> Maybe Bool -> ExecutionConfiguration)
-> Lens
     ExecutionConfiguration
     ExecutionConfiguration
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutionConfiguration' {Maybe Bool
videoCapture :: Maybe Bool
$sel:videoCapture:ExecutionConfiguration' :: ExecutionConfiguration -> Maybe Bool
videoCapture} -> Maybe Bool
videoCapture) (\s :: ExecutionConfiguration
s@ExecutionConfiguration' {} Maybe Bool
a -> ExecutionConfiguration
s {$sel:videoCapture:ExecutionConfiguration' :: Maybe Bool
videoCapture = Maybe Bool
a} :: ExecutionConfiguration)

instance Prelude.Hashable ExecutionConfiguration

instance Prelude.NFData ExecutionConfiguration

instance Core.ToJSON ExecutionConfiguration where
  toJSON :: ExecutionConfiguration -> Value
toJSON ExecutionConfiguration' {Maybe Bool
Maybe Int
videoCapture :: Maybe Bool
jobTimeoutMinutes :: Maybe Int
appPackagesCleanup :: Maybe Bool
accountsCleanup :: Maybe Bool
skipAppResign :: Maybe Bool
$sel:videoCapture:ExecutionConfiguration' :: ExecutionConfiguration -> Maybe Bool
$sel:jobTimeoutMinutes:ExecutionConfiguration' :: ExecutionConfiguration -> Maybe Int
$sel:appPackagesCleanup:ExecutionConfiguration' :: ExecutionConfiguration -> Maybe Bool
$sel:accountsCleanup:ExecutionConfiguration' :: ExecutionConfiguration -> Maybe Bool
$sel:skipAppResign:ExecutionConfiguration' :: ExecutionConfiguration -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"skipAppResign" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
skipAppResign,
            (Text
"accountsCleanup" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
accountsCleanup,
            (Text
"appPackagesCleanup" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
appPackagesCleanup,
            (Text
"jobTimeoutMinutes" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
jobTimeoutMinutes,
            (Text
"videoCapture" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
videoCapture
          ]
      )