{-# 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.SuiteDefinitionConfiguration
-- 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.SuiteDefinitionConfiguration 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 Definition Configuration.
--
-- /See:/ 'newSuiteDefinitionConfiguration' smart constructor.
data SuiteDefinitionConfiguration = SuiteDefinitionConfiguration'
  { -- | Gets Suite Definition Configuration name.
    SuiteDefinitionConfiguration -> Maybe Text
suiteDefinitionName :: Prelude.Maybe Prelude.Text,
    -- | Gets the tests intended for qualification in a suite.
    SuiteDefinitionConfiguration -> Maybe Bool
intendedForQualification :: Prelude.Maybe Prelude.Bool,
    -- | Gets device permission arn.
    SuiteDefinitionConfiguration -> Maybe Text
devicePermissionRoleArn :: Prelude.Maybe Prelude.Text,
    -- | Gets the devices configured.
    SuiteDefinitionConfiguration -> Maybe [DeviceUnderTest]
devices :: Prelude.Maybe [DeviceUnderTest],
    -- | Gets test suite root group.
    SuiteDefinitionConfiguration -> Maybe Text
rootGroup :: Prelude.Maybe Prelude.Text
  }
  deriving (SuiteDefinitionConfiguration
-> SuiteDefinitionConfiguration -> Bool
(SuiteDefinitionConfiguration
 -> SuiteDefinitionConfiguration -> Bool)
-> (SuiteDefinitionConfiguration
    -> SuiteDefinitionConfiguration -> Bool)
-> Eq SuiteDefinitionConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SuiteDefinitionConfiguration
-> SuiteDefinitionConfiguration -> Bool
$c/= :: SuiteDefinitionConfiguration
-> SuiteDefinitionConfiguration -> Bool
== :: SuiteDefinitionConfiguration
-> SuiteDefinitionConfiguration -> Bool
$c== :: SuiteDefinitionConfiguration
-> SuiteDefinitionConfiguration -> Bool
Prelude.Eq, ReadPrec [SuiteDefinitionConfiguration]
ReadPrec SuiteDefinitionConfiguration
Int -> ReadS SuiteDefinitionConfiguration
ReadS [SuiteDefinitionConfiguration]
(Int -> ReadS SuiteDefinitionConfiguration)
-> ReadS [SuiteDefinitionConfiguration]
-> ReadPrec SuiteDefinitionConfiguration
-> ReadPrec [SuiteDefinitionConfiguration]
-> Read SuiteDefinitionConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SuiteDefinitionConfiguration]
$creadListPrec :: ReadPrec [SuiteDefinitionConfiguration]
readPrec :: ReadPrec SuiteDefinitionConfiguration
$creadPrec :: ReadPrec SuiteDefinitionConfiguration
readList :: ReadS [SuiteDefinitionConfiguration]
$creadList :: ReadS [SuiteDefinitionConfiguration]
readsPrec :: Int -> ReadS SuiteDefinitionConfiguration
$creadsPrec :: Int -> ReadS SuiteDefinitionConfiguration
Prelude.Read, Int -> SuiteDefinitionConfiguration -> ShowS
[SuiteDefinitionConfiguration] -> ShowS
SuiteDefinitionConfiguration -> String
(Int -> SuiteDefinitionConfiguration -> ShowS)
-> (SuiteDefinitionConfiguration -> String)
-> ([SuiteDefinitionConfiguration] -> ShowS)
-> Show SuiteDefinitionConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SuiteDefinitionConfiguration] -> ShowS
$cshowList :: [SuiteDefinitionConfiguration] -> ShowS
show :: SuiteDefinitionConfiguration -> String
$cshow :: SuiteDefinitionConfiguration -> String
showsPrec :: Int -> SuiteDefinitionConfiguration -> ShowS
$cshowsPrec :: Int -> SuiteDefinitionConfiguration -> ShowS
Prelude.Show, (forall x.
 SuiteDefinitionConfiguration -> Rep SuiteDefinitionConfiguration x)
-> (forall x.
    Rep SuiteDefinitionConfiguration x -> SuiteDefinitionConfiguration)
