{-# 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.IoTDeviceAdvisor.Types.SuiteRunConfiguration
-- 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.IoTDeviceAdvisor.Types.SuiteRunConfiguration where

import qualified Amazonka.Core as Core
import Amazonka.IoTDeviceAdvisor.Types.DeviceUnderTest
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Gets suite run configuration.
--
-- /See:/ 'newSuiteRunConfiguration' smart constructor.
data SuiteRunConfiguration = SuiteRunConfiguration'
  { -- | Gets the primary device for suite run.
    SuiteRunConfiguration -> Maybe DeviceUnderTest
primaryDevice :: Prelude.Maybe DeviceUnderTest,
    -- | Gets test case list.
    SuiteRunConfiguration -> Maybe [Text]
selectedTestList :: Prelude.Maybe [Prelude.Text]
  }
  deriving (SuiteRunConfiguration -> SuiteRunConfiguration -> Bool
(SuiteRunConfiguration -> SuiteRunConfiguration -> Bool)
-> (SuiteRunConfiguration -> SuiteRunConfiguration -> Bool)
-> Eq SuiteRunConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SuiteRunConfiguration -> SuiteRunConfiguration -> Bool
$c/= :: SuiteRunConfiguration -> SuiteRunConfiguration -> Bool
== :: SuiteRunConfiguration -> SuiteRunConfiguration -> Bool
$c== :: SuiteRunConfiguration -> SuiteRunConfiguration -> Bool
Prelude.Eq, ReadPrec [SuiteRunConfiguration]
ReadPrec SuiteRunConfiguration
Int -> ReadS SuiteRunConfiguration
ReadS [SuiteRunConfiguration]
(Int -> ReadS SuiteRunConfiguration)
-> ReadS [SuiteRunConfiguration]
-> ReadPrec SuiteRunConfiguration
-> ReadPrec [SuiteRunConfiguration]
-> Read SuiteRunConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SuiteRunConfiguration]
$creadListPrec :: ReadPrec [SuiteRunConfiguration]
readPrec :: ReadPrec SuiteRunConfiguration
$creadPrec :: ReadPrec SuiteRunConfiguration
readList :: ReadS [SuiteRunConfiguration]
$creadList :: ReadS [SuiteRunConfiguration]
readsPrec :: Int -> ReadS SuiteRunConfiguration
$creadsPrec :: Int -> ReadS SuiteRunConfiguration
Prelude.Read, Int -> SuiteRunConfiguration -> ShowS
[SuiteRunConfiguration] -> ShowS
SuiteRunConfiguration -> String
(Int -> SuiteRunConfiguration -> ShowS)
-> (SuiteRunConfiguration -> String)
-> ([SuiteRunConfiguration] -> ShowS)
-> Show SuiteRunConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SuiteRunConfiguration] -> ShowS
$cshowList :: [SuiteRunConfiguration] -> ShowS
show :: SuiteRunConfiguration -> String
$cshow :: SuiteRunConfiguration -> String
showsPrec :: Int -> SuiteRunConfiguration -> ShowS
$cshowsPrec :: Int -> SuiteRunConfiguration -> ShowS
Prelude.Show, (forall x. SuiteRunConfiguration -> Rep SuiteRunConfiguration x)
-> (forall x. Rep SuiteRunConfiguration x -> SuiteRunConfiguration)
-> Generic SuiteRunConfiguration
forall x. Rep SuiteRunConfiguration x -> SuiteRunConfiguration
forall x. SuiteRunConfiguration -> Rep SuiteRunConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SuiteRunConfiguration x -> SuiteRunConfiguration
$cfrom :: forall x. SuiteRunConfiguration -> Rep SuiteRunConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'SuiteRunConfiguration' 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:
--
-- 'primaryDevice', 'suiteRunConfiguration_primaryDevice' - Gets the primary device for suite run.
--
-- 'selectedTestList', 'suiteRunConfiguration_selectedTestList' - Gets test case list.
newSuiteRunConfiguration ::
  SuiteRunConfiguration
newSuiteRunConfiguration :: SuiteRunConfiguration
newSuiteRunConfiguration =
  SuiteRunConfiguration' :: Maybe DeviceUnderTest -> Maybe [Text] -> SuiteRunConfiguration
