{-# 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.AuditManager.Types.CreateAssessmentFrameworkControlSet
-- 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.AuditManager.Types.CreateAssessmentFrameworkControlSet where

import Amazonka.AuditManager.Types.CreateAssessmentFrameworkControl
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A @controlSet@ entity that represents a collection of controls in Audit
-- Manager. This does not contain the control set ID.
--
-- /See:/ 'newCreateAssessmentFrameworkControlSet' smart constructor.
data CreateAssessmentFrameworkControlSet = CreateAssessmentFrameworkControlSet'
  { -- | The list of controls within the control set. This does not contain the
    -- control set ID.
    CreateAssessmentFrameworkControlSet
-> Maybe (NonEmpty CreateAssessmentFrameworkControl)
controls :: Prelude.Maybe (Prelude.NonEmpty CreateAssessmentFrameworkControl),
    -- | The name of the specified control set.
    CreateAssessmentFrameworkControlSet -> Text
name :: Prelude.Text
  }
  deriving (CreateAssessmentFrameworkControlSet
-> CreateAssessmentFrameworkControlSet -> Bool
(CreateAssessmentFrameworkControlSet
 -> CreateAssessmentFrameworkControlSet -> Bool)
-> (CreateAssessmentFrameworkControlSet
    -> CreateAssessmentFrameworkControlSet -> Bool)
-> Eq CreateAssessmentFrameworkControlSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAssessmentFrameworkControlSet
-> CreateAssessmentFrameworkControlSet -> Bool
$c/= :: CreateAssessmentFrameworkControlSet
-> CreateAssessmentFrameworkControlSet -> Bool
== :: CreateAssessmentFrameworkControlSet
-> CreateAssessmentFrameworkControlSet -> Bool
$c== :: CreateAssessmentFrameworkControlSet
-> CreateAssessmentFrameworkControlSet -> Bool
Prelude.Eq, ReadPrec [CreateAssessmentFrameworkControlSet]
ReadPrec CreateAssessmentFrameworkControlSet
Int -> ReadS CreateAssessmentFrameworkControlSet
ReadS [CreateAssessmentFrameworkControlSet]
(Int -> ReadS CreateAssessmentFrameworkControlSet)
-> ReadS [CreateAssessmentFrameworkControlSet]
-> ReadPrec CreateAssessmentFrameworkControlSet
-> ReadPrec [CreateAssessmentFrameworkControlSet]
-> Read CreateAssessmentFrameworkControlSet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateAssessmentFrameworkControlSet]
$creadListPrec :: ReadPrec [CreateAssessmentFrameworkControlSet]
readPrec :: ReadPrec CreateAssessmentFrameworkControlSet
$creadPrec :: ReadPrec CreateAssessmentFrameworkControlSet
readList :: ReadS [CreateAssessmentFrameworkControlSet]
$creadList :: ReadS [CreateAssessmentFrameworkControlSet]
readsPrec :: Int -> ReadS CreateAssessmentFrameworkControlSet
$creadsPrec :: Int -> ReadS CreateAssessmentFrameworkControlSet
Prelude.Read, Int -> CreateAssessmentFrameworkControlSet -> ShowS
[CreateAssessmentFrameworkControlSet] -> ShowS
CreateAssessmentFrameworkControlSet -> String
(Int -> CreateAssessmentFrameworkControlSet -> ShowS)
-> (CreateAssessmentFrameworkControlSet -> String)
-> ([CreateAssessmentFrameworkControlSet] -> ShowS)
-> Show CreateAssessmentFrameworkControlSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAssessmentFrameworkControlSet] -> ShowS
$cshowList :: [CreateAssessmentFrameworkControlSet] -> ShowS
show :: CreateAssessmentFrameworkControlSet -> String
$cshow :: CreateAssessmentFrameworkControlSet -> String
showsPrec :: Int -> CreateAssessmentFrameworkControlSet -> ShowS
$cshowsPrec :: Int -> CreateAssessmentFrameworkControlSet -> ShowS
Prelude.Show, (forall x.
 CreateAssessmentFrameworkControlSet
 -> Rep CreateAssessmentFrameworkControlSet x)