-> Generic SuiteDefinitionConfiguration
forall x.
Rep SuiteDefinitionConfiguration x -> SuiteDefinitionConfiguration
forall x.
SuiteDefinitionConfiguration -> Rep SuiteDefinitionConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SuiteDefinitionConfiguration x -> SuiteDefinitionConfiguration
$cfrom :: forall x.
SuiteDefinitionConfiguration -> Rep SuiteDefinitionConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'SuiteDefinitionConfiguration' 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:
--
-- 'suiteDefinitionName', 'suiteDefinitionConfiguration_suiteDefinitionName' - Gets Suite Definition Configuration name.
--
-- 'intendedForQualification', 'suiteDefinitionConfiguration_intendedForQualification' - Gets the tests intended for qualification in a suite.
--
-- 'devicePermissionRoleArn', 'suiteDefinitionConfiguration_devicePermissionRoleArn' - Gets device permission arn.
--
-- 'devices', 'suiteDefinitionConfiguration_devices' - Gets the devices configured.
--
-- 'rootGroup', 'suiteDefinitionConfiguration_rootGroup' - Gets test suite root group.
newSuiteDefinitionConfiguration ::
  SuiteDefinitionConfiguration
newSuiteDefinitionConfiguration :: SuiteDefinitionConfiguration
newSuiteDefinitionConfiguration =
  SuiteDefinitionConfiguration' :: Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe [DeviceUnderTest]
-> Maybe Text
-> SuiteDefinitionConfiguration
SuiteDefinitionConfiguration'
    { $sel:suiteDefinitionName:SuiteDefinitionConfiguration' :: Maybe Text
suiteDefinitionName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:intendedForQualification:SuiteDefinitionConfiguration' :: Maybe Bool
intendedForQualification = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:devicePermissionRoleArn:SuiteDefinitionConfiguration' :: Maybe Text
devicePermissionRoleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:devices:SuiteDefinitionConfiguration' :: Maybe [DeviceUnderTest]
devices = Maybe [DeviceUnderTest]
forall a. Maybe a
Prelude.Nothing,
      $sel:rootGroup:SuiteDefinitionConfiguration' :: Maybe Text
rootGroup = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Gets Suite Definition Configuration name.
suiteDefinitionConfiguration_suiteDefinitionName :: Lens.Lens' SuiteDefinitionConfiguration (Prelude.Maybe Prelude.Text)
suiteDefinitionConfiguration_suiteDefinitionName :: (Maybe Text -> f (Maybe Text))
-> SuiteDefinitionConfiguration -> f SuiteDefinitionConfiguration
suiteDefinitionConfiguration_suiteDefinitionName = (SuiteDefinitionConfiguration -> Maybe Text)
-> (SuiteDefinitionConfiguration
    -> Maybe Text -> SuiteDefinitionConfiguration)
-> Lens
     SuiteDefinitionConfiguration
     SuiteDefinitionConfiguration
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SuiteDefinitionConfiguration' {Maybe Text
suiteDefinitionName :: Maybe Text
$sel:suiteDefinitionName:SuiteDefinitionConfiguration' :: SuiteDefinitionConfiguration -> Maybe Text
suiteDefinitionName} -> Maybe Text
suiteDefinitionName) (\s :: SuiteDefinitionConfiguration
s@SuiteDefinitionConfiguration' {} Maybe Text
a -> SuiteDefinitionConfiguration
s {$sel:suiteDefinitionName:SuiteDefinitionConfiguration' :: Maybe Text
suiteDefinitionName = Maybe Text
a} :: SuiteDefinitionConfiguration)

-- | Gets the tests intended for qualification in a suite.
suiteDefinitionConfiguration_intendedForQualification :: Lens.Lens' SuiteDefinitionConfiguration (Prelude.Maybe Prelude.Bool)
suiteDefinitionConfiguration_intendedForQualification :: (Maybe Bool -> f (Maybe Bool))
-> SuiteDefinitionConfiguration -> f SuiteDefinitionConfiguration
suiteDefinitionConfiguration_intendedForQualification = (SuiteDefinitionConfiguration -> Maybe Bool)
-> (SuiteDefinitionConfiguration
    -> Maybe Bool -> SuiteDefinitionConfiguration)
-> Lens
     SuiteDefinitionConfiguration
     SuiteDefinitionConfiguration
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SuiteDefinitionConfiguration' {Maybe Bool
intendedForQualification :: Maybe Bool
$sel:intendedForQualification:SuiteDefinitionConfiguration' :: SuiteDefinitionConfiguration -> Maybe Bool
intendedForQualification} -> Maybe Bool
intendedForQualification) (\s :: SuiteDefinitionConfiguration
s@SuiteDefinitionConfiguration' {} Maybe Bool
a -> SuiteDefinitionConfiguration
s {$sel:intendedForQualification:SuiteDefinitionConfiguration' :: Maybe Bool
intendedForQualification = Maybe Bool
a} :: SuiteDefinitionConfiguration)