SuiteRunConfiguration'
    { $sel:primaryDevice:SuiteRunConfiguration' :: Maybe DeviceUnderTest
primaryDevice =
        Maybe DeviceUnderTest
forall a. Maybe a
Prelude.Nothing,
      $sel:selectedTestList:SuiteRunConfiguration' :: Maybe [Text]
selectedTestList = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

-- | Gets the primary device for suite run.
suiteRunConfiguration_primaryDevice :: Lens.Lens' SuiteRunConfiguration (Prelude.Maybe DeviceUnderTest)
suiteRunConfiguration_primaryDevice :: (Maybe DeviceUnderTest -> f (Maybe DeviceUnderTest))
-> SuiteRunConfiguration -> f SuiteRunConfiguration
suiteRunConfiguration_primaryDevice = (SuiteRunConfiguration -> Maybe DeviceUnderTest)
-> (SuiteRunConfiguration
    -> Maybe DeviceUnderTest -> SuiteRunConfiguration)
-> Lens
     SuiteRunConfiguration
     SuiteRunConfiguration
     (Maybe DeviceUnderTest)
     (Maybe DeviceUnderTest)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SuiteRunConfiguration' {Maybe DeviceUnderTest
primaryDevice :: Maybe DeviceUnderTest
$sel:primaryDevice:SuiteRunConfiguration' :: SuiteRunConfiguration -> Maybe DeviceUnderTest
primaryDevice} -> Maybe DeviceUnderTest
primaryDevice) (\s :: SuiteRunConfiguration
s@SuiteRunConfiguration' {} Maybe DeviceUnderTest
a -> SuiteRunConfiguration
s {$sel:primaryDevice:SuiteRunConfiguration' :: Maybe DeviceUnderTest
primaryDevice = Maybe DeviceUnderTest
a} :: SuiteRunConfiguration)

-- | Gets test case list.
suiteRunConfiguration_selectedTestList :: Lens.Lens' SuiteRunConfiguration (Prelude.Maybe [Prelude.Text])
suiteRunConfiguration_selectedTestList :: (Maybe [Text] -> f (Maybe [Text]))
-> SuiteRunConfiguration -> f SuiteRunConfiguration
suiteRunConfiguration_selectedTestList = (SuiteRunConfiguration -> Maybe [Text])
-> (SuiteRunConfiguration -> Maybe [Text] -> SuiteRunConfiguration)
-> Lens
     SuiteRunConfiguration
     SuiteRunConfiguration
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SuiteRunConfiguration' {Maybe [Text]
selectedTestList :: Maybe [Text]
$sel:selectedTestList:SuiteRunConfiguration' :: SuiteRunConfiguration -> Maybe [Text]
selectedTestList} -> Maybe [Text]
selectedTestList) (\s :: SuiteRunConfiguration
s@SuiteRunConfiguration' {} Maybe [Text]
a -> SuiteRunConfiguration
s {$sel:selectedTestList:SuiteRunConfiguration' :: Maybe [Text]
selectedTestList = Maybe [Text]
a} :: SuiteRunConfiguration) ((Maybe [Text] -> f (Maybe [Text]))
 -> SuiteRunConfiguration -> f SuiteRunConfiguration)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> SuiteRunConfiguration
-> f SuiteRunConfiguration
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 SuiteRunConfiguration where
  parseJSON :: Value -> Parser SuiteRunConfiguration
parseJSON =
    String
-> (Object -> Parser SuiteRunConfiguration)
-> Value
-> Parser SuiteRunConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SuiteRunConfiguration"
      ( \Object
x ->
          Maybe DeviceUnderTest -> Maybe [Text] -> SuiteRunConfiguration
SuiteRunConfiguration'
            (Maybe DeviceUnderTest -> Maybe [Text] -> SuiteRunConfiguration)
-> Parser (Maybe DeviceUnderTest)
-> Parser (Maybe [Text] -> SuiteRunConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe DeviceUnderTest)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"primaryDevice")
            Parser (Maybe [Text] -> SuiteRunConfiguration)
-> Parser (Maybe [Text]) -> Parser SuiteRunConfiguration
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
"selectedTestList"
                            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 SuiteRunConfiguration

instance Prelude.NFData SuiteRunConfiguration

instance Core.ToJSON SuiteRunConfiguration where
  toJSON :: SuiteRunConfiguration -> Value
toJSON SuiteRunConfiguration' {Maybe [Text]
Maybe DeviceUnderTest
selectedTestList :: Maybe [Text]
primaryDevice :: Maybe DeviceUnderTest
$sel:selectedTestList:SuiteRunConfiguration' :: SuiteRunConfiguration -> Maybe [Text]
$sel:primaryDevice:SuiteRunConfiguration' :: SuiteRunConfiguration -> Maybe DeviceUnderTest
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"primaryDevice" Text -> DeviceUnderTest -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (DeviceUnderTest -> Pair) -> Maybe DeviceUnderTest -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DeviceUnderTest
primaryDevice,
            (Text
"selectedTestList" 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]
selectedTestList
          ]
      )