-> (forall x.
    Rep CreateAssessmentFrameworkControlSet x
    -> CreateAssessmentFrameworkControlSet)
-> Generic CreateAssessmentFrameworkControlSet
forall x.
Rep CreateAssessmentFrameworkControlSet x
-> CreateAssessmentFrameworkControlSet
forall x.
CreateAssessmentFrameworkControlSet
-> Rep CreateAssessmentFrameworkControlSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateAssessmentFrameworkControlSet x
-> CreateAssessmentFrameworkControlSet
$cfrom :: forall x.
CreateAssessmentFrameworkControlSet
-> Rep CreateAssessmentFrameworkControlSet x
Prelude.Generic)

-- |
-- Create a value of 'CreateAssessmentFrameworkControlSet' 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:
--
-- 'controls', 'createAssessmentFrameworkControlSet_controls' - The list of controls within the control set. This does not contain the
-- control set ID.
--
-- 'name', 'createAssessmentFrameworkControlSet_name' - The name of the specified control set.
newCreateAssessmentFrameworkControlSet ::
  -- | 'name'
  Prelude.Text ->
  CreateAssessmentFrameworkControlSet
newCreateAssessmentFrameworkControlSet :: Text -> CreateAssessmentFrameworkControlSet
newCreateAssessmentFrameworkControlSet Text
pName_ =
  CreateAssessmentFrameworkControlSet' :: Maybe (NonEmpty CreateAssessmentFrameworkControl)
-> Text -> CreateAssessmentFrameworkControlSet
CreateAssessmentFrameworkControlSet'
    { $sel:controls:CreateAssessmentFrameworkControlSet' :: Maybe (NonEmpty CreateAssessmentFrameworkControl)
controls =
        Maybe (NonEmpty CreateAssessmentFrameworkControl)
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateAssessmentFrameworkControlSet' :: Text
name = Text
pName_
    }

-- | The list of controls within the control set. This does not contain the
-- control set ID.
createAssessmentFrameworkControlSet_controls :: Lens.Lens' CreateAssessmentFrameworkControlSet (Prelude.Maybe (Prelude.NonEmpty CreateAssessmentFrameworkControl))
createAssessmentFrameworkControlSet_controls :: (Maybe (NonEmpty CreateAssessmentFrameworkControl)
 -> f (Maybe (NonEmpty CreateAssessmentFrameworkControl)))
-> CreateAssessmentFrameworkControlSet
-> f CreateAssessmentFrameworkControlSet
createAssessmentFrameworkControlSet_controls = (CreateAssessmentFrameworkControlSet
 -> Maybe (NonEmpty CreateAssessmentFrameworkControl))
-> (CreateAssessmentFrameworkControlSet
    -> Maybe (NonEmpty CreateAssessmentFrameworkControl)
    -> CreateAssessmentFrameworkControlSet)
-> Lens
     CreateAssessmentFrameworkControlSet
     CreateAssessmentFrameworkControlSet
     (Maybe (NonEmpty CreateAssessmentFrameworkControl))
     (Maybe (NonEmpty CreateAssessmentFrameworkControl))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssessmentFrameworkControlSet' {Maybe (NonEmpty CreateAssessmentFrameworkControl)
controls :: Maybe (NonEmpty CreateAssessmentFrameworkControl)
$sel:controls:CreateAssessmentFrameworkControlSet' :: CreateAssessmentFrameworkControlSet
-> Maybe (NonEmpty CreateAssessmentFrameworkControl)
controls} -> Maybe (NonEmpty CreateAssessmentFrameworkControl)
controls) (\s :: CreateAssessmentFrameworkControlSet
s@CreateAssessmentFrameworkControlSet' {} Maybe (NonEmpty CreateAssessmentFrameworkControl)
a -> CreateAssessmentFrameworkControlSet
s {$sel:controls:CreateAssessmentFrameworkControlSet' :: Maybe (NonEmpty CreateAssessmentFrameworkControl)
controls = Maybe (NonEmpty CreateAssessmentFrameworkControl)
a} :: CreateAssessmentFrameworkControlSet) ((Maybe (NonEmpty CreateAssessmentFrameworkControl)
  -> f (Maybe (NonEmpty CreateAssessmentFrameworkControl)))
 -> CreateAssessmentFrameworkControlSet
 -> f CreateAssessmentFrameworkControlSet)