-- | Gets device permission arn.
suiteDefinitionConfiguration_devicePermissionRoleArn :: Lens.Lens' SuiteDefinitionConfiguration (Prelude.Maybe Prelude.Text)
suiteDefinitionConfiguration_devicePermissionRoleArn :: (Maybe Text -> f (Maybe Text))
-> SuiteDefinitionConfiguration -> f SuiteDefinitionConfiguration
suiteDefinitionConfiguration_devicePermissionRoleArn = (SuiteDefinitionConfiguration -> Maybe Text)
-> (SuiteDefinitionConfiguration
    -> Maybe Text -> SuiteDefinitionConfiguration)
-> Lens
     SuiteDefinitionConfiguration
     SuiteDefinitionConfiguration
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SuiteDefinitionConfiguration' {Maybe Text
devicePermissionRoleArn :: Maybe Text
$sel:devicePermissionRoleArn:SuiteDefinitionConfiguration' :: SuiteDefinitionConfiguration -> Maybe Text
devicePermissionRoleArn} -> Maybe Text
devicePermissionRoleArn) (\s :: SuiteDefinitionConfiguration
s@SuiteDefinitionConfiguration' {} Maybe Text
a -> SuiteDefinitionConfiguration
s {$sel:devicePermissionRoleArn:SuiteDefinitionConfiguration' :: Maybe Text
devicePermissionRoleArn = Maybe Text
a} :: SuiteDefinitionConfiguration)

-- | Gets the devices configured.
suiteDefinitionConfiguration_devices :: Lens.Lens' SuiteDefinitionConfiguration (Prelude.Maybe [DeviceUnderTest])
suiteDefinitionConfiguration_devices :: (Maybe [DeviceUnderTest] -> f (Maybe [DeviceUnderTest]))
-> SuiteDefinitionConfiguration -> f SuiteDefinitionConfiguration
suiteDefinitionConfiguration_devices = (SuiteDefinitionConfiguration -> Maybe [DeviceUnderTest])
-> (SuiteDefinitionConfiguration
    -> Maybe [DeviceUnderTest] -> SuiteDefinitionConfiguration)
-> Lens
     SuiteDefinitionConfiguration
     SuiteDefinitionConfiguration
     (Maybe [DeviceUnderTest])
     (Maybe [DeviceUnderTest])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SuiteDefinitionConfiguration' {Maybe [DeviceUnderTest]
devices :: Maybe [DeviceUnderTest]
$sel:devices:SuiteDefinitionConfiguration' :: SuiteDefinitionConfiguration -> Maybe [DeviceUnderTest]
devices} -> Maybe [DeviceUnderTest]
devices) (\s :: SuiteDefinitionConfiguration
s@SuiteDefinitionConfiguration' {} Maybe [DeviceUnderTest]
a -> SuiteDefinitionConfiguration
s {$sel:devices:SuiteDefinitionConfiguration' :: Maybe [DeviceUnderTest]
devices = Maybe [DeviceUnderTest]
a} :: SuiteDefinitionConfiguration) ((Maybe [DeviceUnderTest] -> f (Maybe [DeviceUnderTest]))
 -> SuiteDefinitionConfiguration -> f SuiteDefinitionConfiguration)
-> ((Maybe [DeviceUnderTest] -> f (Maybe [DeviceUnderTest]))
    -> Maybe [DeviceUnderTest] -> f (Maybe [DeviceUnderTest]))
-> (Maybe [DeviceUnderTest] -> f (Maybe [DeviceUnderTest]))
-> SuiteDefinitionConfiguration
-> f SuiteDefinitionConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [DeviceUnderTest]
  [DeviceUnderTest]
  [DeviceUnderTest]
  [DeviceUnderTest]
-> Iso
     (Maybe [DeviceUnderTest])
     (Maybe [DeviceUnderTest])
     (Maybe [DeviceUnderTest])
     (Maybe [DeviceUnderTest])
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
  [DeviceUnderTest]
  [DeviceUnderTest]
  [DeviceUnderTest]
  [DeviceUnderTest]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Gets test suite root group.
suiteDefinitionConfiguration_rootGroup :: Lens.Lens' SuiteDefinitionConfiguration (Prelude.Maybe Prelude.Text)
suiteDefinitionConfiguration_rootGroup :: (Maybe Text -> f (Maybe Text))
-> SuiteDefinitionConfiguration -> f SuiteDefinitionConfiguration
suiteDefinitionConfiguration_rootGroup = (SuiteDefinitionConfiguration -> Maybe Text)
-> (SuiteDefinitionConfiguration
    -> Maybe Text -> SuiteDefinitionConfiguration)
-> Lens
     SuiteDefinitionConfiguration
     SuiteDefinitionConfiguration
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SuiteDefinitionConfiguration' {Maybe Text
rootGroup :: Maybe Text
$sel:rootGroup:SuiteDefinitionConfiguration' :: SuiteDefinitionConfiguration -> Maybe Text
rootGroup} -> Maybe Text
rootGroup) (\s :: SuiteDefinitionConfiguration
s@SuiteDefinitionConfiguration' {} Maybe Text
a -> SuiteDefinitionConfiguration
s {$sel:rootGroup:SuiteDefinitionConfiguration' :: Maybe Text
rootGroup = Maybe Text
a} :: SuiteDefinitionConfiguration)

instance Core.FromJSON SuiteDefinitionConfiguration where
  parseJSON :: Value -> Parser SuiteDefinitionConfiguration
parseJSON =
    String
-> (Object -> Parser SuiteDefinitionConfiguration)
-> Value
-> Parser SuiteDefinitionConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SuiteDefinitionConfiguration"
      ( \Object
x ->
          Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe [DeviceUnderTest]
-> Maybe Text
-> SuiteDefinitionConfiguration
SuiteDefinitionConfiguration'
            (Maybe Text
 -> Maybe Bool
 -> Maybe Text
 -> Maybe [DeviceUnderTest]
 -> Maybe Text
 -> SuiteDefinitionConfiguration)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool
      -> Maybe Text
      -> Maybe [DeviceUnderTest]
      -> Maybe Text
      -> SuiteDefinitionConfiguration)
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
"suiteDefinitionName")
            Parser
  (Maybe Bool
   -> Maybe Text
   -> Maybe [DeviceUnderTest]
   -> Maybe Text
   -> SuiteDefinitionConfiguration)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe [DeviceUnderTest]
      -> Maybe Text
      -> SuiteDefinitionConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"intendedForQualification")
            Parser
  (Maybe Text
   -> Maybe [DeviceUnderTest]
   -> Maybe Text
   -> SuiteDefinitionConfiguration)
-> Parser (Maybe Text)
-> Parser
     (Maybe [DeviceUnderTest]
      -> Maybe Text -> SuiteDefinitionConfiguration)
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
"devicePermissionRoleArn")
            Parser
  (Maybe [DeviceUnderTest]
   -> Maybe Text -> SuiteDefinitionConfiguration)
-> Parser (Maybe [DeviceUnderTest])
-> Parser (Maybe Text -> SuiteDefinitionConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [DeviceUnderTest]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"devices" Parser (Maybe (Maybe [DeviceUnderTest]))
-> Maybe [DeviceUnderTest] -> Parser (Maybe [DeviceUnderTest])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [DeviceUnderTest]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe Text -> SuiteDefinitionConfiguration)
-> Parser (Maybe Text) -> Parser SuiteDefinitionConfiguration
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
"rootGroup")
      )

instance
  Prelude.Hashable
    SuiteDefinitionConfiguration

instance Prelude.NFData SuiteDefinitionConfiguration

instance Core.ToJSON SuiteDefinitionConfiguration where
  toJSON :: SuiteDefinitionConfiguration -> Value
toJSON SuiteDefinitionConfiguration' {Maybe Bool
Maybe [DeviceUnderTest]
Maybe Text
rootGroup :: Maybe Text
devices :: Maybe [DeviceUnderTest]
devicePermissionRoleArn :: Maybe Text
intendedForQualification :: Maybe Bool
suiteDefinitionName :: Maybe Text
$sel:rootGroup:SuiteDefinitionConfiguration' :: SuiteDefinitionConfiguration -> Maybe Text
$sel:devices:SuiteDefinitionConfiguration' :: SuiteDefinitionConfiguration -> Maybe [DeviceUnderTest]
$sel:devicePermissionRoleArn:SuiteDefinitionConfiguration' :: SuiteDefinitionConfiguration -> Maybe Text
$sel:intendedForQualification:SuiteDefinitionConfiguration' :: SuiteDefinitionConfiguration -> Maybe Bool
$sel:suiteDefinitionName:SuiteDefinitionConfiguration' :: SuiteDefinitionConfiguration -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"suiteDefinitionName" 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
suiteDefinitionName,
            (Text
"intendedForQualification" 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
intendedForQualification,
            (Text
"devicePermissionRoleArn" 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
devicePermissionRoleArn,
            (Text
"devices" 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]
devices,
            (Text
"rootGroup" 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
rootGroup
          ]
      )