-> ((Maybe (NonEmpty CreateAssessmentFrameworkControl)
     -> f (Maybe (NonEmpty CreateAssessmentFrameworkControl)))
    -> Maybe (NonEmpty CreateAssessmentFrameworkControl)
    -> f (Maybe (NonEmpty CreateAssessmentFrameworkControl)))
-> (Maybe (NonEmpty CreateAssessmentFrameworkControl)
    -> f (Maybe (NonEmpty CreateAssessmentFrameworkControl)))
-> CreateAssessmentFrameworkControlSet
-> f CreateAssessmentFrameworkControlSet
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty CreateAssessmentFrameworkControl)
  (NonEmpty CreateAssessmentFrameworkControl)
  (NonEmpty CreateAssessmentFrameworkControl)
  (NonEmpty CreateAssessmentFrameworkControl)
-> Iso
     (Maybe (NonEmpty CreateAssessmentFrameworkControl))
     (Maybe (NonEmpty CreateAssessmentFrameworkControl))
     (Maybe (NonEmpty CreateAssessmentFrameworkControl))
     (Maybe (NonEmpty CreateAssessmentFrameworkControl))
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
  (NonEmpty CreateAssessmentFrameworkControl)
  (NonEmpty CreateAssessmentFrameworkControl)
  (NonEmpty CreateAssessmentFrameworkControl)
  (NonEmpty CreateAssessmentFrameworkControl)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the specified control set.
createAssessmentFrameworkControlSet_name :: Lens.Lens' CreateAssessmentFrameworkControlSet Prelude.Text
createAssessmentFrameworkControlSet_name :: (Text -> f Text)
-> CreateAssessmentFrameworkControlSet
-> f CreateAssessmentFrameworkControlSet
createAssessmentFrameworkControlSet_name = (CreateAssessmentFrameworkControlSet -> Text)
-> (CreateAssessmentFrameworkControlSet
    -> Text -> CreateAssessmentFrameworkControlSet)
-> Lens
     CreateAssessmentFrameworkControlSet
     CreateAssessmentFrameworkControlSet
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssessmentFrameworkControlSet' {Text
name :: Text
$sel:name:CreateAssessmentFrameworkControlSet' :: CreateAssessmentFrameworkControlSet -> Text
name} -> Text
name) (\s :: CreateAssessmentFrameworkControlSet
s@CreateAssessmentFrameworkControlSet' {} Text
a -> CreateAssessmentFrameworkControlSet
s {$sel:name:CreateAssessmentFrameworkControlSet' :: Text
name = Text
a} :: CreateAssessmentFrameworkControlSet)

instance
  Prelude.Hashable
    CreateAssessmentFrameworkControlSet

instance
  Prelude.NFData
    CreateAssessmentFrameworkControlSet

instance
  Core.ToJSON
    CreateAssessmentFrameworkControlSet
  where
  toJSON :: CreateAssessmentFrameworkControlSet -> Value
toJSON CreateAssessmentFrameworkControlSet' {Maybe (NonEmpty CreateAssessmentFrameworkControl)
Text
name :: Text
controls :: Maybe (NonEmpty CreateAssessmentFrameworkControl)
$sel:name:CreateAssessmentFrameworkControlSet' :: CreateAssessmentFrameworkControlSet -> Text
$sel:controls:CreateAssessmentFrameworkControlSet' :: CreateAssessmentFrameworkControlSet
-> Maybe (NonEmpty CreateAssessmentFrameworkControl)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"controls" Text -> NonEmpty CreateAssessmentFrameworkControl -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty CreateAssessmentFrameworkControl -> Pair)
-> Maybe (NonEmpty CreateAssessmentFrameworkControl) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty CreateAssessmentFrameworkControl)
controls,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
          ]
      )